[FFmpeg-devel] [PATCH 4/6] lavc/mlpdec: reset layout when channels change.

Nicolas George nicolas.george at normalesup.org
Wed Nov 28 16:14:19 CET 2012


Triggered by the sample for trac ticket #1726.

Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavcodec/mlpdec.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


Note: it would be better to actually find the correct channel layout, but I
do not know how truehd works, nor do I have any references on it.

Leaving an invalid channel layout is just wrong; setting it to 0 is better
than nothing; setting the correct layout can come later.


diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index d587982..6947fd4 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -523,8 +523,11 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
         cp->huff_lsbs        = 24;
     }
 
-    if (substr == m->max_decoded_substream)
+    if (substr == m->max_decoded_substream &&
+        m->avctx->channels != s->max_matrix_channel + 1) {
         m->avctx->channels = s->max_matrix_channel + 1;
+        m->avctx->channel_layout = 0;
+    }
 
     return 0;
 }
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list