Fix reel that subtitles are put in when they are exactly on a reel boundary.
authorCarl Hetherington <cth@carlh.net>
Fri, 27 Nov 2015 20:28:26 +0000 (20:28 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 27 Nov 2015 20:28:26 +0000 (20:28 +0000)
src/lib/writer.cc
src/lib/writer.h

index ab5d3504ce4e71c25e8e77a23cc457f1c5eadaa1..17bd21daf6cb61b0bef42cd6c0167a5166f33aad 100644 (file)
@@ -150,6 +150,12 @@ Writer::write (Data encoded, Frame frame, Eyes eyes)
        _empty_condition.notify_all ();
 }
 
+bool
+Writer::can_repeat (Frame frame) const
+{
+       return frame > _reels[video_reel(frame)].start();
+}
+
 /** Repeat the last frame that was written to a reel as a new frame.
  *  @param frame Frame index within the DCP of the new (repeated) frame.
  *  @param eyes Eyes that this repeated frame image is for.
@@ -519,7 +525,7 @@ Writer::write (PlayerSubtitles subs)
                return;
        }
 
-       if (_subtitle_reel->period().to < subs.from) {
+       if (_subtitle_reel->period().to <= subs.from) {
                ++_subtitle_reel;
        }
 
index 28e243c352a87247e731b33aac6d67a991dd825c..5c974f0f37ee68b7d2382752ff853c78e03c0f54 100644 (file)
@@ -95,6 +95,7 @@ public:
 
        void write (Data, Frame, Eyes);
        void fake_write (Frame, Eyes);
+       bool can_repeat (Frame) const;
        void repeat (Frame, Eyes);
        void write (boost::shared_ptr<const AudioBuffers>);
        void write (PlayerSubtitles subs);