summaryrefslogtreecommitdiffstats
path: root/libhb/encx264.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/encx264.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/encx264.c')
-rw-r--r--libhb/encx264.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/libhb/encx264.c b/libhb/encx264.c
index 552e713ad..f87573609 100644
--- a/libhb/encx264.c
+++ b/libhb/encx264.c
@@ -92,7 +92,7 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job )
job->encoder_preset, job->encoder_tune) < 0)
{
free( pv );
- pv = NULL;
+ w->private_data = NULL;
return 1;
}
@@ -120,17 +120,8 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job )
/* Some HandBrake-specific defaults; users can override them
* using the encoder_options string. */
- if( job->pass_id == HB_PASS_ENCODE_2ND && job->cfr != 1 )
- {
- hb_interjob_t * interjob = hb_interjob_get( job->h );
- param.i_fps_num = interjob->vrate.num;
- param.i_fps_den = interjob->vrate.den;
- }
- else
- {
- param.i_fps_num = job->vrate.num;
- param.i_fps_den = job->vrate.den;
- }
+ param.i_fps_num = job->vrate.num;
+ param.i_fps_den = job->vrate.den;
if ( job->cfr == 1 )
{
param.i_timebase_num = 0;
@@ -146,9 +137,9 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job )
/* Set min:max keyframe intervals to 1:10 of fps;
* adjust +0.5 for when fps has remainder to bump
* { 23.976, 29.976, 59.94 } to { 24, 30, 60 }. */
- param.i_keyint_min = (double)job->vrate.num / job->vrate.den + 0.5;
+ param.i_keyint_min = (double)job->orig_vrate.num / job->orig_vrate.den +
+ 0.5;
param.i_keyint_max = 10 * param.i_keyint_min;
-
param.i_log_level = X264_LOG_INFO;
/* set up the VUI color model & gamma to match what the COLR atom
@@ -301,7 +292,7 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job )
if (hb_apply_h264_profile(&param, job->encoder_profile, 1))
{
free(pv);
- pv = NULL;
+ w->private_data = NULL;
return 1;
}
}
@@ -311,7 +302,7 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job )
job->encoder_profile, 1) < 0)
{
free(pv);
- pv = NULL;
+ w->private_data = NULL;
return 1;
}
}
@@ -354,7 +345,7 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job )
{
hb_error("encx264: x264_encoder_open failed.");
free( pv );
- pv = NULL;
+ w->private_data = NULL;
return 1;
}
@@ -380,6 +371,11 @@ void encx264Close( hb_work_object_t * w )
{
hb_work_private_t * pv = w->private_data;
+ if (pv == NULL)
+ {
+ // Not initialized
+ return;
+ }
if (pv->delayed_chapters != NULL)
{
struct chapter_s *item;