From 9593a397546edbe691f4dd6c3656821553321525 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sat, 7 Jul 2001 14:07:03 +0000 Subject: [PATCH] Added a parse_launch example. Original commit message from CVS: Added a parse_launch example. --- examples/launch/Makefile.am | 6 ++++++ examples/launch/mp3parselaunch.c | 24 ++++++++++++++++++++++++ tests/old/examples/launch/Makefile.am | 6 ++++++ tests/old/examples/launch/mp3parselaunch.c | 24 ++++++++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 examples/launch/mp3parselaunch.c create mode 100644 tests/old/examples/launch/mp3parselaunch.c diff --git a/examples/launch/Makefile.am b/examples/launch/Makefile.am index 25b92c3..11c2e57 100644 --- a/examples/launch/Makefile.am +++ b/examples/launch/Makefile.am @@ -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 index 0000000..42461c6 --- /dev/null +++ b/examples/launch/mp3parselaunch.c @@ -0,0 +1,24 @@ +#include + +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); + +} diff --git a/tests/old/examples/launch/Makefile.am b/tests/old/examples/launch/Makefile.am index 25b92c3..11c2e57 100644 --- a/tests/old/examples/launch/Makefile.am +++ b/tests/old/examples/launch/Makefile.am @@ -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 index 0000000..42461c6 --- /dev/null +++ b/tests/old/examples/launch/mp3parselaunch.c @@ -0,0 +1,24 @@ +#include + +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); + +} -- 2.7.4