AJA NTV2 SDK  17.5.0.1492
NTV2 SDK 17.5.0.1492
AJATimeCode Class Reference

Utility class for timecodes. More...

#include <timecode.h>

Public Member Functions

 AJATimeCode ()
 
 AJATimeCode (uint32_t frame, bool bStdTcForHfr=true)
 
 AJATimeCode (const std::string &str, const AJATimeBase &timeBase, bool bDropFrame, bool bStdTcForHfr=true)
 
 AJATimeCode (const std::string &str, const AJATimeBase &timeBase)
 
 AJATimeCode (const AJATimeCode &other)
 
virtual ~AJATimeCode ()
 
void QueryString (std::string &str, const AJATimeBase &timeBase, bool bDropFrame, bool bStdTcForHfr, AJATimecodeNotation notation=AJA_TIMECODE_LEGACY)
 
void QueryString (std::string &str, const AJATimeBase &timeBase, bool bDropFrame, AJATimecodeNotation notation=AJA_TIMECODE_LEGACY)
 
void QuerySMPTEString (char *pString, const AJATimeBase &timeBase, bool bDropFrame)
 
uint32_t QueryFrame (void) const
 
bool QueryStdTimecodeForHfr ()
 
void QueryHmsf (uint32_t &h, uint32_t &m, uint32_t &s, uint32_t &f, const AJATimeBase &timeBase, bool bDropFrame) const
 
void Set (uint32_t frame)
 
void Set (const std::string &str, const AJATimeBase &timeBase)
 
void SetWithCleanup (const std::string &str, const AJATimeBase &timeBase, bool bDrop)
 
void Set (const std::string &str, const AJATimeBase &timeBase, bool bDropFrame)
 
void SetHmsf (uint32_t h, uint32_t m, uint32_t s, uint32_t f, const AJATimeBase &timeBase, bool bDropFrame, bool bStdTcForHfr, uint32_t addFrame)
 
void SetHmsf (uint32_t h, uint32_t m, uint32_t s, uint32_t f, const AJATimeBase &timeBase, bool bDropFrame)
 
void SetSMPTEString (const char *pBufr, const AJATimeBase &timeBase)
 
void SetRP188 (const uint32_t inDBB, const uint32_t inLo, const uint32_t inHi, const AJATimeBase &inTimeBase)
 
void QueryRP188 (uint32_t &outDBB, uint32_t &outLo, uint32_t &outHi, const AJATimeBase &timeBase, const bool bDrop)
 
void SetStdTimecodeForHfr (bool bStdTc)
 
AJATimeCodeoperator= (const AJATimeCode &val)
 
AJATimeCodeoperator+= (const AJATimeCode &val)
 
AJATimeCodeoperator-= (const AJATimeCode &val)
 
AJATimeCodeoperator+= (const int32_t val)
 
AJATimeCodeoperator-= (const int32_t val)
 
const AJATimeCode operator+ (const AJATimeCode &val) const
 
const AJATimeCode operator+ (const int32_t val) const
 
const AJATimeCode operator- (const AJATimeCode &val) const
 
const AJATimeCode operator- (const int32_t val) const
 
bool operator== (const AJATimeCode &val) const
 
bool operator< (const AJATimeCode &val) const
 
bool operator< (const int32_t val) const
 
bool operator> (const AJATimeCode &val) const
 
bool operator> (const int32_t val) const
 
bool operator!= (const AJATimeCode &val) const
 
void QueryString (char *pStr, const AJATimeBase &tb, bool df, AJATimecodeNotation notation=AJA_TIMECODE_LEGACY)
 
void QueryRP188 (uint32_t *pDbb, uint32_t *pLo, uint32_t *pHi, const AJATimeBase &tb, bool drop)
 

Static Public Member Functions

static uint32_t CalcFrame (uint32_t h, uint32_t m, uint32_t s, uint32_t f, const AJATimeBase &timeBase, bool bDropFrame, bool bStdTcForHfr, uint32_t addFrame)
 
