From 2603c3c5d94ce5e300337d71eeabb56ff3f55fc4 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 23 Oct 2016 23:27:49 +0100 Subject: Merge identical time periods returned from text_subtitles_during to stop multiple copies of subtitles being returned from the decoder. --- src/lib/dcp_subtitle_decoder.cc | 3 +++ src/lib/dcpomatic_time.h | 7 +++++++ 2 files changed, 10 insertions(+) (limited to 'src/lib') diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index d7b39d5de..e3f724d93 100644 --- a/src/lib/dcp_subtitle_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -103,6 +103,9 @@ DCPSubtitleDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) c } } + d.sort (); + d.unique (); + return d; } diff --git a/src/lib/dcpomatic_time.h b/src/lib/dcpomatic_time.h index da903cf09..893bce257 100644 --- a/src/lib/dcpomatic_time.h +++ b/src/lib/dcpomatic_time.h @@ -272,6 +272,13 @@ public: return (from <= other && other < to); } + bool operator< (TimePeriod const & o) const { + if (from != o.from) { + return from < o.from; + } + return to < o.to; + } + bool operator== (TimePeriod const & other) const { return from == other.from && to == other.to; } -- cgit v1.2.3