diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-01-23 16:44:30 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-01-23 16:44:30 +0100 |
commit | 826188d27acdef6bf14edf018415e958f59ecfdd (patch) | |
tree | 09fd9e72118f51f60452f3b6ccb25af6cc1e9c0b /libavcodec/mlp_parser.c | |
parent | 86b892af199d420fe2bcf5f8fb96c377d924ad43 (diff) | |
parent | ed1b01131e662c9086b27aaaea69684d8575fbea (diff) | |
download | ffmpeg-826188d27acdef6bf14edf018415e958f59ecfdd.tar.gz |
Merge commit 'ed1b01131e662c9086b27aaaea69684d8575fbea'
* commit 'ed1b01131e662c9086b27aaaea69684d8575fbea':
mlp: implement support for AVCodecContext.request_channel_layout.
Conflicts:
libavcodec/mlpdec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
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 5393b6f01b..1831f64a4b 100644 --- a/libavcodec/mlp_parser.c +++ b/libavcodec/mlp_parser.c @@ -328,28 +328,45 @@ static int mlp_parse(AVCodecParserContext *s, if(!avctx->channels || !avctx->channel_layout) { 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; } } } |