diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-04-12 22:25:04 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-04-12 22:25:04 +0200 |
| commit | 19f1a934c9e3531da3bd95cdc854f491ee14e215 (patch) | |
| tree | 93d473ae0c7edee05fe9ced05a1fa265ea27fdbb /src/lib | |
| parent | 2b38754e56ded471019ef910fb9c9a579fe5e1d9 (diff) | |
Fix case where -ve duration subtitles could be created at reel boundaries (#3012)
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/writer.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 9f64a1686..ce5d40c75 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -846,7 +846,11 @@ Writer::write (PlayerText text, TextType type, optional<DCPTextTrack> track, DCP } auto back_off = [this](DCPTimePeriod period) { - period.to -= DCPTime::from_frames(2, film()->video_frame_rate()); + auto const vfr = film()->video_frame_rate(); + period.to -= DCPTime::from_frames(2, vfr); + if (period.duration().frames_floor(vfr) <= 0) { + period.to = period.from + DCPTime::from_frames(1, vfr); + } return period; }; @@ -860,7 +864,7 @@ Writer::write (PlayerText text, TextType type, optional<DCPTextTrack> track, DCP _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 + /* Try to 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; |
