unable to play gstreamer in QWidget

prkhr4u prakhargupta at bel.co.in
Thu Feb 6 22:18:03 PST 2014

I am trying to play gstreamer pipeline inside QWidget on button click code as

    gst_init (NULL, NULL);
    // prepare the pipeline
    GstElement *pipeline = gst_pipeline_new ("xvoverlay");
    GstElement *src = gst_element_factory_make ("souphttpsrc",NULL);
    GstElement *sink = gst_element_factory_make ("xvimagesink", NULL);
    GstElement *jpegdec = gst_element_factory_make("jpegdec",NULL);
    gst_bin_add_many (GST_BIN (pipeline), src,jpegdec, sink, NULL);
    gst_element_link_many(src,jpegdec, sink);
    gst_element_set_state(sink, GST_STATE_READY);
    g_object_set (src, "location", "",
    // prepare the ui
    QWidget widg1;
    WId xwinid = widg1.winId();
    gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), xwinid);
    GstStateChangeReturn sret = gst_element_set_state (pipeline,
    if (sret == GST_STATE_CHANGE_FAILURE) {
    gst_element_set_state (pipeline, GST_STATE_NULL);
    gst_object_unref (pipeline);

However I am unable to see anything.

After debugging, I found that an empty QWidget window is created after
QApplication::syncX(),but is destroyed as it exits the function.
Also the State is changing successfully as it does not enter the if
condition and directly exit.

What should I do to retain the window and successfully overlay the gstreamer
stream over it??

View this message in context: http://gstreamer-devel.966125.n4.nabble.com/unable-to-play-gstreamer-in-QWidget-tp4665139.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.

More information about the gstreamer-devel mailing list