summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-10-20 00:52:08 +0100
committerCarl Hetherington <cth@carlh.net>2012-10-20 00:52:08 +0100
commitd7d1a6b8d97390e57ce8d2442d90d25f97d8b562 (patch)
tree22fc8fdb65b6d7e7f09ee196f34b8faa2807431a /src/lib/ffmpeg_decoder.cc
parente06f9e4dc4290b387eb08fea0c90460ef46654b4 (diff)
Cope with AVSubtitles having no AVSubtitleRects.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
-rw-r--r--src/lib/ffmpeg_decoder.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 828934604..554188343 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -254,7 +254,12 @@ FFmpegDecoder::do_pass ()
int got_subtitle;
AVSubtitle sub;
if (avcodec_decode_subtitle2 (_subtitle_codec_context, &sub, &got_subtitle, &_packet) && got_subtitle) {
- process_subtitle (shared_ptr<TimedSubtitle> (new TimedSubtitle (sub)));
+ /* I'm not entirely sure why, but sometimes we get an AVSubtitle with
+ no AVSubtitleRects.
+ */
+ if (sub.num_rects > 0) {
+ process_subtitle (shared_ptr<TimedSubtitle> (new TimedSubtitle (sub)));
+ }
avsubtitle_free (&sub);
}
}