From c35200bf058092c1675a54bb0fc98d111af00165 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sun, 15 Sep 2002 21:33:26 +0000 Subject: [PATCH] another example Original commit message from CVS: another example --- docs/manual/queues.xml | 37 ++++++++++----------------- examples/manual/Makefile.am | 10 ++++---- tests/old/examples/manual/Makefile.am | 10 ++++---- 3 files changed, 24 insertions(+), 33 deletions(-) diff --git a/docs/manual/queues.xml b/docs/manual/queues.xml index 8179742ab6..57654fa09b 100644 --- a/docs/manual/queues.xml +++ b/docs/manual/queues.xml @@ -46,6 +46,7 @@ +/* example-begin queue.c */ #include <stdlib.h> #include <gst/gst.h> @@ -63,14 +64,14 @@ eos (GstElement *element, gpointer data) int main (int argc, char *argv[]) { - GstElement *filesrc, *audiosink, *queue, *parse, *decode; + GstElement *filesrc, *audiosink, *queue, *decode; GstElement *bin; GstElement *thread; gst_init (&argc,&argv); if (argc != 2) { - g_print ("usage: %s <filename>\n", argv[0]); + g_print ("usage: %s <mp3 filename>\n", argv[0]); exit (-1); } @@ -87,36 +88,25 @@ main (int argc, char *argv[]) g_assert (filesrc != NULL); g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); g_signal_connect (G_OBJECT (filesrc), "eos", - G_CALLBACK (eos), thread); + G_CALLBACK (eos), thread); queue = gst_element_factory_make ("queue", "queue"); + g_assert (queue != NULL); /* and an audio sink */ - audiosink = gst_element_factory_make ("audiosink", "play_audio"); + audiosink = gst_element_factory_make ("osssink", "play_audio"); g_assert (audiosink != NULL); - parse = gst_element_factory_make ("mp3parse", "parse"); - decode = gst_element_factory_make ("mpg123", "decode"); + decode = gst_element_factory_make ("mad", "decode"); /* add objects to the main bin */ - gst_bin_add (GST_BIN (bin), filesrc); - gst_bin_add (GST_BIN (bin), queue); + gst_bin_add_many (GST_BIN (thread), decode, audiosink, NULL); + + gst_bin_add_many (GST_BIN (bin), filesrc, queue, thread, NULL); - gst_bin_add (GST_BIN (thread), parse); - gst_bin_add (GST_BIN (thread), decode); - gst_bin_add (GST_BIN (thread), audiosink); - gst_pad_connect (gst_element_get_pad (filesrc,"src"), - gst_element_get_pad (queue,"sink")); - - gst_pad_connect (gst_element_get_pad (queue, "src"), - gst_element_get_pad (parse, "sink")); - gst_pad_connect (gst_element_get_pad (parse, "src"), - gst_element_get_pad (decode, "sink")); - gst_pad_connect (gst_element_get_pad (decode, "src"), - gst_element_get_pad (audiosink, "sink")); - - gst_bin_add (GST_BIN (bin), thread); + gst_element_connect (filesrc, queue); + gst_element_connect_many (queue, decode, audiosink, NULL); /* start playing */ gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING); @@ -129,8 +119,9 @@ main (int argc, char *argv[]) gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); - exit (0); + return 0; } +/* example-end queue.c */ diff --git a/examples/manual/Makefile.am b/examples/manual/Makefile.am index 915bcfb479..00eb3657a9 100644 --- a/examples/manual/Makefile.am +++ b/examples/manual/Makefile.am @@ -1,17 +1,17 @@ if HAVE_LIBGNOMEUI -GNOME=gnome dynamic +GNOME=gnome else GNOME= endif -EXAMPLES = $(GNOME) xml-mp3 +EXAMPLES = dynamic $(GNOME) helloworld helloworld2 queue xml-mp3 noinst_PROGRAMS = $(EXAMPLES) LDADD = $(GST_LIBS) INCLUDES = $(GST_CFLAGS) -dynamic_LDADD = $(GST_LIBS) $(LIBGNOMEUI_LIBS) -dynamic_CFLAGS = $(GST_CFLAGS) $(LIBGNOMEUI_CFLAGS) +#dynamic_LDADD = $(GST_LIBS) $(LIBGNOMEUI_LIBS) +#dynamic_CFLAGS = $(GST_CFLAGS) $(LIBGNOMEUI_CFLAGS) gnome_LDADD = $(GST_LIBS) $(LIBGNOMEUI_LIBS) gnome_CFLAGS = $(GST_CFLAGS) $(LIBGNOMEUI_CFLAGS) @@ -23,5 +23,5 @@ EXTRA_DIST = extract.pl # also, it's a bit irritating that right now a change in any xml file # triggers a rebuild of all examples #%.c: -dynamic.c gnome.c xml-mp3.c: $(top_srcdir)/docs/manual/*.xml +dynamic.c gnome.c helloworld.c helloworld2.c queue.c xml-mp3.c: $(top_srcdir)/docs/manual/*.xml $(srcdir)/extract.pl $@ $(top_srcdir)/docs/manual/*.xml diff --git a/tests/old/examples/manual/Makefile.am b/tests/old/examples/manual/Makefile.am index 915bcfb479..00eb3657a9 100644 --- a/tests/old/examples/manual/Makefile.am +++ b/tests/old/examples/manual/Makefile.am @@ -1,17 +1,17 @@ if HAVE_LIBGNOMEUI -GNOME=gnome dynamic +GNOME=gnome else GNOME= endif -EXAMPLES = $(GNOME) xml-mp3 +EXAMPLES = dynamic $(GNOME) helloworld helloworld2 queue xml-mp3 noinst_PROGRAMS = $(EXAMPLES) LDADD = $(GST_LIBS) INCLUDES = $(GST_CFLAGS) -dynamic_LDADD = $(GST_LIBS) $(LIBGNOMEUI_LIBS) -dynamic_CFLAGS = $(GST_CFLAGS) $(LIBGNOMEUI_CFLAGS) +#dynamic_LDADD = $(GST_LIBS) $(LIBGNOMEUI_LIBS) +#dynamic_CFLAGS = $(GST_CFLAGS) $(LIBGNOMEUI_CFLAGS) gnome_LDADD = $(GST_LIBS) $(LIBGNOMEUI_LIBS) gnome_CFLAGS = $(GST_CFLAGS) $(LIBGNOMEUI_CFLAGS) @@ -23,5 +23,5 @@ EXTRA_DIST = extract.pl # also, it's a bit irritating that right now a change in any xml file # triggers a rebuild of all examples #%.c: -dynamic.c gnome.c xml-mp3.c: $(top_srcdir)/docs/manual/*.xml +dynamic.c gnome.c helloworld.c helloworld2.c queue.c xml-mp3.c: $(top_srcdir)/docs/manual/*.xml $(srcdir)/extract.pl $@ $(top_srcdir)/docs/manual/*.xml