[FFmpeg-devel] [RFC]TrueHD 7.1

Carl Eugen Hoyos cehoyos at ag.or.at
Sat Apr 2 02:42:31 CEST 2011


Afaik, we currently only have two kinds of TrueHD samples: 5.1 and 7.1.
5.1 samples work fine while 7.1 samples have side and back channels swapped.

Attached patch is a possible work-around, I do not understand the mlp code 
good enough to implement anything better. It at least has the advantage not to 
break mlp (further) because mlp (or at least the FFmpeg mlp decoder) does not 
support more than six channels.

Any suggestions?

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index a655b3d..ce90591 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -435,6 +435,10 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
         s->ch_assign[ch_assign] = ch;
+    if (m->avctx->channel_layout == AV_CH_LAYOUT_7POINT1) {
+        FFSWAP(int, s->ch_assign[4], s->ch_assign[6]);
+        FFSWAP(int, s->ch_assign[5], s->ch_assign[7]);
+    }
     checksum = ff_mlp_restart_checksum(buf, get_bits_count(gbp) - start_count);

More information about the ffmpeg-devel mailing list