[gst-embedded] gst_bus_add_watch without _main_loop_run (loop)

Tim-Philipp Müller tim.muller at collabora.co.uk
Mon Apr 6 03:59:25 PDT 2009

On Mon, 2009-04-06 at 18:35 +0800, 宋江山 wrote:

> I would like to know that can I get the "end of stream" event (or a
> signal?)

It's a "bus message" in GStreamer terminology.

>  without using the mainloop?
> I used:
>  gst_bus_add_watch (bus, my_bus_callback, NULL);
>  to add a watch to catch the "end of stream" signal. But it seems
> my_bus_callback not been called at all.
> Maybe because I did not use 
>   g_main_loop_run (loop);
>   because I have something else to do with my program.
> What should  I do?
> Should I create a thread and run  g_main_loop_run (loop)  or 
> this loop is not needed ?

There's no need to run a main loop for this. You can check for messages
on the bus with functions like


etc. which will block or not block, depending on your circumstances. See


You should check for messages on the bus regularly. How often regularly
is, is up to you really.


More information about the Gstreamer-embedded mailing list