Class for holding and manipulating timecode. More...
#include <timecode.h>
Classes | |
| class | Mode |
| Describes the timecode mode (frame rate and drop-frame status). More... | |
Public Types | |
| enum | TimecodeType { NDF24 , NDF25 , NDF30 , DF30 } |
| Standard timecode types. More... | |
| enum | Flags { DropFrame = 0x00000001 , FirstField = 0x00000002 } |
| Timecode flag bits. More... | |
| using | FrameNumber = uint64_t |
| Type used to represent absolute frame numbers. | |
| using | DigitType = uint8_t |
| Type used for individual timecode digit fields. | |
| using | FlagsType = uint32_t |
| Type used for timecode flag bitmasks. | |
Public Member Functions | |
| Timecode ()=default | |
| Constructs a default (invalid) timecode. | |
| Timecode (const Mode &md) | |
| Constructs a timecode with the given mode and zeroed digits. | |
| Timecode (DigitType h, DigitType m, DigitType s, DigitType f) | |
| Constructs a timecode with explicit digit values and no specific mode. | |
| Timecode (const Mode &md, DigitType h, DigitType m, DigitType s, DigitType f) | |
| Constructs a timecode with a mode and explicit digit values. | |
| Timecode (const String &str) | |
| Constructs a timecode by parsing a string representation. | |
| bool | operator== (const Timecode &other) const |
| bool | operator!= (const Timecode &other) const |
| bool | operator> (const Timecode &other) const |
| bool | operator< (const Timecode &other) const |
| bool | operator>= (const Timecode &other) const |
| bool | operator<= (const Timecode &other) const |
| bool | isValid () const |
| Returns true if the timecode mode is valid. | |
| bool | isDropFrame () const |
| Returns true if the timecode uses drop-frame counting. | |
| bool | isFirstField () const |
| Returns true if this timecode represents the first field of an interlaced frame. | |
| uint32_t | fps () const |
| Returns the frames-per-second rate. | |
| Mode | mode () const |
| Returns the timecode mode. | |
| Timecode & | operator++ () |
| Pre-increment: advances the timecode by one frame. | |
| Timecode | operator++ (int) |
| Post-increment: advances the timecode by one frame, returning the previous value. | |
| Timecode & | operator-- () |
| Pre-decrement: moves the timecode back by one frame. | |
| Timecode | operator-- (int) |
| Post-decrement: moves the timecode back by one frame, returning the previous value. | |
| void | set (DigitType h, DigitType m, DigitType s, DigitType f) |
| Sets the timecode digit fields directly. | |
| DigitType | hour () const |
| Returns the hour digit. | |
| DigitType | min () const |
| Returns the minute digit. | |
| DigitType | sec () const |
| Returns the second digit. | |
| DigitType | frame () const |
| Returns the frame digit. | |
| const VtcFormat * | vtcFormat () const |
| Returns the underlying libvtc format pointer from the mode. | |
| operator String () const | |
| Implicit conversion to String using SMPTE format. | |
| std::pair< String, Error > | toString (const VtcStringFormat *fmt=&VTC_STR_FMT_SMPTE) const |
| Converts the timecode to a string. | |
| std::pair< FrameNumber, Error > | toFrameNumber () const |
| Converts the timecode to an absolute frame number. | |
Static Public Member Functions | |
| static Timecode | fromFrameNumber (const Mode &mode, FrameNumber frameNumber) |
| Constructs a Timecode from a mode and absolute frame number. | |
| static std::pair< Timecode, Error > | fromString (const String &str) |
| Parses a Timecode from its string representation. | |
Class for holding and manipulating timecode.
While this class supports all the capabilities of SMPTE timecode, it exceeds it in many ways. It makes no restrictions on hour counts above 23, or frame rates above 30. It will, of course, attempt to do the best it can when asked to output a SMPTE timecode (i.e. the hours will be modulo 24).
Timecode flag bits.
| Enumerator | |
|---|---|
| DropFrame | Indicates drop-frame timecode. |
| FirstField | Indicates the first field of an interlaced frame. |
Standard timecode types.
| Enumerator | |
|---|---|
| NDF24 | 24 fps non-drop-frame (maps to VTC_FORMAT_24) |
| NDF25 | 25 fps non-drop-frame (maps to VTC_FORMAT_25) |
| NDF30 | 30 fps non-drop-frame (maps to VTC_FORMAT_30_NDF) |
| DF30 | 29.97 fps drop-frame (maps to VTC_FORMAT_29_97_DF) |
Constructs a timecode with the given mode and zeroed digits.
| md | The timecode mode. |
Constructs a timecode with explicit digit values and no specific mode.
| h | Hour digit. |
| m | Minute digit. |
| s | Second digit. |
| f | Frame digit. |
Constructs a timecode with a mode and explicit digit values.
| md | The timecode mode. |
| h | Hour digit. |
| m | Minute digit. |
| s | Second digit. |
| f | Frame digit. |
Constructs a timecode by parsing a string representation.
| str | The string to parse. |
|
static |
Sets the timecode digit fields directly.
| h | Hour digit. |
| m | Minute digit. |
| s | Second digit. |
| f | Frame digit. |
| std::pair< FrameNumber, Error > Timecode::toFrameNumber | ( | ) | const |
Converts the timecode to an absolute frame number.
| std::pair< String, Error > Timecode::toString | ( | const VtcStringFormat * | fmt = &VTC_STR_FMT_SMPTE | ) | const |
Converts the timecode to a string.
| fmt | The string format to use (default: SMPTE). |