[vlc-commits] avcodec/audio: move DUALMONO hack in avcodec
Thomas Guillem
git at videolan.org
Thu Jul 13 17:19:49 CEST 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jun 28 16:00:55 2017 +0200| [2090fd53291928dedf2b140768d036c6ceee2032] | committer: Thomas Guillem
avcodec/audio: move DUALMONO hack in avcodec
aout_CheckChannelExtraction() is only used by avcodec.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2090fd53291928dedf2b140768d036c6ceee2032
---
modules/codec/avcodec/audio.c | 12 ++++++++++++
src/audio_output/common.c | 9 ---------
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index 2d751273f7..ea568f9dc7 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -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
{
diff --git a/src/audio_output/common.c b/src/audio_output/common.c
index 47f4836d99..bba122d758 100644
--- a/src/audio_output/common.c
+++ b/src/audio_output/common.c
@@ -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++ )
{
More information about the vlc-commits
mailing list