summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-03-09 22:05:34 +0100
committerCarl Hetherington <cth@carlh.net>2020-03-11 22:24:28 +0100
commitf06c5136e7d3cd0a8e1814763c7774859998efe4 (patch)
tree2e8665c72ac583b6fd12f4d534489507c57817ed
parenta5051181d4f6fe8d30aea66f5c14c2fab9337df0 (diff)
Coalesce short reels.
-rw-r--r--src/lib/film.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 5531a198c..ed2c5a372 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -1643,13 +1643,17 @@ Film::reels () const
split_points.sort ();
split_points.unique ();
- /* Make them into periods */
+ /* Make them into periods, coalescing any that are less than 1 second long */
optional<DCPTime> last;
BOOST_FOREACH (DCPTime t, split_points) {
- if (last) {
+ if (last && (t - *last) >= DCPTime::from_seconds(1)) {
+ /* Period from *last to t is long enough; use it and start a new one */
p.push_back (DCPTimePeriod(*last, t));
+ last = t;
+ } else if (!last) {
+ /* That was the first time, so start a new period */
+ last = t;
}
- last = t;
}
break;
}