diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/dcp_subtitle_decoder.cc | 18 | ||||
| -rw-r--r-- | src/lib/dcpomatic_time.h | 4 |
2 files changed, 19 insertions, 3 deletions
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); |
