diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-03-09 21:33:13 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-03-11 22:24:28 +0100 |
| commit | 1befa3d286a5016e897f1a23cc60cd3d3b96e63a (patch) | |
| tree | c8b5378fb46dc121d60bc2f799c8b2fb5c689db5 | |
| parent | c41fcae660993fcf731266b1774fe94d169bf640 (diff) | |
Enforce minimum reel length when using REELTYPE_BY_LENGTH.
| -rw-r--r-- | src/lib/film.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index 691ef58da..5556c8e68 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -1654,8 +1654,10 @@ Film::reels () const case REELTYPE_BY_LENGTH: { DCPTime current; - /* Integer-divide reel length by the size of one frame to give the number of frames per reel */ - Frame const reel_in_frames = _reel_length / ((j2k_bandwidth() / video_frame_rate()) / 8); + /* Integer-divide reel length by the size of one frame to give the number of frames per reel, + * making sure we don't go less than 1s long. + */ + Frame const reel_in_frames = max(_reel_length / ((j2k_bandwidth() / video_frame_rate()) / 8), static_cast<Frame>(video_frame_rate())); while (current < len) { DCPTime end = min (len, current + DCPTime::from_frames (reel_in_frames, video_frame_rate ())); p.push_back (DCPTimePeriod (current, end)); |
