diff options
author | foo86 <foobaz86@gmail.com> | 2015-12-07 18:47:47 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-12-08 03:37:04 +0100 |
commit | 704654ea170c158419ded9591d8fb9895aca32be (patch) | |
tree | e5a993817dde99288c88a79541fbe2ed1fea54ba /libavcodec/libdcadec.c | |
parent | 97795ba6c3a58fe1b72fedcf9c65c99fb0725b9c (diff) | |
download | ffmpeg-704654ea170c158419ded9591d8fb9895aca32be.tar.gz |
avcodec/libdcadec: fix request_channel_layout
Take request_channel_layout as a hint and don't force 2.0 downmix by
using both the 2CH and 6CH flags together.
Remove warnings about missing coefficients because they are no longer
relevant.
Honor AV_CH_LAYOUT_NATIVE and make it possible for native DTS channel
layout to be output.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/libdcadec.c')
-rw-r--r-- | libavcodec/libdcadec.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c index e8020762ba..6166c9d2af 100644 --- a/libavcodec/libdcadec.c +++ b/libavcodec/libdcadec.c @@ -34,7 +34,6 @@ typedef struct DCADecContext { struct dcadec_context *ctx; uint8_t *buffer; int buffer_size; - int downmix_warned; } DCADecContext; static int dcadec_decode_frame(AVCodecContext *avctx, void *data, @@ -134,17 +133,6 @@ static int dcadec_decode_frame(AVCodecContext *avctx, void *data, if (exss = dcadec_context_get_exss_info(s->ctx)) { enum AVMatrixEncoding matrix_encoding = AV_MATRIX_ENCODING_NONE; - if (!s->downmix_warned) { - uint64_t layout = avctx->request_channel_layout; - - if (((layout == AV_CH_LAYOUT_STEREO_DOWNMIX || layout == AV_CH_LAYOUT_STEREO) && !exss->embedded_stereo) || - ( layout == AV_CH_LAYOUT_5POINT1 && !exss->embedded_6ch)) - av_log(avctx, AV_LOG_WARNING, "%s downmix was requested but no custom coefficients are available, " - "this may result in clipping\n", - layout == AV_CH_LAYOUT_5POINT1 ? "5.1" : "Stereo"); - s->downmix_warned = 1; - } - switch(exss->matrix_encoding) { case DCADEC_MATRIX_ENCODING_SURROUND: matrix_encoding = AV_MATRIX_ENCODING_DOLBY; @@ -209,21 +197,18 @@ static av_cold int dcadec_init(AVCodecContext *avctx) if (avctx->flags & AV_CODEC_FLAG_BITEXACT) flags |= DCADEC_FLAG_CORE_BIT_EXACT; - if (avctx->request_channel_layout > 0 && avctx->request_channel_layout != AV_CH_LAYOUT_NATIVE) { + if (avctx->request_channel_layout) { switch (avctx->request_channel_layout) { case AV_CH_LAYOUT_STEREO: case AV_CH_LAYOUT_STEREO_DOWNMIX: - /* libdcadec ignores the 2ch flag if used alone when no custom downmix coefficients - are available, silently outputting a 5.1 downmix if possible instead. - Using both the 2ch and 6ch flags together forces a 2ch downmix using default - coefficients in such cases. This matches the behavior of the 6ch flag when used - alone, where a 5.1 downmix is generated if possible, regardless of custom - coefficients being available or not. */ - flags |= DCADEC_FLAG_KEEP_DMIX_2CH | DCADEC_FLAG_KEEP_DMIX_6CH; + flags |= DCADEC_FLAG_KEEP_DMIX_2CH; break; case AV_CH_LAYOUT_5POINT1: flags |= DCADEC_FLAG_KEEP_DMIX_6CH; break; + case AV_CH_LAYOUT_NATIVE: + flags |= DCADEC_FLAG_NATIVE_LAYOUT; + break; default: av_log(avctx, AV_LOG_WARNING, "Invalid request_channel_layout\n"); break; |