diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-08-26 20:27:45 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-08-26 20:27:45 +0100 |
| commit | 6b62e9c77b2a45fd1d7084626f2bb2949e832e5f (patch) | |
| tree | 486f58182c8b740a8ba2be20d59e002f2d8c55dd /src/lib/ffmpeg.cc | |
| parent | e7e9347cdd1f43e0dd3d1ca35632e9493a010fc6 (diff) | |
Separate FFmpegSubtitlePeriod.
Diffstat (limited to 'src/lib/ffmpeg.cc')
| -rw-r--r-- | src/lib/ffmpeg.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index 1620b32b4..bba642484 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -246,3 +246,19 @@ FFmpeg::avio_seek (int64_t const pos, int whence) return _file_group.seek (pos, whence); } + +FFmpegSubtitlePeriod +FFmpeg::subtitle_period (AVSubtitle const & sub) +{ + ContentTime const packet_time = ContentTime::from_seconds (static_cast<double> (sub.pts) / AV_TIME_BASE); + + 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) + ); +} |
