Gstreamer application using Qt

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Gstreamer application using Qt

pushpa
Hi,

   Can anyone help me to know how to create gstreamer pipeline using Qt?


Regards,
Pushpa
 
Reply | Threaded
Open this post in threaded view
|

Re: Gstreamer application using Qt

Cedric Hombourger
Hi Pushpa,

Which Gstreamer bindings did you opt for? regular (C) GStreamer APIs, QtGstreamer, .QtMultimedia/QtMobility...

Regards,
Cedric

On Sep 4, 2012, at 7:03 AM, pushpa <[hidden email]> wrote:

Hi,

  Can anyone help me to know how to create gstreamer pipeline using Qt?


Regards,
Pushpa




--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Gstreamer-application-using-Qt-tp4656142.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Gstreamer application using Qt

pushpa
Hi Cedric,

    Thanks for your response.

 I am new to Qt, so i dont know much about it. I dont know what is the difference between QtGstreamer, .QtMultimedia/QtMobility...


If i want to execute using regular 'C' Gstreamer API's how do i have to ?


Regards,
Pushpa
Reply | Threaded
Open this post in threaded view
|

Re: Gstreamer application using Qt

Cedric Hombourger

QtGstreamer is a project aiming at creating a C++ API (with a Qt style) for GStreamer allowing full control of the pipeline(s) created. It is not part of Qt per se. If using an embedded Linux distribution, QtGStreamer may not be included or enabled by default...

QtMultimedia/QtMobility is a high level multimedia framework part of the Qt toolkit. It provides a (very) high level API and (AFAIK) does not allow tweaking of the pipeline(s)

Direct use of regular GStreamer APIs is also possible. In your .pro file, you would add something like:

unix {
    CONFIG += link_pkgconfig
    PKGCONFIG += gstreamer-0.10
}
You can then add the following to your C++ files:

#include <gst/gst.h>
and I suggest something like below as your first experiment:

guint major, minor, micro, nano;
gst_init (&argc, &argv);
gst_version (&major, &minor, &micro, &nano);
Print (or check in your debugger) major, minor, micro values. They should match your GStreamer installation.

Hope this helps!
Cedric

On Sep 4, 2012, at 7:43 AM, pushpa <[hidden email]> wrote:

Hi Cedric,

   Thanks for your response.

I am new to Qt, so i dont know much about it. I dont know what is the
difference between QtGstreamer, .QtMultimedia/QtMobility...


If i want to execute using regular 'C' Gstreamer API's how do i have to ?


Regards,
Pushpa



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Gstreamer-application-using-Qt-tp4656142p4656144.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Gstreamer application using Qt

Luca Santini
If you only need a music/video player or camera capture and eventually plans to use QML, QtMultimediaKit is your way. you can implement a player with a single line of QML code...

Video { source: "myvideo.avi" }

But if you need more power (custom pipelines, capture from v4l2 generic devices etc.) this is definitively not the way to go: you need to link directly to gstreamer (as per Cedric example). The only side effect is you'll need some "major" tweaks to use it in QML (of course, only if you need it).

On 04/09/2012 08:07, Cedric Hombourger wrote:

QtGstreamer is a project aiming at creating a C++ API (with a Qt style) for GStreamer allowing full control of the pipeline(s) created. It is not part of Qt per se. If using an embedded Linux distribution, QtGStreamer may not be included or enabled by default...

QtMultimedia/QtMobility is a high level multimedia framework part of the Qt toolkit. It provides a (very) high level API and (AFAIK) does not allow tweaking of the pipeline(s)

Direct use of regular GStreamer APIs is also possible. In your .pro file, you would add something like:

unix {
    CONFIG += link_pkgconfig
    PKGCONFIG += gstreamer-0.10
}
You can then add the following to your C++ files:

#include <gst/gst.h>
and I suggest something like below as your first experiment:

guint major, minor, micro, nano;
gst_init (&argc, &argv);
gst_version (&major, &minor, &micro, &nano);
Print (or check in your debugger) major, minor, micro values. They should match your GStreamer installation.

Hope this helps!
Cedric

On Sep 4, 2012, at 7:43 AM, pushpa <[hidden email]> wrote:

Hi Cedric,

   Thanks for your response.

I am new to Qt, so i dont know much about it. I dont know what is the
difference between QtGstreamer, .QtMultimedia/QtMobility...


If i want to execute using regular 'C' Gstreamer API's how do i have to ?


Regards,
Pushpa



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Gstreamer-application-using-Qt-tp4656142p4656144.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Gstreamer application using Qt

pushpa
Hi,

    Thanks for your comments Luca.

 @Cedric : I was able to execute gstreamer pipeline. Thanks Cedric.

I have one more question...
Can we stream a video using qt phonon. Does it support the receive of a rtsp stream and decode and display or do we have to go according to Cedric's way of directly implementing Gstreamer pipeline through Qt


