From: Carl Hetherington Date: Mon, 9 Mar 2020 20:33:13 +0000 (+0100) Subject: Enforce minimum reel length when using REELTYPE_BY_LENGTH. X-Git-Tag: v2.15.48~16 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=1befa3d286a5016e897f1a23cc60cd3d3b96e63a Enforce minimum reel length when using REELTYPE_BY_LENGTH. --- 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 + Copyright (C) 2012-2020 Carl Hetherington 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(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));