projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a505118
)
Coalesce short reels.
author
Carl Hetherington
<cth@carlh.net>
Mon, 9 Mar 2020 21:05:34 +0000
(22:05 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Wed, 11 Mar 2020 21:24:28 +0000
(22:24 +0100)
src/lib/film.cc
patch
|
blob
|
history
diff --git
a/src/lib/film.cc
b/src/lib/film.cc
index 5531a198cf8b0d63b8ecd9beb2beeb6afbf78b57..ed2c5a3725946e23dee1c03f5628de8e1cec6cf1 100644
(file)
--- a/
src/lib/film.cc
+++ b/
src/lib/film.cc
@@
-1643,13
+1643,17
@@
Film::reels () const
split_points.sort ();
split_points.unique ();
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) {
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));
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;
}
}
break;
}