]> git.sesse.net Git - vlc/commitdiff
aout_CheckChannelReorder: remove redundant parameter
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 11 Nov 2012 10:37:57 +0000 (12:37 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 11 Nov 2012 11:17:42 +0000 (13:17 +0200)
The number of channels is conveyed in the channels mask.

include/vlc_aout.h
modules/audio_filter/converter/a52tofloat32.c
modules/audio_filter/converter/dtstofloat32.c
modules/audio_output/directx.c
modules/audio_output/waveout.c
modules/codec/opus.c
modules/codec/vorbis.c
modules/demux/wav.c
modules/mux/wav.c
src/audio_output/common.c

index 9aa5ec76260c03ea8d9e674b3854ea3228c31154..27d5bb0192a8df241ef0c1eb3e00a7e0c7738d67 100644 (file)
@@ -178,7 +178,8 @@ static const uint32_t pi_vlc_chan_order_wg4[] =
  * If pi_chan_order_in or pi_chan_order_out is NULL, it will assume that vlc
  * internal (WG4) order is requested.
  */
-VLC_API int aout_CheckChannelReorder( const uint32_t *pi_chan_order_in, const uint32_t *pi_chan_order_out, uint32_t i_channel_mask, int i_channels, int *pi_chan_table );
+VLC_API unsigned aout_CheckChannelReorder( const uint32_t *, const uint32_t *,
+                                           uint32_t mask, int *table );
 VLC_API void aout_ChannelReorder( void *, size_t, unsigned, const int *, unsigned );
 
 /**
index 8379e07687365f165220793e0383ace1936bd572..939131891d263df4cd6eb12e5ebdbd532ce94e72 100644 (file)
@@ -214,7 +214,6 @@ static int Open( vlc_object_t *p_this, filter_sys_t *p_sys,
 
     aout_CheckChannelReorder( pi_channels_in, NULL,
                               output->i_physical_channels,
-                              p_sys->i_nb_channels,
                               p_sys->pi_chan_table );
 
     return VLC_SUCCESS;
index f4b94129c6f3a7e31a9b7d85133183acbf442efd..4df568910b650d968bb367fa6bd347eab8ea62eb 100644 (file)
@@ -176,7 +176,6 @@ static int Open( vlc_object_t *p_this, filter_sys_t *p_sys,
 
     aout_CheckChannelReorder( pi_channels_in, NULL,
                               output->i_physical_channels,
-                              p_sys->i_nb_channels,
                               p_sys->pi_chan_table );
 
     return VLC_SUCCESS;
index 186271026aec54b82dde1bb8fbb6caf01d2dc0a9..5a26d784b90690b0656480d60cbb853429245876 100644 (file)
@@ -787,7 +787,7 @@ static int CreateDSBuffer( audio_output_t *p_aout, int i_format,
     p_aout->sys->i_channel_mask = waveformat.dwChannelMask;
     p_aout->sys->b_chan_reorder =
         aout_CheckChannelReorder( pi_channels_in, pi_channels_out,
-                                  waveformat.dwChannelMask, i_nb_channels,
+                                  waveformat.dwChannelMask,
                                   p_aout->sys->pi_chan_table );
 
     if( p_aout->sys->b_chan_reorder )
index 63914c251170e72e5da60c0eca5947494eafaf5a..4ec5d44db0e6da7be06817d16a0a52b7cf1ca6bc 100644 (file)
@@ -659,7 +659,7 @@ static int OpenWaveOut( audio_output_t *p_aout, uint32_t i_device_id, int i_form
 
     p_aout->sys->b_chan_reorder =
         aout_CheckChannelReorder( pi_channels_in, pi_channels_out,
-                                  waveformat.dwChannelMask, i_nb_channels,
+                                  waveformat.dwChannelMask,
                                   p_aout->sys->pi_chan_table );
 
     if( p_aout->sys->b_chan_reorder )
index d9d32570cf3fbf74b3bee37f3faf8b49a0cba60b..81569765e3dec3ca00b1fbcd461d3bdee398a709 100644 (file)
@@ -298,7 +298,6 @@ static int ProcessInitialHeader( decoder_t *p_dec, ogg_packet *p_oggpacket )
                                             pi_7channels_in, pi_8channels_in };
         aout_CheckChannelReorder( pi_ch[p_header->channels-3], NULL,
                                   p_dec->fmt_out.audio.i_physical_channels,
-                                  p_header->channels,
                                   pi_chan_table );
         for(int i=0;i<p_header->channels;i++)
             new_stream_map[pi_chan_table[i]]=p_header->stream_map[i];
index 524d79ab5984770261b294d6755d0d7cd5f857dc..5d6cd613ad43bccdba1681f007be9086b16d442d 100644 (file)
@@ -660,14 +660,10 @@ static void ConfigureChannelOrder(int *pi_chan_table, int i_channels, uint32_t i
 
     if( b_decode )
         aout_CheckChannelReorder( pi_channels_in, NULL,
-                                  i_channel_mask,
-                                  i_channels,
-                                  pi_chan_table );
+                                  i_channel_mask, pi_chan_table );
     else
         aout_CheckChannelReorder( NULL, pi_channels_in,
-                                  i_channel_mask,
-                                  i_channels,
-                                  pi_chan_table );
+                                  i_channel_mask, pi_chan_table );
 }
 
 /*****************************************************************************
index 6acf6311354c6fae8073759cfdfce088b3156fd6..0bd3adbaa44439e2ca2d0af5a4180179171c1519 100644 (file)
@@ -273,7 +273,6 @@ static int Open( vlc_object_t * p_this )
             p_sys->b_chan_reorder =
                 aout_CheckChannelReorder( pi_channels_in, NULL,
                                           p_sys->i_channel_mask,
-                                          p_sys->fmt.audio.i_channels,
                                           p_sys->pi_chan_table );
 
         msg_Dbg( p_demux, "channel mask: %x, reordering: %i",
index db70f7c899c31ad37c04283e3e9734cdf4375fa8..bb585ab596319d80459065cd3b35d81b8c493b95 100644 (file)
@@ -188,7 +188,6 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
         p_sys->b_chan_reorder =
             aout_CheckChannelReorder( pi_channels_in, pi_channels_out,
                                       p_sys->i_channel_mask,
-                                      p_input->p_fmt->audio.i_channels,
                                       p_sys->pi_chan_table );
 
         msg_Dbg( p_mux, "channel mask: %x, reordering: %i",
index 027caab49aa8fa7871f9483e4309887d430f2055..720d6ff5c0b79a2fb05fbcf45c06671cc48a1bb6 100644 (file)
@@ -241,40 +241,35 @@ void aout_FormatsPrint( vlc_object_t *obj, const char * psz_text,
 /*****************************************************************************
  * aout_CheckChannelReorder : Check if we need to do some channel re-ordering
  *****************************************************************************/
-int aout_CheckChannelReorder( const uint32_t *pi_chan_order_in,
-                              const uint32_t *pi_chan_order_out,
-                              uint32_t i_channel_mask,
-                              int i_channels, int *pi_chan_table )
+unsigned aout_CheckChannelReorder( const uint32_t *chans_in,
+                                   const uint32_t *chans_out,
+                                   uint32_t mask, int *restrict table )
 {
-    bool b_chan_reorder = false;
-    int i, j, k, l;
+    unsigned channels = 0;
 
-    if( i_channels > AOUT_CHAN_MAX )
-        return false;
-
-    if( pi_chan_order_in == NULL )
-        pi_chan_order_in = pi_vlc_chan_order_wg4;
-    if( pi_chan_order_out == NULL )
-        pi_chan_order_out = pi_vlc_chan_order_wg4;
+    if( chans_in == NULL )
+        chans_in = pi_vlc_chan_order_wg4;
+    if( chans_out == NULL )
+        chans_out = pi_vlc_chan_order_wg4;
 
-    for( i = 0, j = 0; pi_chan_order_in[i]; i++ )
+    for( unsigned i = 0; chans_in[i]; i++ )
     {
-        if( !(i_channel_mask & pi_chan_order_in[i]) ) continue;
-
-        for( k = 0, l = 0; pi_chan_order_in[i] != pi_chan_order_out[k]; k++ )
-        {
-            if( i_channel_mask & pi_chan_order_out[k] ) l++;
-        }
+        const uint32_t chan = chans_in[i];
+        if( !(mask & chan) )
+            continue;
 
-        pi_chan_table[j++] = l;
-    }
+        unsigned index = 0;
+        for( unsigned j = 0; chan != chans_out[j]; j++ )
+            if( mask & chans_out[j] )
+                index++;
 
-    for( i = 0; i < i_channels; i++ )
-    {
-        if( pi_chan_table[i] != i ) b_chan_reorder = true;
+        table[channels++] = index;
     }
 
-    return b_chan_reorder;
+    for( unsigned i = 0; i < channels; i++ )
+        if( table[i] != i )
+            return channels;
+    return 0;
 }
 
 /*****************************************************************************