GstBus
The GstBus is an object responsible for delivering GstMessage packets in a first-in first-out way from the streaming threads (see GstTask) to the application.
Since the application typically only wants to deal with delivery of these messages from one thread, the GstBus will marshall the messages between different threads. This is important since the actual streaming of media is done in another thread than the application.
The GstBus provides support for GSource based notifications. This makes it possible to handle the delivery in the glib GMainLoop.
The GSource callback function gst_bus_async_signal_func can be used to convert all bus messages into signal emissions.
A message is posted on the bus with the gst_bus_post method. With the gst_bus_peek and gst_bus_pop methods one can look at or retrieve a previously posted message.
The bus can be polled with the gst_bus_poll method. This methods blocks up to the specified timeout value until one of the specified messages types is posted on the bus. The application can then gst_bus_pop the messages from the bus to handle them. Alternatively the application can register an asynchronous bus function using gst_bus_add_watch_full or gst_bus_add_watch. This function will install a GSource in the default glib main loop and will deliver messages a short while after they have been posted. Note that the main loop should be running for the asynchronous callbacks.
It is also possible to get messages from the bus without any thread marshalling with the gst_bus_set_sync_handler method. This makes it possible to react to a message in the same thread that posted the message on the bus. This should only be used if the application is able to deal with messages from different threads.
Every GstPipeline has one bus.
Note that a GstPipeline will set its bus into flushing state when changing from READY to NULL state.
GstBus
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstBus
The opaque GstBus data structure.
Members
object
(GstObject)
–
the parent structure
Class structure
Gst.BusClass
GStreamer bus class.
Attributes
parent_class
(Gst.ObjectClass)
–
the parent class structure
Gst.BusClass
GStreamer bus class.
Attributes
parent_class
(Gst.ObjectClass)
–
the parent class structure
Gst.Bus
GObject.Object ╰──GObject.InitiallyUnowned ╰──Gst.Object ╰──Gst.Bus
The opaque Gst.Bus data structure.
Members
object
(Gst.Object)
–
the parent structure
Gst.Bus
GObject.Object ╰──GObject.InitiallyUnowned ╰──Gst.Object ╰──Gst.Bus
The opaque Gst.Bus data structure.
Members
object
(Gst.Object)
–
the parent structure
Constructors
gst_bus_new
GstBus * gst_bus_new ()
Creates a new GstBus instance.
a new GstBus instance
Gst.Bus.prototype.new
function Gst.Bus.prototype.new(): {
// javascript wrapper for 'gst_bus_new'
}
Creates a new Gst.Bus instance.
Methods
gst_bus_add_signal_watch
gst_bus_add_signal_watch (GstBus * bus)
Adds a bus signal watch to the default main context with the default priority ( G_PRIORITY_DEFAULT ). It is also possible to use a non-default main context set up using g_main_context_push_thread_default (before one had to create a bus watch source and attach it to the desired main context 'manually').
After calling this statement, the bus will emit the "message" signal for each message posted on the bus.
This function may be called multiple times. To clean up, the caller is responsible for calling gst_bus_remove_signal_watch as many times as this function is called.
Parameters:
bus
–
a GstBus on which you want to receive the "message" signal
Gst.Bus.prototype.add_signal_watch
function Gst.Bus.prototype.add_signal_watch(): {
// javascript wrapper for 'gst_bus_add_signal_watch'
}
Adds a bus signal watch to the default main context with the default priority ( GLib.PRIORITY_DEFAULT ). It is also possible to use a non-default main context set up using GLib.MainContext.prototype.push_thread_default (before one had to create a bus watch source and attach it to the desired main context 'manually').
After calling this statement, the bus will emit the "message" signal for each message posted on the bus.
This function may be called multiple times. To clean up, the caller is responsible for calling Gst.Bus.prototype.remove_signal_watch as many times as this function is called.
Gst.Bus.add_signal_watch
def Gst.Bus.add_signal_watch (self):
#python wrapper for 'gst_bus_add_signal_watch'
Adds a bus signal watch to the default main context with the default priority ( GLib.PRIORITY_DEFAULT ). It is also possible to use a non-default main context set up using GLib.MainContext.push_thread_default (before one had to create a bus watch source and attach it to the desired main context 'manually').
After calling this statement, the bus will emit the "message" signal for each message posted on the bus.
This function may be called multiple times. To clean up, the caller is responsible for calling Gst.Bus.remove_signal_watch as many times as this function is called.
gst_bus_add_signal_watch_full
gst_bus_add_signal_watch_full (GstBus * bus, gint priority)
Adds a bus signal watch to the default main context with the given priority (e.g. G_PRIORITY_DEFAULT). It is also possible to use a non-default main context set up using g_main_context_push_thread_default (before one had to create a bus watch source and attach it to the desired main context 'manually').
After calling this statement, the bus will emit the "message" signal for each message posted on the bus when the GMainLoop is running.
This function may be called multiple times. To clean up, the caller is responsible for calling gst_bus_remove_signal_watch as many times as this function is called.
There can only be a single bus watch per bus, you must remove any signal watch before you can set another type of watch.
Parameters:
bus
–
a GstBus on which you want to receive the "message" signal
priority
–
The priority of the watch.
Gst.Bus.prototype.add_signal_watch_full
function Gst.Bus.prototype.add_signal_watch_full(priority: Number): {
// javascript wrapper for 'gst_bus_add_signal_watch_full'
}
Adds a bus signal watch to the default main context with the given priority (e.g. GLib.PRIORITY_DEFAULT). It is also possible to use a non-default main context set up using GLib.MainContext.prototype.push_thread_default (before one had to create a bus watch source and attach it to the desired main context 'manually').
After calling this statement, the bus will emit the "message" signal for each message posted on the bus when the GMainLoop (not introspectable) is running.
This function may be called multiple times. To clean up, the caller is responsible for calling Gst.Bus.prototype.remove_signal_watch as many times as this function is called.
There can only be a single bus watch per bus, you must remove any signal watch before you can set another type of watch.
Parameters:
The priority of the watch.
Gst.Bus.add_signal_watch_full
def Gst.Bus.add_signal_watch_full (self, priority):
#python wrapper for 'gst_bus_add_signal_watch_full'
Adds a bus signal watch to the default main context with the given priority (e.g. GLib.PRIORITY_DEFAULT). It is also possible to use a non-default main context set up using GLib.MainContext.push_thread_default (before one had to create a bus watch source and attach it to the desired main context 'manually').
After calling this statement, the bus will emit the "message" signal for each message posted on the bus when the GMainLoop (not introspectable) is running.
This function may be called multiple times. To clean up, the caller is responsible for calling Gst.Bus.remove_signal_watch as many times as this function is called.
There can only be a single bus watch per bus, you must remove any signal watch before you can set another type of watch.
Parameters:
The priority of the watch.
gst_bus_add_watch
guint gst_bus_add_watch (GstBus * bus, GstBusFunc func, gpointer user_data)
Adds a bus watch to the default main context with the default priority ( G_PRIORITY_DEFAULT ). It is also possible to use a non-default main context set up using g_main_context_push_thread_default (before one had to create a bus watch source and attach it to the desired main context 'manually').
This function is used to receive asynchronous messages in the main loop. There can only be a single bus watch per bus, you must remove it before you can set a new one.
The bus watch will only work if a GMainLoop is being run.
The watch can be removed using gst_bus_remove_watch or by returning FALSE from func. If the watch was added to the default main context it is also possible to remove the watch using g_source_remove.
The bus watch will take its own reference to the bus, so it is safe to unref bus using gst_object_unref after setting the bus watch.
Parameters:
bus
–
a GstBus to create the watch for
func
–
A function to call when a message is received.
user_data
–
user data passed to func.
The event source id or 0 if bus already got an event source.
gst_bus_add_watch_full
guint gst_bus_add_watch_full (GstBus * bus, gint priority, GstBusFunc func, gpointer user_data, GDestroyNotify notify)
Adds a bus watch to the default main context with the given priority (e.g. G_PRIORITY_DEFAULT). It is also possible to use a non-default main context set up using g_main_context_push_thread_default (before one had to create a bus watch source and attach it to the desired main context 'manually').
This function is used to receive asynchronous messages in the main loop. There can only be a single bus watch per bus, you must remove it before you can set a new one.
The bus watch will only work if a GMainLoop is being run.
When func is called, the message belongs to the caller; if you want to keep a copy of it, call gst_message_ref before leaving func.
The watch can be removed using gst_bus_remove_watch or by returning FALSE from func. If the watch was added to the default main context it is also possible to remove the watch using g_source_remove.
The bus watch will take its own reference to the bus, so it is safe to unref bus using gst_object_unref after setting the bus watch.
Parameters:
bus
–
a GstBus to create the watch for.
priority
–
The priority of the watch.
func
–
A function to call when a message is received.
user_data
–
user data passed to func.
notify
–
the function to call when the source is removed.
The event source id or 0 if bus already got an event source.
Gst.Bus.prototype.add_watch_full
function Gst.Bus.prototype.add_watch_full(priority: Number, func: Gst.BusFunc, user_data: Object): {
// javascript wrapper for 'gst_bus_add_watch_full'
}
Adds a bus watch to the default main context with the given priority (e.g. GLib.PRIORITY_DEFAULT). It is also possible to use a non-default main context set up using GLib.MainContext.prototype.push_thread_default (before one had to create a bus watch source and attach it to the desired main context 'manually').
This function is used to receive asynchronous messages in the main loop. There can only be a single bus watch per bus, you must remove it before you can set a new one.
The bus watch will only work if a GMainLoop (not introspectable) is being run.
When func is called, the message belongs to the caller; if you want to keep a copy of it, call gst_message_ref (not introspectable) before leaving func.
The watch can be removed using Gst.Bus.prototype.remove_watch or by returning false from func. If the watch was added to the default main context it is also possible to remove the watch using GLib.prototype.source_remove.
The bus watch will take its own reference to the bus, so it is safe to unref bus using Gst.Object.prototype.unref after setting the bus watch.
Parameters:
The priority of the watch.
A function to call when a message is received.
user data passed to func.
The event source id or 0 if bus already got an event source.
Gst.Bus.add_watch_full
def Gst.Bus.add_watch_full (self, priority, func, *user_data):
#python wrapper for 'gst_bus_add_watch_full'
Adds a bus watch to the default main context with the given priority (e.g. GLib.PRIORITY_DEFAULT). It is also possible to use a non-default main context set up using GLib.MainContext.push_thread_default (before one had to create a bus watch source and attach it to the desired main context 'manually').
This function is used to receive asynchronous messages in the main loop. There can only be a single bus watch per bus, you must remove it before you can set a new one.
The bus watch will only work if a GMainLoop (not introspectable) is being run.
When func is called, the message belongs to the caller; if you want to keep a copy of it, call gst_message_ref (not introspectable) before leaving func.
The watch can be removed using Gst.Bus.remove_watch or by returning False from func. If the watch was added to the default main context it is also possible to remove the watch using GLib.source_remove.
The bus watch will take its own reference to the bus, so it is safe to unref bus using Gst.Object.unref after setting the bus watch.
Parameters:
The priority of the watch.
A function to call when a message is received.
user data passed to func.
The event source id or 0 if bus already got an event source.
gst_bus_async_signal_func
gboolean gst_bus_async_signal_func (GstBus * bus, GstMessage * message, gpointer data)
A helper GstBusFunc that can be used to convert all asynchronous messages into signals.
Gst.Bus.prototype.async_signal_func
function Gst.Bus.prototype.async_signal_func(message: Gst.Message, data: Object): {
// javascript wrapper for 'gst_bus_async_signal_func'
}
A helper Gst.BusFunc that can be used to convert all asynchronous messages into signals.
Gst.Bus.async_signal_func
def Gst.Bus.async_signal_func (self, message, data):
#python wrapper for 'gst_bus_async_signal_func'
A helper Gst.BusFunc that can be used to convert all asynchronous messages into signals.
gst_bus_create_watch
GSource * gst_bus_create_watch (GstBus * bus)
Create watch for this bus. The GSource will be dispatched whenever a message is on the bus. After the GSource is dispatched, the message is popped off the bus and unreffed.
As with other watches, there can only be one watch on the bus, including any signal watch added with gst_bus_add_signal_watch.
Parameters:
bus
–
a GstBus to create the watch for
Gst.Bus.prototype.create_watch
function Gst.Bus.prototype.create_watch(): {
// javascript wrapper for 'gst_bus_create_watch'
}
Create watch for this bus. The GSource (not introspectable) will be dispatched whenever a message is on the bus. After the GSource is dispatched, the message is popped off the bus and unreffed.
As with other watches, there can only be one watch on the bus, including any signal watch added with Gst.Bus.prototype.add_signal_watch.
a GSource (not introspectable) that can be added to a GMainLoop (not introspectable).
Gst.Bus.create_watch
def Gst.Bus.create_watch (self):
#python wrapper for 'gst_bus_create_watch'
Create watch for this bus. The GSource (not introspectable) will be dispatched whenever a message is on the bus. After the GSource is dispatched, the message is popped off the bus and unreffed.
As with other watches, there can only be one watch on the bus, including any signal watch added with Gst.Bus.add_signal_watch.
a GSource (not introspectable) that can be added to a GMainLoop (not introspectable).
gst_bus_disable_sync_message_emission
gst_bus_disable_sync_message_emission (GstBus * bus)
Instructs GStreamer to stop emitting the "sync-message" signal for this bus. See gst_bus_enable_sync_message_emission for more information.
In the event that multiple pieces of code have called gst_bus_enable_sync_message_emission, the sync-message emissions will only be stopped after all calls to gst_bus_enable_sync_message_emission were "cancelled" by calling this function. In this way the semantics are exactly the same as gst_object_ref that which calls enable should also call disable.
Parameters:
bus
–
a GstBus on which you previously called gst_bus_enable_sync_message_emission
Gst.Bus.prototype.disable_sync_message_emission
function Gst.Bus.prototype.disable_sync_message_emission(): {
// javascript wrapper for 'gst_bus_disable_sync_message_emission'
}
Instructs GStreamer to stop emitting the "sync-message" signal for this bus. See Gst.Bus.prototype.enable_sync_message_emission for more information.
In the event that multiple pieces of code have called Gst.Bus.prototype.enable_sync_message_emission, the sync-message emissions will only be stopped after all calls to Gst.Bus.prototype.enable_sync_message_emission were "cancelled" by calling this function. In this way the semantics are exactly the same as Gst.Object.prototype.ref that which calls enable should also call disable.
Parameters:
a Gst.Bus on which you previously called Gst.Bus.prototype.enable_sync_message_emission
Gst.Bus.disable_sync_message_emission
def Gst.Bus.disable_sync_message_emission (self):
#python wrapper for 'gst_bus_disable_sync_message_emission'
Instructs GStreamer to stop emitting the "sync-message" signal for this bus. See Gst.Bus.enable_sync_message_emission for more information.
In the event that multiple pieces of code have called Gst.Bus.enable_sync_message_emission, the sync-message emissions will only be stopped after all calls to Gst.Bus.enable_sync_message_emission were "cancelled" by calling this function. In this way the semantics are exactly the same as Gst.Object.ref that which calls enable should also call disable.
Parameters:
a Gst.Bus on which you previously called Gst.Bus.enable_sync_message_emission
gst_bus_enable_sync_message_emission
gst_bus_enable_sync_message_emission (GstBus * bus)
Instructs GStreamer to emit the "sync-message" signal after running the bus's sync handler. This function is here so that code can ensure that they can synchronously receive messages without having to affect what the bin's sync handler is.
This function may be called multiple times. To clean up, the caller is responsible for calling gst_bus_disable_sync_message_emission as many times as this function is called.
While this function looks similar to gst_bus_add_signal_watch, it is not exactly the same -- this function enables *synchronous* emission of signals when messages arrive; gst_bus_add_signal_watch adds an idle callback to pop messages off the bus asynchronously. The sync-message signal comes from the thread of whatever object posted the message; the "message" signal is marshalled to the main thread via the GMainLoop.
Parameters:
bus
–
a GstBus on which you want to receive the "sync-message" signal
Gst.Bus.prototype.enable_sync_message_emission
function Gst.Bus.prototype.enable_sync_message_emission(): {
// javascript wrapper for 'gst_bus_enable_sync_message_emission'
}
Instructs GStreamer to emit the "sync-message" signal after running the bus's sync handler. This function is here so that code can ensure that they can synchronously receive messages without having to affect what the bin's sync handler is.
This function may be called multiple times. To clean up, the caller is responsible for calling Gst.Bus.prototype.disable_sync_message_emission as many times as this function is called.
While this function looks similar to Gst.Bus.prototype.add_signal_watch, it is not exactly the same -- this function enables *synchronous* emission of signals when messages arrive; Gst.Bus.prototype.add_signal_watch adds an idle callback to pop messages off the bus asynchronously. The sync-message signal comes from the thread of whatever object posted the message; the "message" signal is marshalled to the main thread via the GMainLoop (not introspectable).
Gst.Bus.enable_sync_message_emission
def Gst.Bus.enable_sync_message_emission (self):
#python wrapper for 'gst_bus_enable_sync_message_emission'
Instructs GStreamer to emit the "sync-message" signal after running the bus's sync handler. This function is here so that code can ensure that they can synchronously receive messages without having to affect what the bin's sync handler is.
This function may be called multiple times. To clean up, the caller is responsible for calling Gst.Bus.disable_sync_message_emission as many times as this function is called.
While this function looks similar to Gst.Bus.add_signal_watch, it is not exactly the same -- this function enables *synchronous* emission of signals when messages arrive; Gst.Bus.add_signal_watch adds an idle callback to pop messages off the bus asynchronously. The sync-message signal comes from the thread of whatever object posted the message; the "message" signal is marshalled to the main thread via the GMainLoop (not introspectable).
gst_bus_get_pollfd
gst_bus_get_pollfd (GstBus * bus, GPollFD * fd)
Gets the file descriptor from the bus which can be used to get notified about messages being available with functions like g_poll, and allows integration into other event loops based on file descriptors. Whenever a message is available, the POLLIN / G_IO_IN event is set.
Warning: NEVER read or write anything to the returned fd but only use it for getting notifications via g_poll or similar and then use the normal GstBus API, e.g. gst_bus_pop.
Since : 1.14
Gst.Bus.prototype.get_pollfd
function Gst.Bus.prototype.get_pollfd(): {
// javascript wrapper for 'gst_bus_get_pollfd'
}
Gets the file descriptor from the bus which can be used to get notified about messages being available with functions like GLib.prototype.poll, and allows integration into other event loops based on file descriptors. Whenever a message is available, the POLLIN / GObject.IOCondition.IN event is set.
Warning: NEVER read or write anything to the returned fd but only use it for getting notifications via GLib.prototype.poll or similar and then use the normal GstBus API, e.g. Gst.Bus.prototype.pop.
Since : 1.14
Gst.Bus.get_pollfd
def Gst.Bus.get_pollfd (self):
#python wrapper for 'gst_bus_get_pollfd'
Gets the file descriptor from the bus which can be used to get notified about messages being available with functions like GLib.poll, and allows integration into other event loops based on file descriptors. Whenever a message is available, the POLLIN / GObject.IOCondition.IN event is set.
Warning: NEVER read or write anything to the returned fd but only use it for getting notifications via GLib.poll or similar and then use the normal GstBus API, e.g. Gst.Bus.pop.
Since : 1.14
gst_bus_have_pending
gboolean gst_bus_have_pending (GstBus * bus)
Checks if there are pending messages on the bus that should be handled.
Parameters:
bus
–
a GstBus to check
Gst.Bus.prototype.have_pending
function Gst.Bus.prototype.have_pending(): {
// javascript wrapper for 'gst_bus_have_pending'
}
Checks if there are pending messages on the bus that should be handled.
Gst.Bus.have_pending
def Gst.Bus.have_pending (self):
#python wrapper for 'gst_bus_have_pending'
Checks if there are pending messages on the bus that should be handled.
gst_bus_peek
GstMessage * gst_bus_peek (GstBus * bus)
Peeks the message on the top of the bus' queue. The message will remain on the bus' message queue.
Parameters:
bus
–
a GstBus
the GstMessage that is on the bus, or NULL if the bus is empty.
Gst.Bus.prototype.peek
function Gst.Bus.prototype.peek(): {
// javascript wrapper for 'gst_bus_peek'
}
Peeks the message on the top of the bus' queue. The message will remain on the bus' message queue.
the Gst.Message that is on the bus, or null if the bus is empty.
Gst.Bus.peek
def Gst.Bus.peek (self):
#python wrapper for 'gst_bus_peek'
Peeks the message on the top of the bus' queue. The message will remain on the bus' message queue.
the Gst.Message that is on the bus, or None if the bus is empty.
gst_bus_poll
GstMessage * gst_bus_poll (GstBus * bus, GstMessageType events, GstClockTime timeout)
Polls the bus for messages. Will block while waiting for messages to come. You can specify a maximum time to poll with the timeout parameter. If timeout is negative, this function will block indefinitely.
All messages not in events will be popped off the bus and will be ignored. It is not possible to use message enums beyond GST_MESSAGE_EXTENDED in the events mask
Because poll is implemented using the "message" signal enabled by gst_bus_add_signal_watch, calling gst_bus_poll will cause the "message" signal to be emitted for every message that poll sees. Thus a "message" signal handler will see the same messages that this function sees -- neither will steal messages from the other.
This function will run a GMainLoop from the default main context when polling.
You should never use this function, since it is pure evil. This is especially true for GUI applications based on Gtk+ or Qt, but also for any other non-trivial application that uses the GLib main loop. As this function runs a GLib main loop, any callback attached to the default GLib main context may be invoked. This could be timeouts, GUI events, I/O events etc.; even if gst_bus_poll is called with a 0 timeout. Any of these callbacks may do things you do not expect, e.g. destroy the main application window or some other resource; change other application state; display a dialog and run another main loop until the user clicks it away. In short, using this function may add a lot of complexity to your code through unexpected re-entrancy and unexpected changes to your application's state.
For 0 timeouts use gst_bus_pop_filtered instead of this function; for other short timeouts use gst_bus_timed_pop_filtered; everything else is better handled by setting up an asynchronous bus watch and doing things from there.
Parameters:
bus
–
a GstBus
events
–
a mask of GstMessageType, representing the set of message types to poll for (note special handling of extended message types below)
timeout
–
the poll timeout, as a GstClockTime, or GST_CLOCK_TIME_NONE to poll indefinitely.
the message that was received, or NULL if the poll timed out.
Gst.Bus.prototype.poll
function Gst.Bus.prototype.poll(events: Gst.MessageType, timeout: Number): {
// javascript wrapper for 'gst_bus_poll'
}
Polls the bus for messages. Will block while waiting for messages to come. You can specify a maximum time to poll with the timeout parameter. If timeout is negative, this function will block indefinitely.
All messages not in events will be popped off the bus and will be ignored. It is not possible to use message enums beyond Gst.MessageType.EXTENDED in the events mask
Because poll is implemented using the "message" signal enabled by Gst.Bus.prototype.add_signal_watch, calling Gst.Bus.prototype.poll will cause the "message" signal to be emitted for every message that poll sees. Thus a "message" signal handler will see the same messages that this function sees -- neither will steal messages from the other.
This function will run a GMainLoop (not introspectable) from the default main context when polling.
You should never use this function, since it is pure evil. This is especially true for GUI applications based on Gtk+ or Qt, but also for any other non-trivial application that uses the GLib main loop. As this function runs a GLib main loop, any callback attached to the default GLib main context may be invoked. This could be timeouts, GUI events, I/O events etc.; even if Gst.Bus.prototype.poll is called with a 0 timeout. Any of these callbacks may do things you do not expect, e.g. destroy the main application window or some other resource; change other application state; display a dialog and run another main loop until the user clicks it away. In short, using this function may add a lot of complexity to your code through unexpected re-entrancy and unexpected changes to your application's state.
For 0 timeouts use Gst.Bus.prototype.pop_filtered instead of this function; for other short timeouts use Gst.Bus.prototype.timed_pop_filtered; everything else is better handled by setting up an asynchronous bus watch and doing things from there.
Parameters:
a mask of Gst.MessageType, representing the set of message types to poll for (note special handling of extended message types below)
the poll timeout, as a Number, or Gst.CLOCK_TIME_NONE to poll indefinitely.
the message that was received, or null if the poll timed out.
Gst.Bus.poll
def Gst.Bus.poll (self, events, timeout):
#python wrapper for 'gst_bus_poll'
Polls the bus for messages. Will block while waiting for messages to come. You can specify a maximum time to poll with the timeout parameter. If timeout is negative, this function will block indefinitely.
All messages not in events will be popped off the bus and will be ignored. It is not possible to use message enums beyond Gst.MessageType.EXTENDED in the events mask
Because poll is implemented using the "message" signal enabled by Gst.Bus.add_signal_watch, calling Gst.Bus.poll will cause the "message" signal to be emitted for every message that poll sees. Thus a "message" signal handler will see the same messages that this function sees -- neither will steal messages from the other.
This function will run a GMainLoop (not introspectable) from the default main context when polling.
You should never use this function, since it is pure evil. This is especially true for GUI applications based on Gtk+ or Qt, but also for any other non-trivial application that uses the GLib main loop. As this function runs a GLib main loop, any callback attached to the default GLib main context may be invoked. This could be timeouts, GUI events, I/O events etc.; even if Gst.Bus.poll is called with a 0 timeout. Any of these callbacks may do things you do not expect, e.g. destroy the main application window or some other resource; change other application state; display a dialog and run another main loop until the user clicks it away. In short, using this function may add a lot of complexity to your code through unexpected re-entrancy and unexpected changes to your application's state.
For 0 timeouts use Gst.Bus.pop_filtered instead of this function; for other short timeouts use Gst.Bus.timed_pop_filtered; everything else is better handled by setting up an asynchronous bus watch and doing things from there.
Parameters:
a mask of Gst.MessageType, representing the set of message types to poll for (note special handling of extended message types below)
the poll timeout, as a int, or Gst.CLOCK_TIME_NONE to poll indefinitely.
the message that was received, or None if the poll timed out.
gst_bus_pop
GstMessage * gst_bus_pop (GstBus * bus)
Gets a message from the bus.
Parameters:
bus
–
a GstBus to pop
the GstMessage that is on the bus, or NULL if the bus is empty.
Gst.Bus.prototype.pop
function Gst.Bus.prototype.pop(): {
// javascript wrapper for 'gst_bus_pop'
}
Gets a message from the bus.
the Gst.Message that is on the bus, or null if the bus is empty.
Gst.Bus.pop
def Gst.Bus.pop (self):
#python wrapper for 'gst_bus_pop'
Gets a message from the bus.
the Gst.Message that is on the bus, or None if the bus is empty.
gst_bus_pop_filtered
GstMessage * gst_bus_pop_filtered (GstBus * bus, GstMessageType types)
Gets a message matching type from the bus. Will discard all messages on the bus that do not match type and that have been posted before the first message that does match type. If there is no message matching type on the bus, all messages will be discarded. It is not possible to use message enums beyond GST_MESSAGE_EXTENDED in the events mask.
the next GstMessage matching type that is on the bus, or NULL if the bus is empty or there is no message matching type.
Gst.Bus.prototype.pop_filtered
function Gst.Bus.prototype.pop_filtered(types: Gst.MessageType): {
// javascript wrapper for 'gst_bus_pop_filtered'
}
Gets a message matching type from the bus. Will discard all messages on the bus that do not match type and that have been posted before the first message that does match type. If there is no message matching type on the bus, all messages will be discarded. It is not possible to use message enums beyond Gst.MessageType.EXTENDED in the events mask.
Parameters:
message types to take into account
the next Gst.Message matching type that is on the bus, or null if the bus is empty or there is no message matching type.
Gst.Bus.pop_filtered
def Gst.Bus.pop_filtered (self, types):
#python wrapper for 'gst_bus_pop_filtered'
Gets a message matching type from the bus. Will discard all messages on the bus that do not match type and that have been posted before the first message that does match type. If there is no message matching type on the bus, all messages will be discarded. It is not possible to use message enums beyond Gst.MessageType.EXTENDED in the events mask.
Parameters:
message types to take into account
the next Gst.Message matching type that is on the bus, or None if the bus is empty or there is no message matching type.
gst_bus_post
gboolean gst_bus_post (GstBus * bus, GstMessage * message)
Posts a message on the given bus. Ownership of the message is taken by the bus.
Gst.Bus.prototype.post
function Gst.Bus.prototype.post(message: Gst.Message): {
// javascript wrapper for 'gst_bus_post'
}
Posts a message on the given bus. Ownership of the message is taken by the bus.
Gst.Bus.post
def Gst.Bus.post (self, message):
#python wrapper for 'gst_bus_post'
Posts a message on the given bus. Ownership of the message is taken by the bus.
gst_bus_remove_signal_watch
gst_bus_remove_signal_watch (GstBus * bus)
Removes a signal watch previously added with gst_bus_add_signal_watch.
Parameters:
bus
–
a GstBus you previously added a signal watch to
Gst.Bus.prototype.remove_signal_watch
function Gst.Bus.prototype.remove_signal_watch(): {
// javascript wrapper for 'gst_bus_remove_signal_watch'
}
Removes a signal watch previously added with Gst.Bus.prototype.add_signal_watch.
Gst.Bus.remove_signal_watch
def Gst.Bus.remove_signal_watch (self):
#python wrapper for 'gst_bus_remove_signal_watch'
Removes a signal watch previously added with Gst.Bus.add_signal_watch.
gst_bus_remove_watch
gboolean gst_bus_remove_watch (GstBus * bus)
Removes an installed bus watch from bus.
Parameters:
bus
–
a GstBus to remove the watch from.
Since : 1.6
Gst.Bus.prototype.remove_watch
function Gst.Bus.prototype.remove_watch(): {
// javascript wrapper for 'gst_bus_remove_watch'
}
Removes an installed bus watch from bus.
Since : 1.6
gst_bus_set_flushing
gst_bus_set_flushing (GstBus * bus, gboolean flushing)
If flushing, flushes out and unrefs any messages queued in the bus. Releases references to the message origin objects. Will flush future messages until gst_bus_set_flushing sets flushing to FALSE.
Gst.Bus.prototype.set_flushing
function Gst.Bus.prototype.set_flushing(flushing: Number): {
// javascript wrapper for 'gst_bus_set_flushing'
}
If flushing, flushes out and unrefs any messages queued in the bus. Releases references to the message origin objects. Will flush future messages until Gst.Bus.prototype.set_flushing sets flushing to false.
Gst.Bus.set_flushing
def Gst.Bus.set_flushing (self, flushing):
#python wrapper for 'gst_bus_set_flushing'
If flushing, flushes out and unrefs any messages queued in the bus. Releases references to the message origin objects. Will flush future messages until Gst.Bus.set_flushing sets flushing to False.
gst_bus_set_sync_handler
gst_bus_set_sync_handler (GstBus * bus, GstBusSyncHandler func, gpointer user_data, GDestroyNotify notify)
Sets the synchronous handler on the bus. The function will be called every time a new message is posted on the bus. Note that the function will be called in the same thread context as the posting object. This function is usually only called by the creator of the bus. Applications should handle messages asynchronously using the gst_bus watch and poll functions.
Before 1.16.3 it was not possible to replace an existing handler and clearing an existing handler with NULL was not thread-safe.
Parameters:
bus
–
a GstBus to install the handler on
func
(
[allow-none])
–
The handler function to install
user_data
–
User data that will be sent to the handler function.
notify
–
called when user_data becomes unused
Gst.Bus.prototype.set_sync_handler
function Gst.Bus.prototype.set_sync_handler(func: Gst.BusSyncHandler, user_data: Object): {
// javascript wrapper for 'gst_bus_set_sync_handler'
}
Sets the synchronous handler on the bus. The function will be called every time a new message is posted on the bus. Note that the function will be called in the same thread context as the posting object. This function is usually only called by the creator of the bus. Applications should handle messages asynchronously using the gst_bus watch and poll functions.
Before 1.16.3 it was not possible to replace an existing handler and clearing an existing handler with null was not thread-safe.
Parameters:
The handler function to install
User data that will be sent to the handler function.
Gst.Bus.set_sync_handler
def Gst.Bus.set_sync_handler (self, func, *user_data):
#python wrapper for 'gst_bus_set_sync_handler'
Sets the synchronous handler on the bus. The function will be called every time a new message is posted on the bus. Note that the function will be called in the same thread context as the posting object. This function is usually only called by the creator of the bus. Applications should handle messages asynchronously using the gst_bus watch and poll functions.
Before 1.16.3 it was not possible to replace an existing handler and clearing an existing handler with None was not thread-safe.
Parameters:
The handler function to install
User data that will be sent to the handler function.
gst_bus_sync_signal_handler
GstBusSyncReply gst_bus_sync_signal_handler (GstBus * bus, GstMessage * message, gpointer data)
A helper GstBusSyncHandler that can be used to convert all synchronous messages into signals.
Gst.Bus.prototype.sync_signal_handler
function Gst.Bus.prototype.sync_signal_handler(message: Gst.Message, data: Object): {
// javascript wrapper for 'gst_bus_sync_signal_handler'
}
A helper Gst.BusSyncHandler that can be used to convert all synchronous messages into signals.
Gst.Bus.sync_signal_handler
def Gst.Bus.sync_signal_handler (self, message, data):
#python wrapper for 'gst_bus_sync_signal_handler'
A helper Gst.BusSyncHandler that can be used to convert all synchronous messages into signals.
gst_bus_timed_pop
GstMessage * gst_bus_timed_pop (GstBus * bus, GstClockTime timeout)
Gets a message from the bus, waiting up to the specified timeout.
If timeout is 0, this function behaves like gst_bus_pop. If timeout is GST_CLOCK_TIME_NONE, this function will block forever until a message was posted on the bus.
the GstMessage that is on the bus after the specified timeout or NULL if the bus is empty after the timeout expired.
Gst.Bus.prototype.timed_pop
function Gst.Bus.prototype.timed_pop(timeout: Number): {
// javascript wrapper for 'gst_bus_timed_pop'
}
Gets a message from the bus, waiting up to the specified timeout.
If timeout is 0, this function behaves like Gst.Bus.prototype.pop. If timeout is Gst.CLOCK_TIME_NONE, this function will block forever until a message was posted on the bus.
the Gst.Message that is on the bus after the specified timeout or null if the bus is empty after the timeout expired.
Gst.Bus.timed_pop
def Gst.Bus.timed_pop (self, timeout):
#python wrapper for 'gst_bus_timed_pop'
Gets a message from the bus, waiting up to the specified timeout.
If timeout is 0, this function behaves like Gst.Bus.pop. If timeout is Gst.CLOCK_TIME_NONE, this function will block forever until a message was posted on the bus.
the Gst.Message that is on the bus after the specified timeout or None if the bus is empty after the timeout expired.
gst_bus_timed_pop_filtered
GstMessage * gst_bus_timed_pop_filtered (GstBus * bus, GstClockTime timeout, GstMessageType types)
Gets a message from the bus whose type matches the message type mask types, waiting up to the specified timeout (and discarding any messages that do not match the mask provided).
If timeout is 0, this function behaves like gst_bus_pop_filtered. If timeout is GST_CLOCK_TIME_NONE, this function will block forever until a matching message was posted on the bus.
Parameters:
bus
–
a GstBus to pop from
timeout
–
a timeout in nanoseconds, or GST_CLOCK_TIME_NONE to wait forever
types
–
message types to take into account, GST_MESSAGE_ANY for any type
a GstMessage matching the filter in types, or NULL if no matching message was found on the bus until the timeout expired.
Gst.Bus.prototype.timed_pop_filtered
function Gst.Bus.prototype.timed_pop_filtered(timeout: Number, types: Gst.MessageType): {
// javascript wrapper for 'gst_bus_timed_pop_filtered'
}
Gets a message from the bus whose type matches the message type mask types, waiting up to the specified timeout (and discarding any messages that do not match the mask provided).
If timeout is 0, this function behaves like Gst.Bus.prototype.pop_filtered. If timeout is Gst.CLOCK_TIME_NONE, this function will block forever until a matching message was posted on the bus.
Parameters:
a timeout in nanoseconds, or Gst.CLOCK_TIME_NONE to wait forever
message types to take into account, Gst.MessageType.ANY for any type
a Gst.Message matching the filter in types, or null if no matching message was found on the bus until the timeout expired.
Gst.Bus.timed_pop_filtered
def Gst.Bus.timed_pop_filtered (self, timeout, types):
#python wrapper for 'gst_bus_timed_pop_filtered'
Gets a message from the bus whose type matches the message type mask types, waiting up to the specified timeout (and discarding any messages that do not match the mask provided).
If timeout is 0, this function behaves like Gst.Bus.pop_filtered. If timeout is Gst.CLOCK_TIME_NONE, this function will block forever until a matching message was posted on the bus.
Parameters:
a timeout in nanoseconds, or Gst.CLOCK_TIME_NONE to wait forever
message types to take into account, Gst.MessageType.ANY for any type
a Gst.Message matching the filter in types, or None if no matching message was found on the bus until the timeout expired.
Signals
message
message_callback (GstBus * self, GstMessage * message, gpointer user_data)
A message has been posted on the bus. This signal is emitted from a GSource added to the mainloop. this signal will only be emitted when there is a GMainLoop running.
Parameters:
self
–
the object which received the signal
message
–
the message that has been posted asynchronously
user_data
–
Flags: Run Last
message
function message_callback(self: Gst.Bus, message: Gst.Message, user_data: Object): {
// javascript callback for the 'message' signal
}
A message has been posted on the bus. This signal is emitted from a GSource (not introspectable) added to the mainloop. this signal will only be emitted when there is a GMainLoop (not introspectable) running.
Parameters:
the object which received the signal
the message that has been posted asynchronously
Flags: Run Last
message
def message_callback (self, message, *user_data):
#python callback for the 'message' signal
A message has been posted on the bus. This signal is emitted from a GSource (not introspectable) added to the mainloop. this signal will only be emitted when there is a GMainLoop (not introspectable) running.
Parameters:
the object which received the signal
the message that has been posted asynchronously
Flags: Run Last
sync-message
sync_message_callback (GstBus * self, GstMessage * message, gpointer user_data)
A message has been posted on the bus. This signal is emitted from the thread that posted the message so one has to be careful with locking.
This signal will not be emitted by default, you have to call gst_bus_enable_sync_message_emission before.
Parameters:
self
–
the object which received the signal
message
–
the message that has been posted synchronously
user_data
–
Flags: Run Last
sync-message
function sync_message_callback(self: Gst.Bus, message: Gst.Message, user_data: Object): {
// javascript callback for the 'sync-message' signal
}
A message has been posted on the bus. This signal is emitted from the thread that posted the message so one has to be careful with locking.
This signal will not be emitted by default, you have to call Gst.Bus.prototype.enable_sync_message_emission before.
Parameters:
the object which received the signal
the message that has been posted synchronously
Flags: Run Last
sync-message
def sync_message_callback (self, message, *user_data):
#python callback for the 'sync-message' signal
A message has been posted on the bus. This signal is emitted from the thread that posted the message so one has to be careful with locking.
This signal will not be emitted by default, you have to call Gst.Bus.enable_sync_message_emission before.
Parameters:
the object which received the signal
the message that has been posted synchronously
Flags: Run Last
Properties
enable-async
“enable-async” gboolean
Enables async message delivery support for bus watches, gst_bus_pop and similar API. Without this only the synchronous message handlers are called.
This property is used to create the child element buses in GstBin.
Flags : Read / Write / Construct Only
enable-async
“enable-async” Number
Enables async message delivery support for bus watches, Gst.Bus.prototype.pop and similar API. Without this only the synchronous message handlers are called.
This property is used to create the child element buses in Gst.Bin.
Flags : Read / Write / Construct Only
enable_async
“self.props.enable_async” bool
Enables async message delivery support for bus watches, Gst.Bus.pop and similar API. Without this only the synchronous message handlers are called.
This property is used to create the child element buses in Gst.Bin.
Flags : Read / Write / Construct Only
Virtual Methods
vfunc_message
function vfunc_message(bus: Gst.Bus, message: Gst.Message): {
// javascript implementation of the 'message' virtual method
}
A message has been posted on the bus.
Parameters:
the message that has been posted asynchronously
do_message
def do_message (bus, message):
#python implementation of the 'message' virtual method
A message has been posted on the bus.
Parameters:
the message that has been posted asynchronously
sync_message
sync_message (GstBus * bus, GstMessage * message)
A message has been posted on the bus.
vfunc_sync_message
function vfunc_sync_message(bus: Gst.Bus, message: Gst.Message): {
// javascript implementation of the 'sync_message' virtual method
}
A message has been posted on the bus.
Parameters:
the message that has been posted synchronously
do_sync_message
def do_sync_message (bus, message):
#python implementation of the 'sync_message' virtual method
A message has been posted on the bus.
Parameters:
the message that has been posted synchronously
Function Macros
GST_BUS_CAST
#define GST_BUS_CAST(bus) ((GstBus*)(bus))
Enumerations
GstBusFlags
The standard flags that a bus may have.
Members
GST_BUS_FLUSHING
(16)
–
The bus is currently dropping all messages
GST_BUS_FLAG_LAST
(32)
–
offset to define more flags
Gst.BusFlags
The standard flags that a bus may have.
Members
Gst.BusFlags.FLUSHING
(16)
–
The bus is currently dropping all messages
Gst.BusFlags.FLAG_LAST
(32)
–
offset to define more flags
Gst.BusFlags
The standard flags that a bus may have.
Members
Gst.BusFlags.FLUSHING
(16)
–
The bus is currently dropping all messages
Gst.BusFlags.FLAG_LAST
(32)
–
offset to define more flags
GstBusSyncReply
The result values for a GstBusSyncHandler.
Members
GST_BUS_DROP
(0)
–
drop the message
GST_BUS_PASS
(1)
–
pass the message to the async queue
GST_BUS_ASYNC
(2)
–
pass message to async queue, continue if message is handled
Gst.BusSyncReply
The result values for a GstBusSyncHandler.
Members
Gst.BusSyncReply.DROP
(0)
–
drop the message
Gst.BusSyncReply.PASS
(1)
–
pass the message to the async queue
Gst.BusSyncReply.ASYNC
(2)
–
pass message to async queue, continue if message is handled
Gst.BusSyncReply
The result values for a GstBusSyncHandler.
Members
Gst.BusSyncReply.DROP
(0)
–
drop the message
Gst.BusSyncReply.PASS
(1)
–
pass the message to the async queue
Gst.BusSyncReply.ASYNC
(2)
–
pass message to async queue, continue if message is handled
Callbacks
GstBusFunc
gboolean (*GstBusFunc) (GstBus * bus, GstMessage * message, gpointer user_data)
Specifies the type of function passed to gst_bus_add_watch or gst_bus_add_watch_full, which is called from the mainloop when a message is available on the bus.
The message passed to the function will be unreffed after execution of this function so it should not be freed in the function.
Note that this function is used as a GSourceFunc which means that returning FALSE will remove the GSource from the mainloop.
Parameters:
bus
–
the GstBus that sent the message
message
–
the GstMessage
user_data
–
user data that has been given, when registering the handler
FALSE if the event source should be removed.
Gst.BusFunc
function Gst.BusFunc(bus: Gst.Bus, message: Gst.Message, user_data: Object): {
// javascript wrapper for 'GstBusFunc'
}
Specifies the type of function passed to gst_bus_add_watch (not introspectable) or Gst.Bus.prototype.add_watch_full, which is called from the mainloop when a message is available on the bus.
The message passed to the function will be unreffed after execution of this function so it should not be freed in the function.
Note that this function is used as a GLib.SourceFunc which means that returning false will remove the GSource (not introspectable) from the mainloop.
Gst.BusFunc
def Gst.BusFunc (bus, message, *user_data):
#python wrapper for 'GstBusFunc'
Specifies the type of function passed to gst_bus_add_watch (not introspectable) or Gst.Bus.add_watch_full, which is called from the mainloop when a message is available on the bus.
The message passed to the function will be unreffed after execution of this function so it should not be freed in the function.
Note that this function is used as a GLib.SourceFunc which means that returning False will remove the GSource (not introspectable) from the mainloop.
GstBusSyncHandler
GstBusSyncReply (*GstBusSyncHandler) (GstBus * bus, GstMessage * message, gpointer user_data)
Handler will be invoked synchronously, when a new message has been injected into the bus. This function is mostly used internally. Only one sync handler can be attached to a given bus.
If the handler returns GST_BUS_DROP, it should unref the message, else the message should not be unreffed by the sync handler.
Parameters:
bus
–
the GstBus that sent the message
message
–
the GstMessage
user_data
–
user data that has been given, when registering the handler
GstBusSyncReply stating what to do with the message
Gst.BusSyncHandler
function Gst.BusSyncHandler(bus: Gst.Bus, message: Gst.Message, user_data: Object): {
// javascript wrapper for 'GstBusSyncHandler'
}
Handler will be invoked synchronously, when a new message has been injected into the bus. This function is mostly used internally. Only one sync handler can be attached to a given bus.
If the handler returns Gst.BusSyncReply.DROP, it should unref the message, else the message should not be unreffed by the sync handler.
Gst.BusSyncReply stating what to do with the message
Gst.BusSyncHandler
def Gst.BusSyncHandler (bus, message, *user_data):
#python wrapper for 'GstBusSyncHandler'
Handler will be invoked synchronously, when a new message has been injected into the bus. This function is mostly used internally. Only one sync handler can be attached to a given bus.
If the handler returns Gst.BusSyncReply.DROP, it should unref the message, else the message should not be unreffed by the sync handler.
Gst.BusSyncReply stating what to do with the message
The results of the search are