Gstreamer display QWidget



  • hi! i am unable to display the gstreamer video window at central window of the QFrame. My Code @VideoDisplay::VideoDisplay(QWidget *parent):
    QWidget(parent)
    {
    setGeometry(0,0,800,480);

    QCoreApplication::setAttribute(Qt::AA_NativeWindows);
    
    setAttribute(Qt::WA_NativeWindow, false);
    
    frame = new QFrame(this);
    frame->setGeometry(0,0,800,480);
    frame->setObjectName(QString::fromUtf8("frameVideo"));
    frame->setAutoFillBackground(true);
    frame->setFrameShape(QFrame::StyledPanel);
    frame->setFrameShadow(QFrame::Raised);
    
     GstElement *v_pipeline;
    GstElement *videosink;
    GstElement *audiosink;
    
    v_pipeline = gst_element_factory_make("playbin2", "player");
    videosink = gst_element_factory_make("ximagesink", "videosink");
    audiosink = gst_element_factory_make("alsasink", "audiosink");
    if (NULL == v_pipeline || NULL == videosink || NULL == audiosink) {
        qDebug()<<"error";
    }
    
    g_object_set(G_OBJECT(v_pipeline),
                 "audio-sink", audiosink,
                 "video-sink", videosink,
                 NULL);
    
    g_object_set(G_OBJECT(v_pipeline), "uri","/home/test/test.mp4", NULL);
    
    GstStateChangeReturn ret;
    GstElement* videosinks;
    
    gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(videosink),this->winId());
    gst_element_set_state(v_pipeline, GST_STATE_PLAYING);
    

    }@



  • Could you use the 'at' symbols around your code please?



  • If I interpret the code correctly, you place a frame onto the VideoDisplay. Afterwards you stream the video into the VideoDisplay hich has a full overlay by a frame...

    You can't see anything, as you see the frame, Try to remove it and see what happens...


Log in to reply
 

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