mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 02:30:35 +00:00
another example
Original commit message from CVS: another example
This commit is contained in:
parent
88aba59fb7
commit
c35200bf05
3 changed files with 24 additions and 33 deletions
|
@ -46,6 +46,7 @@
|
|||
</para>
|
||||
|
||||
<programlisting>
|
||||
/* 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 */
|
||||
</programlisting>
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue