Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Gstreamer display QWidget
Qt 6.11 is out! See what's new in the release blog

Gstreamer display QWidget

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 5.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jianxin.jin
    wrote on last edited by
    #1

    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);
    

    }@

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p-himik
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        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...

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved