Gstreamer playbin integration in QT application
arnaud tonda
arnaud.tonda at gmail.com
Fri Jul 22 09:32:57 PDT 2011
Some news on the subject.
i have made some investigation and tested to create my own pipeline without
playbin2.
the pipeline looks like this :
filesrc ==> matroskademux ==> fluvadec ==> fluvasink
and the code is below :
############################################
GstElement *pipeline = gst_pipeline_new("pipeline");
GstElement *videoSrc = gst_element_factory_make("filesrc","filesrc");
GstElement *demux = gst_element_factory_make("matroskademux","demux");
GstElement *dec = gst_element_factory_make("fluvadec","dec");
GstElement *sink = gst_element_factory_make("fluvasink","sink");
g_object_set(G_OBJECT(videoSrc),"location","/root/test.mkv",NULL);
gst_bin_add_many(GST_BIN (pipeline), videoSrc, demux,dec,sink, NULL);
gst_element_link(videoSrc,demux);
gst_element_link(dec,sink);
g_signal_connect(G_OBJECT(demux),"pad-added",G_CALLBACK(on_pad_added),dec);
gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(sink), windowIdStatic );
gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PLAYING);
############################################
in precision, i link demux and dec on a on_pad_add callback.
with this code there no problem and the result is has expected, the video is
playing on the dedicated window.
it seems that my problem is with the playbin2 element.
any idea?
2011/7/22 arnaud tonda <arnaud.tonda at gmail.com>
> Hi everybody,
>
> I don't know if it's the right place but i try.
>
> after writing a C standalone code using playbin2 gstreamer elements, i
> started integration on a QT c++ source Application.
>
> i have a lot of windows and one is dedicated to video rendering.
> I want to use gstxoverlay.
>
> firstly i tried to use the gstreamer sample code shown on gstxoverlay Api.
>
> with videotestsrc and xvimagesrc :
>
> ######################################
> GstElement *pipeline = gst_pipeline_new ("xvoverlay");
>
> GstElement *src = gst_element_factory_make ("videotestsrc", NULL);
>
> GstElement *sink = gst_element_factory_make ("xvimagesink", NULL);
>
> gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
>
> gst_element_link (src, sink);
>
> gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(sink), windowId );
>
> bus = gst_pipeline_get_bus (GST_PIPELINE(pipeline));
>
> gst_bus_add_watch(bus, (GstBusFunc)bus_callback, NULL);
>
> gst_object_unref(bus);
>
> gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PLAYING);
> ######################################
>
> here i have what i expected, videotest is displayed on the right window
> without problem.
>
> secondly i tried to use playbin2 and the problem is there.
>
> i get the video-sink element of playbin2 but before pipeline is playing
> video-sink is null.
> if i overload video-sink with a xvimagesink element video-sink is not null,
> and i can use gst_x_overlay_set_xwindow_id on this.
> but it result on a fullscreen video.... i think something is wrong but i
> don't understand what....
>
> ######################################
>
> playbin = gst_element_factory_make("playbin2","playbin");
>
> GstElement *videosink = gst_element_factory_make("xvimagesink",
> "videosink");
>
> g_object_set(G_OBJECT(playbin), "video-sink", videosink, NULL);
>
> g_object_set(G_OBJECT(playbin),"uri","file:///root/test.mkv",NULL);
> g_object_set(G_OBJECT(playbin),"flags",0x00000013,NULL);
>
> //2 - We add a message Handler
> bus = gst_pipeline_get_bus (GST_PIPELINE(playbin));
> gst_bus_add_watch(bus, (GstBusFunc)bus_callback, NULL);
> gst_object_unref(bus);
>
>
> g_signal_connect(G_OBJECT(playbin),"video-changed",G_CALLBACK(on_video_changed),this);
>
> g_signal_connect(G_OBJECT(playbin),"pad-added",G_CALLBACK(on_pad_added),this);
>
> g_signal_connect(G_OBJECT(playbin),"deep-notify::source",(GCallback)on_video_sink_notify,this);
>
> GstElement *videosink2 = 0;
> g_object_get(playbin, "video-sink", &videosink2, NULL);
>
> if (videosink2 && GST_IS_X_OVERLAY(videosink2) )
> {
> cout << "videosink and overlay are OK" << endl;
> gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(videosink), windowId );
> }
> else
> {
> if(!videosink)
> cout << "videosink is NULL" << endl;
> else
> cout << "overlay is NULL" << endl;
> }
>
> gst_element_set_state(GST_ELEMENT(playbin), GST_STATE_PLAYING);
>
> ######################################
>
> any idea? what is wrong?
>
> One other thing :
>
> the gst_bus_add_watch did not work. the attached callback is never called.
> Has it work on the standalone C source code i think it is due to the QT
> event loop but i can't confirm.
> am i right?
>
> Best regards
>
> --
> Arnaud Tonda
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110722/660cfe35/attachment-0001.htm>
More information about the gstreamer-devel
mailing list