static uint32_t CalcHmsf (uint32_t &h, uint32_t &m, uint32_t &s, uint32_t &f, uint32_t frame, const AJATimeBase &timeBase, bool bDropFrame, bool bStdTcForHfr)
 
static int QuerySMPTEStringSize (void)
 
static bool QueryIsDropFrame (const std::string &str)
 
static int QueryStringSize (void)
 
static bool QueryIsRP188DropFrame (const uint32_t inDBB, const uint32_t inLo, const uint32_t inHi)
 

Detailed Description

Utility class for timecodes.

This is a storage and conversion class for timecodes.

Definition at line 28 of file timecode.h.

Constructor & Destructor Documentation

◆ AJATimeCode() [1/5]

AJATimeCode::AJATimeCode ( )

Definition at line 44 of file timecode.cpp.

◆ AJATimeCode() [2/5]

AJATimeCode::AJATimeCode ( uint32_t  frame,
bool  bStdTcForHfr = true 
)

Definition at line 50 of file timecode.cpp.

◆ AJATimeCode() [3/5]

AJATimeCode::AJATimeCode ( const std::string &  str,
const AJATimeBase timeBase,
bool  bDropFrame,
bool  bStdTcForHfr = true 
)

Definition at line 56 of file timecode.cpp.

◆ AJATimeCode() [4/5]

AJATimeCode::AJATimeCode ( const std::string &  str,
const AJATimeBase timeBase 
)

Definition at line 62 of file timecode.cpp.

◆ AJATimeCode() [5/5]

AJATimeCode::AJATimeCode ( const AJATimeCode other)

Definition at line 68 of file timecode.cpp.

◆ ~AJATimeCode()

AJATimeCode::~AJATimeCode ( )
virtual

Definition at line 77 of file timecode.cpp.

Member Function Documentation

◆ CalcFrame()

uint32_t AJATimeCode::CalcFrame ( uint32_t  h,
uint32_t  m,
uint32_t  s,
uint32_t  f,
const AJATimeBase timeBase,
bool  bDropFrame,
bool  bStdTcForHfr,
uint32_t  addFrame 
)
static

Calculate frame count given hmsf presentation.

Parameters
[in]hspecifies the hours value.
[in]mspecifies the minutes value.
[in]sspecifies the seconds value.
[in]fspecifies the frames value.
[in]timeBaseframe rate from which to calculate string.
[in]bDropFrametrue if using drop frame calculation.
[in]bStdTcForHfrtrue to use standard (LFR) frame values (1/2 frame values for framerates above 30 fps, 1/4 for rates above 60)
[in]addFramenumber of frames to add when bStdTcForHfr=true (e.g given 60 fps, h=m=s=0 f=29 addFrame=1 -> return=59).
Returns
Return calculated frame count based on input values

Definition at line 107 of file timecode.cpp.

◆ CalcHmsf()

uint32_t AJATimeCode::CalcHmsf ( uint32_t &  h,
uint32_t &  m,
uint32_t &  s,
uint32_t &  f,
uint32_t  frame,
const AJATimeBase timeBase,
bool  bDropFrame,
bool  bStdTcForHfr = true 
)
static

Calculate hmsf values given frame count. Return add-frame remainder when using std timecode presentation

Parameters
[out]hspecifies the hours value.
[out]mspecifies the minutes value.
[out]sspecifies the seconds value.
[out]fspecifies the frames value.
[in]frameframe count.
[in]timeBaseframe rate from which to calculate hmsf values.
[in]bDropFrametrue to use drop frame calculation.
[in]bStdTcForHfrtrue to use standard (LFR) frame values (1/2 frame values for framerates above 30 fps, 1/4 for rates above 60 fps)
Returns
Return remaining uncounted frame with bStdTcForHfr=true (e.g given 60 fps, frame=59 => h=m=s=0 f=29 return=1)

