gst_bus_add_watch without _main_loop_run (loop)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


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

 gst_bus_pop()
 gst_bus_timed_pop()

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

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html#gst-bus-timed-pop

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

Cheers
 -Tim






[Index of Archives]     [Linux Embedded]     [Linux ARM Kernel]     [Linux for ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux Media]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux