8 GMainLoop *loop = data;
10 switch (GST_MESSAGE_TYPE (msg)) {
12 g_print ("End-of-stream\n");
13 g_main_loop_quit (loop);
15 case GST_MESSAGE_ERROR: {
19 gst_message_parse_error (msg, &err, &debug);
22 g_print ("Error: %s\n", err->message);
25 g_main_loop_quit (loop);
39 GstElement *pipeline, *filesrc, *decoder, *filter, *sink;
43 gst_init (&argc, &argv);
44 loop = g_main_loop_new (NULL, FALSE);
46 g_print ("Usage: %s <myth uri>\n", argv[0]);
51 pipeline = gst_pipeline_new ("mythtvsrc_pipeline");
52 gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (pipeline)),
55 filesrc = gst_element_factory_make ("mythtvsrc", "mythtvsrc");
56 decoder = gst_element_factory_make ("mad", "my_decoder");
57 filter = gst_element_factory_make ("my_filter", "my_filter");
58 sink = gst_element_factory_make ("osssink", "audiosink");
59 if (!sink || !decoder) {
60 g_print ("Decoder or output could not be found - check your install\n");
63 g_print ("Your self-written filter could not be found. Make sure it "
64 "is installed correctly in $(libdir)/gstreamer-0.9/ and that "
65 "you've ran gst-register-0.9 to register it. Check availability "
66 "of the plugin afterwards using \"gst-inspect-0.9 my_filter\"");
70 g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
72 /* link everything together */
73 gst_element_link_many (filesrc, decoder, filter, sink, NULL);
74 gst_bin_add_many (GST_BIN (pipeline), filesrc, decoder, filter, sink, NULL);
77 gst_element_set_state (pipeline, GST_STATE_PLAYING);
78 g_main_loop_run (loop);
81 gst_element_set_state (pipeline, GST_STATE_NULL);
82 gst_object_unref (GST_OBJECT (pipeline));