Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Initializing gstreamer crashes my Qt Application



  • Hi ,
    I am trying to integrate "gstreamer":http://www.gstreamer.freedesktop.org/ into my application as suggested "here ":http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideooverlay.html#GstVideoOverlay ,the problem is that the application crashes with the follwing application output:
    @
    Starting D:\play_ground\build-gstreamerWidget-Qt_4_8_6-Debug\debug\gstreamerWidget.exe...
    The program has unexpectedly finished.
    @

    A section of my main function looks like this:
    @

    #include "widget.h"
    #include <QApplication>
    #include <QTimer>
    #include <QWidget>

    #include <glib.h>
    #include <gst/gst.h>
    #include <gst/video/videooverlay.h>

    int main(int argc, char *argv[])
    {

    if (!g_thread_supported ())
        g_thread_init (NULL);
    
      gst_init (&argc, &argv);//The application crashes here
      QApplication app(argc, argv);
      app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit ()));
    
    
     
      // prepare the pipeline
    
      GstElement *pipeline = gst_pipeline_new ("xvoverlay");
     ...................................
    
      // prepare the ui
    
      QWidget window;
      window.resize(320, 240);
      window.show();
    
     WId xwinid = window.winId();
     gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink),
                                           guintptr (xwinid));
    
      run the pipeline
    
      int ret = app.exec();
    
      window.hide();
    gst_element_set_state (pipeline, GST_STATE_NULL);
    gst_object_unref (pipeline);
    
      return ret;
    

    }

    @

    I would appreciate it if somebody helped with the issue.Gstreamer is working within visual studio environment (console and creating its own display window) .I want that window to be a Qt widget within my app.

    I am working with Qt 4.8.6 /vs 2010/win x86 if this is helpful

    Thank you for your time.


  • Lifetime Qt Champion

    Hi,

    If you want to mix both, you should have a look at QtGStreamer, it provides everything you need to mix Qt and gstreamer


Log in to reply