changeset 1987:d9e067853051 libavcodec

>2 channels decoding fix
author michael
date Thu, 29 Apr 2004 03:33:34 +0000
parents c8e866f4515f
children b5753525f9a8
files parser.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/parser.c	Tue Apr 27 13:50:41 2004 +0000
+++ b/parser.c	Thu Apr 29 03:33:34 2004 +0000
@@ -877,9 +877,12 @@
 		    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;
                 }