#include <ktime.h>
Definition at line 65 of file ktime.h.
Time Modes and Protocols |
|
enum | ETimeMode |
Time modes. More... |
|
enum | ETimeProtocol |
Time protocols. More... |
|
static void | SetGlobalTimeMode (ETimeMode pTimeMode, double pFrameRate=0.0) |
Set default time mode. |
|
static ETimeMode | GetGlobalTimeMode () |
Get default time mode. |
|
static void | SetGlobalTimeProtocol (ETimeProtocol pTimeProtocol) |
Set default time protocol. |
|
static ETimeProtocol | GetGlobalTimeProtocol () |
Get default time protocol. |
|
static double | GetFrameRate (ETimeMode pTimeMode) |
Get frame rate associated with time mode, in
frames per second. |
|
static ETimeMode | ConvertFrameRateToTimeMode (double pFrameRate, double lPrecision=0.00000001) |
Get time mode associated with frame rate.
|
|
Time Conversion |
|
void | Set (kLongLong pTime) |
Set time in internal format. |
|
const kLongLong & | Get () const |
Get time in internal format. |
|
void | SetMilliSeconds (kLongLong pMilliSeconds) |
Set time in milliseconds. |
|
kLongLong | GetMilliSeconds () const |
Get time in milliseconds. |
|
void | SetSecondDouble (double pTime) |
Set time in seconds. |
|
double | GetSecondDouble () const |
Get time in seconds. |
|
void | SetTime (int pHour, int pMinute, int pSecond, int pFrame=0, int pField=0, int pTimeMode=eDEFAULT_MODE, double pFramerate=0.0) |
Set time in hour/minute/second/frame/field
format. |
|
void | SetTime (int pHour, int pMinute, int pSecond, int pFrame, int pField, int pResidual, int pTimeMode, double pFramerate=0.0) |
Set time in
hour/minute/second/frame/field/residual format. |
|
bool | GetTime (kLongLong &pHour, kLongLong &pMinute, kLongLong &pSecond, kLongLong &pFrame, kLongLong &pField, kLongLong &pResidual, int pTimeMode=eDEFAULT_MODE, double pFramerate=0.0) const |
Get time in
hour/minute/second/frame/field/residual format. |
|
KTime | GetFramedTime (bool pRound=true) |
Return a Time Snapped on the
NEAREST(rounded) Frame (if asked). |
|
kLongLong | GetHour (bool pCummul=false, int pTimeMode=eDEFAULT_MODE, double pFramerate=0.0) const |
Get number of hours in time. |
|
kLongLong | GetMinute (bool pCummul=false, int pTimeMode=eDEFAULT_MODE, double pFramerate=0.0) const |
Get number of minutes in time. |
|
kLongLong | GetSecond (bool pCummul=false, int pTimeMode=eDEFAULT_MODE, double pFramerate=0.0) const |
Get number of seconds in time. |
|
kLongLong | GetFrame (bool pCummul=false, int pTimeMode=eDEFAULT_MODE, double pFramerate=0.0) const |
Get number of frames in time. |
|
kLongLong | GetField (bool pCummul=false, int pTimeMode=eDEFAULT_MODE, double pFramerate=0.0) const |
Get number of fields in time. |
|
kLongLong | GetResidual (int pTimeMode=eDEFAULT_MODE, double pFramerate=0.0) const |
Get residual time exceeding last full field.
|
|
char * | GetTimeString (char *pTimeString, int pInfo=5, int pTimeMode=eDEFAULT_MODE, int pTimeFormat=eDEFAULT_PROTOCOL, double pFramerate=0.0) const |
Get time in a human readable format.
|
|
void | SetTimeString (char *pTime, int pTimeMode=eDEFAULT_MODE, int pTimeFormat=eDEFAULT_PROTOCOL, double pFramerate=0.0) |
Set time in a human readable format.
|
|
Time Operators |
|
bool | operator== (const KTime &pTime) const |
Equality operator. |
|
bool | operator!= (const KTime &pTime) const |
Inequality operator. |
|
bool | operator>= (const KTime &pTime) const |
Superior or equal to operator. |
|
bool | operator<= (const KTime &pTime) const |
Inferior or equal to operator. |
|
bool | operator> (const KTime &pTime) const |
Superior to operator. |
|
bool | operator< (const KTime &pTime) const |
Inferior to operator. |
|
KTime & | operator= (const KTime &pTime) |
Assignment operator. |
|
KTime & | operator+= (const KTime &pTime) |
Addition operator. |
|
KTime & | operator-= (const KTime &pTime) |
Subtraction operator. |
|
KTime | operator+ (const KTime &pTime) const |
Addition operator. |
|
KTime | operator- (const KTime &pTime) const |
Subtraction operator. |
|
KTime | operator* (const int Mult) const |
Multiplication operator. |
|
KTime | operator/ (const KTime &pTime) const |
Division operator. |
|
KTime | operator* (const KTime &pTime) const |
Multiplication operator. |
|
KTime & | operator++ () |
Increment time of one unit of the internal
format (prefix form). |
|
const KTime | operator++ (int) |
Increment time of one unit of the internal
format (postfix form). |
|
KTime & | operator-- () |
Decrement time of one unit of the internal
format (prefix form). |
|
const KTime | operator-- (int) |
Decrement time of one unit of the internal
format (postfix form). |
|
Public Member Functions |
|
KTime (kLongLong pTime=0) | |
Constructor. |
enum ETimeMode |
Time modes.
eNTSC_DROP_FRAME
is used for broadcasting
operations where clock time must be (almost) in sync with timecode.
To bring back color NTSC timecode with clock time, this mode drops
2 frames per minute except for every 10 minutes (00, 10, 20, 30,
40, 50). 108 frames are dropped per hour. Over 24 hours the error
is 2 frames and 1/4 of a frame.eNTSC_FULL_FRAME
represents a time address
and therefore is NOT IN SYNC with clock time. A timecode of
01:00:00:00 equals a clock time of 01:00:03:18.eFRAMES30_DROP
drops 2 frames every minutes
except for every 10 minutes (00, 10, 20, 30, 40, 50). This timecode
represents a time address and is therefore NOT IN SYNC with clock
time. A timecode of 01:00:03:18 equals a clock time of 01:00:00:00.
It is the close counterpart of mode eNTSC_FULL_FRAME
.
Time modes.
enum ETimeProtocol |
KTime | ( | kLongLong | pTime = 0 |
) | [inline] |
static void SetGlobalTimeMode | ( | ETimeMode | pTimeMode, | |
double | pFrameRate = 0.0 |
|||
) | [static] |
Set default time mode.
pTimeMode | Time mode identifier. | |
pFrameRate | in case of pTimeMode = custom, we specify the custom framerate to use: EX:12.5 |
eDEFAULT_MODE
.static ETimeMode GetGlobalTimeMode | ( | ) | [static] |
Get default time mode.
static void SetGlobalTimeProtocol | ( | ETimeProtocol | pTimeProtocol | ) | [static] |
Set default time protocol.
pTimeProtocol | Time protocol identifier. |
eDEFAULT_PROTOCOL
.static ETimeProtocol GetGlobalTimeProtocol | ( | ) | [static] |
Get default time protocol.
static double GetFrameRate | ( | ETimeMode | pTimeMode | ) | [static] |
Get frame rate associated with time mode, in frames per second.
pTimeMode | Time mode identifier. |
static ETimeMode ConvertFrameRateToTimeMode | ( | double | pFrameRate, | |
double | lPrecision =
0.00000001 |
|||
) | [static] |
Get time mode associated with frame rate.
pFrameRate | The frame rate value. | |
lPrecision | The tolerance value. |
eDEFAULT_MODE
if no time mode associated to the given
frame rate is found.void Set | ( | kLongLong | pTime | ) | [inline] |
const kLongLong& Get | ( | ) | const [inline] |
void SetMilliSeconds | ( | kLongLong | pMilliSeconds | ) | [inline] |
kLongLong GetMilliSeconds | ( | ) | const [inline] |
void SetSecondDouble | ( | double | pTime | ) |
Set time in seconds.
pTime | Time value to set. |
double GetSecondDouble | ( | ) | const |
Get time in seconds.
void SetTime | ( | int | pHour, | |
int | pMinute, | |||
int | pSecond, | |||
int | pFrame = 0 , |
|||
int | pField = 0 , |
|||
int | pTimeMode =
eDEFAULT_MODE , |
|||
double | pFramerate = 0.0 |
|||
) |
Set time in hour/minute/second/frame/field format.
pHour | The hours value. | |
pMinute | The minutes value. | |
pSecond | The seconds value. | |
pFrame | The frames values. | |
pField | The field value. | |
pTimeMode | A time mode identifier. | |
pFramerate | indicate custom framerate in case of pTimeMode = eCUSTOM |
void SetTime | ( | int | pHour, | |
int | pMinute, | |||
int | pSecond, | |||
int | pFrame, | |||
int | pField, | |||
int | pResidual, | |||
int | pTimeMode, | |||
double | pFramerate = 0.0 |
|||
) |
Set time in hour/minute/second/frame/field/residual format.
pHour | The hours value. | |
pMinute | The minutes value. | |
pSecond | The seconds value. | |
pFrame | The frames values. | |
pField | The field value. | |
pResidual | The hundredths of frame value. | |
pTimeMode | A time mode identifier. | |
pFramerate | indicate custom framerate in case of pTimeMode = eCUSTOM |
The time mode can't have a default value, because otherwise SetTime(int, int, int, int, int, int) would be ambiguous. Please specify DEFAULT_MODE.
bool GetTime | ( | kLongLong & | pHour, | |
kLongLong & | pMinute, | |||
kLongLong & | pSecond, | |||
kLongLong & | pFrame, | |||
kLongLong & | pField, | |||
kLongLong & | pResidual, | |||
int | pTimeMode =
eDEFAULT_MODE , |
|||
double | pFramerate = 0.0 |
|||
) | const |
Get time in hour/minute/second/frame/field/residual format.
pHour | The returned hours value. | |
pMinute | The returned minutes value. | |
pSecond | The returned seconds value. | |
pFrame | The returned frames values. | |
pField | The returned field value. | |
pResidual | The returned hundredths of frame value. | |
pTimeMode | The time mode identifier which will dictate the extraction algorithm. | |
pFramerate | indicate custom framerate in case of pTimeMode = eCUSTOM |
true
if the pTimeMode parameter is a valid
identifier and thus the extraction succeeded. If the function
returns false
, all the values are set to 0.KTime GetFramedTime | ( | bool | pRound = true |
) |
Return a Time Snapped on the NEAREST(rounded) Frame (if asked).
pRound |
kLongLong GetHour | ( | bool | pCummul = false , |
|
int | pTimeMode =
eDEFAULT_MODE , |
|||
double | pFramerate = 0.0 |
|||
) | const |
Get number of hours in time.
pCummul | This parameter has no effect. | |
pTimeMode | Time mode identifier. | |
pFramerate | indicate custom framerate in case of pTimeMode = eCUSTOM |
kLongLong GetMinute | ( | bool | pCummul = false , |
|
int | pTimeMode =
eDEFAULT_MODE , |
|||
double | pFramerate = 0.0 |
|||
) | const |
Get number of minutes in time.
pCummul | If true , get total number of minutes. If
false , get number of minutes exceeding last full
hour. |
|
pTimeMode | Time mode identifier. | |
pFramerate | indicate custom framerate in case of pTimeMode = eCUSTOM |
kLongLong GetSecond | ( | bool | pCummul = false , |
|
int | pTimeMode =
eDEFAULT_MODE , |
|||
double | pFramerate = 0.0 |
|||
) | const |
Get number of seconds in time.
pCummul | If true , get total number of seconds. If
false , get number of seconds exceeding last full
minute. |
|
pTimeMode | Time mode identifier. | |
pFramerate | indicate custom framerate in case of pTimeMode = eCUSTOM |
kLongLong GetFrame | ( | bool | pCummul = false , |
|
int | pTimeMode =
eDEFAULT_MODE , |
|||
double | pFramerate = 0.0 |
|||
) | const |
Get number of frames in time.
pCummul | If true , get total number of frames. If
false , get number of frames exceeding last full
second. |
|
pTimeMode | Time mode identifier. | |
pFramerate | indicate custom framerate in case of pTimeMode = eCUSTOM |
kLongLong GetField | ( | bool | pCummul = false , |
|
int | pTimeMode =
eDEFAULT_MODE , |
|||
double | pFramerate = 0.0 |
|||
) | const |
Get number of fields in time.
pCummul | If true , get total number of fields. If
false , get number of fields exceeding last full
frame. |
|
pTimeMode | Time mode identifier. | |
pFramerate | indicate custom framerate in case of pTimeMode = eCUSTOM |
kLongLong GetResidual | ( | int | pTimeMode =
eDEFAULT_MODE , |
|
double | pFramerate = 0.0 |
|||
) | const |
Get residual time exceeding last full field.
pTimeMode | Time mode identifier. | |
pFramerate | indicate custom framerate in case of pTimeMode = eCUSTOM |
char* GetTimeString | ( | char * | pTimeString, | |
int | pInfo = 5 , |
|||
int | pTimeMode =
eDEFAULT_MODE , |
|||
int | pTimeFormat =
eDEFAULT_PROTOCOL , |
|||
double | pFramerate = 0.0 |
|||
) | const |
Get time in a human readable format.
pTimeString | An array large enough to contain a minimum of 19 characters. | |
pInfo | The amount of information if time protocol is
eSMPTE:
|
|
pTimeMode | Requested time mode. | |
pTimeFormat | Requested time protocol. | |
pFramerate | indicate custom framerate in case of pTimeMode = eCUSTOM |
void SetTimeString | ( | char * | pTime, | |
int | pTimeMode =
eDEFAULT_MODE , |
|||
int | pTimeFormat =
eDEFAULT_PROTOCOL , |
|||
double | pFramerate = 0.0 |
|||
) |
Set time in a human readable format.
pTime | An array of a maximum of 18 characters. If time protocol is
eSMPTE , pTimeString must be formatted this way:
"[hours:]minutes[:seconds[.frames[.fields]]]". Hours, minutes,
seconds, frames and fields are parsed as integers and brackets
indicate optional parts. If time protocol is eFRAME ,
pTimeString must be formatted this way: "frames". Frames is parsed
as a 64 bits integer. |
|
pTimeMode | Given time mode. | |
pTimeFormat | Given time protocol. | |
pFramerate | indicate custom framerate in case of pTimeMode = eCUSTOM |
bool operator== | ( | const KTime & | pTime | ) | const [inline] |
bool operator!= | ( | const KTime & | pTime | ) | const [inline] |
bool operator>= | ( | const KTime & | pTime | ) | const [inline] |
bool operator<= | ( | const KTime & | pTime | ) | const [inline] |
bool operator> | ( | const KTime & | pTime | ) | const [inline] |
bool operator< | ( | const KTime & | pTime | ) | const [inline] |
KTime operator* | ( | const int | Mult | ) | const |
KTime& operator++ | ( | ) | [inline] |
const KTime operator++ | ( | int | ) | [inline] |
KTime& operator-- | ( | ) | [inline] |