diff options
author | Rodeo <[email protected]> | 2012-01-31 01:34:30 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2012-01-31 01:34:30 +0000 |
commit | 446af21bdb70552095e0fd00770c1476f508fdb6 (patch) | |
tree | 78afa80d2a6af80e586674e8b71d0c79a97c5a73 /libhb | |
parent | a6543769881f5c16bd6cf8fc8955279410dc7419 (diff) |
Update hb_ff_dts_request_5point1 to work with DTS-ES 6.0 Distcrete sources (decode the DTS 5.0 core).
Rename it to hb_ff_dts_disable_xch.
Tested with:
M2TS
-> regular DTS 5.1
-> DTS-ES 6.1 Discrete
MKV
-> regular DTS 5.1
-> DTS-ES 6.0 Discrete
-> DTS-ES 6.1 Discrete
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4428 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/decavcodec.c | 25 | ||||
-rw-r--r-- | libhb/hb.c | 13 | ||||
-rw-r--r-- | libhb/hbffmpeg.h | 2 | ||||
-rw-r--r-- | libhb/stream.c | 6 |
4 files changed, 24 insertions, 22 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index 1882c3724..3c88be7ed 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -208,22 +208,25 @@ 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 ) ) + // DTS: work around lack of 6.0/6.1 support in libhb + if( hb_ff_dts_disable_xch( pv->context ) ) { - hb_deep_log( 2, "decavcodecaInit: found DTS-ES 6.1, requesting 5.1 core" ); + hb_deep_log( 2, "decavcodecaInit: found DTS-ES, requesting DTS 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 ) ) ) + ( ( w->audio->config.in.channel_layout & HB_INPUT_CH_LAYOUT_3F2R ) == HB_INPUT_CH_LAYOUT_3F2R ) ) { /* 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, + * the first time. If the scan info says the source is 5.0 or 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" ); + pv->context->request_channels = pv->context->channels = + HB_INPUT_CH_LAYOUT_GET_DISCRETE_COUNT( w->audio->config.in.channel_layout ); + pv->context->channel_layout = AV_CH_LAYOUT_5POINT0; + if( w->audio->config.in.channel_layout & HB_INPUT_CH_LAYOUT_HAS_LFE ) + pv->context->channel_layout |= AV_CH_LOW_FREQUENCY; + hb_deep_log( 2, "decavcodecaInit: scan detected DTS 5.0/5.1, disabling XCh processing" ); } if ( w->audio != NULL ) @@ -462,10 +465,10 @@ 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 ) ) + // DTS: work around lack of 6.0/6.1 support in libhb + if( hb_ff_dts_disable_xch( context ) ) { - hb_deep_log( 2, "decavcodecaBSInfo: found DTS-ES 6.1, requesting 5.1 core" ); + hb_deep_log( 2, "decavcodecaBSInfo: found DTS-ES, requesting DTS core" ); } int isamp = av_get_bytes_per_sample( context->sample_fmt ); info->bitrate = context->bit_rate; diff --git a/libhb/hb.c b/libhb/hb.c index 0e3e9e572..90e6916ff 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -300,16 +300,15 @@ void hb_ff_set_sample_fmt(AVCodecContext *context, AVCodec *codec) } } -// Libav can decode DTS-ES 6.1 (5.1 core + XCh extension) -// but we don't support 6.1 (and incorrectly assume 7.0) -// request 6 channels to disable XCh processing in Libav -int hb_ff_dts_request_5point1( AVCodecContext *c ) +// Libav can decode DTS-ES 6.0/6.1 (5.0/5.1 core + XCh extension) +// but we don't support 6.0/6.1 (and incorrectly assume 5.1/7.0) +// request channels-1 to disable XCh processing in Libav +int hb_ff_dts_disable_xch( AVCodecContext *c ) { if( ( c->codec_id == CODEC_ID_DTS ) && - ( c->channels == 7 ) && - ( c->channel_layout & ( AV_CH_BACK_CENTER|AV_CH_LOW_FREQUENCY ) ) ) + ( c->channel_layout & ( AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER ) ) ) { - c->request_channels = c->channels = 6; + c->request_channels = --c->channels; c->channel_layout &= ~AV_CH_BACK_CENTER; return 1; } diff --git a/libhb/hbffmpeg.h b/libhb/hbffmpeg.h index 53cdee87a..0fb0cd0a5 100644 --- a/libhb/hbffmpeg.h +++ b/libhb/hbffmpeg.h @@ -19,4 +19,4 @@ hb_sws_get_context(int srcW, int srcH, enum PixelFormat srcFormat, int dstW, int dstH, enum PixelFormat dstFormat, int flags); void hb_ff_set_sample_fmt(AVCodecContext *context, AVCodec *codec); -int hb_ff_dts_request_5point1( AVCodecContext *c ); +int hb_ff_dts_disable_xch( AVCodecContext *c ); diff --git a/libhb/stream.c b/libhb/stream.c index 1d7652136..b89836b14 100644 --- a/libhb/stream.c +++ b/libhb/stream.c @@ -4885,10 +4885,10 @@ static void add_ffmpeg_audio( hb_title_t *title, hb_stream_t *stream, int id ) AVDictionaryEntry *tag; int layout; - // DTS: work around lack of 6.1 support in libhb - if( hb_ff_dts_request_5point1( codec ) ) + // DTS: work around lack of 6.0/6.1 support in libhb + if( hb_ff_dts_disable_xch( codec ) ) { - hb_deep_log( 2, "add_ffmpeg_audio: found DTS-ES 6.1, requesting 5.1 core" ); + hb_deep_log( 2, "add_ffmpeg_audio: found DTS-ES, requesting DTS core" ); } // scan will ignore any audio without a bitrate. Since we've already |