[0.11] gst-plugins-base: audioringbuffer: Use new function to get a channel reordering map

Sebastian Dröge slomo at kemper.freedesktop.org
Thu Jan 5 01:36:01 PST 2012


Module: gst-plugins-base
Branch: 0.11
Commit: bd409364092fe7c79b08d392a0ac756885ee81ab
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=bd409364092fe7c79b08d392a0ac756885ee81ab

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Sat Dec 24 10:54:20 2011 +0100

audioringbuffer: Use new function to get a channel reordering map

---

 gst-libs/gst/audio/gstaudioringbuffer.c |   24 ++++--------------------
 1 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/gst-libs/gst/audio/gstaudioringbuffer.c b/gst-libs/gst/audio/gstaudioringbuffer.c
index bb433ad..54fc5e4 100644
--- a/gst-libs/gst/audio/gstaudioringbuffer.c
+++ b/gst-libs/gst/audio/gstaudioringbuffer.c
@@ -1883,7 +1883,7 @@ gst_audio_ring_buffer_set_channel_positions (GstAudioRingBuffer * buf,
 {
   const GstAudioChannelPosition *to;
   gint channels;
-  gint i, j;
+  gint i;
 
   g_return_if_fail (GST_IS_AUDIO_RING_BUFFER (buf));
   g_return_if_fail (buf->acquired);
@@ -1895,25 +1895,9 @@ gst_audio_ring_buffer_set_channel_positions (GstAudioRingBuffer * buf,
   if (memcmp (position, to, channels * sizeof (to[0])) == 0)
     return;
 
-  /* Build reorder map and check compatibility */
-  for (i = 0; i < channels; i++) {
-    g_return_if_fail (position[i] == GST_AUDIO_CHANNEL_POSITION_NONE
-        || to[i] == GST_AUDIO_CHANNEL_POSITION_NONE);
-    g_return_if_fail (position[i] == GST_AUDIO_CHANNEL_POSITION_INVALID
-        || to[i] == GST_AUDIO_CHANNEL_POSITION_INVALID);
-    g_return_if_fail (position[i] == GST_AUDIO_CHANNEL_POSITION_MONO
-        || to[i] == GST_AUDIO_CHANNEL_POSITION_MONO);
-
-    for (j = 0; j < channels; j++) {
-      if (position[i] == to[j]) {
-        buf->channel_reorder_map[i] = j;
-        break;
-      }
-    }
-
-    /* Not all channels present in both */
-    g_return_if_fail (j == channels);
-  }
+  if (!gst_audio_get_channel_reorder_map (channels, position, to,
+          buf->channel_reorder_map))
+    g_return_if_reached ();
 
   for (i = 0; i < channels; i++) {
     if (buf->channel_reorder_map[i] != i) {



More information about the gstreamer-commits mailing list