From 7a25c08988111224f264ecfffa7df392d4c9af1a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 24 Oct 2012 13:52:24 +0100 Subject: Try to fix overrunning subtitles. --- src/lib/ffmpeg_decoder.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lib/ffmpeg_decoder.cc') diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index e954294ec..9891bb55b 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -309,11 +309,13 @@ FFmpegDecoder::do_pass () int got_subtitle; AVSubtitle sub; if (avcodec_decode_subtitle2 (_subtitle_codec_context, &sub, &got_subtitle, &_packet) && got_subtitle) { - /* I'm not entirely sure why, but sometimes we get an AVSubtitle with - no AVSubtitleRects. + /* Sometimes we get an empty AVSubtitle, which is used by some codecs to + indicate that the previous subtitle should stop. */ if (sub.num_rects > 0) { process_subtitle (shared_ptr (new TimedSubtitle (sub, _first_video.get()))); + } else { + process_subtitle (shared_ptr ()); } avsubtitle_free (&sub); } -- cgit v1.2.3