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:
Wim Taymans 2009-04-22 12:04:36 +02:00 committed by Wim Taymans
parent 5eccc07856
commit b6f55607d6

View file

@ -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);