AJA NTV2 SDK
17.1.3.1410
NTV2 SDK 17.1.3.1410
|
#include <timebase.h>
Public Member Functions | |
AJATimeBase () | |
AJATimeBase (AJA_FrameRate ajaFrameRate) | |
AJATimeBase (int64_t frameTimeScale, int64_t frameDuration) | |
AJATimeBase (int64_t frameTimeScale, int64_t frameDuration, int64_t audioRate) | |
AJATimeBase (const AJATimeBase &other) | |
virtual | ~AJATimeBase () |
void | SetToDefault (void) |
void | SetFrameRate (int64_t frameTimeScale, int64_t frameDuration) |
void | SetAJAFrameRate (AJA_FrameRate ajaFrameRate) |
void | GetFrameRate (int64_t &frameTimeScale, int64_t &frameDuration) const |
void | GetFrameRate (uint32_t &frameTimeScale, uint32_t &frameDuration) const |
int64_t | GetFrameTimeScale (void) const |
void | SetFrameTimeScale (int64_t timeScale) |
int64_t | GetFrameDuration (void) const |
void | SetAudioRate (int64_t rate) |
int64_t | GetAudioRate () const |
AJA_FrameRate | GetAJAFrameRate (void) const |
void | SetTickRate (int64_t rate) |
int64_t | GetTickRate () const |
int64_t | FramesToSamples (int64_t frames, bool round=false) const |
int64_t | FramesToTicks (int64_t frames, bool round=false) const |
double | FramesToSeconds (int64_t frames) const |
double | ScaleUnitsToSeconds (int64_t num) const |
int64_t | FramesToMicroseconds (int64_t frames, bool round=false) const |
int64_t | FramesToNanoseconds100 (int64_t frames, bool round=false) const |
int64_t | SamplesToFrames (int64_t samples, bool round=false) const |
int64_t | SamplesToTicks (int64_t samples, bool round=false) const |
double | SamplesToSeconds (int64_t samples) |
int64_t | SamplesToMicroseconds (int64_t samples, bool round=false) |
int64_t | TicksToFrames (int64_t ticks, bool round=false) |
int64_t | TicksToSamples (int64_t ticks, bool round=false) |
double | TicksToSeconds (int64_t ticks) |
int64_t | TicksToMicroseconds (int64_t ticks, bool round=false) |
int64_t | SecondsToFrames (double seconds, bool round=false) |
int64_t | SecondsToSamples (double seconds, bool round=false) |
int64_t | SecondsToTicks (double seconds, bool round=false) |
int64_t | MicrosecondsToFrames (int64_t microseconds, bool round=false) |
int64_t | Nanoseconds100ToFrames (int64_t nanoseconds100, bool round=false) |
int64_t | MicrosecondsToSamples (int64_t microseconds, bool round=false) |
int64_t | MicrosecondsToTicks (int64_t microseconds, bool round=false) |
int64_t | GetSystemTicks () |
bool | IsCloseTo (const AJATimeBase &timeBase) const |
bool | IsCloseTo (int64_t frameTimeScale, int64_t frameDuration) const |
bool | IsNonIntegralRatio (void) const |
float | GetFramesPerSecond (void) const |
double | GetFramesPerSecondDouble (void) const |
AJATimeBase & | operator= (const AJATimeBase &t) |
bool | operator== (const AJATimeBase &val) const |
bool | operator!= (const AJATimeBase &val) const |
Static Public Member Functions | |
static int64_t | SecondsToMicroseconds (double seconds, bool round=false) |
static double | MicrosecondsToSeconds (int64_t microseconds) |
static int64_t | Convert (int64_t inValue, int64_t inRate, int64_t outRate, bool round, bool large) |
static int64_t | Convert (int64_t inValue, int64_t inScale, int64_t inDuration, int64_t outScale, int64_t outDuration, bool round, bool large) |
Class provides high resolution time base conversion
Definition at line 18 of file timebase.h.
AJATimeBase::AJATimeBase | ( | ) |
Definition at line 46 of file timebase.cpp.
AJATimeBase::AJATimeBase | ( | AJA_FrameRate | ajaFrameRate | ) |
Construct the time base class.
[in] | ajaFrameRate | Frame rate define found in videotypes.h |
Definition at line 51 of file timebase.cpp.
AJATimeBase::AJATimeBase | ( | int64_t | frameTimeScale, |
int64_t | frameDuration | ||
) |
Construct the time base class.
[in] | frameTimeScale | Time units per second (units/second) |
[in] | frameDuration | Time units per frame (units/frame) |
Definition at line 58 of file timebase.cpp.
AJATimeBase::AJATimeBase | ( | int64_t | frameTimeScale, |
int64_t | frameDuration, | ||
int64_t | audioRate | ||
) |
Construct the time base class.
[in] | frameTimeScale | Time units per second (units/second) |
[in] | frameDuration | Time units per frame (units/frame) |
[in] | audioRate | Audio sample rate (samples/second) |
Definition at line 65 of file timebase.cpp.
AJATimeBase::AJATimeBase | ( | const AJATimeBase & | other | ) |
Copy constructor
[in] | other | AJATimeBase to copy |
Definition at line 73 of file timebase.cpp.
|
virtual |
Definition at line 81 of file timebase.cpp.
|
static |
Definition at line 357 of file timebase.cpp.
|
static |
Definition at line 390 of file timebase.cpp.
int64_t AJATimeBase::FramesToMicroseconds | ( | int64_t | frames, |
bool | round = false |
||
) | const |
Convert video frames to time in microseconds.
[in] | frames | Video frame count to convert. |
[in] | round | Round the result. |
Definition at line 223 of file timebase.cpp.
int64_t AJATimeBase::FramesToNanoseconds100 | ( | int64_t | frames, |
bool | round = false |
||
) | const |
Convert video frames to time in 100 nanoseconds.
[in] | frames | Video frame count to convert. |
[in] | round | Round the result. |
Definition at line 228 of file timebase.cpp.
int64_t AJATimeBase::FramesToSamples | ( | int64_t | frames, |
bool | round = false |
||
) | const |
Convert video frames to audio samples.
[in] | frames | Video frame count to convert. |
[in] | round | Round the result. |
Definition at line 187 of file timebase.cpp.
double AJATimeBase::FramesToSeconds | ( | int64_t | frames | ) | const |
Convert video frames to time in seconds.
[in] | frames | Video frame count to convert. |
Definition at line 197 of file timebase.cpp.
int64_t AJATimeBase::FramesToTicks | ( | int64_t | frames, |
bool | round = false |
||
) | const |
Convert video frames to system ticks.
[in] | frames | Video frame count to convert. |
[in] | round | Round the result. |
Definition at line 192 of file timebase.cpp.
AJA_FrameRate AJATimeBase::GetAJAFrameRate | ( | void | ) | const |
Get the AJA_FrameRate which is close to the current value, return unknown if not close.
Definition at line 427 of file timebase.cpp.
int64_t AJATimeBase::GetAudioRate | ( | ) | const |
Get the audio sample rate used in conversions.
Definition at line 159 of file timebase.cpp.
int64_t AJATimeBase::GetFrameDuration | ( | void | ) | const |
Get the video frame duration used in conversions.
Definition at line 149 of file timebase.cpp.
void AJATimeBase::GetFrameRate | ( | int64_t & | frameTimeScale, |
int64_t & | frameDuration | ||
) | const |
Get the video frame rate used in conversions.
The frame rate is specified as frameTimeScale/frameDuration = frames/seconds.
[out] | frameTimeScale | Time units per second (units/second) |
[out] | frameDuration | Time units per frame (units/frame) |
Definition at line 133 of file timebase.cpp.
void AJATimeBase::GetFrameRate | ( | uint32_t & | frameTimeScale, |
uint32_t & | frameDuration | ||
) | const |
float AJATimeBase::GetFramesPerSecond | ( | void | ) | const |
double AJATimeBase::GetFramesPerSecondDouble | ( | void | ) | const |
Definition at line 215 of file timebase.cpp.
int64_t AJATimeBase::GetFrameTimeScale | ( | void | ) | const |
Get the video frame time scale used in conversions.
Definition at line 139 of file timebase.cpp.
int64_t AJATimeBase::GetSystemTicks | ( | ) |
Get the current value of the system tick count.
Definition at line 344 of file timebase.cpp.
int64_t AJATimeBase::GetTickRate | ( | ) | const |
Get the system tick rate used in conversions.
Definition at line 182 of file timebase.cpp.
bool AJATimeBase::IsCloseTo | ( | const AJATimeBase & | timeBase | ) | const |
Returns if timebases are reasonably close
[in] | timeBase | Time base to compare. |
Definition at line 318 of file timebase.cpp.
bool AJATimeBase::IsCloseTo | ( | int64_t | frameTimeScale, |
int64_t | frameDuration | ||
) | const |
Returns if timebases are reasonably close
[in] | frameTimeScale | Time scale to compare. |
[in] | frameDuration | Time duration to compare. |
Definition at line 333 of file timebase.cpp.
bool AJATimeBase::IsNonIntegralRatio | ( | void | ) | const |
Test if the timescale is not a simple multiple of the duration
The intent is that even ratios are "non-drop", otherwise the timebase is "drop frame" In this sense, this method can be thought of as equivalent to IsDropFrame()
Definition at line 339 of file timebase.cpp.
int64_t AJATimeBase::MicrosecondsToFrames | ( | int64_t | microseconds, |
bool | round = false |
||
) |
Convert microseconds to video frames.
[in] | microseconds | System tick count to convert. |
[in] | round | Round the result. |
Definition at line 288 of file timebase.cpp.
int64_t AJATimeBase::MicrosecondsToSamples | ( | int64_t | microseconds, |
bool | round = false |
||
) |
Convert microseconds to audio samples.
[in] | microseconds | System tick count to convert. |
[in] | round | Round the result. |
Definition at line 298 of file timebase.cpp.
|
static |
Convert microseconds to time in seconds.
[in] | microseconds | System tick count to convert. |
Definition at line 313 of file timebase.cpp.
int64_t AJATimeBase::MicrosecondsToTicks | ( | int64_t | microseconds, |
bool | round = false |
||
) |
Convert microseconds to system ticks.
[in] | microseconds | System tick count to convert. |
[in] | round | Round the result. |
Definition at line 303 of file timebase.cpp.
int64_t AJATimeBase::Nanoseconds100ToFrames | ( | int64_t | nanoseconds100, |
bool | round = false |
||
) |
Convert 100 nanoseconds to video frames.
[in] | nanoseconds100 | 100 nanosecond intervals to convert. |
[in] | round | Round the result. |
Definition at line 293 of file timebase.cpp.
bool AJATimeBase::operator!= | ( | const AJATimeBase & | val | ) | const |
Definition at line 122 of file timebase.cpp.
AJATimeBase & AJATimeBase::operator= | ( | const AJATimeBase & | t | ) |
Definition at line 93 of file timebase.cpp.
bool AJATimeBase::operator== | ( | const AJATimeBase & | val | ) | const |
Definition at line 106 of file timebase.cpp.
int64_t AJATimeBase::SamplesToFrames | ( | int64_t | samples, |
bool | round = false |
||
) | const |
Convert audio samples to video frames.
[in] | samples | Audio sample count to convert. |
[in] | round | Round the result. |
Definition at line 233 of file timebase.cpp.
int64_t AJATimeBase::SamplesToMicroseconds | ( | int64_t | samples, |
bool | round = false |
||
) |
Convert audio samples to time in microseconds.
[in] | samples | Sample count to convert. |
[in] | round | Round the result. |
Definition at line 248 of file timebase.cpp.
double AJATimeBase::SamplesToSeconds | ( | int64_t | samples | ) |
Convert audio samples to time in seconds.
[in] | samples | Sample count to convert. |
Definition at line 243 of file timebase.cpp.
int64_t AJATimeBase::SamplesToTicks | ( | int64_t | samples, |
bool | round = false |
||
) | const |
Convert audio samples to system ticks.
[in] | samples | Audio sample count to convert. |
[in] | round | Round the result. |
Definition at line 238 of file timebase.cpp.
double AJATimeBase::ScaleUnitsToSeconds | ( | int64_t | num | ) | const |
Convert time scale units to time in seconds.
[in] | num | Time scale units to convert. |
Definition at line 202 of file timebase.cpp.
int64_t AJATimeBase::SecondsToFrames | ( | double | seconds, |
bool | round = false |
||
) |
Convert time in seconds to video frames.
[in] | seconds | Time in seconds. |
[in] | round | Round the result. |
Definition at line 273 of file timebase.cpp.
|
static |
Convert time in seconds to microseconds.
[in] | seconds | Time in seconds. |
[in] | round | Round the result. |
Definition at line 308 of file timebase.cpp.
int64_t AJATimeBase::SecondsToSamples | ( | double | seconds, |
bool | round = false |
||
) |
Convert time in seconds to audio samples.
[in] | seconds | Time in seconds. |
[in] | round | Round the result. |
Definition at line 278 of file timebase.cpp.
int64_t AJATimeBase::SecondsToTicks | ( | double | seconds, |
bool | round = false |
||
) |
Convert time in seconds to system ticks.
[in] | seconds | Time in seconds. |
[in] | round | Round the result. |
Definition at line 283 of file timebase.cpp.
void AJATimeBase::SetAJAFrameRate | ( | AJA_FrameRate | ajaFrameRate | ) |
Set the video frame rate to use in conversions.
The frame rate is specified Frame rate define found in videotypes.h
[in] | ajaFrameRate | AJA_FrameRate |
Definition at line 164 of file timebase.cpp.
void AJATimeBase::SetAudioRate | ( | int64_t | rate | ) |
Set the audio sample rate to use in conversions.
[in] | rate | Audio rate in samples/second. |
Definition at line 154 of file timebase.cpp.
void AJATimeBase::SetFrameRate | ( | int64_t | frameTimeScale, |
int64_t | frameDuration | ||
) |
Set the video frame rate to use in conversions.
The frame rate is specified as frameTimeScale/frameDuration = frames/second.
[in] | frameTimeScale | Time units per second (units/second) |
[in] | frameDuration | Time units per frame (units/frame) |
Definition at line 127 of file timebase.cpp.
void AJATimeBase::SetFrameTimeScale | ( | int64_t | timeScale | ) |
Set the video frame duration used in conversions.
[in] | timeScale | Time units per second (units/second) |
Definition at line 144 of file timebase.cpp.
void AJATimeBase::SetTickRate | ( | int64_t | rate | ) |
Set the system tick rate to use in conversions.
[in] | rate | System tick rate in ticks/second. 0 == system native rate. |
Definition at line 169 of file timebase.cpp.
void AJATimeBase::SetToDefault | ( | void | ) |
Set to default value.
Definition at line 85 of file timebase.cpp.
int64_t AJATimeBase::TicksToFrames | ( | int64_t | ticks, |
bool | round = false |
||
) |
Convert system ticks to video frames.
[in] | ticks | System tick count to convert. |
[in] | round | Round the result. |
Definition at line 253 of file timebase.cpp.
int64_t AJATimeBase::TicksToMicroseconds | ( | int64_t | ticks, |
bool | round = false |
||
) |
Convert system ticks to time in microseconds.
[in] | ticks | System tick count to convert. |
[in] | round | Round the result. |
Definition at line 268 of file timebase.cpp.
int64_t AJATimeBase::TicksToSamples | ( | int64_t | ticks, |
bool | round = false |
||
) |
Convert system ticks to audio samples.
[in] | ticks | System tick count to convert. |
[in] | round | Round the result. |
Definition at line 258 of file timebase.cpp.
double AJATimeBase::TicksToSeconds | ( | int64_t | ticks | ) |
Convert system ticks to time in seconds.
[in] | ticks | System tick count to convert. |
Definition at line 263 of file timebase.cpp.