diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-10-24 13:52:24 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-10-24 13:52:24 +0100 |
| commit | 7a25c08988111224f264ecfffa7df392d4c9af1a (patch) | |
| tree | 6a50872f1b03d4ef9d91121eb6e8334bc1c67970 /src/lib/ffmpeg_decoder.cc | |
| parent | 6d1748f37097e6f61ee1c6fb66c4352b0834ec8c (diff) | |
Try to fix overrunning subtitles.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 6 |
1 files changed, 4 insertions, 2 deletions
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<TimedSubtitle> (new TimedSubtitle (sub, _first_video.get()))); + } else { + process_subtitle (shared_ptr<TimedSubtitle> ()); } avsubtitle_free (&sub); } |
