-
-/*****************************************************************************
- * CheckReordering: Check if we need to do some channel re-ordering
- * (our channel order is different from the one chosen by Microsoft).
- *****************************************************************************/
-static void CheckReordering( sout_mux_t *p_mux, int i_nb_channels )
-{
- sout_mux_sys_t *p_sys = p_mux->p_sys;
- int i, j, k, l;
-
- p_sys->b_chan_reorder = VLC_FALSE;
-
- for( i = 0, j = 0;
- i < (int)(sizeof(pi_channels_out)/sizeof(uint32_t)); i++ )
- {
- if( p_sys->i_channel_mask & pi_channels_out[i] )
- {
- for( k = 0, l = 0;
- pi_channels_out[i] != pi_channels_ordered[k]; k++ )
- {
- if( p_sys->i_channel_mask & pi_channels_ordered[k] )
- {
- l++;
- }
- }
-
- p_sys->pi_chan_table[j] = l;
-
- j++;
- }
- }
-
- for( i = 0; i < i_nb_channels; i++ )
- {
- if( p_sys->pi_chan_table[i] != i ) p_sys->b_chan_reorder = VLC_TRUE;
- }
-
- if( p_sys->b_chan_reorder ) msg_Dbg( p_mux, "channel reordering needed" );
-}
-
-/*****************************************************************************
- * InterleaveFloat32/S16: change the channel order to the Microsoft one.
- *****************************************************************************/
-static void InterleaveFloat32( float *p_buf, int i_buf, int *pi_chan_table,
- int i_nb_channels )
-{
- int i, j;
- float p_tmp[MAX_CHANNELS];
-
- for( i = 0; i < i_buf / i_nb_channels / sizeof(float); i++ )
- {
- for( j = 0; j < i_nb_channels; j++ )
- {
- p_tmp[pi_chan_table[j]] = p_buf[i*i_nb_channels + j];
- }
-
- memcpy( &p_buf[i*i_nb_channels], p_tmp,
- i_nb_channels * sizeof(float) );
- }
-}
-
-static void InterleaveS16( int16_t *p_buf, int i_buf, int *pi_chan_table,
- int i_nb_channels )
-{
- int i, j;
- int16_t p_tmp[MAX_CHANNELS];
-
- for( i = 0; i < i_buf / i_nb_channels / sizeof(int16_t); i++ )
- {
- for( j = 0; j < i_nb_channels; j++ )
- {
- p_tmp[pi_chan_table[j]] = p_buf[i*i_nb_channels + j];
- }
-
- memcpy( &p_buf[i*i_nb_channels], p_tmp,
- i_nb_channels * sizeof(int16_t) );
- }
-}