50 #ifndef COMMON_TIMESTAMP_H 51 #define COMMON_TIMESTAMP_H int64 frameDiff(const Timestamp &ts) const
Computes the number of frames between this timestamp and ts.
int64 totalNumberOfFrames() const
Return the time in frames described by this timestamp.
A simple rational class that holds fractions.
uint64 framerate() const
Return the framerate used by this timestamp.
uint64 _framerate
The internal framerate, i.e.
bool operator==(const Timestamp &ts) const
Check whether to timestamps describe the exact same moment in time.
int64 msecsDiff(const Timestamp &ts) const
Computes the number off milliseconds between this timestamp and ts.
bool operator!=(const Timestamp &ts) const
int64 _secs
The seconds part of this timestamp.
bool operator>=(const Timestamp &ts) const
bool operator<=(const Timestamp &ts) const
Timestamp operator-() const
Timestamp(uint64 msecs=0, uint64 framerate=1)
Set up a timestamp with a given time and framerate.
Timestamp addMsecs(int64 msecs) const
Returns a new timestamp, which corresponds to the time encoded by this timestamp with the given numbe...
Timestamp operator+(const Timestamp &ts) const
Compute the sum of two timestamps.
uint64 _framerateFactor
Factor by which the original framerate specified by the client code was multipled to obtain the inter...
int64 cmp(const Timestamp &ts) const
Compare this timestamp to another one and return a value similar to strcmp.
Low-level type definitions to handle fixed width types portably.
void normalize()
Normalize this timestamp by making _numFrames non-negative and reducing it modulo _framerate...
int64 secs() const
Return the time in seconds described by this timestamp, rounded down.
int64 numberOfFrames() const
A timestamp consists of a number of seconds, plus a number of frames, the latter describing a fractio...
bool operator>(const Timestamp &ts) const
bool operator<(const Timestamp &ts) const
Timestamps allow specifying points in time and measuring time intervals with a sub-millisecond granul...
int64 msecs() const
Return the time in milliseconds described by this timestamp, rounded down.
int64 _numFrames
The number of frames which together with _secs encodes the timestamp.
Timestamp addFrames(int64 frames) const
Returns a new timestamp, which corresponds to the time encoded by this timestamp with the given numbe...
Timestamp convertToFramerate(uint64 newFramerate) const
Return a timestamp which represents as closely as possible the point in time describes by this timest...
void addIntern(const Timestamp &ts)
Add another timestamp to this one and normalize the result.