multiple streams in QWidget

prkhr4u prakhargupta at
Sat Feb 1 00:36:02 PST 2014

I want to implement multiple mjpeg streams from IP Cameras in one/more
I have successfully implemented 1 stream in one QWidget but is not able to
play streams from 2 cameras simultaneously..
What are the possible options for me?
Here is my implementation for single stream:

if (!g_thread_supported ())
      g_thread_init (NULL);

    gst_init (NULL, NULL);
    QApplication app(NULL, NULL);
    app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit ()));

    // 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);    
    g_object_set (src, "location", "",
    // prepare the ui

    QWidget window;
    window.resize(320, 240);;

    WId xwinid = window.winId();
    gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), xwinid);

    // run the pipeline

    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);
      // Exit application
      QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit()));

    int ret = app.exec();

    gst_element_set_state (pipeline, GST_STATE_NULL);
    gst_object_unref (pipeline);

    return ret;

View this message in context:
Sent from the GStreamer-devel mailing list archive at

More information about the gstreamer-devel mailing list