summaryrefslogtreecommitdiffstats
path: root/libhb/hb.c
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2015-09-25 14:02:19 -0700
committerJohn Stebbins <[email protected]>2015-09-29 09:47:56 -0700
commit291243c3fcd34282a700b059995c27a993b12e71 (patch)
tree3d4ec14d3df387ddb47b1611b69cc54c521dd137 /libhb/hb.c
parentc349173bb641530a97f787e75e9aa14fff043506 (diff)
scan: fix rescan avoidance logic
We need to rescan when the number of previews changes.
Diffstat (limited to 'libhb/hb.c')
-rw-r--r--libhb/hb.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/libhb/hb.c b/libhb/hb.c
index 2f4a71720..55800c832 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -610,14 +610,29 @@ void hb_scan( hb_handle_t * h, const char * path, int title_index,
title = hb_list_item(h->title_set.list_title, ii);
if (title->index == title_index)
{
- // Title has already been scanned.
- hb_lock( h->state_lock );
- h->state.state = HB_STATE_SCANDONE;
- hb_unlock( h->state_lock );
- return;
+ // In some cases, we don't care what the preview count is.
+ // E.g. when rescanning at the start of a job. In these
+ // cases, the caller can set preview_count to -1 to tell
+ // us to use the same count as the previous scan, if known.
+ if (preview_count < 0)
+ {
+ preview_count = title->preview_count;
+ }
+ if (preview_count == title->preview_count)
+ {
+ // Title has already been scanned.
+ hb_lock( h->state_lock );
+ h->state.state = HB_STATE_SCANDONE;
+ hb_unlock( h->state_lock );
+ return;
+ }
}
}
}
+ if (preview_count < 0)
+ {
+ preview_count = 10;
+ }
h->scan_die = 0;