summaryrefslogtreecommitdiffstats
path: root/libhb/encavcodec.c
diff options
context:
space:
mode:
authorBradley Sepos <[email protected]>2015-08-29 18:55:32 -0400
committerBradley Sepos <[email protected]>2015-09-10 15:33:06 -0400
commit400bb38bf8ebc7dbe1c8eb5f525983ebdfd5d3b0 (patch)
tree59c3e86962ff23c5d42efaca242257cf9b2ef487 /libhb/encavcodec.c
parentcbb6fbdbdf2fec70a4d06bf8742c95dfb060f2ed (diff)
libhb: Clock/frame rate handling improvements.
Allows for arbitrary frame rates between 1 and 1000 fps. Adds min/max frame rates to CLI help. Removes hardcoded instances of the internal clock rate in favor of hb_video_framerate_get_limits(). Unfortunately, much of the codebase generally refers to clock rate as frame rate, so a little extra care is still necessary going forward.
Diffstat (limited to 'libhb/encavcodec.c')
-rw-r--r--libhb/encavcodec.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c
index 856fff31a..5063e43f1 100644
--- a/libhb/encavcodec.c
+++ b/libhb/encavcodec.c
@@ -64,9 +64,11 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job )
hb_work_private_t * pv = calloc( 1, sizeof( hb_work_private_t ) );
w->private_data = pv;
-
pv->job = job;
+ int clock_min, clock_max, clock;
+ hb_video_framerate_get_limits(&clock_min, &clock_max, &clock);
+
switch ( w->codec_param )
{
case AV_CODEC_ID_MPEG4:
@@ -111,13 +113,13 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job )
fps.num = job->vrate.num;
}
- // If the fps.num is 27000000, there's a good chance this is
- // a standard rate that we have in our hb_video_rates table.
+ // If the fps.num is the internal clock rate, there's a good chance
+ // this is a standard rate that we have in our hb_video_rates table.
// Because of rounding errors and approximations made while
// measuring framerate, the actual value may not be exact. So
// we look for rates that are "close" and make an adjustment
// to fps.den.
- if (fps.num == 27000000)
+ if (fps.num == clock)
{
const hb_rate_t *video_framerate = NULL;
while ((video_framerate = hb_video_framerate_get_next(video_framerate)) != NULL)