aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/parser.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-04-29 03:33:34 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-04-29 03:33:34 +0000
commit20da31792b1988d2f21f4c14548333405cd9c37d (patch)
treeae7afc233fb554476d31856eabc18ec419f388fe /libavcodec/parser.c
parent8aedc51d2b568b7d0f11aa9d9ff2437b13ebb3fb (diff)
downloadffmpeg-20da31792b1988d2f21f4c14548333405cd9c37d.tar.gz
>2 channels decoding fix
Originally committed as revision 3086 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/parser.c')
-rw-r--r--libavcodec/parser.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 027e0b9bf8..851bac3be2 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -877,9 +877,12 @@ static int ac3_parse(AVCodecParserContext *s1,
s->frame_size = len;
/* update codec info */
avctx->sample_rate = sample_rate;
- avctx->channels = ac3_channels[s->flags & 7];
- if (s->flags & A52_LFE)
- avctx->channels++;
+ /* set channels,except if the user explicitly requests 1 or 2 channels, XXX/FIXME this is a bit ugly */
+ if(avctx->channels!=1 && avctx->channels!=2){
+ avctx->channels = ac3_channels[s->flags & 7];
+ if (s->flags & A52_LFE)
+ avctx->channels++;
+ }
avctx->bit_rate = bit_rate;
avctx->frame_size = 6 * 256;
}