Added a parse_launch example.
authorWim Taymans <wim.taymans@gmail.com>
Sat, 7 Jul 2001 14:07:03 +0000 (14:07 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Sat, 7 Jul 2001 14:07:03 +0000 (14:07 +0000)
Original commit message from CVS:
Added a parse_launch example.

examples/launch/Makefile.am
examples/launch/mp3parselaunch.c [new file with mode: 0644]
tests/old/examples/launch/Makefile.am
tests/old/examples/launch/mp3parselaunch.c [new file with mode: 0644]

index 25b92c3..11c2e57 100644 (file)
@@ -1,2 +1,8 @@
+noinst_PROGRAMS = mp3parselaunch
+
+# just an app here, we're safe
+LIBS += $(GST_LIBS)
+CFLAGS += $(GST_CFLAGS)
+
 noinst_SCRIPTS = mp3play
 EXTRA_DIST = mp3play
diff --git a/examples/launch/mp3parselaunch.c b/examples/launch/mp3parselaunch.c
new file mode 100644 (file)
index 0000000..42461c6
--- /dev/null
@@ -0,0 +1,24 @@
+#include <gst/gst.h>
+
+int
+main (int argc, char *argv[]) 
+{
+  GstElement *pipeline;
+  GstElement *disksrc;
+
+  gst_init (&argc, &argv);
+
+  pipeline = gst_pipeline_new ("my_pipeline");
+
+  gst_parse_launch ("disksrc[my_disksrc] ! mp3parse ! mpg123 ! osssink", GST_BIN (pipeline));
+
+  disksrc = gst_bin_get_by_name (GST_BIN (pipeline), "my_disksrc");
+  g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
+
+  gst_element_set_state (pipeline, GST_STATE_PLAYING);
+
+  while (gst_bin_iterate (GST_BIN (pipeline)));
+  
+  gst_element_set_state (pipeline, GST_STATE_NULL);
+  
+}
index 25b92c3..11c2e57 100644 (file)
@@ -1,2 +1,8 @@
+noinst_PROGRAMS = mp3parselaunch
+
+# just an app here, we're safe
+LIBS += $(GST_LIBS)
+CFLAGS += $(GST_CFLAGS)
+
 noinst_SCRIPTS = mp3play
 EXTRA_DIST = mp3play
diff --git a/tests/old/examples/launch/mp3parselaunch.c b/tests/old/examples/launch/mp3parselaunch.c
new file mode 100644 (file)
index 0000000..42461c6
--- /dev/null
@@ -0,0 +1,24 @@
+#include <gst/gst.h>
+
+int
+main (int argc, char *argv[]) 
+{
+  GstElement *pipeline;
+  GstElement *disksrc;
+
+  gst_init (&argc, &argv);
+
+  pipeline = gst_pipeline_new ("my_pipeline");
+
+  gst_parse_launch ("disksrc[my_disksrc] ! mp3parse ! mpg123 ! osssink", GST_BIN (pipeline));
+
+  disksrc = gst_bin_get_by_name (GST_BIN (pipeline), "my_disksrc");
+  g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
+
+  gst_element_set_state (pipeline, GST_STATE_PLAYING);
+
+  while (gst_bin_iterate (GST_BIN (pipeline)));
+  
+  gst_element_set_state (pipeline, GST_STATE_NULL);
+  
+}