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

Nicolas George nicolas.george at normalesup.org
Sun Dec 2 18:57:49 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(-)


As I said the first time: it would be better if someone who knows TrueHD
had a look at it to find the correct channel layout, but in the meantime
it is better to fix it partially that leaving it invalid.


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