From b1ec601f7f4d7fd5ae4a17b6efb4471b67c7ee06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Thu, 23 Aug 2007 20:28:28 +0000 Subject: [PATCH] Add request_channels member to AVCodecContext so we now have a proper way to tell the decoder how many output channels we would like. Originally committed as revision 10199 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/avcodec.h | 11 +++++++++-- libavcodec/dca.c | 1 + libavcodec/utils.c | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 67d8985c08..11d78b55f3 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -33,8 +33,8 @@ #define AV_STRINGIFY(s) AV_TOSTRING(s) #define AV_TOSTRING(s) #s -#define LIBAVCODEC_VERSION_INT ((51<<16)+(41<<8)+0) -#define LIBAVCODEC_VERSION 51.41.0 +#define LIBAVCODEC_VERSION_INT ((51<<16)+(42<<8)+0) +#define LIBAVCODEC_VERSION 51.42.0 #define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT #define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) @@ -2123,6 +2123,13 @@ typedef struct AVCodecContext { * - decoding: unused */ int64_t timecode_frame_start; + + /** + * Decoder should decode to this many channels if it can (0 for default) + * - encoding: unused + * - decoding: Set by user. + */ + int request_channels; } AVCodecContext; /** diff --git a/libavcodec/dca.c b/libavcodec/dca.c index d9bf03a58e..0426693d43 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -1158,6 +1158,7 @@ static int dca_decode_frame(AVCodecContext * avctx, avctx->bit_rate = s->bit_rate; channels = s->prim_channels + !!s->lfe; + avctx->channels = avctx->request_channels; if(avctx->channels == 0) { avctx->channels = channels; } else if(channels < avctx->channels) { diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 3b194899b3..9ca8a2d38e 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -753,6 +753,7 @@ static const AVOption options[]={ {"timecode_frame_start", "GOP timecode frame start number, in non drop frame format", OFFSET(timecode_frame_start), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|E}, {"drop_frame_timecode", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_DROP_FRAME_TIMECODE, INT_MIN, INT_MAX, V|E, "flags2"}, {"non_linear_q", "use non linear quantizer", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_NON_LINEAR_QUANT, INT_MIN, INT_MAX, V|E, "flags2"}, +{"request_channels", "set desired number of audio channels", OFFSET(request_channels), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|D}, {NULL}, };