X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Futil.cc;h=418d7b3e0f6123810b2f482df524473d5abe2d55;hb=8aeb741ccbe2edb528e98a431bf55459a6836a9b;hp=b2f8c4470e5af5ee5117489870f4899bd38367bb;hpb=5832c7851a946890f04d6d1c548c23d563249e9f;p=dcpomatic.git diff --git a/src/lib/util.cc b/src/lib/util.cc index b2f8c4470..418d7b3e0 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -341,6 +342,7 @@ dcpomatic_setup () set_terminate (terminate); + Pango::init (); libdcp::init (); Ratio::setup_ratios (); @@ -781,7 +783,7 @@ ensure_ui_thread () * @return Equivalent number of audio frames for `v'. */ int64_t -video_frames_to_audio_frames (VideoContent::Frame v, float audio_sample_rate, float frames_per_second) +video_frames_to_audio_frames (VideoFrame v, float audio_sample_rate, float frames_per_second) { return ((int64_t) v * audio_sample_rate / frames_per_second); } @@ -806,7 +808,7 @@ audio_channel_name (int c) return channels[c]; } -FrameRateConversion::FrameRateConversion (float source, int dcp) +FrameRateChange::FrameRateChange (float source, int dcp) : skip (false) , repeat (1) , change_speed (false) @@ -824,7 +826,8 @@ FrameRateConversion::FrameRateConversion (float source, int dcp) repeat = round (dcp / source); } - change_speed = !about_equal (source * factor(), dcp); + speed_up = dcp / (source * factor()); + change_speed = !about_equal (speed_up, 1.0); if (!skip && repeat == 1 && !change_speed) { description = _("Content and DCP have the same rate.\n"); @@ -949,6 +952,13 @@ fit_ratio_within (float ratio, libdcp::Size full_frame) return libdcp::Size (full_frame.width, rint (full_frame.width / ratio)); } +DCPTime +time_round_up (DCPTime t, DCPTime nearest) +{ + DCPTime const a = t + nearest - 1; + return a - (a % nearest); +} + void * wrapped_av_malloc (size_t s) { @@ -958,4 +968,3 @@ wrapped_av_malloc (size_t s) } return p; } -