summaryrefslogtreecommitdiff
path: root/libavcodec/ac3dec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2008-01-05 15:22:53 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2008-01-05 15:22:53 +0000
commit95283c17011f7277e4ce73526f61889c3d446e4c (patch)
treec212089c3e52e9082aee2c4f37c275ea8c1b7eb3 /libavcodec/ac3dec.c
parent6cd325c1064c80f47b596f3b2bea24f227b198f2 (diff)
check for request_channels at codec init
Originally committed as revision 11415 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r--libavcodec/ac3dec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 5c09a2e40d..314eaa0624 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -312,6 +312,13 @@ static int ac3_decode_init(AVCodecContext *avctx)
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;
}