diff options
author | Rodeo <[email protected]> | 2011-09-09 02:37:16 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2011-09-09 02:37:16 +0000 |
commit | a25b6621a54eef55fffbfe9d2cfb4987327e3434 (patch) | |
tree | e067d9e73f6a1775acd9d9e73f78691b0547bb1a /libhb/decavcodec.c | |
parent | c3c4a5b9ed6baa30f35d5701148b2a755b98817f (diff) |
libhb: work around the lack of 6.1 support for DTS sources
libhb doesn't support 6.1 sources and assumes they're 7.0 instead. This breaks downmixing.
Libav can decode the DTS-ES 6.1 core of DTS-HD 6.1 audio tracks; tell it to not process the additional channel so that such tracks can be re-encoded correctly.
See https://reviews.handbrake.fr/r/200/ for more information.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4209 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/decavcodec.c')
-rw-r--r-- | libhb/decavcodec.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index f67850d86..4d62c0274 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -203,6 +203,24 @@ static int decavcodecaInit( hb_work_object_t * w, hb_job_t * job ) return 1; } + // DTS: work around lack of 6.1 support in libhb + if( hb_ff_dts_request_5point1( pv->context ) ) + { + hb_deep_log( 2, "decavcodecaInit: found DTS-ES 6.1, requesting 5.1 core" ); + } + else if( ( !pv->context->channels || !pv->context->channel_layout ) && + ( w->audio->config.in.codec == HB_ACODEC_DCA_HD ) && + ( w->audio->config.in.channel_layout == ( HB_INPUT_CH_LAYOUT_3F2R|HB_INPUT_CH_LAYOUT_HAS_LFE ) ) ) + { + /* XXX: when we are demuxing the stream ourselves, it seems we have no + * channel count/layout info in the context until we decode audio for + * the first time. If the scan info says the source is DTS-HD 5.1, + * make sure XCh processing is disabled in Libav before decoding. */ + pv->context->request_channels = pv->context->channels = 6; + pv->context->channel_layout = AV_CH_LAYOUT_5POINT1; + hb_deep_log( 2, "decavcodecaInit: scan detected DTS 5.1, disabling XCh processing" ); + } + if ( w->audio != NULL ) { if ( hb_need_downmix( w->audio->config.in.channel_layout, @@ -439,6 +457,11 @@ static int decavcodecaBSInfo( hb_work_object_t *w, const hb_buffer_t *buf, &out_size, &avp ); if ( len > 0 && context->sample_rate > 0 ) { + // DTS: work around lack of 6.1 support in libhb + if( hb_ff_dts_request_5point1( context ) ) + { + hb_deep_log( 2, "decavcodecaBSInfo: found DTS-ES 6.1, requesting 5.1 core" ); + } int isamp = av_get_bytes_per_sample( context->sample_fmt ); info->bitrate = context->bit_rate; info->rate = context->sample_rate; |