Regards,
Pushpa
Reply | Threaded
Open this post in threaded view
|

Re: Gstreamer application using Qt

Cedric Hombourger
Have you tried something like:

MediaObject mediaObject;
mediaObject.setCurrentSource (QUrl ("<a href="rtsp://rtsp-channel/">rtsp://rtsp-channel/.."));

On Sep 4, 2012, at 10:29 AM, pushpa <[hidden email]> wrote:

Hi,

   Thanks for your comments Luca.

@Cedric : I was able to execute gstreamer pipeline. Thanks Cedric.

I have one more question...
Can we stream a video using qt phonon. Does it support the receive of a rtsp
stream and decode and display or do we have to go according to Cedric's way
of directly implementing Gstreamer pipeline through Qt


Regards,
Pushpa



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Gstreamer-application-using-Qt-tp4656142p4656158.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Gstreamer application using Qt

Kaj-Michael Lang
In reply to this post by Luca Santini
On Tue, 2012-09-04 at 09:01 +0200, Luca Santini wrote:
> The only side effect is you'll need some "major" tweaks to use it in
> QML (of course, only if you need it).

If you like to look at an example in using gstreamer and QML check out
my rtsp radio player, sources are here
http://git.tal.org/cgi-bin/gitweb.cgi?p=m3x-oidar.git

I can't say if it's the prettiest or best way to do it, but it works for
me.

--
Kaj-Michael Lang <[hidden email]>

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Gstreamer application using Qt

pushpa
 I will sure have look at your code  Lang

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Gstreamer application using Qt

pushpa
I tried to execute gstreamer pipeline using Qt and display gstreamer window on Qtwidget. This worked fine on host pc, however did not succeed on my target platform(omap35x).

On target platform, gstreamer window is not showed on Qtwidget, video is displayed on separate window with following messages

(gst:1743): GStreamer-CRITICAL **: gst_implements_interface_cast: assertion `gst_element_implements_interface (GST_ELEMENT
(from), iface_type)' failed

** (gst:1743): CRITICAL **: gst_x_overlay_set_xwindow_id: assertion `overlay != NULL' failed


Here is the code which i am using

int main(int argc, char *argv[])
{
    gst_init (&argc, &argv);
    QApplication app(argc, argv);
      app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit ()));
    GstElement *pipeline = gst_pipeline_new ("xvoverlay");
    GstElement *src = gst_element_factory_make ("videotestsrc", NULL);
    GstElement *sink = gst_element_factory_make ("autovideosink", NULL);

    gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
      gst_element_link (src, sink);


      QWidget window;
        window.resize(320, 240);
        window.setWindowTitle("Video");
        window.show();

        gst_element_set_state (sink, GST_STATE_READY);

        WId xwinid = window.winId();
        QApplication::syncX();

       gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), xwinid);
         
        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);

           QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit()));
         }

         int ret = app.exec();

         window.hide();
         gst_element_set_state (pipeline, GST_STATE_NULL);
         gst_object_unref (pipeline);

    return ret;
}

Reply | Threaded
Open this post in threaded view
|

Re: Gstreamer application using Qt

Tim-Philipp Müller-2
On Fri, 2012-09-07 at 00:00 -0700, pushpa wrote:

> On target platform, gstreamer window is not showed on Qtwidget, video is
> displayed on separate window with following messages
>
> (gst:1743): GStreamer-CRITICAL **: gst_implements_interface_cast: assertion
> `gst_element_implements_interface (GST_ELEMENT
> (from), iface_type)' failed
>
> ** (gst:1743): CRITICAL **: gst_x_overlay_set_xwindow_id: assertion `overlay
> != NULL' failed
>
> Here is the code which i am using
> ...
>     GstElement *sink = gst_element_factory_make ("autovideosink", NULL);
> ...
>        gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), xwinid);

autovideosink does not itself implement/proxy the GstXOverlay interface
(see gst-inspect-0.10 autovideosink). If you use autovideosink you will
have to handle the prepare-xwindow-id element message on the bus
(synchronously!) and set the window ID from there.

You could do something like the bus_sync_handler() code in the Gtk+
example in
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstxoverlay.html

You don't need to do the realize_cb() thing if you can get the window ID
as you do now, just make sure to obtain it in the main thread and safe
it somewhere, so that in the sync bus handler, which is called from a
streaming thread, you just need to pass the saved number and not need to
do any X/Qt calls (which won't work well).


Note that with recent versions of playbin2 you can just set the window
handle/ID on playbin2 directly using the GstXOverlay interface, and it
will proxy it to the video sink.

Cheers
 -Tim

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Gstreamer application using Qt

pushpa
Thanks for your inputs Tim....
I will try to implement the Gstxoverlay interface for autovideosink



Thanks,
Pushpa