Definition at line 170 of file timecode.cpp.

◆ operator!=()

bool AJATimeCode::operator!= ( const AJATimeCode val) const

Definition at line 701 of file timecode.cpp.

◆ operator+() [1/2]

const AJATimeCode AJATimeCode::operator+ ( const AJATimeCode val) const

Definition at line 747 of file timecode.cpp.

◆ operator+() [2/2]

const AJATimeCode AJATimeCode::operator+ ( const int32_t  val) const

Definition at line 752 of file timecode.cpp.

◆ operator+=() [1/2]

AJATimeCode & AJATimeCode::operator+= ( const AJATimeCode val)

Definition at line 709 of file timecode.cpp.

◆ operator+=() [2/2]

AJATimeCode & AJATimeCode::operator+= ( const int32_t  val)

Definition at line 715 of file timecode.cpp.

◆ operator-() [1/2]

const AJATimeCode AJATimeCode::operator- ( const AJATimeCode val) const

Definition at line 760 of file timecode.cpp.

◆ operator-() [2/2]

const AJATimeCode AJATimeCode::operator- ( const int32_t  val) const

Definition at line 765 of file timecode.cpp.

◆ operator-=() [1/2]

AJATimeCode & AJATimeCode::operator-= ( const AJATimeCode val)

Definition at line 724 of file timecode.cpp.

◆ operator-=() [2/2]

AJATimeCode & AJATimeCode::operator-= ( const int32_t  val)

Definition at line 734 of file timecode.cpp.

◆ operator<() [1/2]

bool AJATimeCode::operator< ( const AJATimeCode val) const

Definition at line 669 of file timecode.cpp.

◆ operator<() [2/2]

bool AJATimeCode::operator< ( const int32_t  val) const

Definition at line 675 of file timecode.cpp.

◆ operator=()

AJATimeCode & AJATimeCode::operator= ( const AJATimeCode val)

Definition at line 643 of file timecode.cpp.

◆ operator==()

bool AJATimeCode::operator== ( const AJATimeCode val) const

Definition at line 656 of file timecode.cpp.

◆ operator>() [1/2]

bool AJATimeCode::operator> ( const AJATimeCode val) const

Definition at line 685 of file timecode.cpp.

◆ operator>() [2/2]

bool AJATimeCode::operator> ( const int32_t  val) const

Definition at line 691 of file timecode.cpp.

◆ QueryFrame()

uint32_t AJATimeCode::QueryFrame ( void  ) const

Query frame number.

Returns
frame number.

Definition at line 92 of file timecode.cpp.

◆ QueryHmsf()

void AJATimeCode::QueryHmsf ( uint32_t &  h,
uint32_t &  m,
uint32_t &  s,
uint32_t &  f,
const AJATimeBase timeBase,
bool  bDropFrame 
) const

Query hmsf values showing timecode for current frame count given the passed parameters.

Parameters
[out]hspecifies the hours value.
[out]mspecifies the minutes value.
[out]sspecifies the seconds value.
[out]fspecifies the frames value.
[in]timeBaseframe rate from which to calculate string.
[in]bDropFramedrop frame value for string.

Definition at line 292 of file timecode.cpp.

◆ QueryIsDropFrame()

bool AJATimeCode::QueryIsDropFrame ( const std::string &  str)
static

Query string showing timecode for current frame count given the passed parameters.

Parameters
[in]strstring with timecode

Definition at line 81 of file timecode.cpp.

◆ QueryIsRP188DropFrame()

bool AJATimeCode::QueryIsRP188DropFrame ( const uint32_t  inDBB,
const uint32_t  inLo,
const uint32_t  inHi 
)
static

Query if rp188 data is drop frame or not

Parameters
[in]inDBBSpecifies the DBB bits of the RP188 struct.
[in]inLoSpecifies the lo-order 32-bit word of the RP188 struct.
[in]inHiSpecifies the hi-order 32-bit word of the RP188 struct.

