---
Example:

request_channel_layout: 3.1 (L, R, C, LFE)
substream  0:           2.0 (L, R)
substreams 0+1:         5.1 (L, R, C, LFE, SL, SR)
substreams 0+1+2:       7.1 (L, R, C, LFE, BL, BR, SL, SR)

3.1 is a subset of 5.1; before, substreams 0, 1 and 2 would get
decoded, whereas now we stop decoding after substreams 0 and 1.

 libavcodec/mlp_parser.c | 5 +++--
 libavcodec/mlpdec.c     | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index 8766bd0..a30cd05 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -362,8 +362,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
                 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) {
+            } else if (!mh.channels_thd_stream2 ||
+                       (mh.channel_layout_thd_stream1 & 
avctx->request_channel_layout) ==
+                       avctx->request_channel_layout) {
                 avctx->channels       = mh.channels_thd_stream1;
                 avctx->channel_layout = mh.channel_layout_thd_stream1;
             } else {
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 76ce4c4..d8a76f5 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -504,8 +504,8 @@ FF_DISABLE_DEPRECATION_WARNINGS
     } else
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
-    if (m->avctx->request_channel_layout == s->ch_layout &&
-        m->max_decoded_substream > substr) {
+    if ((s->ch_layout & m->avctx->request_channel_layout) ==
+        m->avctx->request_channel_layout && m->max_decoded_substream > substr) 
{
         av_log(m->avctx, AV_LOG_DEBUG,
                "Extracting %d-channel downmix (0x%"PRIx64") from substream %d. 
"
                "Further substreams will be skipped.\n",
-- 
1.8.3.4 (Apple Git-47)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to