summaryrefslogtreecommitdiff
path: root/src/lib/video_content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-10-29 18:40:48 +0000
committerCarl Hetherington <cth@carlh.net>2013-10-29 18:40:48 +0000
commit8053593f2ccff66287c43d20a8f28be9919bff75 (patch)
tree135be0576c45556f6b19b6746a9d9e0a1a957245 /src/lib/video_content.cc
parent8d31298c71df875d88e9f22061645d54309875eb (diff)
Seek past trim on setting up player pieces.
Diffstat (limited to 'src/lib/video_content.cc')
-rw-r--r--src/lib/video_content.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index 347836855..d0eab4dbf 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -26,6 +26,8 @@
#include "compose.hpp"
#include "config.h"
#include "colour_conversion.h"
+#include "util.h"
+#include "film.h"
#include "i18n.h"
@@ -289,3 +291,21 @@ VideoContent::video_size_after_crop () const
{
return crop().apply (video_size_after_3d_split ());
}
+
+/** @param t A time offset from the start of this piece of content.
+ * @return Corresponding frame index.
+ */
+VideoContent::Frame
+VideoContent::time_to_content_video_frames (Time t) const
+{
+ shared_ptr<const Film> film = _film.lock ();
+ assert (film);
+
+ FrameRateConversion frc (video_frame_rate(), film->video_frame_rate());
+
+ /* Here we are converting from time (in the DCP) to a frame number in the content.
+ Hence we need to use the DCP's frame rate and the double/skip correction, not
+ the source's rate.
+ */
+ return t * film->video_frame_rate() / (frc.factor() * TIME_HZ);
+}