summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2016-05-18 09:46:20 -0600
committerJohn Stebbins <[email protected]>2016-05-18 09:46:20 -0600
commit93ecd810cda833416353f66c88c67e06df8a7129 (patch)
tree0dd1a41d4a050e7fcebf2378b53f473f9da9dcd4
parent7d290195368d5229066e2516d597928dd7315514 (diff)
sync: improve code readability
-rw-r--r--libhb/sync.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/libhb/sync.c b/libhb/sync.c
index 413011913..dd975e817 100644
--- a/libhb/sync.c
+++ b/libhb/sync.c
@@ -2356,14 +2356,6 @@ static void UpdateState( sync_common_t * common, int frame_count )
hb_job_t * job = common->job;
hb_state_t state;
- hb_get_state2(job->h, &state);
- if (frame_count == 0)
- {
- common->st_first = hb_get_date();
- job->st_pause_date = -1;
- job->st_paused = 0;
- }
-
if (job->indepth_scan)
{
// Progress for indept scan is handled by reader
@@ -2372,6 +2364,13 @@ static void UpdateState( sync_common_t * common, int frame_count )
return;
}
+ if (frame_count == 0)
+ {
+ common->st_first = hb_get_date();
+ job->st_pause_date = -1;
+ job->st_paused = 0;
+ }
+
if (hb_get_date() > common->st_dates[3] + 1000)
{
memmove( &common->st_dates[0], &common->st_dates[1],
@@ -2382,8 +2381,10 @@ static void UpdateState( sync_common_t * common, int frame_count )
common->st_counts[3] = frame_count;
}
-#define p state.param.working
+ hb_get_state2(job->h, &state);
state.state = HB_STATE_WORKING;
+
+#define p state.param.working
p.progress = (float)frame_count / common->est_frame_count;
if (p.progress > 1.0)
{
@@ -2421,14 +2422,6 @@ static void UpdateSearchState( sync_common_t * common, int64_t start,
uint64_t now;
double avg;
- now = hb_get_date();
- if (frame_count == 0)
- {
- common->st_first = now;
- job->st_pause_date = -1;
- job->st_paused = 0;
- }
-
if (job->indepth_scan)
{
// Progress for indept scan is handled by reader
@@ -2437,10 +2430,18 @@ static void UpdateSearchState( sync_common_t * common, int64_t start,
return;
}
+ now = hb_get_date();
+ if (frame_count == 0)
+ {
+ common->st_first = now;
+ job->st_pause_date = -1;
+ job->st_paused = 0;
+ }
+
hb_get_state2(job->h, &state);
+ state.state = HB_STATE_SEARCHING;
#define p state.param.working
- state.state = HB_STATE_SEARCHING;
if (job->frame_to_start)
p.progress = (float)frame_count / job->frame_to_start;
else if (job->pts_to_start)