1 GstBus
2 ------
4 The GstBus is an object responsible for delivering GstMessages in
5 a first-in first-out way from the streaming threads to the application.
7 Since the application typically only wants to deal with delivery of these
8 messages from one thread, the GstBus will marshall the messages between
9 different threads. This is important since the actual streaming of media
10 is done in another threads (streaming threads) than the application. It is
11 also important to not block the streaming threads while the application deals
12 with the message.
14 The GstBus provides support for GSource based notifications. This makes it
15 possible to handle the delivery in the glib mainloop. Different GSources
16 can be added to the same bin provided they listen to different message types.
18 A message is posted on the bus with the gst_bus_post() method. With the
19 gst_bus_peek() and _pop() methods one can look at or retrieve a previously
20 posted message.
22 The bus can be polled with the gst_bus_poll() method. This methods blocks
23 up to the specified timeout value until one of the specified messages types
24 is posted on the bus. The application can then _pop() the messages from the
25 bus to handle them.
27 It is also possible to get messages from the bus without any thread
28 marshalling with the gst_bus_set_sync_handler() method. This makes it
29 possible to react to a message in the same thread that posted the
30 message on the bus. This should only be used if the application is able
31 to deal with messages from different threads.
33 If no messages are popped from the bus with either a GSource or gst_bus_pop(),
34 they remain on the bus.
36 When a pipeline or bin goes from READY into NULL state, it will set its bus
37 to flushing, ie. the bus will drop all existing and new messages on the bus,
38 This is necessary because bus messages hold references to the bin/pipeline
39 or its elements, so there are circular references that need to be broken if
40 one ever wants to be able to destroy a bin or pipeline properly.