changeset 6112:1e77145f9c74 libavcodec

check for request_channels at codec init
author jbr
date Sat, 05 Jan 2008 15:22:53 +0000
parents ed3937d4f2aa
children 5e7585cd5fd3
files ac3dec.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ac3dec.c	Sat Jan 05 15:18:15 2008 +0000
+++ b/ac3dec.c	Sat Jan 05 15:22:53 2008 +0000
@@ -312,6 +312,13 @@
         s->mul_bias = 32767.0f;
     }
 
+    /* allow downmixing to stereo or mono */
+    if (avctx->channels > 0 && avctx->request_channels > 0 &&
+            avctx->request_channels < avctx->channels &&
+            avctx->request_channels <= 2) {
+        avctx->channels = avctx->request_channels;
+    }
+
     return 0;
 }