*/
+/** @file src/time_pair.h
+ * @brief TimePair class.
+ */
+
#ifndef LIBSUB_TIME_PAIR_H
#define LIBSUB_TIME_PAIR_H
namespace sub {
+/** @class TimePair
+ * @brief A time, expressed either in metric (h:m:s:ms) or frames (h:m:s:f).
+ */
class TimePair
{
public:
+ TimePair () {}
+
+ TimePair (FrameTime t)
+ : _frame (t)
+ {}
+
+ TimePair (MetricTime t)
+ : _metric (t)
+ {}
+
void set_frame (FrameTime t) {
_frame = t;
_metric = boost::optional<MetricTime> ();
return _metric;
}
- FrameTime frame (float frames_per_second) const;
- MetricTime metric (float frames_per_second) const;
+ FrameTime frame (float fps) const;
+ MetricTime metric (float fps) const;
+
+ void add (FrameTime t, float fps);
+ void scale (float f, float fps);
bool operator== (TimePair const & other) const;
boost::optional<MetricTime> _metric;
};
+std::ostream& operator<< (std::ostream & s, TimePair const &);
+
}
#endif