Use FAB subtitler's rather odd DFC -> frame rate mapping.
[libsub.git] / src / time_pair.cc
index 3ef2429c96e143dfe52c7ae1922f05e955a1c6d0..9fc7974ef5353ce86d14f3bac0fea2c290f0ce66 100644 (file)
@@ -23,25 +23,45 @@ using std::ostream;
 using namespace sub;
 
 FrameTime
-TimePair::frame (float frames_per_second) const
+TimePair::frame (float fps) const
 {
        if (_frame) {
                return _frame.get ();
        }
 
        MetricTime const m = _metric.get ();
-       return FrameTime (m.hours(), m.minutes(), m.seconds(), m.milliseconds() * frames_per_second / 1000);
+       return FrameTime (m.hours(), m.minutes(), m.seconds(), m.milliseconds() * fps / 1000);
 }
 
 MetricTime
-TimePair::metric (float frames_per_second) const
+TimePair::metric (float fps) const
 {
        if (_metric) {
                return _metric.get ();
        }
 
        FrameTime const f = _frame.get ();
-       return MetricTime (f.hours(), f.minutes(), f.seconds(), f.frames() * 1000 / frames_per_second);
+       return MetricTime (f.hours(), f.minutes(), f.seconds(), f.frames() * 1000 / fps);
+}
+
+void
+TimePair::add (FrameTime t, float fps)
+{
+       if (_frame) {
+               _frame.get().add (t, fps);
+       } else {
+               _metric.get().add (MetricTime (t.hours(), t.minutes(), t.seconds(), t.frames() * 1000 / fps));
+       }
+}
+
+void
+TimePair::scale (float f, float fps)
+{
+       if (_frame) {
+               _frame.get().scale (f, fps);
+       } else {
+               _metric.get().scale (f);
+       }
 }
 
 bool