tests/examples/helloworld/helloworld.c: Must plug audioconvert and audioresample...
authorTim-Philipp Müller <tim@centricular.net>
Thu, 18 May 2006 08:48:21 +0000 (08:48 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Thu, 18 May 2006 08:48:21 +0000 (08:48 +0000)
Original commit message from CVS:
* tests/examples/helloworld/helloworld.c: (main):
Must plug audioconvert and audioresample between decoder
and audio sink.

ChangeLog
common
tests/examples/helloworld/helloworld.c

index ed5ddbf..375f46b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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),
diff --git a/common b/common
index 7a056f8..8eb9ea4 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 7a056f8737474de939f05f189e6ef0986a4b34c8
+Subproject commit 8eb9ea46137c34191bdbeca946ca4419ba573b51
index 0c2f3ac..bd6016a 100644 (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);