103 bool operator==(
const Mode &
other)
const {
104 if(_format ==
other._format)
return _valid ==
other._valid;
105 if(_format ==
nullptr ||
other._format ==
nullptr) {
107 return _valid ==
other._valid && _format ==
other._format;
109 return _format->tc_fps ==
other._format->tc_fps &&
113 bool operator!=(
const Mode &
other)
const {
114 return !(*
this ==
other);
160 _mode(
Mode(0
u, 0
u)), _hour(
h), _min(
m), _sec(
s), _frame(
f) {}
168 _mode(
md), _hour(
h), _min(
m), _sec(
s), _frame(
f) {}
173 if(
err.isOk()) *
this =
tc;
177 return _mode ==
other._mode &&
178 _hour ==
other._hour &&
179 _min ==
other._min &&
180 _sec ==
other._sec &&
181 _frame ==
other._frame;
185 return !(*
this ==
other);
Dynamic array container wrapping std::vector.
Definition list.h:40
Encoding-aware string class with copy-on-write semantics.
Definition string.h:35
Describes the timecode mode (frame rate and drop-frame status).
Definition timecode.h:70
Mode(TimecodeType type)
Constructs a mode from a standard TimecodeType.
Definition timecode.h:94
Mode()=default
Constructs an invalid, default mode.
bool hasFormat() const
Returns true if a VtcFormat pointer is assigned.
Definition timecode.h:124
bool isValid() const
Returns true if this mode has been explicitly set.
Definition timecode.h:120
Mode(const VtcFormat *format)
Constructs a mode from a libvtc format pointer.
Definition timecode.h:77
const VtcFormat * vtcFormat() const
Returns the underlying libvtc format pointer.
Definition timecode.h:127
Mode(uint32_t fps, uint32_t flags)
Constructs a mode from a frame rate and flag set.
Definition timecode.h:84
uint32_t fps() const
Returns the frames-per-second rate, or 0 if no format is set.
Definition timecode.h:118
bool isDropFrame() const
Returns true if this mode uses drop-frame counting.
Definition timecode.h:122
Class for holding and manipulating timecode.
Definition timecode.h:45
Timecode(DigitType h, DigitType m, DigitType s, DigitType f)
Constructs a timecode with explicit digit values and no specific mode.
Definition timecode.h:159
static std::pair< Timecode, Error > fromString(const String &str)
Parses a Timecode from its string representation.
Timecode & operator--()
Pre-decrement: moves the timecode back by one frame.
Flags
Timecode flag bits.
Definition timecode.h:60
@ FirstField
Indicates the first field of an interlaced frame.
Definition timecode.h:62
@ DropFrame
Indicates drop-frame timecode.
Definition timecode.h:61
Timecode operator++(int)
Post-increment: advances the timecode by one frame, returning the previous value.
Definition timecode.h:218
Mode mode() const
Returns the timecode mode.
Definition timecode.h:213
DigitType sec() const
Returns the second digit.
Definition timecode.h:249
Timecode(const String &str)
Constructs a timecode by parsing a string representation.
Definition timecode.h:171
static Timecode fromFrameNumber(const Mode &mode, FrameNumber frameNumber)
Constructs a Timecode from a mode and absolute frame number.
TimecodeType
Standard timecode types.
Definition timecode.h:52
@ NDF25
25 fps non-drop-frame (maps to VTC_FORMAT_25)
Definition timecode.h:54
@ DF30
29.97 fps drop-frame (maps to VTC_FORMAT_29_97_DF)
Definition timecode.h:56
@ NDF24
24 fps non-drop-frame (maps to VTC_FORMAT_24)
Definition timecode.h:53
@ NDF30
30 fps non-drop-frame (maps to VTC_FORMAT_30_NDF)
Definition timecode.h:55
Timecode & operator++()
Pre-increment: advances the timecode by one frame.
Timecode(const Mode &md)
Constructs a timecode with the given mode and zeroed digits.
Definition timecode.h:153
DigitType frame() const
Returns the frame digit.
Definition timecode.h:251
const VtcFormat * vtcFormat() const
Returns the underlying libvtc format pointer from the mode.
Definition timecode.h:254
void set(DigitType h, DigitType m, DigitType s, DigitType f)
Sets the timecode digit fields directly.
Definition timecode.h:237
Timecode operator--(int)
Post-decrement: moves the timecode back by one frame, returning the previous value.
Definition timecode.h:226
DigitType hour() const
Returns the hour digit.
Definition timecode.h:245
bool isFirstField() const
Returns true if this timecode represents the first field of an interlaced frame.
Definition timecode.h:209
std::pair< String, Error > toString(const VtcStringFormat *fmt=&VTC_STR_FMT_SMPTE) const
Converts the timecode to a string.
bool isValid() const
Returns true if the timecode mode is valid.
Definition timecode.h:205
Timecode(const Mode &md, DigitType h, DigitType m, DigitType s, DigitType f)
Constructs a timecode with a mode and explicit digit values.
Definition timecode.h:167
uint32_t fps() const
Returns the frames-per-second rate.
Definition timecode.h:211
bool isDropFrame() const
Returns true if the timecode uses drop-frame counting.
Definition timecode.h:207
DigitType min() const
Returns the minute digit.
Definition timecode.h:247
std::pair< FrameNumber, Error > toFrameNumber() const
Converts the timecode to an absolute frame number.
Timecode()=default
Constructs a default (invalid) timecode.
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19