]> git.sesse.net Git - ffmpeg/commitdiff
>2 channels decoding fix
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 29 Apr 2004 03:33:34 +0000 (03:33 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 29 Apr 2004 03:33:34 +0000 (03:33 +0000)
Originally committed as revision 3086 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/parser.c

index 027e0b9bf8805b511ad1e8988a8c3627d736da59..851bac3be2b834a1cdbb5e97d7e5a718a7f86d28 100644 (file)
@@ -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;
                 }