From 1befa3d286a5016e897f1a23cc60cd3d3b96e63a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 9 Mar 2020 21:33:13 +0100 Subject: [PATCH] Enforce minimum reel length when using REELTYPE_BY_LENGTH. --- src/lib/film.cc | 8 +++++--- 1 file 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 + 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)); -- 2.30.2