summaryrefslogtreecommitdiff
path: root/libavcodec/mlp_parser.c
diff options
context:
space:
mode:
authorTim Walker <tdskywalker@gmail.com>2014-02-08 17:21:14 +0000
committerTim Walker <tdskywalker@gmail.com>2014-02-08 20:10:51 +0100
commitc1e7de8f62c7fd71e23d62969a618f042059381f (patch)
tree8ab0b85edb94f647523ab99a04a39d795911f998 /libavcodec/mlp_parser.c
parentf90a4bfc43c9192e89d9b4c81d80789cd9b38a2f (diff)
mlp_parser: fix request_channel_layout behavior.
When request_channel_layout is 0, all substreams should be decoded. Thanks to Michael Niedermayer for spotting. Also fix a mismatch between the parser and decoder when request_channel_layout is a subset of Stereo.
Diffstat (limited to 'libavcodec/mlp_parser.c')
-rw-r--r--libavcodec/mlp_parser.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index a30cd05dc5..075227f302 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -335,7 +335,9 @@ FF_DISABLE_DEPRECATION_WARNINGS
} else
FF_ENABLE_DEPRECATION_WARNINGS
#endif
- if (avctx->request_channel_layout == AV_CH_LAYOUT_STEREO &&
+ if (avctx->request_channel_layout &&
+ (avctx->request_channel_layout & AV_CH_LAYOUT_STEREO) ==
+ avctx->request_channel_layout &&
mh.num_substreams > 1) {
avctx->channels = 2;
avctx->channel_layout = AV_CH_LAYOUT_STEREO;
@@ -358,13 +360,16 @@ FF_DISABLE_DEPRECATION_WARNINGS
} else
FF_ENABLE_DEPRECATION_WARNINGS
#endif
- if (avctx->request_channel_layout == AV_CH_LAYOUT_STEREO &&
- mh.num_substreams > 1) {
+ if (avctx->request_channel_layout &&
+ (avctx->request_channel_layout & AV_CH_LAYOUT_STEREO) ==
+ avctx->request_channel_layout &&
+ mh.num_substreams > 1) {
avctx->channels = 2;
avctx->channel_layout = AV_CH_LAYOUT_STEREO;
} else if (!mh.channels_thd_stream2 ||
- (mh.channel_layout_thd_stream1 & avctx->request_channel_layout) ==
- avctx->request_channel_layout) {
+ (avctx->request_channel_layout &&
+ (avctx->request_channel_layout & mh.channel_layout_thd_stream1) ==
+ avctx->request_channel_layout)) {
avctx->channels = mh.channels_thd_stream1;
avctx->channel_layout = mh.channel_layout_thd_stream1;
} else {