diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-05-12 16:13:48 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-05-12 16:13:48 +0100 |
| commit | 2bfd531137f1a4874493186015046e33c5a07c1e (patch) | |
| tree | 76f753a5307e8e37c9802aed765f2c93ca911ac2 /src/lib/ffmpeg_examiner.cc | |
| parent | 120c587cffb540d18b519f53615dd73e33df177c (diff) | |
Assorted image subtitle fixes.
Diffstat (limited to 'src/lib/ffmpeg_examiner.cc')
| -rw-r--r-- | src/lib/ffmpeg_examiner.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index 4409526dc..e4f4e6f29 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -150,13 +150,18 @@ FFmpegExaminer::subtitle_packet (AVCodecContext* context, shared_ptr<FFmpegSubti int frame_finished; AVSubtitle sub; if (avcodec_decode_subtitle2 (context, &sub, &frame_finished, &_packet) >= 0 && frame_finished) { - ContentTimePeriod const period = subtitle_period (sub); - if (sub.num_rects == 0 && !stream->periods.empty () && stream->periods.back().to > period.from) { - /* Finish the last subtitle */ - stream->periods.back().to = period.from; + FFmpegSubtitlePeriod const period = subtitle_period (sub); + if (sub.num_rects <= 0 && _last_subtitle_start) { + stream->periods.push_back (ContentTimePeriod (_last_subtitle_start.get (), period.from)); + _last_subtitle_start = optional<ContentTime> (); } else if (sub.num_rects == 1) { - stream->periods.push_back (period); + if (period.to) { + stream->periods.push_back (ContentTimePeriod (period.from, period.to.get ())); + } else { + _last_subtitle_start = period.from; + } } + avsubtitle_free (&sub); } } |
