mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
examples: set bus handler before state change
We need to set the bus handler before starting the pipeline or we might just miss the message we are looking for.
This commit is contained in:
parent
5eccc07856
commit
b6f55607d6
1 changed files with 3 additions and 3 deletions
|
@ -116,13 +116,13 @@ main (int argc, char *argv[])
|
|||
/* link the elements */
|
||||
gst_element_link (fakesrc, fakesink);
|
||||
|
||||
/* start playing */
|
||||
gst_element_set_state (bin, GST_STATE_PLAYING);
|
||||
|
||||
/* get the bus, we need to install a sync handler */
|
||||
bus = gst_pipeline_get_bus (GST_PIPELINE (bin));
|
||||
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) sync_bus_handler, bin);
|
||||
|
||||
/* start playing */
|
||||
gst_element_set_state (bin, GST_STATE_PLAYING);
|
||||
|
||||
/* Run event loop listening for bus messages until EOS or ERROR */
|
||||
event_loop (bus, bin);
|
||||
|
||||
|
|
Loading…
Reference in a new issue