Definition at line 563 of file timecode.cpp.

◆ QueryRP188() [1/2]

void AJATimeCode::QueryRP188 ( uint32_t &  outDBB,
uint32_t &  outLo,
uint32_t &  outHi,
const AJATimeBase timeBase,
const bool  bDrop 
)

Get RP188 register values using the given timebase, and drop frame.

Parameters
[out]outDBBReceives the DBB component.
[out]outLoReceives the low byte component.
[out]outHiReceives the high byte component.
[in]timeBaseSpecifies the AJATimeBase to use.
[in]bDropSpecify true if forcing drop-frame; otherwise false.
Bug:
Unimplemented.
Todo:
Needs to be implemented.

Definition at line 625 of file timecode.cpp.

◆ QueryRP188() [2/2]

void AJATimeCode::QueryRP188 ( uint32_t *  pDbb,
uint32_t *  pLo,
uint32_t *  pHi,
const AJATimeBase tb,
bool  drop 
)

◆ QuerySMPTEString()

void AJATimeCode::QuerySMPTEString ( char *  pString,
const AJATimeBase timeBase,
bool  bDropFrame 
)

Query SMPTE string showing timecode for current frame count given the passed parameters.

Parameters
[out]pStringbuffer in which to place string.
[in]timeBaseframe rate from which to calculate string.
[in]bDropFramedrop frame value for string.

Definition at line 401 of file timecode.cpp.

◆ QuerySMPTEStringSize()

int AJATimeCode::QuerySMPTEStringSize ( void  )
static

Query SMPTE string byte count.

Returns
number of bytes in SMPTE timecode string.

Definition at line 396 of file timecode.cpp.

◆ QueryStdTimecodeForHfr()

bool AJATimeCode::QueryStdTimecodeForHfr ( )
inline

Query HFR divide-by-two flag.

