[vlc-devel] [PATCH] Sets the output channel configuration when opening the decoder
Rafaël Carré
funman at videolan.org
Mon Apr 14 14:17:02 CEST 2008
From 5c1708b1486fcb01b0bdfb48528ff1fde01a44e6 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Rafa=C3=ABl=20Carr=C3=A9?= <funman at videolan.org>
Date: Mon, 14 Apr 2008 14:01:26 +0200
Subject: [PATCH] Sets the output channel configuration when opening the decoder
I would like to ask someone knowing the audio architecture.
A lot (so far I only noticed faad and ffmpeg) of decoders do not set
the physical channel configuration, and that breaks some filters such
as mono downmixer.
---
modules/codec/ffmpeg/audio.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/modules/codec/ffmpeg/audio.c b/modules/codec/ffmpeg/audio.c
index 0dad01b..1df1397 100644
--- a/modules/codec/ffmpeg/audio.c
+++ b/modules/codec/ffmpeg/audio.c
@@ -109,6 +109,18 @@ int E_(InitAudioDec)( decoder_t *p_dec,
AVCodecContext *p_context,
/* ***** Fill p_context with init values ***** */
p_sys->p_context->sample_rate = p_dec->fmt_in.audio.i_rate;
p_sys->p_context->channels = p_dec->fmt_in.audio.i_channels;
+ if( !p_dec->fmt_in.audio.i_physical_channels )
+ {
+ msg_Warn( p_dec, "Physical channel configuration not set : guessing" );
+ p_dec->fmt_in.audio.i_original_channels =
+ p_dec->fmt_in.audio.i_physical_channels =
+ pi_channels_maps[p_sys->p_context->channels];
+ }
+
+ p_dec->fmt_out.audio.i_physical_channels =
+ p_dec->fmt_out.audio.i_original_channels =
+ p_dec->fmt_in.audio.i_physical_channels;
+
p_sys->p_context->block_align = p_dec->fmt_in.audio.i_blockalign;
p_sys->p_context->bit_rate = p_dec->fmt_in.i_bitrate;
p_sys->p_context->bits_per_sample = p_dec->fmt_in.audio.i_bitspersample;
--
1.5.4.3
--
Rafaël Carré
More information about the vlc-devel
mailing list