summaryrefslogtreecommitdiff
path: root/src/lib/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-05-22 16:53:38 +0100
committerCarl Hetherington <cth@carlh.net>2014-05-22 16:53:38 +0100
commit24d54ea7fe1ba128cf8d3521d6738fc73a7c623e (patch)
tree7c3674e34b30f81334dc8f35a91d3cbb31b7ff9d /src/lib/util.cc
parentd156fe45ee21fc416ce6b9e43ceed95bf42fde41 (diff)
Basics of noting subtitle times in FFmpegSubtitleStreams.
Diffstat (limited to 'src/lib/util.cc')
-rw-r--r--src/lib/util.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 14dfd1fa5..6e370f577 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -982,3 +982,16 @@ ScopedTemporary::close ()
_open = 0;
}
}
+
+ContentTimePeriod
+subtitle_period (AVSubtitle const & sub)
+{
+ ContentTime const packet_time = ContentTime::from_seconds (static_cast<double> (sub.pts) / AV_TIME_BASE);
+
+ ContentTimePeriod period (
+ packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3),
+ packet_time + ContentTime::from_seconds (sub.end_display_time / 1e3)
+ );
+
+ return period;
+}