Commit 86b892af authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'b0c7e3ff'

* commit 'b0c7e3ff':
  mlp_parser: account for AVCodecContext.request_channels when setting the channel layout.
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 1cf6f6f3 b0c7e3ff
......@@ -328,11 +328,23 @@ static int mlp_parse(AVCodecParserContext *s,
if(!avctx->channels || !avctx->channel_layout) {
if (mh.stream_type == 0xbb) {
/* MLP stream */
avctx->channels = mh.channels_mlp;
avctx->channel_layout = mh.channel_layout_mlp;
if (avctx->request_channels > 0 && avctx->request_channels <= 2 &&
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 (mh.channels_thd_stream2) {
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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment