From 400bb38bf8ebc7dbe1c8eb5f525983ebdfd5d3b0 Mon Sep 17 00:00:00 2001 From: Bradley Sepos Date: Sat, 29 Aug 2015 18:55:32 -0400 Subject: 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. --- libhb/muxavformat.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libhb/muxavformat.c') diff --git a/libhb/muxavformat.c b/libhb/muxavformat.c index d54200e1a..e6ad4ae23 100644 --- a/libhb/muxavformat.c +++ b/libhb/muxavformat.c @@ -123,6 +123,9 @@ static int avformatInit( hb_mux_object_t * m ) int max_tracks; int ii, ret; + int clock_min, clock_max, clock; + hb_video_framerate_get_limits(&clock_min, &clock_max, &clock); + const char *muxer_name = NULL; uint8_t default_track_flag = 1; @@ -362,13 +365,13 @@ static int avformatInit( hb_mux_object_t * m ) vrate = job->vrate; } - // If the vrate is 27000000, there's a good chance this is - // a standard rate that we have in our hb_video_rates table. + // If the vrate 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 (vrate.num == 27000000) + if (vrate.num == clock) { const hb_rate_t *video_framerate = NULL; while ((video_framerate = hb_video_framerate_get_next(video_framerate)) != NULL) -- cgit v1.2.3