diff options
author | jstebbins <[email protected]> | 2015-04-09 18:45:23 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2015-04-09 18:45:23 +0000 |
commit | f0cc63a21d2e4510f911c4cde75d051aec3e5635 (patch) | |
tree | 20ab584fac61f9974c57be1f9a9f49cb664a0a82 | |
parent | 9215eafbc27930ce5f8de9644b34bb116861dfb3 (diff) |
LinGui: fix libhb work state tracking
I never updated this after the work state defines were updated
to bitfields. It mostly worked, but sometimes missed transitions in state.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7074 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | gtk/src/hb-backend.c | 173 |
1 files changed, 93 insertions, 80 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 317e9f06e..791f3b678 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -3211,96 +3211,109 @@ ghb_get_status(ghb_status_t *status) static void update_status(hb_state_t *state, ghb_instance_status_t *status) { - switch( state->state ) - { #define p state->param.scanning - case HB_STATE_SCANNING: + if (state->state & HB_STATE_SCANNING) + { + status->state |= GHB_STATE_SCANNING; + status->title_count = p.title_count; + status->title_cur = p.title_cur; + status->preview_count = p.preview_count; + status->preview_cur = p.preview_cur; + status->progress = p.progress; + } + else + { + if (status->state & GHB_STATE_SCANNING) { - status->state |= GHB_STATE_SCANNING; - status->title_count = p.title_count; - status->title_cur = p.title_cur; - status->preview_count = p.preview_count; - status->preview_cur = p.preview_cur; - status->progress = p.progress; - } break; + status->state |= GHB_STATE_SCANDONE; + } + status->state &= ~GHB_STATE_SCANNING; + } #undef p - - case HB_STATE_SCANDONE: +#define p state->param.working + if (state->state & HB_STATE_WORKING) + { + if (status->state & GHB_STATE_SCANNING) { status->state &= ~GHB_STATE_SCANNING; status->state |= GHB_STATE_SCANDONE; - } break; - -#define p state->param.working - case HB_STATE_WORKING: - if (status->state & GHB_STATE_SCANNING) - { - status->state &= ~GHB_STATE_SCANNING; - status->state |= GHB_STATE_SCANDONE; - } - status->state |= GHB_STATE_WORKING; - status->state &= ~GHB_STATE_PAUSED; - status->state &= ~GHB_STATE_SEARCHING; - status->pass = p.pass; - status->pass_count = p.pass_count; - status->pass_id = p.pass_id; - status->progress = p.progress; - status->rate_cur = p.rate_cur; - status->rate_avg = p.rate_avg; - status->hours = p.hours; - status->minutes = p.minutes; - status->seconds = p.seconds; - status->unique_id = p.sequence_id & 0xFFFFFF; - break; - - case HB_STATE_SEARCHING: - status->state |= GHB_STATE_SEARCHING; - status->state &= ~GHB_STATE_WORKING; - status->state &= ~GHB_STATE_PAUSED; - status->pass = p.pass; - status->pass_count = p.pass_count; - status->pass_id = p.pass_id; - status->progress = p.progress; - status->rate_cur = p.rate_cur; - status->rate_avg = p.rate_avg; - status->hours = p.hours; - status->minutes = p.minutes; - status->seconds = p.seconds; - status->unique_id = p.sequence_id & 0xFFFFFF; - break; + } + status->state |= GHB_STATE_WORKING; + status->state &= ~GHB_STATE_PAUSED; + status->state &= ~GHB_STATE_SEARCHING; + status->pass = p.pass; + status->pass_count = p.pass_count; + status->pass_id = p.pass_id; + status->progress = p.progress; + status->rate_cur = p.rate_cur; + status->rate_avg = p.rate_avg; + status->hours = p.hours; + status->minutes = p.minutes; + status->seconds = p.seconds; + status->unique_id = p.sequence_id & 0xFFFFFF; + } + else + { + status->state &= ~GHB_STATE_WORKING; + } + if (state->state & HB_STATE_SEARCHING) + { + status->state |= GHB_STATE_SEARCHING; + status->state &= ~GHB_STATE_WORKING; + status->state &= ~GHB_STATE_PAUSED; + status->pass = p.pass; + status->pass_count = p.pass_count; + status->pass_id = p.pass_id; + status->progress = p.progress; + status->rate_cur = p.rate_cur; + status->rate_avg = p.rate_avg; + status->hours = p.hours; + status->minutes = p.minutes; + status->seconds = p.seconds; + status->unique_id = p.sequence_id & 0xFFFFFF; + } + else + { + status->state &= ~GHB_STATE_SEARCHING; + } #undef p - - case HB_STATE_PAUSED: - status->state |= GHB_STATE_PAUSED; - break; - - case HB_STATE_MUXING: - { - status->state |= GHB_STATE_MUXING; - } break; - #define p state->param.workdone - case HB_STATE_WORKDONE: + if (state->state & HB_STATE_WORKDONE) + { + status->state |= GHB_STATE_WORKDONE; + status->state &= ~GHB_STATE_MUXING; + status->state &= ~GHB_STATE_PAUSED; + status->state &= ~GHB_STATE_WORKING; + status->state &= ~GHB_STATE_SEARCHING; + switch (p.error) { - status->state |= GHB_STATE_WORKDONE; - status->state &= ~GHB_STATE_MUXING; - status->state &= ~GHB_STATE_PAUSED; - status->state &= ~GHB_STATE_WORKING; - status->state &= ~GHB_STATE_SEARCHING; - switch (p.error) - { - case HB_ERROR_NONE: - status->error = GHB_ERROR_NONE; - break; - case HB_ERROR_CANCELED: - status->error = GHB_ERROR_CANCELED; - break; - default: - status->error = GHB_ERROR_FAIL; - break; - } - } break; + case HB_ERROR_NONE: + status->error = GHB_ERROR_NONE; + break; + case HB_ERROR_CANCELED: + status->error = GHB_ERROR_CANCELED; + break; + default: + status->error = GHB_ERROR_FAIL; + break; + } + } #undef p + if (state->state & HB_STATE_PAUSED) + { + status->state |= GHB_STATE_PAUSED; + } + else + { + status->state &= ~GHB_STATE_PAUSED; + } + if (state->state & HB_STATE_MUXING) + { + status->state |= GHB_STATE_MUXING; + } + else + { + status->state &= ~GHB_STATE_MUXING; } } |