diff options
author | John Stebbins <[email protected]> | 2019-06-25 15:55:59 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2019-06-25 16:06:10 -0700 |
commit | 25e1f04a63dc07e944522a10e9f9733e027cb9f5 (patch) | |
tree | 8e4eb686468ce9e86b6a8a704d4fb135310bd213 /libhb/work.c | |
parent | a8b2607e4bb59445f76d6b3d1733595bb856070c (diff) |
LinGui: add queue statistics
and tweak the layout per BradleyS suggestions
Diffstat (limited to 'libhb/work.c')
-rw-r--r-- | libhb/work.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/libhb/work.c b/libhb/work.c index a20f33dbd..56e7270bb 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -57,43 +57,40 @@ hb_thread_t * hb_work_init( hb_list_t * jobs, volatile int * die, hb_error_code return hb_thread_init( "work", work_func, work, HB_LOW_PRIORITY ); } -static void InitWorkState(hb_handle_t *h, int pass_id, int pass, int pass_count) +static void InitWorkState(hb_job_t * job, int pass, int pass_count) { hb_state_t state; - state.state = HB_STATE_WORKING; + memset(&state, 0, sizeof(state)); + state.state = HB_STATE_WORKING; + state.sequence_id = job->sequence_id; #define p state.param.working - p.pass_id = pass_id; - p.pass = pass; - p.pass_count = pass_count; - p.progress = 0.0; - p.rate_cur = 0.0; - p.rate_avg = 0.0; - p.hours = -1; - p.minutes = -1; - p.seconds = -1; + p.pass_id = job->pass_id; + p.pass = pass; + p.pass_count = pass_count; + p.progress = 0.0; + p.rate_cur = 0.0; + p.rate_avg = 0.0; + p.eta_seconds = 0; + p.hours = -1; + p.minutes = -1; + p.seconds = -1; #undef p - hb_set_state( h, &state ); - + hb_set_state( job->h, &state ); } static void SetWorkStateInfo(hb_job_t *job) { hb_state_t state; - if (job == NULL) { return; } hb_get_state2(job->h, &state); - - state.param.working.error = *job->done_error; - state.param.working.sequence_id = job->sequence_id; - + state.param.working.error = *job->done_error; hb_set_state( job->h, &state ); - } /** @@ -122,6 +119,8 @@ static void work_func( void * _work ) { hb_deep_log(1, "json job:\n%s", job->json); + // Initialize state sequence_id + InitWorkState(job, 0, 0); // Perform title scan for json job hb_json_job_scan(job->h, job->json); @@ -151,7 +150,7 @@ static void work_func( void * _work ) job->die = work->die; job->done_error = work->error; *(work->current_job) = job; - InitWorkState(job->h, job->pass_id, pass + 1, pass_count); + InitWorkState(job, pass + 1, pass_count); do_job( job ); } SetWorkStateInfo(job); |