Add an audioconvert, just in case...
authorXavi Artigas <xartigas@fluendo.com>
Wed, 27 Jun 2012 09:05:27 +0000 (11:05 +0200)
committerXavi Artigas <xartigas@fluendo.com>
Wed, 27 Jun 2012 09:05:27 +0000 (11:05 +0200)
gst-sdk/tutorials/playback-tutorial-7.c

index da0570b..2ccd069 100644 (file)
@@ -1,7 +1,7 @@
 #include <gst/gst.h>\r
   \r
 int main(int argc, char *argv[]) {\r
-  GstElement *pipeline, *bin, *equalizer, *sink;\r
+  GstElement *pipeline, *bin, *equalizer, *convert, *sink;\r
   GstPad *pad, *ghost_pad;\r
   GstBus *bus;\r
   GstMessage *msg;\r
@@ -14,16 +14,17 @@ int main(int argc, char *argv[]) {
   \r
   /* Create the elements inside the sink bin */\r
   equalizer = gst_element_factory_make ("equalizer-3bands", "equalizer");\r
+  convert = gst_element_factory_make ("audioconvert", "convert");\r
   sink = gst_element_factory_make ("autoaudiosink", "audio_sink");\r
-  if (!equalizer || !sink) {\r
+  if (!equalizer || !convert || !sink) {\r
     g_printerr ("Not all elements could be created.\n");\r
     return -1;\r
   }\r
   \r
   /* Create the sink bin, add the elements and link them */\r
   bin = gst_bin_new ("audio_sink_bin");\r
-  gst_bin_add_many (GST_BIN (bin), equalizer, sink, NULL);\r
-  gst_element_link (equalizer, sink);\r
+  gst_bin_add_many (GST_BIN (bin), equalizer, convert, sink, NULL);\r
+  gst_element_link_many (equalizer, convert, sink, NULL);\r
   pad = gst_element_get_static_pad (equalizer, "sink");\r
   ghost_pad = gst_ghost_pad_new ("sink", pad);\r
   gst_pad_set_active (ghost_pad, TRUE);\r