Merge identical time periods returned from text_subtitles_during
authorCarl Hetherington <cth@carlh.net>
Sun, 23 Oct 2016 22:27:49 +0000 (23:27 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 23 Oct 2016 22:27:49 +0000 (23:27 +0100)
to stop multiple copies of subtitles being returned from the decoder.

src/lib/dcp_subtitle_decoder.cc
src/lib/dcpomatic_time.h

index d7b39d5de29021b78f8a6c3cc62daaa9e0f83fe7..e3f724d936ef782ae945911c16d9582ce112497b 100644 (file)
@@ -103,6 +103,9 @@ DCPSubtitleDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) c
                }
        }
 
+       d.sort ();
+       d.unique ();
+
        return d;
 }
 
index da903cf09316e0e34865e62a5443a7ff1ba5b64e..893bce2572e21752a1de59f6dcdb43f9eb8a0ca4 100644 (file)
@@ -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;
        }