From 4337694dfd488e88f56b63898ad35ce8ce9bb3c3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 20 Nov 2016 22:08:11 +0000 Subject: Fix subtitles (seen in DVB) which have a specified `to' time but then are terminated earlier than that by a num_rects=0 subtitle. --- src/lib/ffmpeg_decoder.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/lib/ffmpeg_decoder.cc') diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index ddc563b98..b7dced34d 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -510,13 +510,11 @@ FFmpegDecoder::decode_subtitle_packet () ContentTimePeriod period; period.from = sub_period.from + _pts_offset; subtitle->set_position (period.from); - if (sub_period.to) { - /* We already know the subtitle period `to' time */ - period.to = sub_period.to.get() + _pts_offset; - } else { - /* We have to look up the `to' time in the stream's records */ - period.to = ffmpeg_content()->subtitle_stream()->find_subtitle_to (subtitle_id (sub)); - } + /* We can't trust the `to' time from sub_period as there are some decoders which + give a sub_period time for `to' which is subsequently overridden by a `stop' subtitle; + see also FFmpegExaminer. + */ + period.to = ffmpeg_content()->subtitle_stream()->find_subtitle_to (subtitle_id (sub)); for (unsigned int i = 0; i < sub.num_rects; ++i) { AVSubtitleRect const * rect = sub.rects[i]; -- cgit v1.2.3