? gst/audioconvert/.gstaudioconvert.c.swp
Index: gst/audioconvert/gstaudioconvert.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst/audioconvert/gstaudioconvert.c,v
retrieving revision 1.119
diff -u -r1.119 gstaudioconvert.c
--- gst/audioconvert/gstaudioconvert.c	28 Jun 2007 20:37:58 -0000	1.119
+++ gst/audioconvert/gstaudioconvert.c	25 Oct 2007 16:08:31 -0000
@@ -668,8 +668,9 @@
     GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
 {
   GstStructure *ins, *outs;
-  gint rate, endianness, depth, width, channels;
+  gint rate, endianness, depth, width, channels_in, channels_out;
   gboolean signedness;
+  GstAudioChannelPosition *positions;
 
   g_return_if_fail (gst_caps_is_fixed (caps));
 
@@ -679,9 +680,29 @@
   ins = gst_caps_get_structure (caps, 0);
   outs = gst_caps_get_structure (othercaps, 0);
 
-  if (gst_structure_get_int (ins, "channels", &channels)) {
+  if (gst_structure_get_int (ins, "channels", &channels_in)) {
     if (gst_structure_has_field (outs, "channels")) {
-      gst_structure_fixate_field_nearest_int (outs, "channels", channels);
+      gst_structure_get_int (outs, "channels", &channels_out);
+      gst_structure_fixate_field_nearest_int (outs, "channels", channels_in);
+    }
+    
+    if ( channels_out > channels_in)
+    {
+      /* we are converting to more channels */
+      gint i;
+      
+      positions = (GstAudioChannelPosition *)malloc( channels_out * sizeof( GstAudioChannelPosition));
+      for(i = 0 ; i < channels_out; i++)
+        positions[i] = GST_AUDIO_CHANNEL_POSITION_NONE;
+    } else
+    {
+      /* we are converting to lower channels */
+      positions = gst_audio_get_channel_positions(ins);
+    }
+    if (positions)
+    {
+      gst_audio_set_channel_positions(outs, positions);
+      g_free(positions);
     }
   }
   if (gst_structure_get_int (ins, "rate", &rate)) {
