</para>
<programlisting>
+/* example-begin queue.c */
#include <stdlib.h>
#include <gst/gst.h>
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);
}
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 (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_many (GST_BIN (bin), filesrc, queue, thread, NULL);
- 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);
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL);
- exit (0);
+ return 0;
}
+/* example-end queue.c */
</programlisting>
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)
# 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
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)
# 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