diff options
author | jstebbins <[email protected]> | 2015-03-07 22:25:48 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2015-03-07 22:25:48 +0000 |
commit | 7705413a03a90c16734b40fb7bc492be8b56ab6f (patch) | |
tree | 2b3c861e0a7b78e45869a191b20f7dc57c0fe48b /libhb/scan.c | |
parent | a4ad5062c3fa1787b208389123bb81ea57483142 (diff) |
json: automatically scan title when processing json jobs
Simplifies the WinGui.
This also changes how jobs are processed. Creating the sub-jobs for
multiple passes is delayed until after scanning and immediately before
running the job.
Working status has also changed. Sub-job passes are identified in status
with an ID that allows the frontend to definitively identify what pass
is in progress.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6976 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/scan.c')
-rw-r--r-- | libhb/scan.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/libhb/scan.c b/libhb/scan.c index 55c9bfc90..32a5c60bb 100644 --- a/libhb/scan.c +++ b/libhb/scan.c @@ -74,7 +74,19 @@ hb_thread_t * hb_scan_init( hb_handle_t * handle, volatile int * die, data->preview_count = preview_count; data->store_previews = store_previews; data->min_title_duration = min_duration; - + + // Initialize scan state + hb_state_t state; +#define p state.param.scanning + state.state = HB_STATE_SCANNING; + p.title_cur = 1; + p.title_count = 1; + p.preview_cur = 0; + p.preview_count = 1; + p.progress = 0.0; +#undef p + hb_set_state(handle, &state); + return hb_thread_init( "scan", ScanFunc, data, HB_NORMAL_PRIORITY ); } @@ -169,7 +181,14 @@ static void ScanFunc( void * _data ) } else { - data->title_index = 1; + // Title index 0 is not a valid title number and means scan all titles. + // So set title index to 1 in this scenario. + // + // Otherwise, set title index in new title to the index that was + // requested. This preserves the original index created in batch + // mode. + if (data->title_index == 0) + data->title_index = 1; hb_title_t * title = hb_title_init( data->path, data->title_index ); if ( (data->stream = hb_stream_open( data->path, title, 1 ) ) != NULL ) { |