diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-10-31 21:45:41 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-10-31 22:39:50 +0100 |
| commit | 122bea7f0e08e07dcdaccd51751a9c83504f4c04 (patch) | |
| tree | 76fda35f6ffd5bcfad032bf32d07c498b084b734 /src/lib/film.cc | |
| parent | b950f49fa893e71545eaf9c0abe8a453d42a4340 (diff) | |
Make separate reels for parts of the timeline with no video when
we are in REEL_TYPE_BY_VIDEO_CONTENT mode. This fixes VF creation
with gaps. Also the implementation of Film::reels() is cleaner now.
Diffstat (limited to 'src/lib/film.cc')
| -rw-r--r-- | src/lib/film.cc | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index d19dcc73c..39dfaf5c0 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1606,29 +1606,29 @@ Film::reels () const break; case REELTYPE_BY_VIDEO_CONTENT: { - DCPTime last_split; - shared_ptr<Content> last_video; - BOOST_FOREACH (shared_ptr<Content> c, content ()) { + /* Collect all reel boundaries */ + list<DCPTime> split_points; + split_points.push_back (DCPTime()); + split_points.push_back (len); + BOOST_FOREACH (shared_ptr<Content> c, content()) { if (c->video) { BOOST_FOREACH (DCPTime t, c->reel_split_points(shared_from_this())) { - if (last_split != t) { - p.push_back (DCPTimePeriod(last_split, t)); - last_split = t; - } + split_points.push_back (t); } - last_video = c; + split_points.push_back (c->end(shared_from_this())); } } - DCPTime video_end = last_video ? last_video->end(shared_from_this()) : DCPTime(0); - if (last_split != video_end) { - /* Definitely go from the last split to the end of the video content */ - p.push_back (DCPTimePeriod(last_split, video_end)); - } + split_points.sort (); + split_points.unique (); - if (video_end < len) { - /* And maybe go after that as well if there is any non-video hanging over the end */ - p.push_back (DCPTimePeriod (video_end, len)); + /* Make them into periods */ + optional<DCPTime> last; + BOOST_FOREACH (DCPTime t, split_points) { + if (last) { + p.push_back (DCPTimePeriod(*last, t)); + } + last = t; } break; } |