Returns
bStdTc Return true when using standard TC notation for HFR (e.g 01:00:00#59 -> 01:00:00:29), set to true by default

Definition at line 122 of file timecode.h.

◆ QueryString() [1/3]

void AJATimeCode::QueryString ( char *  pStr,
const AJATimeBase tb,
bool  df,
AJATimecodeNotation  notation = AJA_TIMECODE_LEGACY 
)

◆ QueryString() [2/3]

void AJATimeCode::QueryString ( std::string &  str,
const AJATimeBase timeBase,
bool  bDropFrame,
AJATimecodeNotation  notation = AJA_TIMECODE_LEGACY 
)

Query string showing timecode for current frame count given the passed parameters.

Parameters
[out]strstring in which to place timecode.
[in]timeBaseframe rate from which to calculate string.
[in]bDropFramedrop frame value for string.
[in]notationspecifies AJATimecodeNotation for timecode delimiters
See also
Timecode Display

Definition at line 381 of file timecode.cpp.

◆ QueryString() [3/3]

void AJATimeCode::QueryString ( std::string &  str,
const AJATimeBase timeBase,
bool  bDropFrame,
bool  bStdTcForHfr,
AJATimecodeNotation  notation = AJA_TIMECODE_LEGACY 
)

Query string showing timecode for current frame count given the passed parameters.

Parameters
[out]strstring in which to place timecode.
[in]timeBaseframe rate from which to calculate string.
[in]bDropFramedrop frame value for string.
[in]bStdTcForHfrtrue to use standard (LFR) frame values (1/2 frame values for framerates above 30 fps, 1/4 for rates above 60)
[in]notationspecifies AJATimecodeNotation for timecode delimiters
See also
Timecode Display

Definition at line 299 of file timecode.cpp.

◆ QueryStringSize()

int AJATimeCode::QueryStringSize ( void  )
static
Deprecated:
Not needed when using std::string.

Definition at line 87 of file timecode.cpp.

◆ Set() [1/3]

void AJATimeCode::Set ( const std::string &  str,
const AJATimeBase timeBase 
)

Set current frame number.

Parameters
[in]strxx:xx:xx:xx style string representing new frame number.
[in]timeBaseframe rate associated with pString.

Definition at line 489 of file timecode.cpp.

◆ Set() [2/3]

void AJATimeCode::Set ( const std::string &  str,
const AJATimeBase timeBase,
bool  bDropFrame 
)

Set current frame number.

Parameters
[in]strxx:xx:xx:xx style string representing new frame number.
[in]timeBaseframe rate associated with pString.
[in]bDropFrametrue if forcing dropframe, false otherwise.

Definition at line 439 of file timecode.cpp.

◆ Set() [3/3]

void AJATimeCode::Set ( uint32_t  frame)

Set current frame number.

Parameters
[in]framenew frame number.

Definition at line 420 of file timecode.cpp.

◆ SetHmsf() [1/2]

void AJATimeCode::SetHmsf ( uint32_t  h,
uint32_t  m,
uint32_t  s,
uint32_t  f,
const AJATimeBase timeBase,
bool  bDropFrame 
)

Definition at line 431 of file timecode.cpp.

◆ SetHmsf() [2/2]

void AJATimeCode::SetHmsf ( uint32_t  h,
uint32_t  m,
uint32_t  s,
uint32_t  f,
const AJATimeBase timeBase,
bool  bDropFrame,
bool  bStdTcForHfr,
uint32_t  addFrame 
)

Set current frame number.

Parameters
[in]hspecifies the hours value.
[in]mspecifies the minutes value.
[in]sspecifies the seconds value.
[in]fspecifies the frames value.
[in]timeBaseframe rate associated with hmsf.
[in]bDropFrametrue if forcing dropframe, false otherwise.
[in]bStdTcForHfrtrue to use standard (LFR) frame values (1/2 frame values for framerates above 30 fps, 1/4 for rates above 60)
[in]addFramenumber of frames to add when using std TC presentation (e.g given 60 fps, 00:00:00.29 addFrame=0 => set:frame=58 .. 00:00:00:29 addFrame=1 => set:frame=59).

Definition at line 425 of file timecode.cpp.

◆ SetRP188()

void AJATimeCode::SetRP188 ( const uint32_t  inDBB,
const uint32_t  inLo,
const uint32_t  inHi,
const AJATimeBase inTimeBase 
)

Set timecode via RP188 bytes.

Parameters
[in]inDBBSpecifies the DBB bits of the RP188 struct.
[in]inLoSpecifies the lo-order 32-bit word of the RP188 struct.
[in]inHiSpecifies the hi-order 32-bit word of the RP188 struct.
[in]inTimeBaseSpecifies the time base to use.

Definition at line 570 of file timecode.cpp.

◆ SetSMPTEString()

void AJATimeCode::SetSMPTEString ( const char *  pBufr,
const AJATimeBase timeBase 
)

Set timecode via a SMPTE string.

Parameters
[in]pBufrpointer to string.
[in]timeBasetime base associated with string.

Definition at line 549 of file timecode.cpp.

◆ SetStdTimecodeForHfr()

void AJATimeCode::SetStdTimecodeForHfr ( bool  bStdTc)
inline

Set HFR divide-by-two flag.

Parameters
[in]bStdTcSet true when using standard TC notation for HFR (e.g 01:00:00#59 -> 01:00:00:29), set to true by default

Definition at line 220 of file timecode.h.

◆ SetWithCleanup()

void AJATimeCode::SetWithCleanup ( const std::string &  str,
const AJATimeBase timeBase,
bool  bDrop 
)

Set current frame number. A variant which may have junk in the string.

Parameters
[in]strxx:xx:xx:xx style string representing new frame number.
[in]timeBaseframe rate associated with pString.
[in]bDroptrue if drop frame

Definition at line 495 of file timecode.cpp.


The documentation for this class was generated from the following files: