Gstreamer playbin integration in QT application

George Kiagiadakis at
Sat Jul 23 02:39:13 PDT 2011

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.

for an example.

> 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.

for an example.

PS: You can also just use QtGStreamer... ;)


More information about the gstreamer-devel mailing list