From f7813a5324be39d13ab536c245d15dfc602a7849 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sun, 29 Dec 2013 12:19:38 +0000 Subject: basic type mechanism working --- ffmpeg/libavcodec/aac_ac3_parser.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'ffmpeg/libavcodec/aac_ac3_parser.c') diff --git a/ffmpeg/libavcodec/aac_ac3_parser.c b/ffmpeg/libavcodec/aac_ac3_parser.c index 6f1e188..7fefda5 100644 --- a/ffmpeg/libavcodec/aac_ac3_parser.c +++ b/ffmpeg/libavcodec/aac_ac3_parser.c @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/channel_layout.h" #include "libavutil/common.h" #include "parser.h" #include "aac_ac3_parser.h" @@ -82,14 +83,23 @@ get_next: if (avctx->codec_id != AV_CODEC_ID_AAC) { avctx->sample_rate = s->sample_rate; - /* allow downmixing to stereo (or mono for AC-3) */ - if(avctx->request_channels > 0 && - avctx->request_channels < s->channels && - (avctx->request_channels <= 2 || - (avctx->request_channels == 1 && - (avctx->codec_id == AV_CODEC_ID_AC3 || - avctx->codec_id == AV_CODEC_ID_EAC3)))) { - avctx->channels = avctx->request_channels; + /* (E-)AC-3: allow downmixing to stereo or mono */ +#if FF_API_REQUEST_CHANNELS +FF_DISABLE_DEPRECATION_WARNINGS + if (avctx->request_channels == 1) + avctx->request_channel_layout = AV_CH_LAYOUT_MONO; + else if (avctx->request_channels == 2) + avctx->request_channel_layout = AV_CH_LAYOUT_STEREO; +FF_ENABLE_DEPRECATION_WARNINGS +#endif + if (s->channels > 1 && + avctx->request_channel_layout == AV_CH_LAYOUT_MONO) { + avctx->channels = 1; + avctx->channel_layout = AV_CH_LAYOUT_MONO; + } else if (s->channels > 2 && + avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) { + avctx->channels = 2; + avctx->channel_layout = AV_CH_LAYOUT_STEREO; } else { avctx->channels = s->channels; avctx->channel_layout = s->channel_layout; -- cgit v1.2.3