From 9eb8646ec2f9a8167c93aae08d55533d8a5984a3 Mon Sep 17 00:00:00 2001 From: Rodeo Date: Tue, 1 May 2012 13:53:12 +0000 Subject: Simplify Foreign Audio Search code: - move all subtitle hit counting to the decoders instead of reader ---> allows us to count actual subtitles rather than just packets - always count subtitles, even when not doing a scan (may be useful in the future) Miscellaneous improvements: - always insert select_subtitle at the head of the output subtitle list, to make it less likely to be dropped - when multiple subtitle tracks have forced hits, pick the track with the fewest forced hits ---> Foreign Audio Search should now work with Star Wars on Blu-ray - logging improvements (more readable, and log job->select_subtitle configuration - Forced Only vs. All, Render vs. Passthrough) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4622 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/decpgssub.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'libhb/decpgssub.c') diff --git a/libhb/decpgssub.c b/libhb/decpgssub.c index 1b0f7e4cd..77b90ad03 100644 --- a/libhb/decpgssub.c +++ b/libhb/decpgssub.c @@ -111,32 +111,30 @@ static int decsubWork( hb_work_object_t * w, hb_buffer_t ** buf_in, avp.size = 0; } + if (has_subtitle && subtitle.num_rects > 0) + { + w->subtitle->hits++; + if (subtitle.forced) + w->subtitle->forced_hits++; + } + // The sub is "usable" if: // 1. libav returned a sub AND - // 2. we are scanning for foreign audio subs OR + // 2. we are not scanning for foreign audio subs AND // 3. we want all subs (e.g. not forced) OR // 4. the sub is forced and we only want forced OR // 5. subtitle clears the previous sub (these are never forced) // subtitle.num_rects == 0 - uint8_t useable_sub = - pv->job->indepth_scan || - subtitle.num_rects == 0 || - !w->subtitle->config.force || - ( w->subtitle->config.force && subtitle.forced ); + uint8_t useable_sub = has_subtitle && !pv->job->indepth_scan && + ( !subtitle.num_rects || !w->subtitle->config.force || + ( w->subtitle->config.force && subtitle.forced ) ); - if (has_subtitle && useable_sub) + if (useable_sub) { int64_t pts = av_rescale(subtitle.pts, 90000, AV_TIME_BASE); hb_buffer_t * out = NULL; - if( pv->job->indepth_scan ) - { - if (subtitle.forced) - { - w->subtitle->forced_hits++; - } - } - else if ( w->subtitle->config.dest == PASSTHRUSUB && + if ( w->subtitle->config.dest == PASSTHRUSUB && hb_subtitle_can_pass( PGSSUB, pv->job->mux ) ) { out = pv->list_pass_buffer; -- cgit v1.2.3