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

How to get gstreamer inside of GUI



  • Hi I currently have this setup (see picture) for my GUI. But instead of the viewer popping up as its own window I wanted it to be in the "Video Widget Example" window. How would I be able to do this?

    Here is one of my functions to help:

    VideoPlayer::VideoPlayer(QWidget *parent)
        : QWidget(parent)
    {
        m_mediaPlayer = new QMediaPlayer(this, QMediaPlayer::VideoSurface);
        QVideoWidget *videoWidget = new QVideoWidget;
    
    
    
        m_playButton = new QPushButton;
        m_playButton->setEnabled(true);
        m_playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
    
        QAbstractButton *openButton = new QPushButton(tr("Open..."));
        connect(m_playButton, &QAbstractButton::clicked, this, &VideoPlayer::openFile);
    
        connect(m_playButton, &QAbstractButton::clicked, this, &VideoPlayer::play);
    
    
        m_errorLabel = new QLabel;
        m_errorLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
    
        QBoxLayout *controlLayout = new QHBoxLayout;
        controlLayout->setMargin(0);
        controlLayout->addWidget(openButton);
        controlLayout->addWidget(m_playButton);
        //controlLayout->addWidget(m_positionSlider);
    
        QBoxLayout *layout = new QVBoxLayout;
        layout->addWidget(videoWidget);
        layout->addLayout(controlLayout);
        layout->addWidget(m_errorLabel);
    
        setLayout(layout);
    
        m_mediaPlayer->setVideoOutput(videoWidget);
        connect(m_mediaPlayer, &QMediaPlayer::stateChanged, this, &VideoPlayer::mediaStateChanged);
       
    

    Screenshot from 2020-08-26 16-47-18.png


  • Lifetime Qt Champion

    Hi,

    Which version of Qt ?
    Is it the one provided with your distribution ?



  • QT Creator 4.12.4
    Based on Qt 5.14.2 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit)


  • Lifetime Qt Champion

    That's the information from Qt Creator.
    I asked for the Qt version you are using to build your project.



  • It is 5.15.0


  • Lifetime Qt Champion

    Can you test the version provided by your distribution ?


Log in to reply