diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/frame_rate_change.cc | 8 | ||||
| -rw-r--r-- | src/lib/frame_rate_change.h | 12 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/lib/frame_rate_change.cc b/src/lib/frame_rate_change.cc index d4e51d669..6057f9ca3 100644 --- a/src/lib/frame_rate_change.cc +++ b/src/lib/frame_rate_change.cc @@ -46,7 +46,7 @@ FrameRateChange::FrameRateChange(double source, int dcp) /* The difference between source and DCP frame rate will be lower (i.e. better) if we skip. */ - _skip = true; + _skip = round(source / dcp) - 1; } else if (fabs(_source * 2 - _dcp) < fabs(_source - _dcp)) { /* The difference between source and DCP frame rate would be better if we repeated each frame once; it may be better still if we @@ -84,11 +84,13 @@ FrameRateChange::description() const { string description; - if (!_skip && _repeat == 1 && !_change_speed) { + if (_skip == 0 && _repeat == 1 && !_change_speed) { description = _("Content and DCP have the same rate.\n"); } else { - if (_skip) { + if (_skip == 1) { description = _("DCP will use every other frame of the content.\n"); + } else if (_skip >= 2) { + description = fmt::format(_("DCP will contain 1 out of every {} frames of the content.\n"), _skip + 1); } else if (_repeat == 2) { description = _("Each content frame will be doubled in the DCP.\n"); } else if (_repeat > 2) { diff --git a/src/lib/frame_rate_change.h b/src/lib/frame_rate_change.h index 478cadeee..b58e499d8 100644 --- a/src/lib/frame_rate_change.h +++ b/src/lib/frame_rate_change.h @@ -43,8 +43,8 @@ public: to get the effective rate after any skip or repeat has happened. */ double factor() const { - if (_skip) { - return 0.5; + if (_skip > 0) { + return 1.0 / (_skip + 1); } return _repeat; @@ -52,7 +52,7 @@ public: std::string description() const; - bool skip() const { + int skip() const { return _skip; } @@ -80,8 +80,10 @@ private: double _source = 24; int _dcp = 24; - /** true to skip every other frame */ - bool _skip = false; + /** Frames to skip between each one to use, e.g. + * 0 to skip no frames, 1 to skip every other one, 2 to skip 2 out of 3, etc. + */ + int _skip = 0; /** number of times to use each frame (e.g. 1 is normal, 2 means repeat each frame once, and so on) */ int _repeat = 1; /** true if this DCP will run its video faster or slower than the source |
