From: Carl Hetherington Date: Fri, 19 Mar 2021 09:36:56 +0000 (+0100) Subject: Fix handling of subtitles at reel boundaries. X-Git-Tag: v2.15.136~1 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=2c29855d0143f227a8fd4c8f7836e20fc53cb843 Fix handling of subtitles at reel boundaries. When a subtitle spans 3 reels were were backing off the end of the subtitle at the end of reel #1 but not the one at the end of reel #2, causing two subs to be too close together. --- diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 4386b8e26..035fc2b1d 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -802,6 +802,11 @@ Writer::write (PlayerText text, TextType type, optional track, DCP write_hanging_text (**reel); } + auto back_off = [this](DCPTimePeriod period) { + period.to -= DCPTime::from_frames(2, film()->video_frame_rate()); + return period; + }; + if (period.to > (*reel)->period().to) { /* This text goes off the end of the reel. Store parts of it that should go into * other reels. @@ -809,13 +814,14 @@ Writer::write (PlayerText text, TextType type, optional track, DCP for (auto i = std::next(*reel); i != _reels.end(); ++i) { auto overlap = i->period().overlap(period); if (overlap) { - _hanging_texts.push_back (HangingText{text, type, track, *overlap}); + _hanging_texts.push_back (HangingText{text, type, track, back_off(*overlap)}); } } /* Back off from the reel boundary by a couple of frames to avoid tripping checks * for subtitles being too close together. */ - period.to = (*reel)->period().to - DCPTime::from_frames(2, film()->video_frame_rate()); + period.to = (*reel)->period().to; + period = back_off(period); } (*reel)->write (text, type, track, period);