tests/examples/helloworld/helloworld.c: Must plug audioconvert and audioresample between decoder and audio sink.

Original commit message from CVS:
* tests/examples/helloworld/helloworld.c: (main):
Must plug audioconvert and audioresample between decoder
and audio sink.
This commit is contained in:
Tim-Philipp Müller 2006-05-18 08:48:21 +00:00
parent f6e2e9c38d
commit 754dbafe51
3 changed files with 26 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2006-05-18 Tim-Philipp Müller <tim at centricular dot net>
* tests/examples/helloworld/helloworld.c: (main):
Must plug audioconvert and audioresample between decoder
and audio sink.
2006-05-17 Jan Schmidt <thaytan@mad.scientist.com>
* gst/gstregistryxml.c: (read_string), (load_pad_template),

2
common

@ -1 +1 @@
Subproject commit 7a056f8737474de939f05f189e6ef0986a4b34c8
Subproject commit 8eb9ea46137c34191bdbeca946ca4419ba573b51

View file

@ -41,6 +41,7 @@ int
main (int argc, char *argv[])
{
GstElement *bin, *filesrc, *decoder, *audiosink;
GstElement *conv, *resample;
gst_init (&argc, &argv);
@ -64,15 +65,31 @@ main (int argc, char *argv[])
g_print ("could not find plugin \"mad\"");
return -1;
}
/* also, we need to add some converters to make sure the audio stream
* from the decoder is converted into a format the audio sink can
* understand (if necessary) */
conv = gst_element_factory_make ("audioconvert", "audioconvert");
if (!conv) {
g_print ("could not create \"audioconvert\" element!");
return -1;
}
resample = gst_element_factory_make ("audioresample", "audioresample");
if (!conv) {
g_print ("could not create \"audioresample\" element!");
return -1;
}
/* and an audio sink */
audiosink = gst_element_factory_make ("alsasink", "play_audio");
g_assert (audiosink);
/* add objects to the main pipeline */
gst_bin_add_many (GST_BIN (bin), filesrc, decoder, audiosink, NULL);
gst_bin_add_many (GST_BIN (bin), filesrc, decoder, conv,
resample, audiosink, NULL);
/* link the elements */
gst_element_link_many (filesrc, decoder, audiosink, NULL);
gst_element_link_many (filesrc, decoder, conv, resample, audiosink, NULL);
/* start playing */
gst_element_set_state (bin, GST_STATE_PLAYING);