Skip to content

Commit

Permalink
mlpdec: support TrueHD streams with an Atmos substream
Browse files Browse the repository at this point in the history
The fourth substream is being discarded, since its not raw audio data,
but an encoded Atmos stream which needs a specialized decoder.

Fixes decoding of the true hd stream from Transformers\ -\ Age\ of\ Extinction\ 2014\ 1080P-003.mkv

Signed-off-by: Michael Niedermayer <[email protected]>
  • Loading branch information
Nevcairiel authored and fritsch committed Sep 21, 2014
1 parent bb8573a commit 26a3740
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libavcodec/mlp.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
/** Maximum number of substreams that can be decoded.
* MLP's limit is 2. TrueHD supports at least up to 3.
*/
#define MAX_SUBSTREAMS 3
#define MAX_SUBSTREAMS 4

/** which multiple of 48000 the maximum sample rate is */
#define MAX_RATEFACTOR 4
Expand Down
4 changes: 3 additions & 1 deletion libavcodec/mlpdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,9 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
m->access_unit_size_pow2 = mh.access_unit_size_pow2;

m->num_substreams = mh.num_substreams;
m->max_decoded_substream = m->num_substreams - 1;

/* limit to decoding 3 substreams, as the 4th is used by Dolby Atmos for non-audio data */
m->max_decoded_substream = FFMIN(m->num_substreams - 1, 2);

m->avctx->sample_rate = mh.group1_samplerate;
m->avctx->frame_size = mh.access_unit_size;
Expand Down

0 comments on commit 26a3740

Please sign in to comment.