diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-04-19 22:51:45 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-05-14 23:21:25 +0100 |
| commit | 216d424afaf521e1bd1b95cadbe4d1eac58a6c4a (patch) | |
| tree | ec53bf3968a1d6b56cbb63c684b9d37616d4cc93 | |
| parent | df2d7f2173ede7270735b645420187890ff9bc31 (diff) | |
Fix crash on make-dcp after trimming end of text subtitles (#1275).
(cherry-picking cd810b7658b0f4910c093ac191c2b4ba06ba0677 from master)
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | src/lib/player.cc | 8 |
2 files changed, 12 insertions, 0 deletions
@@ -3,6 +3,10 @@ * Fix invalid timings in SMPTE subtitle files (causing failure to play subtitles) in some cases (#1293). +2018-04-19 Carl Hetherington <cth@carlh.net> + + * Fix crash on making a DCP after trimming the end of some text-based subtitles (#1275). + 2018-04-14 Carl Hetherington <cth@carlh.net> * Version 2.12.4 released. diff --git a/src/lib/player.cc b/src/lib/player.cc index 148e0a3c5..7e0186bf4 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -888,6 +888,10 @@ Player::text_subtitle_start (weak_ptr<Piece> wp, ContentTextSubtitle subtitle) PlayerSubtitles ps; DCPTime const from (content_time_to_dcp (piece, subtitle.from())); + if (from > piece->content->end()) { + return; + } + BOOST_FOREACH (dcp::SubtitleString s, subtitle.subs) { s.set_h_position (s.h_position() + piece->content->subtitle->x_offset ()); s.set_v_position (s.v_position() + piece->content->subtitle->y_offset ()); @@ -930,6 +934,10 @@ Player::subtitle_stop (weak_ptr<Piece> wp, ContentTime to) DCPTime const dcp_to = content_time_to_dcp (piece, to); + if (dcp_to > piece->content->end()) { + return; + } + pair<PlayerSubtitles, DCPTime> from = _active_subtitles.add_to (wp, dcp_to); if (piece->content->subtitle->use() && !_always_burn_subtitles && !piece->content->subtitle->burn()) { |
