a8009712f52314697c78e6054a4f8b94122b63ef
[platform/upstream/gstreamer.git] / tests / old / examples / launch / mp3parselaunch.c
1 #include <stdlib.h>
2 #include <gst/gst.h>
3
4 int
5 main (int argc, char *argv[])
6 {
7   GstElement *pipeline;
8   GstElement *filesrc;
9   GError *error = NULL;
10
11   gst_init (&argc, &argv);
12
13   if (argc != 2) {
14     g_print ("usage: %s <filename>\n", argv[0]);
15     return -1;
16   }
17
18   pipeline =
19       (GstElement *)
20       gst_parse_launch ("filesrc name=my_filesrc ! mad ! osssink", &error);
21   if (!pipeline) {
22     fprintf (stderr, "Parse error: %s", error->message);
23     exit (1);
24   }
25
26   filesrc = gst_bin_get_by_name (GST_BIN (pipeline), "my_filesrc");
27   g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
28
29   gst_element_set_state (pipeline, GST_STATE_PLAYING);
30
31   while (gst_bin_iterate (GST_BIN (pipeline)));
32
33   gst_element_set_state (pipeline, GST_STATE_NULL);
34
35   return 0;
36 }