Commit 2090fd53 authored by Thomas Guillem's avatar Thomas Guillem

avcodec/audio: move DUALMONO hack in avcodec

aout_CheckChannelExtraction() is only used by avcodec.
parent cd95e411
......@@ -607,6 +607,16 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
if( i_channels_src != p_sys->p_context->channels && b_trust )
msg_Err( p_dec, "Channel layout not understood" );
bool dual_mono = false;
/* Detect special dual mono case */
if( i_channels_src == 2 && pi_order_src[0] == AOUT_CHAN_CENTER
&& pi_order_src[1] == AOUT_CHAN_CENTER )
{
dual_mono = true;
pi_order_src[0] = AOUT_CHAN_LEFT;
pi_order_src[1] = AOUT_CHAN_RIGHT;
}
uint32_t i_layout_dst;
int i_channels_dst;
p_sys->b_extract = aout_CheckChannelExtraction( p_sys->pi_extraction,
......@@ -617,6 +627,8 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
p_dec->fmt_out.audio.i_physical_channels =
p_dec->fmt_out.audio.i_original_channels = i_layout_dst;
if (dual_mono)
p_dec->fmt_out.audio.i_original_channels |= AOUT_CHAN_DUALMONO;
}
else
{
......
......@@ -461,7 +461,6 @@ bool aout_CheckChannelExtraction( int *pi_selection,
static_assert(AOUT_CHAN_MAX <= (sizeof (*pi_order_dst) * CHAR_BIT),
"Missing bits");
const uint32_t pi_order_dual_mono[] = { AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT };
uint32_t i_layout = 0;
int i_out = 0;
int pi_index[AOUT_CHAN_MAX];
......@@ -470,14 +469,6 @@ bool aout_CheckChannelExtraction( int *pi_selection,
if( !pi_order_dst )
pi_order_dst = pi_vlc_chan_order_wg4;
/* Detect special dual mono case */
if( i_channels == 2 &&
pi_order_src[0] == AOUT_CHAN_CENTER && pi_order_src[1] == AOUT_CHAN_CENTER )
{
i_layout |= AOUT_CHAN_DUALMONO;
pi_order_src = pi_order_dual_mono;
}
/* */
for( int i = 0; i < i_channels; i++ )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment