summaryrefslogtreecommitdiff
path: root/src/frame_time.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/frame_time.cc')
-rw-r--r--src/frame_time.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/frame_time.cc b/src/frame_time.cc
index da9973c..65996c0 100644
--- a/src/frame_time.cc
+++ b/src/frame_time.cc
@@ -64,6 +64,12 @@ FrameTime::timecode () const
FrameTime::FrameTime (int64_t f, float fps)
{
+ set_from_frames (f, fps);
+}
+
+void
+FrameTime::set_from_frames (int64_t f, float fps)
+{
_hours = f / (60 * 60 * fps);
f -= _hours * 60 * 60 * fps;
_minutes = f / (60 * fps);
@@ -96,3 +102,12 @@ FrameTime::add (FrameTime t, float fps)
_hours += t.hours ();
}
+
+void
+FrameTime::scale (float f, float frames_per_second)
+{
+ set_from_frames (
+ (((_hours * 3600 + _minutes * 60 + _seconds) * frames_per_second) + _frames) * f,
+ frames_per_second
+ );
+}