Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Using QtMultimedia Without a QGuiApplication



  • Hi!
    I'm experimenting with the QtMultimedia module. I would like to use it without the other parts of Qt.
    The goal is to open a video file and render it into an OpenGL texture.
    To do this, I set up a QMediaPlayer and my custom class inheriting from QAbstractVideoSurface.

    Some code:

        qmediaplayer->setMedia( QUrl::fromLocalFile( "...somevideo..." ) );
        qmediaplayer->setVolume( 100 );
        qmediaplayer->setVideoOutput( this );  //<-- Crashes here. 'this' is the class inheriting from QAbstractVideoSurface
        qmediaplayer->play();
    

    When I'm opening a video, Qt will assert:

    1cd52ac7-1c24-4632-9648-f30b60227a60-image.png

    Note that I don't have any QGuiApplications running, I'm using my own event loop etc.
    Is there a way to use Qt only for multimedia rendering, or is it a requirement for multimedia to have a QGuiApplication?


  • Moderators

    If I am not mistaken, you cannot use any QObject-based class without a Q*Application, it won't work.


  • Lifetime Qt Champion

    Hi,

    It's mandatory as it's that object that creates all the plumbing needed with your platform graphics system.


Log in to reply