How to display RTSP Stream using QT?

  • I am totally new for RTSP technology... If I have url like rtsp://localhost:8080/xyz.sdp, then how can I access this url in QT application?

    I have a code from old Qt forum:

    // Sample code to play rtsp stream on qt widgets

    int main(int argc, char *argv[])
          gst_init (&argc, &argv);
          QApplication app(argc, argv);
          app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit ()));
          // prepare the pipeline
          GstElement *pipeline = gst_parse_launch ("playbin uri=rtsp://", NULL);
          // prepare the ui
          QWidget window;
          window.resize(640, 480);
          WId xwinid = window.winId();
          //this is the call to overlay the gstreamer's output to the Qt Widgets...
          gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (pipeline), xwinid);
          // run the pipeline
          GstStateChangeReturn sret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
          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;

    But I don't know how to use this. What I have to pass in arguments? and How can I pass argument in this code? means I want full detail to use this code, which other .cpp files will use? which type of data in header file and .pro file? everything.

    I got data from :

Log in to reply

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