From 8ca6fd6d97e6d42492afddb655fa85130946853c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 8 Jun 2018 13:53:30 +0100 Subject: [PATCH] Fix doubled subtitles if subtitle stop times are specified. --- src/lib/ffmpeg_decoder.cc | 4 ++-- src/lib/ffmpeg_decoder.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 55ff01046..6a8f4d413 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington 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(); + _have_current_subtitle = true; } for (unsigned int i = 0; i < sub.num_rects; ++i) { diff --git a/src/lib/ffmpeg_decoder.h b/src/lib/ffmpeg_decoder.h index 3a38f4475..16a55d558 100644 --- a/src/lib/ffmpeg_decoder.h +++ b/src/lib/ffmpeg_decoder.h @@ -75,6 +75,7 @@ private: ContentTime _pts_offset; boost::optional _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 _black_image; -- 2.30.2