summaryrefslogtreecommitdiffstats
path: root/libhb/decpgssub.c
diff options
context:
space:
mode:
authorRodeo <[email protected]>2012-05-01 13:53:12 +0000
committerRodeo <[email protected]>2012-05-01 13:53:12 +0000
commit9eb8646ec2f9a8167c93aae08d55533d8a5984a3 (patch)
treeba322cf1fdbfb5eda27d7f24402fdca98eafcbf5 /libhb/decpgssub.c
parentdf3daf7cdd85794ef3d7f0eff181eb3b323a489f (diff)
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
Diffstat (limited to 'libhb/decpgssub.c')
-rw-r--r--libhb/decpgssub.c28
1 files changed, 13 insertions, 15 deletions
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;