diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-11-21 12:15:26 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-11-21 12:15:26 +0000 |
| commit | f67bc45820b4e56f90eecb97ba3b7762c119f9b5 (patch) | |
| tree | 58b009c238bc4dad8606e70ba617bcb7a49fb89c /src/lib/frame_rate_change.cc | |
| parent | 84012cdd64f451891febd36154b7226ea21a899b (diff) | |
Add and use new FrameRateChange constructors.
Diffstat (limited to 'src/lib/frame_rate_change.cc')
| -rw-r--r-- | src/lib/frame_rate_change.cc | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/lib/frame_rate_change.cc b/src/lib/frame_rate_change.cc index 80a167029..456b4151e 100644 --- a/src/lib/frame_rate_change.cc +++ b/src/lib/frame_rate_change.cc @@ -20,12 +20,15 @@ #include "frame_rate_change.h" #include "types.h" +#include "content.h" +#include "film.h" #include "compose.hpp" #include <cmath> #include "i18n.h" using std::string; +using boost::shared_ptr; static bool about_equal (double a, double b) @@ -33,14 +36,20 @@ about_equal (double a, double b) return (fabs (a - b) < VIDEO_FRAME_RATE_EPSILON); } - FrameRateChange::FrameRateChange (double source_, int dcp_) - : source (source_) - , dcp (dcp_) - , skip (false) + : skip (false) , repeat (1) , change_speed (false) { + construct (source_, dcp_); +} + +void +FrameRateChange::construct (double source_, int dcp_) +{ + source = source_; + dcp = dcp_; + if (fabs (source / 2.0 - dcp) < fabs (source - dcp)) { /* The difference between source and DCP frame rate will be lower (i.e. better) if we skip. @@ -58,6 +67,16 @@ FrameRateChange::FrameRateChange (double source_, int dcp_) change_speed = !about_equal (speed_up, 1.0); } +FrameRateChange::FrameRateChange (shared_ptr<const Film> film, shared_ptr<const Content> content) +{ + construct (content->active_video_frame_rate(film), film->video_frame_rate()); +} + +FrameRateChange::FrameRateChange (shared_ptr<const Film> film, Content const * content) +{ + construct (content->active_video_frame_rate(film), film->video_frame_rate()); +} + string FrameRateChange::description () const { |
