Gst.Bus
const Gst = imports.gi.Gst;
let bus = new Gst.Bus({
enable_async: value,
});
The Gst.Bus is an object responsible for delivering Gst.Message packets in a first-in first-out way from the streaming threads (see Gst.Task) 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 GLib.Source based notifications. This makes it possible to handle the delivery in the glib mainloop.
The GLib.Source callback function Gst.async_signal_func can be used to convert all bus messages into signal emissions.
A message is posted on the bus with the Gst.post method. With the Gst.peek and Gst.pop methods one can look at or retrieve a previously posted message.
The bus can be polled with the Gst.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.pop the messages from the bus to handle them. Alternatively the application can register an asynchronous bus function using Gst.add_watch_full or Gst.add_watch. This function will install a GLib.Source 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.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 Gst.Pipeline has one bus.
Note that a Gst.Pipeline will set its bus into flushing state when changing from READY to NULL state.
Last reviewed on 2012-03-28 (0.11.3)
Hierarchy
-
GObject.Object
-
GObject.InitiallyUnowned
-
Gst.Object
- Gst.Bus
-
-
Methods
- Gst.Bus.prototype.add_signal_watch
- Gst.Bus.prototype.add_signal_watch_full
- Gst.Bus.prototype.add_watch_full
- Gst.Bus.prototype.async_signal_func
- Gst.Bus.prototype.create_watch
- Gst.Bus.prototype.disable_sync_message_emission
- Gst.Bus.prototype.enable_sync_message_emission
- Gst.Bus.prototype.have_pending
- Gst.Bus.prototype.peek
- Gst.Bus.prototype.poll
- Gst.Bus.prototype.pop
- Gst.Bus.prototype.pop_filtered
- Gst.Bus.prototype.post
- Gst.Bus.prototype.remove_signal_watch
- Gst.Bus.prototype.set_flushing
- Gst.Bus.prototype.set_sync_handler
- Gst.Bus.prototype.sync_signal_handler
- Gst.Bus.prototype.timed_pop
- Gst.Bus.prototype.timed_pop_filtered