summaryrefslogtreecommitdiffstats
path: root/libhb/hb.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2015-01-12 17:15:19 +0000
committerjstebbins <[email protected]>2015-01-12 17:15:19 +0000
commit84d152fecb516134d1d89d4689761430d6aa0a0d (patch)
tree325ba895366390a0ce2b2ca4ae5079e7a2fb9b50 /libhb/hb.c
parent2d6aa981b2da6536051b4d350d3b491bd970a957 (diff)
Simplify frontend useage of hb_add()
Modify hb_add() to automatically add all necessary passes, so hb_add() only needs to be called once per job. It now automatically adds subtitle scan and 2-pass encoding passes. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6738 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/hb.c')
-rw-r--r--libhb/hb.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/libhb/hb.c b/libhb/hb.c
index 73dbd448c..b447c3fd0 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -1255,7 +1255,7 @@ hb_job_t * hb_current_job( hb_handle_t * h )
* @param h Handle to hb_handle_t.
* @param job Handle to hb_job_t.
*/
-void hb_add( hb_handle_t * h, hb_job_t * job )
+static void hb_add_internal( hb_handle_t * h, hb_job_t * job )
{
hb_job_t * job_copy;
hb_audio_t * audio;
@@ -1347,6 +1347,40 @@ void hb_add( hb_handle_t * h, hb_job_t * job )
h->job_count_permanent++;
}
+void hb_add( hb_handle_t * h, hb_job_t * job )
+{
+ int sub_id = 0;
+
+ if (job->vquality >= 0)
+ {
+ job->twopass = 0;
+ }
+ if (job->indepth_scan)
+ {
+ hb_deep_log(2, "Adding subtitle scan pass");
+ job->pass = -1;
+ job->sequence_id = (job->sequence_id & 0xFFFFFF) | (sub_id++ << 24);
+ hb_add_internal(h, job);
+ job->indepth_scan = 0;
+ }
+ if (job->twopass)
+ {
+ hb_deep_log(2, "Adding two-pass encode");
+ job->pass = 1;
+ job->sequence_id = (job->sequence_id & 0xFFFFFF) | (sub_id++ << 24);
+ hb_add_internal(h, job);
+ job->pass = 2;
+ job->sequence_id = (job->sequence_id & 0xFFFFFF) | (sub_id++ << 24);
+ hb_add_internal(h, job);
+ }
+ else
+ {
+ job->pass = 0;
+ job->sequence_id = (job->sequence_id & 0xFFFFFF) | (sub_id++ << 24);
+ hb_add_internal(h, job);
+ }
+}
+
/**
* Removes a job from the job list.
* @param h Handle to hb_handle_t.
@@ -1789,7 +1823,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;
+ h->state.param.working.sequence_id = h->current_job->sequence_id & 0xFFFFFF;
else
h->state.param.working.sequence_id = 0;
}