summaryrefslogtreecommitdiffstats
path: root/libhb/hb.c
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2015-11-03 09:46:28 -0800
committerJohn Stebbins <[email protected]>2015-11-09 11:06:59 -0800
commita986f54a4109bb8c3b2fb57849b4b0ea01e3c522 (patch)
tree7add9d007dc8bdd72114637c8f3f7361621ad4a5 /libhb/hb.c
parent63b340ebc33d57aeda22e340dab48b1df2106541 (diff)
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.
Diffstat (limited to 'libhb/hb.c')
-rw-r--r--libhb/hb.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libhb/hb.c b/libhb/hb.c
index 0364a5a15..dedeadaf5 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -46,6 +46,7 @@ struct hb_handle_s
/* The thread which processes the jobs. Others threads are launched
from this one (see work.c) */
+ int sequence_id;
hb_list_t * jobs;
hb_job_t * current_job;
volatile int work_die;
@@ -1524,11 +1525,14 @@ hb_job_t* hb_job_copy(hb_job_t * job)
return job_copy;
}
-void hb_add( hb_handle_t * h, hb_job_t * job )
+int hb_add( hb_handle_t * h, hb_job_t * job )
{
hb_job_t *job_copy = hb_job_copy(job);
job_copy->h = h;
+ job_copy->sequence_id = ++h->sequence_id;
hb_list_add(h->jobs, job_copy);
+
+ return job_copy->sequence_id;
}
void hb_job_setup_passes(hb_handle_t * h, hb_job_t * job, hb_list_t * list_pass)
@@ -1968,7 +1972,7 @@ void hb_set_state( hb_handle_t * h, hb_state_t * s )
{
// Set which job is being worked on
if (h->current_job)
- h->state.param.working.sequence_id = h->current_job->sequence_id & 0xFFFFFF;
+ h->state.param.working.sequence_id = h->current_job->sequence_id;
else
h->state.param.working.sequence_id = 0;
}