* internal (WG4) order is requested.
*/
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 );
+ uint32_t mask, uint8_t *table );
+VLC_API void aout_ChannelReorder( void *, size_t, unsigned, const uint8_t *, unsigned );
/**
* This fonction will compute the extraction parameter into pi_selection to go
bool b_dontwarn;
int i_nb_channels; /* number of float32 per sample */
- int pi_chan_table[AOUT_CHAN_MAX]; /* channel reordering */
+ uint8_t pi_chan_table[AOUT_CHAN_MAX]; /* channel reordering */
};
/*****************************************************************************
* Interleave: helper function to interleave channels
*****************************************************************************/
static void Interleave( sample_t * p_out, const sample_t * p_in,
- int i_nb_channels, int *pi_chan_table )
+ int i_nb_channels, uint8_t *pi_chan_table )
{
/* We do not only have to interleave, but also reorder the channels */
bool b_dontwarn;
int i_nb_channels; /* number of float32 per sample */
- int pi_chan_table[AOUT_CHAN_MAX]; /* channel reordering */
+ uint8_t pi_chan_table[AOUT_CHAN_MAX]; /* channel reordering */
};
/*****************************************************************************
* Interleave: helper function to interleave channels
*****************************************************************************/
static void Interleave( float * p_out, const float * p_in, int i_nb_channels,
- int *pi_chan_table )
+ uint8_t *pi_chan_table )
{
/* We do not only have to interleave, but also reorder the channels. */
int i_speaker_setup; /* Speaker setup override */
- bool b_chan_reorder; /* do we need channel reordering */
- int pi_chan_table[AOUT_CHAN_MAX];
+ uint8_t chans_to_reorder; /* do we need channel reordering */
+ uint8_t chan_table[AOUT_CHAN_MAX];
uint32_t i_channel_mask;
uint32_t i_bits_per_sample;
uint32_t i_channels;
p_aout->sys->i_frame_size = i_bytes_per_frame;
p_aout->sys->i_channel_mask = waveformat.dwChannelMask;
- p_aout->sys->b_chan_reorder =
+ p_aout->sys->chans_to_reorder =
aout_CheckChannelReorder( pi_channels_in, pi_channels_out,
waveformat.dwChannelMask,
- p_aout->sys->pi_chan_table );
-
- if( p_aout->sys->b_chan_reorder )
+ p_aout->sys->chan_table );
+ if( p_aout->sys->chans_to_reorder )
{
msg_Dbg( p_aout, "channel reordering needed" );
}
}
else
{
- if( p_sys->b_chan_reorder )
- {
+ if( p_sys->chans_to_reorder )
/* Do the channel reordering here */
aout_ChannelReorder( p_buffer->p_buffer, p_buffer->i_buffer,
- p_sys->i_channels, p_sys->pi_chan_table,
+ p_sys->chans_to_reorder, p_sys->chan_table,
p_sys->i_bits_per_sample );
- }
memcpy( p_write_position, p_buffer->p_buffer, l_bytes1 );
block_Release( p_buffer );
bool soft_mute;
};
- bool b_chan_reorder; /* do we need channel reordering */
- int pi_chan_table[AOUT_CHAN_MAX];
+ uint8_t chans_to_reorder; /* do we need channel reordering */
+ uint8_t chan_table[AOUT_CHAN_MAX];
};
#include "volume.h"
return VLC_EGENERIC;
}
- p_aout->sys->b_chan_reorder =
+ p_aout->sys->chans_to_reorder =
aout_CheckChannelReorder( pi_channels_in, pi_channels_out,
waveformat.dwChannelMask,
- p_aout->sys->pi_chan_table );
-
- if( p_aout->sys->b_chan_reorder )
- {
+ p_aout->sys->chan_table );
+ if( p_aout->sys->chans_to_reorder )
msg_Dbg( p_aout, "channel reordering needed" );
- }
return VLC_SUCCESS;
}
/* Do the channel reordering */
- if( p_buffer && p_sys->b_chan_reorder )
+ if( p_buffer && p_sys->chans_to_reorder )
{
aout_ChannelReorder( p_buffer->p_buffer,
p_buffer->i_buffer,
p_sys->waveformat.Format.nChannels,
- p_sys->pi_chan_table,
+ p_sys->chan_table,
p_sys->waveformat.Format.wBitsPerSample );
}
static int ProcessInitialHeader( decoder_t *p_dec, ogg_packet *p_oggpacket )
{
int err;
- int pi_chan_table[AOUT_CHAN_MAX];
unsigned char new_stream_map[8];
decoder_sys_t *p_sys = p_dec->p_sys;
static const uint32_t *pi_ch[6] = { pi_3channels_in, pi_4channels_in,
pi_5channels_in, pi_6channels_in,
pi_7channels_in, pi_8channels_in };
+ uint8_t pi_chan_table[AOUT_CHAN_MAX];
+
aout_CheckChannelReorder( pi_ch[p_header->channels-3], NULL,
p_dec->fmt_out.audio.i_physical_channels,
pi_chan_table );
/*
** Channel reordering
*/
- int pi_chan_table[AOUT_CHAN_MAX];
+ uint8_t pi_chan_table[AOUT_CHAN_MAX];
};
static const int pi_channels_maps[9] =
}
}
+ uint8_t tab[AOUT_CHAN_MAX];
if( b_decode )
aout_CheckChannelReorder( pi_channels_in, NULL,
- i_channel_mask, pi_chan_table );
+ i_channel_mask, tab );
else
aout_CheckChannelReorder( NULL, pi_channels_in,
- i_channel_mask, pi_chan_table );
+ i_channel_mask, tab );
+ for( int i = 0; i < i_channels; i++)
+ pi_chan_table[i] = tab[i];
}
/*****************************************************************************
date_t pts;
uint32_t i_channel_mask;
- bool b_chan_reorder; /* do we need channel reordering */
- int pi_chan_table[AOUT_CHAN_MAX];
+ uint8_t i_chans_to_reorder; /* do we need channel reordering */
+ uint8_t pi_chan_table[AOUT_CHAN_MAX];
};
static int ChunkFind( demux_t *, const char *, unsigned int * );
return VLC_ENOMEM;
p_sys->p_es = NULL;
- p_sys->b_chan_reorder = false;
+ p_sys->i_chans_to_reorder = 0;
p_sys->i_channel_mask = 0;
/* skip riff header */
if( p_sys->fmt.i_codec == VLC_FOURCC('a','r','a','w') ||
p_sys->fmt.i_codec == VLC_FOURCC('p','c','m',' ') ||
p_sys->fmt.i_codec == VLC_FOURCC('a','f','l','t') )
- p_sys->b_chan_reorder =
+ p_sys->i_chans_to_reorder =
aout_CheckChannelReorder( pi_channels_in, NULL,
p_sys->i_channel_mask,
p_sys->pi_chan_table );
- msg_Dbg( p_demux, "channel mask: %x, reordering: %i",
- p_sys->i_channel_mask, (int)p_sys->b_chan_reorder );
+ msg_Dbg( p_demux, "channel mask: %x, reordering: %u",
+ p_sys->i_channel_mask, p_sys->i_chans_to_reorder );
}
p_sys->fmt.audio.i_physical_channels =
es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block->i_pts );
/* Do the channel reordering */
- if( p_sys->b_chan_reorder )
+ if( p_sys->i_chans_to_reorder )
aout_ChannelReorder( p_block->p_buffer, p_block->i_buffer,
p_sys->fmt.audio.i_channels,
p_sys->pi_chan_table,
uint32_t waveheader2[2];
uint32_t i_channel_mask;
- bool b_chan_reorder; /* do we need channel reordering */
- int pi_chan_table[AOUT_CHAN_MAX];
+ uint8_t i_chans_to_reorder; /* do we need channel reordering */
+ uint8_t pi_chan_table[AOUT_CHAN_MAX];
};
static const uint32_t pi_channels_in[] =
p_sys->b_header = true;
p_sys->i_data = 0;
- p_sys->b_chan_reorder = 0;
+ p_sys->i_chans_to_reorder = 0;
return VLC_SUCCESS;
}
if( p_input->p_fmt->audio.i_physical_channels & pi_vlc_chan_order_wg4[i])
p_sys->i_channel_mask |= pi_channels_in[i];
- p_sys->b_chan_reorder =
+ p_sys->i_chans_to_reorder =
aout_CheckChannelReorder( pi_channels_in, pi_channels_out,
p_sys->i_channel_mask,
p_sys->pi_chan_table );
- msg_Dbg( p_mux, "channel mask: %x, reordering: %i",
- p_sys->i_channel_mask, (int)p_sys->b_chan_reorder );
+ msg_Dbg( p_mux, "channel mask: %x, reordering: %u",
+ p_sys->i_channel_mask, p_sys->i_chans_to_reorder );
}
fourcc_to_wf_tag( p_input->p_fmt->i_codec, &i_format );
p_sys->i_data += p_block->i_buffer;
/* Do the channel reordering */
- if( p_sys->b_chan_reorder )
+ if( p_sys->i_chans_to_reorder )
aout_ChannelReorder( p_block->p_buffer, p_block->i_buffer,
- p_input->p_fmt->audio.i_channels,
+ p_sys->i_chans_to_reorder,
p_sys->pi_chan_table,
p_input->p_fmt->audio.i_bitspersample );
*****************************************************************************/
unsigned aout_CheckChannelReorder( const uint32_t *chans_in,
const uint32_t *chans_out,
- uint32_t mask, int *restrict table )
+ uint32_t mask, uint8_t *restrict table )
{
unsigned channels = 0;
* aout_ChannelReorder :
*****************************************************************************/
void aout_ChannelReorder( void *ptr, size_t bytes, unsigned channels,
- const int *pi_chan_table, unsigned bits_per_sample )
+ const uint8_t *chans_table, unsigned bits_per_sample )
{
size_t samples = bytes / (channels * (bits_per_sample >> 3));
uint32_t tmp[AOUT_CHAN_MAX];
for( size_t j = 0; j < channels; j++ )
- tmp[pi_chan_table[j]] = buf[j];
+ tmp[chans_table[j]] = buf[j];
memcpy( buf, tmp, 4 * channels );
buf += channels;
uint16_t tmp[AOUT_CHAN_MAX];
for( size_t j = 0; j < channels; j++ )
- tmp[pi_chan_table[j]] = buf[j];
+ tmp[chans_table[j]] = buf[j];
memcpy( buf, tmp, 2 * channels );
buf += channels;
uint8_t tmp[AOUT_CHAN_MAX];
for( size_t j = 0; j < channels; j++ )
- tmp[pi_chan_table[j]] = buf[j];
+ tmp[chans_table[j]] = buf[j];
memcpy( buf, tmp, channels );
buf += channels;
uint8_t tmp[3 * AOUT_CHAN_MAX];
for( size_t j = 0; j < channels; j++ )
- memcpy( tmp + (3 * pi_chan_table[j]), buf + (3 * j), 3 );
+ memcpy( tmp + (3 * chans_table[j]), buf + (3 * j), 3 );
memcpy( buf, tmp, 3 * channels );
buf += 3 * channels;