summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-10-23 23:27:49 +0100
committerCarl Hetherington <cth@carlh.net>2016-10-23 23:27:49 +0100
commit2603c3c5d94ce5e300337d71eeabb56ff3f55fc4 (patch)
tree464faf21e291a14be323dbc254112778e1ff00a2 /src/lib
parentbb1eb89a4e4318a63f509a213216da5fdc1937b9 (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/lib')
-rw-r--r--src/lib/dcp_subtitle_decoder.cc3
-rw-r--r--src/lib/dcpomatic_time.h7
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;
}