Results 1 to 3 of 3

Thread: What is the correct way to link Qt5 videoplayers to gstreamer sinks?

  1. #1
    Join Date
    Jul 2016
    Qt products

    Default What is the correct way to link Qt5 videoplayers to gstreamer sinks?

    See my question here:

    have linked a simple videotestsrc to an autovideosink, but when I try to play with

    gst_element_set_state(data->pipeline_1, GST_STATE_PLAYING);

    my application opens a "GStreamer Direct3D sink default window" and outputs the video there.

    Before running the video I try to connect the sink to the QVideoWidget by doing:

    video_widget_1->setAttribute(Qt::WA_NativeWindow, true); // this is a QVideoWidget
    WId win_1_id = video_widget_1->winId();
    gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(data->el_autovideo_snk_1), win_1_id);

    By the way I saw that QApplication::syncX() is deprecated in Qt5, and noone gave an answer on what to use instead, so I'm guessing sync() is a suitable alternative. Still, even by commenting sync() line as well as setAttribute(Qt::WA_NativeWindow), it opens the sink default window and plays the video there.

    I don't plan to use QtGstreamer since I found it very difficult to install; it was giving always errors.

    My gstreamer pipeline contains only a videotest src and the autovideosink. The elements are correctly created with:

    gst_bin_add_many(GST_BIN(data->pipeline_1), data->el_videotest_src, data->el_autovideo_snk_1, NULL);
    if (!gst_element_link(data->el_videotest_src, data->el_autovideo_snk_1))
    console_out_err("STREAMING", "Failed to link test elements");
    console_out_good("STREAMING", "Test elements linked correctly");

    Am I missing anything?

  2. #2
    Join Date
    Jan 2006
    Warsaw, Poland
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits

    Default Re: What is the correct way to link Qt5 videoplayers to gstreamer sinks?

    I don't really understand how you are trying to link the Gst pipeline with a QVideoWidget. If you create an autovideosink, it will create a suitable window for you and you won't need QVideoWidget. If you want to render the video on QVideoWidget then you don't need an autovideosink. Instead you can use an appsink, read frames from the sink and render them on a bare QWidget by reimplementing its paintEvent. Just make sure the sink receives frames that are already decoded into a format you can render on a widget (some kind of RGB). You can probably also use glimagesink and pass it a window id of a QOpenGLWindow or QOpenGLWidget.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.

  3. #3
    Join Date
    Jul 2016
    Qt products

    Default Re: What is the correct way to link Qt5 videoplayers to gstreamer sinks?

    Very interesting.
    I believed autovideosink was the endpoint of a pipeline and you could link it to a surface or widget (like qvideowidget) so that it would render the media there.

    Now, as suggested, I created an appsink and I linked it to the qvideowidget with

    video_widget->setAttribute(Qt::WA_NativeWindow, true);
    WId win_id = video_widget->winId();
    gst_x_overlay_set_window_handle(GST_X_OVERLAY(data->appsink), win_id);

    but it still outputs the video on a new window.
    Can you explain better how to render the video from an appsink to a qvideowidget?
    Especially the part of the paintEvent.

    Before the app sink, the pipeline contains: videoscale and ffmpegcolorspace

    Thank you for your answer though.

Similar Threads

  1. Replies: 0
    Last Post: 26th March 2016, 12:02
  2. Gstreamer + Qt Problem
    By hedlabel in forum Qt Programming
    Replies: 0
    Last Post: 8th August 2012, 19:48
  3. Replies: 11
    Last Post: 5th May 2011, 14:05
  4. How to link a Push Button with a Web link ???
    By prajnaranjan.das in forum Newbie
    Replies: 3
    Last Post: 10th December 2010, 07:25
  5. how to use gstreamer with Qt
    By qwakaw in forum Qt Programming
    Replies: 9
    Last Post: 27th August 2008, 14:41

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.