Documentation ¶
Overview ¶
This example demonstrates how events can be created and sent to the pipeline. What this example does is scheduling a timeout in a goroutine, and sending an EOS message on the bus from there - telling the pipeline to shut down. Once that event is processed by everything, the EOS message is going to be sent and we catch that one to shut down everything.
GStreamer's bus is an abstraction layer above an arbitrary main loop. This makes sure that GStreamer can be used in conjunction with any existing other framework (GUI frameworks, mostly) that operate their own main loops. Main idea behind the bus is the simplification between the application and GStreamer, because GStreamer is heavily threaded underneath.
Any thread can post messages to the bus, which is essentially a thread-safe queue of messages to process. When a new message was sent to the bus, it will wake up the main loop implementation underneath it (which will then process the pending messages from the main loop thread).
An application itself can post messages to the bus aswell. This makes it possible, e.g., to schedule an arbitrary piece of code to run in the main loop thread - avoiding potential threading issues.