The number of channels is conveyed in the channels mask.
* 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 );
/**
aout_CheckChannelReorder( pi_channels_in, NULL,
output->i_physical_channels,
- p_sys->i_nb_channels,
p_sys->pi_chan_table );
return VLC_SUCCESS;
aout_CheckChannelReorder( pi_channels_in, NULL,
output->i_physical_channels,
- p_sys->i_nb_channels,
p_sys->pi_chan_table );
return VLC_SUCCESS;
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 )
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 )
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];
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 );
}
/*****************************************************************************
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",
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",
/*****************************************************************************
* 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;
}
/*****************************************************************************