Based on patches by Carl Eugen Hoyos and Hendrik Leppkes (FFmpeg commits 6daf513cf24a99ddddb7e748fc150f37bcd323f3, b9d8af03270223202c9a991655d3f75b5a8b56b5, 1af0ace3a4b8aa8c6240a99de3c40f495ab279e9).
Fixes the following samples (channel names are spoken in libavcodec order): AV_CH_LAYOUT_6POINT1 http://dl.dropbox.com/u/37259775/audio/truehd/truehd-6point1a.png http://dl.dropbox.com/u/37259775/audio/truehd/truehd-6point1a.mka http://dl.dropbox.com/u/37259775/audio/truehd/truehd-6point1a-broken.pdf http://dl.dropbox.com/u/37259775/audio/truehd/truehd-6point1a-fixed.pdf AV_CH_LAYOUT_6POINT1|AV_CH_TOP_CENTER http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1f.png http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1f.mka http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1f-broken.pdf http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1f-fixed.pdf AV_CH_LAYOUT_6POINT1|AV_CH_TOP_FRONT_CENTER http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1g.png http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1g.mka http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1g-broken.pdf http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1g-fixed.pdf AV_CH_LAYOUT_7POINT1 http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1a.png http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1a.mka http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1a-broken.pdf http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1a-fixed.pdf AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1b.png http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1b.mka http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1b-broken.pdf http://dl.dropbox.com/u/37259775/audio/truehd/truehd-7point1b-fixed.pdf --- libavcodec/mlpdec.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) 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)) -- 1.7.5.4 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
