diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-03-19 10:36:56 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-03-19 10:36:56 +0100 |
| commit | 2c29855d0143f227a8fd4c8f7836e20fc53cb843 (patch) | |
| tree | b8993136e51377b78d95ee30f3b4fc5a89f4ad87 /src/lib | |
| parent | 6485b4cb7afb020a8a4e8ff1a5b36544d25595a8 (diff) | |
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.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/writer.cc | 10 |
1 files changed, 8 insertions, 2 deletions
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<DCPTextTrack> 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<DCPTextTrack> 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); |
