QT 4.6.2 and QMediaPlayer



  • Hi,
    My setup is this for the development machine:

    • Ubuntu 10.04 LTS
    • QT 4.6.2
    • QMake: Qt-arm-X11
      and for the embedded computer:
    • Anders DX4 with CM-T3730 (ARMv7a based)
    • Linux distro: Angstrom

    I've been struggling to put a simple window playing an mp4 video. As simple as this: just playing a video!
    After a few months trying everything, from simple to complex solutions, I just don't know where to turn to. I need help!
    I don't have neither qmediaplayer libraries nor phonon ones installed.
    Is there out there a kind soul that can help me install, for instance, qmediaplayer which I find to be easier to play with so I can play the video?
    If there is a quick solution please can you guide me on how to achieve it?
    Thanks in advance.


  • Lifetime Qt Champion

    Hi,

    Are you really locked to that pretty old version of Qt ?



  • Hi,
    Sorry for this late response.
    You don't want to know the headache this stuff have been for during the last months.
    Anyway, I'm stuck with this, on one hand because I don't know enough about Qt (basically this is my first app) and on the other hand because the module that I have (that Anders DX4 thing) is not that popular in a way that basically there isn't a single soul besides me that uses it. Adding to that the support from the manufacturer/assembler is not that good also.
    Anyway, I've manage to use mplayer calling it from the main app using this slot:

    void MainWindow::on_pushbutton_video_clicked()
    {
    FILE* pipe;
    int i;
    QMainWindow::showMinimized();
    pipe=popen("mplayer -fs 'teste_video.mp4'", "w");
    pclose(pipe);
    QMainWindow::showFullScreen();
    }

    This sorts out the problem, however, I add to use that 'showMinimized' function otherwise the video was played behind the main window.
    Now this is the problem: after the video finishes, the video window closes and it stays like that! I tried the last line of code to put the main app back but nothing happens...
    Any ideas?
    Thanks


  • Lifetime Qt Champion

    Go rather with QProcess and the fact that you can control mplayer using std in. So you can stop / start it gracefully from Qt.



  • Can you help me with that?
    I'm so sorry but I'm used to low microcontrollers/microprocessors programming and this is all new to me...
    Any thing like add x and y lines to z file and so on... I'd me much thankful for that.



  • Sorted it!
    I did this, it might not be the most orthodox approach but it works:

    FILE* pipe;
    
    pipe=popen("mplayer -slave -fs 'teste_video.mp4'", "w");
    QMainWindow::lower();
    
    pclose(pipe);
    
    QMainWindow::activateWindow();
    QMainWindow::show();
    QMainWindow::raise();
    

    Thanks anyway.


  • Lifetime Qt Champion

    QProcess details is worth reading anyway.

    You can more easily integrate it within your application if you need more control about mplayer


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.