Fix doubled subtitles if subtitle stop times are specified.
authorCarl Hetherington <cth@carlh.net>
Fri, 8 Jun 2018 12:53:30 +0000 (13:53 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 8 Jun 2018 12:53:30 +0000 (13:53 +0100)
src/lib/ffmpeg_decoder.cc
src/lib/ffmpeg_decoder.h

index 55ff01046f761ec61ff73990d142ec9720db6620..6a8f4d4136dab4322b4b7713536b4e6019b09852 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -567,11 +567,11 @@ FFmpegDecoder::decode_subtitle_packet ()
        FFmpegSubtitlePeriod sub_period = subtitle_period (sub);
        ContentTime from;
        from = sub_period.from + _pts_offset;
-       _have_current_subtitle = true;
        if (sub_period.to) {
                _current_subtitle_to = *sub_period.to + _pts_offset;
        } else {
                _current_subtitle_to = optional<ContentTime>();
+               _have_current_subtitle = true;
        }
 
        for (unsigned int i = 0; i < sub.num_rects; ++i) {
index 3a38f4475333d3f3871e057fb376c56ff3ca2122..16a55d5589139d56c3555b2c3a3f7b1f11a8760d 100644 (file)
@@ -75,6 +75,7 @@ private:
 
        ContentTime _pts_offset;
        boost::optional<ContentTime> _current_subtitle_to;
+       /** true if we have a subtitle which has not had emit_stop called for it yet */
        bool _have_current_subtitle;
 
        boost::shared_ptr<Image> _black_image;