2 /*** block a from ../../../docs/manual/highlevel-components.xml ***/
5 /*** block b from ../../../docs/manual/highlevel-components.xml ***/
7 my_bus_callback (GstBus *bus,
11 GMainLoop *loop = data;
13 switch (GST_MESSAGE_TYPE (message)) {
14 case GST_MESSAGE_ERROR: {
18 gst_message_parse_error (message, &err, &debug);
19 g_print ("Error: %s\n", err->message);
23 g_main_loop_quit (loop);
28 g_main_loop_quit (loop);
31 /* unhandled message */
35 /* remove message from the queue */
39 /*** block c from ../../../docs/manual/highlevel-components.xml ***/
49 gst_init (&argc, &argv);
50 loop = g_main_loop_new (NULL, FALSE);
52 /* make sure we have a URI */
54 g_print ("Usage: %s <URI>\n", argv[0]);
59 play = gst_element_factory_make ("playbin", "play");
60 g_object_set (G_OBJECT (play), "uri", argv[1], NULL);
62 bus = gst_pipeline_get_bus (GST_PIPELINE (play));
63 gst_bus_add_watch (bus, my_bus_callback, loop);
64 gst_object_unref (bus);
66 gst_element_set_state (play, GST_STATE_PLAYING);
69 g_main_loop_run (loop);
72 gst_element_set_state (play, GST_STATE_NULL);
73 gst_object_unref (GST_OBJECT (play));