summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2015-05-26 17:10:09 +0000
committerjstebbins <[email protected]>2015-05-26 17:10:09 +0000
commit62dd0977862318d28fc9d19f2bb5ce96d61dd2c3 (patch)
tree985f907ece17cc7f5e47794ab7f0da6b637eda8b /libhb
parent36aeaf4b29260cc97c9a2c6cbab11ee2555ca993 (diff)
scan: skip scan if title has already been scanned
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7226 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/common.h1
-rw-r--r--libhb/hb.c20
-rw-r--r--libhb/hb_json.c10
-rw-r--r--libhb/scan.c9
4 files changed, 36 insertions, 4 deletions
diff --git a/libhb/common.h b/libhb/common.h
index c9cf50798..ce5dc8841 100644
--- a/libhb/common.h
+++ b/libhb/common.h
@@ -434,6 +434,7 @@ struct hb_title_set_s
{
hb_list_t * list_title;
int feature; // Detected DVD feature title
+ char path[1024];
};
typedef enum
diff --git a/libhb/hb.c b/libhb/hb.c
index f4ec2308f..2512c4568 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -602,6 +602,26 @@ void hb_scan( hb_handle_t * h, const char * path, int title_index,
{
hb_title_t * title;
+ // Check if scanning is necessary.
+ if (!strcmp(h->title_set.path, path))
+ {
+ // Current title_set path matches requested path.
+ // Check if the requested title has already been scanned.
+ int ii;
+ for (ii = 0; ii < hb_list_count(h->title_set.list_title); ii++)
+ {
+ 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;
+ }
+ }
+ }
+
h->scan_die = 0;
/* Clean up from previous scan */
diff --git a/libhb/hb_json.c b/libhb/hb_json.c
index 93673f371..69760cd83 100644
--- a/libhb/hb_json.c
+++ b/libhb/hb_json.c
@@ -391,8 +391,8 @@ hb_dict_t* hb_job_to_dict( const hb_job_t * job )
"s:o,"
// Destination {Mux, ChapterMarkers, ChapterList}
"s:{s:o, s:o, s:[]},"
- // Source {Title, Angle}
- "s:{s:o, s:o,},"
+ // Source {Path, Title, Angle}
+ "s:{s:o, s:o, s:o,},"
// PAR {Num, Den}
"s:{s:o, s:o},"
// Video {Codec, QSV {Decode, AsyncDepth}}
@@ -412,6 +412,7 @@ hb_dict_t* hb_job_to_dict( const hb_job_t * job )
"ChapterMarkers", hb_value_bool(job->chapter_markers),
"ChapterList",
"Source",
+ "Path", hb_value_string(job->title->path),
"Title", hb_value_int(job->title->index),
"Angle", hb_value_int(job->angle),
"PAR",
@@ -753,11 +754,12 @@ void hb_json_job_scan( hb_handle_t * h, const char * json_job )
// Wait for scan to complete
hb_state_t state;
- do
+ hb_get_state2(h, &state);
+ while (state.state == HB_STATE_SCANNING)
{
hb_snooze(50);
hb_get_state2(h, &state);
- } while (state.state == HB_STATE_SCANNING);
+ }
}
static int validate_audio_codec_mux(int codec, int mux, int track)
diff --git a/libhb/scan.c b/libhb/scan.c
index b747c7239..3a19d9e19 100644
--- a/libhb/scan.c
+++ b/libhb/scan.c
@@ -288,6 +288,15 @@ static void ScanFunc( void * _data )
title = hb_list_item( data->title_set->list_title, i );
title->flags |= HBTF_SCAN_COMPLETE;
}
+ if (hb_list_count(data->title_set->list_title) > 0)
+ {
+ strncpy(data->title_set->path, data->path, 1024);
+ data->title_set->path[1023] = 0;
+ }
+ else
+ {
+ data->title_set->path[0] = 0;
+ }
finish: