diff options
author | Tim Walker <tdskywalker@gmail.com> | 2012-12-31 15:33:27 +0100 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2013-01-22 16:10:02 -0500 |
commit | ed1b01131e662c9086b27aaaea69684d8575fbea (patch) | |
tree | 0f628ceb968766ac02ddda422aeb2cdeaa92d6c2 /libavcodec/mlp_parser.c | |
parent | b0c7e3ffd09f68022429920da483ad7abed84aa1 (diff) | |
download | ffmpeg-ed1b01131e662c9086b27aaaea69684d8575fbea.tar.gz |
mlp: implement support for AVCodecContext.request_channel_layout.
Also wrap usage of AVCodecContext.request_channels in FF_API_REQUEST_CHANNELS directives.
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
Diffstat (limited to 'libavcodec/mlp_parser.c')
-rw-r--r-- | libavcodec/mlp_parser.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c index 8c57840bd8..7f6739fabf 100644 --- a/libavcodec/mlp_parser.c +++ b/libavcodec/mlp_parser.c @@ -322,28 +322,45 @@ static int mlp_parse(AVCodecParserContext *s, if (mh.stream_type == 0xbb) { /* MLP stream */ +#if FF_API_REQUEST_CHANNELS if (avctx->request_channels > 0 && avctx->request_channels <= 2 && mh.num_substreams > 1) { avctx->channels = 2; avctx->channel_layout = AV_CH_LAYOUT_STEREO; + } else +#endif + if (avctx->request_channel_layout == AV_CH_LAYOUT_STEREO && + mh.num_substreams > 1) { + avctx->channels = 2; + avctx->channel_layout = AV_CH_LAYOUT_STEREO; } else { avctx->channels = mh.channels_mlp; avctx->channel_layout = mh.channel_layout_mlp; } } else { /* mh.stream_type == 0xba */ /* TrueHD stream */ +#if FF_API_REQUEST_CHANNELS if (avctx->request_channels > 0 && avctx->request_channels <= 2 && mh.num_substreams > 1) { avctx->channels = 2; avctx->channel_layout = AV_CH_LAYOUT_STEREO; - } else if (mh.channels_thd_stream2 && - (avctx->request_channels <= 0 || - avctx->request_channels > mh.channels_thd_stream1)) { - avctx->channels = mh.channels_thd_stream2; - avctx->channel_layout = mh.channel_layout_thd_stream2; - } else { + } else if (avctx->request_channels > 0 && + avctx->request_channels <= mh.channels_thd_stream1) { + avctx->channels = mh.channels_thd_stream1; + avctx->channel_layout = mh.channel_layout_thd_stream1; + } else +#endif + if (avctx->request_channel_layout == AV_CH_LAYOUT_STEREO && + mh.num_substreams > 1) { + avctx->channels = 2; + avctx->channel_layout = AV_CH_LAYOUT_STEREO; + } else if (avctx->request_channel_layout == mh.channel_layout_thd_stream1 || + !mh.channels_thd_stream2) { avctx->channels = mh.channels_thd_stream1; avctx->channel_layout = mh.channel_layout_thd_stream1; + } else { + avctx->channels = mh.channels_thd_stream2; + avctx->channel_layout = mh.channel_layout_thd_stream2; } } |