summaryrefslogtreecommitdiffstats
path: root/contrib/ffmpeg/A02-channel-layout-order.patch
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ffmpeg/A02-channel-layout-order.patch')
-rw-r--r--contrib/ffmpeg/A02-channel-layout-order.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/contrib/ffmpeg/A02-channel-layout-order.patch b/contrib/ffmpeg/A02-channel-layout-order.patch
new file mode 100644
index 000000000..2326e7d3e
--- /dev/null
+++ b/contrib/ffmpeg/A02-channel-layout-order.patch
@@ -0,0 +1,41 @@
+diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
+index 91efaf3..e6c5c8e 100644
+--- a/libavcodec/mlpdec.c
++++ b/libavcodec/mlpdec.c
+@@ -30,6 +30,7 @@
+ #include "dsputil.h"
+ #include "libavutil/intreadwrite.h"
+ #include "get_bits.h"
++#include "libavutil/audioconvert.h"
+ #include "libavutil/crc.h"
+ #include "parser.h"
+ #include "mlp_parser.h"
+@@ -434,6 +435,28 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
+ s->ch_assign[ch_assign] = ch;
+ }
+
++ if (m->avctx->codec_id == CODEC_ID_TRUEHD) {
++ switch (m->avctx->channel_layout) {
++ case AV_CH_LAYOUT_6POINT1:
++ case (AV_CH_LAYOUT_6POINT1|AV_CH_TOP_CENTER):
++ case (AV_CH_LAYOUT_6POINT1|AV_CH_TOP_FRONT_CENTER):
++ {
++ int i = s->ch_assign[6];
++ s->ch_assign[6] = s->ch_assign[5];
++ s->ch_assign[5] = s->ch_assign[4];
++ s->ch_assign[4] = i;
++ break;
++ }
++ case AV_CH_LAYOUT_7POINT1:
++ case (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER):
++ FFSWAP(int, s->ch_assign[4], s->ch_assign[6]);
++ FFSWAP(int, s->ch_assign[5], s->ch_assign[7]);
++ break;
++ default:
++ break;
++ }
++ }
++
+ checksum = ff_mlp_restart_checksum(buf, get_bits_count(gbp) - start_count);
+
+ if (checksum != get_bits(gbp, 8))