diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-10-23 23:27:49 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-10-23 23:27:49 +0100 |
| commit | 2603c3c5d94ce5e300337d71eeabb56ff3f55fc4 (patch) | |
| tree | 464faf21e291a14be323dbc254112778e1ff00a2 /src | |
| parent | bb1eb89a4e4318a63f509a213216da5fdc1937b9 (diff) | |
Merge identical time periods returned from text_subtitles_during
to stop multiple copies of subtitles being returned from the decoder.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/dcp_subtitle_decoder.cc | 3 | ||||
| -rw-r--r-- | src/lib/dcpomatic_time.h | 7 |
2 files changed, 10 insertions, 0 deletions
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<T> const & o) const { + if (from != o.from) { + return from < o.from; + } + return to < o.to; + } + bool operator== (TimePeriod<T> const & other) const { return from == other.from && to == other.to; } |
