Gstreamer playbin integration in QT application

arnaud tonda arnaud.tonda at
Mon Jul 25 06:28:16 PDT 2011


I answer to myself...

George was right.

the problem was that i did set the windowId on the video-sink too early.
in fact in my code i used the gst_bus_add_watch() that don't work in
my configuration.
i must use gst_bus_set_sync_handler() instead.

with this i can receive all messages transiting into the Bus and
waiting a GST_MESSAGE_ELEMENT that contains a structure named
"prepare-xwindow-id". if a get the GstElement emitting this message
and apply the WindowId on it, all is fine.

here is a part of my switch on bus_message_callback :

			 if (gst_structure_has_name (msg->structure, "prepare-xwindow-id"))
(msg)), windowId);

Thanks all and Best regards


2011/7/25 arnaud tonda <arnaud.tonda at>:
> 2011/7/23 George Kiagiadakis < at>
>> On Fri, Jul 22, 2011 at 3:49 PM, arnaud tonda <arnaud.tonda at> wrote:
>> > 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.
>> This is correct, because the video sink is created when the playbin
>> switches to the PAUSED state, and it is created in another thread.
>> To make this work, you need to connect to the bus sync-message signal,
>> wait for the "prepare-xwindow-id" message and set the window ID from
>> there. Of course you need to save the window id earlier because you
>> can't call QWidget::winId() from another thread.
>> See
>> for an example.
> Thanks for the reply, i will try this.
>> > 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....
>> Maybe something is not correctly in sync. Try calling
>> QApplication::syncX() before setting the window id.
>> > 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?
>> It depends. On Unix/X11, Qt can optionally use the Glib event loop,
>> which achieves proper integration with the bus watch. Most
>> distributions compile Qt with Glib support, so it should work.
>> However, if you have compiled Qt yourself, you may have omited Glib
>> support... But to make sure it works in either case, you need to write
>> some dispatcher that will poll the bus for new messages from the Qt
>> main loop.
>> See
>> for an example.
>> PS: You can also just use QtGStreamer... ;)
> Yes, i know about QTGstreamer but the problem is that i must (for the
> moment) use QT3.3. so i cant use this and cant compile my own
> QTGstreamer. it's boring it would be a real time saver.....
> thanks.
>> Regards,
>> George
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at
> --
> Arnaud Tonda
> téléphone : 06 34 23 57 78

Arnaud Tonda

More information about the gstreamer-devel mailing list