aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2008-01-05 16:45:25 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2008-01-05 16:45:25 +0000
commitdc7009ea1bca3f1a2efe5722e445c153956f6e05 (patch)
tree75a619d930f7e83f4cda4e90fd93f72cc9550f8c
parent2816d32310a85e809f631a871865074b835c56d4 (diff)
downloadffmpeg-dc7009ea1bca3f1a2efe5722e445c153956f6e05.tar.gz
use request_channels in liba52 decoder
Originally committed as revision 11417 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/liba52.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/libavcodec/liba52.c b/libavcodec/liba52.c
index 68147a125e..d8065ef14c 100644
--- a/libavcodec/liba52.c
+++ b/libavcodec/liba52.c
@@ -117,6 +117,13 @@ static int a52_decode_init(AVCodecContext *avctx)
s->inbuf_ptr = s->inbuf;
s->frame_size = 0;
+ /* 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;
}
@@ -179,12 +186,11 @@ static int a52_decode_frame(AVCodecContext *avctx,
s->channels = ac3_channels[s->flags & 7];
if (s->flags & A52_LFE)
s->channels++;
- if (avctx->channels == 0)
- /* No specific number of channel requested */
- avctx->channels = s->channels;
- else if (s->channels < avctx->channels) {
- av_log(avctx, AV_LOG_ERROR, "ac3dec: AC3 Source channels are less than specified: output to %d channels.. (frmsize: %d)\n", s->channels, len);
avctx->channels = s->channels;
+ if (avctx->request_channels > 0 &&
+ avctx->request_channels <= 2 &&
+ avctx->request_channels < s->channels) {
+ avctx->channels = avctx->request_channels;
}
avctx->bit_rate = bit_rate;
}