diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-07-20 20:50:54 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-07-20 20:50:54 +0100 |
| commit | 5ba9edaabe4dabbbfb213f1ef053301f604d2517 (patch) | |
| tree | e9cbd7bca5c5e2812f6d1639ae3dfd6cb1906889 | |
| parent | 2d9fac34107b14a6e346bb8dda44451281159ad3 (diff) | |
Fix missing second-lines of subtitles (#641).
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | src/lib/dcp_subtitle_decoder.cc | 18 | ||||
| -rw-r--r-- | src/lib/dcpomatic_time.h | 4 |
3 files changed, 24 insertions, 3 deletions
@@ -1,3 +1,8 @@ +2015-07-20 Carl Hetherington <cth@carlh.net> + + * Fix missing second lines of subtitles in + some cases (#641). + 2015-07-19 Carl Hetherington <cth@carlh.net> * Fix some missing set-to-defaults (#640). diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index bb2537fc4..fd801da2f 100644 --- a/src/lib/dcp_subtitle_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -52,10 +52,22 @@ DCPSubtitleDecoder::pass () return true; } + /* Gather all subtitles with the same time period that are next + on the list. We must emit all subtitles for the same time + period with the same text_subtitle() call otherwise the + SubtitleDecoder will assume there is nothing else at the + time of emit the first. + */ + list<dcp::SubtitleString> s; - s.push_back (*_next); - text_subtitle (content_time_period (*_next), s); - ++_next; + ContentTimePeriod const p = content_time_period (*_next); + + while (_next != _subtitles.end () && content_time_period (*_next) == p) { + s.push_back (*_next); + ++_next; + } + + text_subtitle (p, s); return false; } diff --git a/src/lib/dcpomatic_time.h b/src/lib/dcpomatic_time.h index 494aebba7..41339d128 100644 --- a/src/lib/dcpomatic_time.h +++ b/src/lib/dcpomatic_time.h @@ -238,6 +238,10 @@ public: bool overlaps (ContentTimePeriod const & o) const; bool contains (ContentTime const & o) const; + + bool operator== (ContentTimePeriod const & o) const { + return from == o.from && to == o.to; + } }; DCPTime min (DCPTime a, DCPTime b); |
