Index: multichannel.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/audio/multichannel.c,v
retrieving revision 1.2
diff -u -p -r1.2 multichannel.c
--- multichannel.c	20 Jul 2005 17:16:54 -0000	1.2
+++ multichannel.c	28 Sep 2005 10:50:09 -0000
@@ -119,6 +119,58 @@ gst_audio_check_channel_positions (const
   return TRUE;
 }
 
+static const GstAudioChannelPosition default_positions[7][7] = {
+  /* 1 channel */
+  {
+    GST_AUDIO_CHANNEL_POSITION_FRONT_MONO,
+  },
+  /* 2 channels */
+  {
+    GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
+    GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
+  },
+  /* 3 channels */
+  {
+    GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
+    GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
+    GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
+  },
+  /* 4 channels */
+  {
+    GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
+    GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
+    GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
+    GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
+  },
+  /* 5 channels */
+  {
+    GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
+    GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
+    GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
+    GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
+    GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
+  },
+  /* 6 channels */
+  {
+    GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
+    GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
+    GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
+    GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
+    GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
+    GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
+  },
+  /* 7 channels */
+  {
+    GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
+    GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
+    GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
+    GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
+    GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
+    GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
+    GST_AUDIO_CHANNEL_POSITION_LFE,
+  }
+};
+
 /**
  * gst_audio_get_channel_positions:
  * @str: A #GstStructure to retrieve channel positions from.
@@ -155,15 +207,9 @@ gst_audio_get_channel_positions (GstStru
    * implementing this property. They expect that channels=1 implies mono
    * and channels=2 implies stereo, so we follow that.
    * This might be removed during 0.9.x. */
-  if (!pos_val_arr && (channels == 1 || channels == 2)) {
-    pos = g_new (GstAudioChannelPosition, channels);
-    if (channels == 1) {
-      pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_MONO;
-    } else {
-      pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
-      pos[1] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
-    }
-    return pos;
+  if (!pos_val_arr && channels >= 1 && channels <= 7) {
+    const GstAudioChannelPosition *p = default_positions[channels-1];
+    return g_memdup (p, channels * sizeof (GstAudioChannelPosition));
   }
   g_return_val_if_fail (pos_val_arr != NULL, NULL);
   g_return_val_if_fail (gst_value_list_get_size (pos_val_arr) == channels,
