X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fframe_time.cc;h=65996c090742082d25a48700a64b961a3dbef59c;hb=589a2d8108899141756bd41126ab117e42f17701;hp=da9973cc0904e80e26fec463da6dd8a28aad23dd;hpb=99d72a19f9e5ebbbb36bbbb95164a15c165a6a42;p=libsub.git 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 @@ -63,6 +63,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; @@ -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 + ); +}