From 96600c15fd788327b7c12110684a06c11116c282 Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Mon, 16 Jan 2017 14:54:13 -0800 Subject: [PATCH] libhb: force title rescan after completing a job encode (#488) Fixes https://forum.handbrake.fr/viewtopic.php?f=12&t=35583 (cherry picked from commit 922db9bec26e1def4c8ba60afb2147cc06ec524d) --- libhb/hb.c | 5 +++++ libhb/hb.h | 1 + libhb/work.c | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/libhb/hb.c b/libhb/hb.c index 562f0dc70..f8bba2a66 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -659,6 +659,11 @@ void hb_scan( hb_handle_t * h, const char * path, int title_index, store_previews, min_duration ); } +void hb_force_rescan( hb_handle_t * h ) +{ + h->title_set.path[0] = 0; +} + /** * Returns the list of titles found. * @param h Handle to hb_handle_t diff --git a/libhb/hb.h b/libhb/hb.h index 86fed9bc0..fd8061431 100644 --- a/libhb/hb.h +++ b/libhb/hb.h @@ -58,6 +58,7 @@ void hb_scan( hb_handle_t *, const char * path, int title_index, int preview_count, int store_previews, uint64_t min_duration ); void hb_scan_stop( hb_handle_t * ); +void hb_force_rescan( hb_handle_t * ); uint64_t hb_first_duration( hb_handle_t * ); /* hb_get_titles() diff --git a/libhb/work.c b/libhb/work.c index 3dfa03469..8aa920860 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -92,6 +92,8 @@ static void work_func( void * _work ) while( !*work->die && ( job = hb_list_item( work->jobs, 0 ) ) ) { + hb_handle_t * h = job->h; + hb_list_rem( work->jobs, job ); hb_list_t * passes = hb_list_init(); @@ -143,6 +145,10 @@ static void work_func( void * _work ) hb_job_close(&job); } hb_list_close(&passes); + + // Force rescan of next source processed by this hb_handle_t + // TODO: Fix this ugly hack! + hb_force_rescan(h); } free( work ); -- 2.40.0