diff options
author | Rodeo <[email protected]> | 2013-02-05 18:03:07 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2013-02-05 18:03:07 +0000 |
commit | e27e9541fe7db0dcc6bb15861912a8bd813c8f90 (patch) | |
tree | 6843003f03a8302a52c8afaa5128c00d01c104de /contrib/ffmpeg | |
parent | 5ca5ec3e6f4ebb47e92984a4ef859510df56b537 (diff) |
Set AVCodecContext.request_channel_layout when decoding.
Allows extracting a 5.1 or 2-channel downmix from a dedicated substream (TrueHD).
Also works around a bug when decoding TrueHD Mono.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5242 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'contrib/ffmpeg')
-rw-r--r-- | contrib/ffmpeg/A05-truehd-downmix.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/contrib/ffmpeg/A05-truehd-downmix.patch b/contrib/ffmpeg/A05-truehd-downmix.patch new file mode 100644 index 000000000..35344613f --- /dev/null +++ b/contrib/ffmpeg/A05-truehd-downmix.patch @@ -0,0 +1,46 @@ +diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c +index 3852f6e..86aecf7 100644 +--- a/libavcodec/mlpdec.c ++++ b/libavcodec/mlpdec.c +@@ -394,14 +394,24 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, + return AVERROR_INVALIDDATA; + } + +- if (m->avctx->request_channels > 0 +- && s->max_channel + 1 >= m->avctx->request_channels +- && substr < m->max_decoded_substream) { ++#if FF_API_REQUEST_CHANNELS ++ if (m->avctx->request_channels > 0 && ++ m->avctx->request_channels <= s->max_channel + 1 && ++ m->max_decoded_substream > substr) { + av_log(m->avctx, AV_LOG_DEBUG, +- "Extracting %d channel downmix from substream %d. " ++ "Extracting %d-channel downmix from substream %d. " + "Further substreams will be skipped.\n", + s->max_channel + 1, substr); + m->max_decoded_substream = substr; ++ } else ++#endif ++ if (m->avctx->request_channel_layout == s->ch_layout && ++ m->max_decoded_substream > substr) { ++ av_log(m->avctx, AV_LOG_DEBUG, ++ "Extracting %d-channel downmix (0x%"PRIx64") from substream %d. " ++ "Further substreams will be skipped.\n", ++ s->max_channel + 1, s->ch_layout, substr); ++ m->max_decoded_substream = substr; + } + + s->noise_shift = get_bits(gbp, 4); +@@ -463,8 +473,10 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, + cp->huff_lsbs = 24; + } + +- if (substr == m->max_decoded_substream) +- m->avctx->channels = s->max_matrix_channel + 1; ++ if (substr == m->max_decoded_substream) { ++ m->avctx->channels = s->max_matrix_channel + 1; ++ m->avctx->channel_layout = s->ch_layout; ++ } + + return 0; + } |