From a986f54a4109bb8c3b2fb57849b4b0ea01e3c522 Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Tue, 3 Nov 2015 09:46:28 -0800 Subject: libhb: make muxer, sync, and reader behave like other work objects simplify job initialization sequence, clean up code, and document dependencies in the sequence better. Make hb_add set job->sequence_id. It is no longer necessary for the frontend to do this. If the frontend needs the sequence_id, it is returned by hb_add(). Clean up use of interjob. do_job() now uses sequence_id to detect when a new sequence of related jobs is running and automatically clears interjob. --- gtk/src/hb-backend.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'gtk/src/hb-backend.c') diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 88e7a89a1..d6e16d537 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -3375,7 +3375,7 @@ update_status(hb_state_t *state, ghb_instance_status_t *status) status->hours = p.hours; status->minutes = p.minutes; status->seconds = p.seconds; - status->unique_id = p.sequence_id & 0xFFFFFF; + status->unique_id = p.sequence_id; } else { @@ -3395,7 +3395,7 @@ update_status(hb_state_t *state, ghb_instance_status_t *status) status->hours = p.hours; status->minutes = p.minutes; status->seconds = p.seconds; - status->unique_id = p.sequence_id & 0xFFFFFF; + status->unique_id = p.sequence_id; } else { @@ -4316,18 +4316,19 @@ ghb_validate_audio(GhbValue *settings, GtkWindow *parent) return TRUE; } -void -ghb_add_job(hb_handle_t *h, GhbValue *js, gint unique_id) +int +ghb_add_job(hb_handle_t *h, GhbValue *js) { GhbValue *job; char *json_job; + int sequence_id; job = ghb_dict_get(js, "Job"); - ghb_dict_set_int(job, "SequenceID", unique_id); json_job = hb_value_get_json(job); - - hb_add_json(h, json_job); + sequence_id = hb_add_json(h, json_job); free(json_job); + + return sequence_id; } void @@ -4342,7 +4343,7 @@ ghb_remove_job(gint unique_id) ii = hb_count(h_queue) - 1; while ((job = hb_job(h_queue, ii--)) != NULL) { - if ((job->sequence_id & 0xFFFFFF) == unique_id) + if (job->sequence_id == unique_id) hb_rem(h_queue, job); } } -- cgit v1.2.3