Enforce a minimum DCP length of 1 second.
authorCarl Hetherington <cth@carlh.net>
Mon, 9 Mar 2020 20:41:36 +0000 (21:41 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 11 Mar 2020 21:24:28 +0000 (22:24 +0100)
src/lib/film.cc

index 5556c8e680ebd39595db3a4748aef4b81e14692b..5531a198cf8b0d63b8ecd9beb2beeb6afbf78b57 100644 (file)
@@ -1254,11 +1254,13 @@ Film::move_content_later (shared_ptr<Content> c)
        _playlist->move_later (shared_from_this(), c);
 }
 
-/** @return length of the film from time 0 to the last thing on the playlist */
+/** @return length of the film from time 0 to the last thing on the playlist,
+ *  with a minimum length of 1 second.
+ */
 DCPTime
 Film::length () const
 {
-       return _playlist->length(shared_from_this()).ceil(video_frame_rate());
+       return max(DCPTime::from_seconds(1), _playlist->length(shared_from_this()).ceil(video_frame_rate()));
 }
 
 int