Fix missing second-lines of subtitles (#641).
authorCarl Hetherington <cth@carlh.net>
Mon, 20 Jul 2015 19:50:54 +0000 (20:50 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 20 Jul 2015 19:50:54 +0000 (20:50 +0100)
ChangeLog
src/lib/dcp_subtitle_decoder.cc
src/lib/dcpomatic_time.h

index aedac048ff6493c49a5981a95053ecff023b5b05..c90ee414f784f8766755c8f0da0d3bb7bc3d02cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-20  Carl Hetherington  <cth@carlh.net>
+
+       * Fix missing second lines of subtitles in
+       some cases (#641).
+
 2015-07-19  Carl Hetherington  <cth@carlh.net>
 
        * Fix some missing set-to-defaults (#640).
index bb2537fc4181368e4ca53390513f18941a9f58e0..fd801da2f53dc6f2a0bcb86953d15e6b16ef1d8a 100644 (file)
@@ -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;
 }
index 494aebba73c32583d902608a55d5184a9523af1c..41339d128b30270765ace032b5ddfcc4c0246dfd 100644 (file)
@@ -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);