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/util.cc | |
| parent | 120c587cffb540d18b519f53615dd73e33df177c (diff) | |
Assorted image subtitle fixes.
Diffstat (limited to 'src/lib/util.cc')
| -rw-r--r-- | src/lib/util.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc index bffbe90d4..d8c754607 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -564,18 +564,21 @@ wrapped_av_malloc (size_t s) } return p; } - -ContentTimePeriod + +FFmpegSubtitlePeriod subtitle_period (AVSubtitle const & sub) { ContentTime const packet_time = ContentTime::from_seconds (static_cast<double> (sub.pts) / AV_TIME_BASE); - ContentTimePeriod period ( + if (sub.end_display_time == static_cast<uint32_t> (-1)) { + /* End time is not known */ + return FFmpegSubtitlePeriod (packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3)); + } + + return FFmpegSubtitlePeriod ( packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3), packet_time + ContentTime::from_seconds (sub.end_display_time / 1e3) ); - - return period; } map<string, string> |
