Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
Common functions for handling of time values.
Working with time values in sexagesimal format, quantising time and converting to/from common timecode formats can be tricky to get right. Thus the goal is to concentrate the actual bits of math for these operations into a small number of library functions, which are easy to test thoroughly in isolation.
Built on top of that, the actual time handling in the GUI and within the Lumiera session is mostly confined to use the opaque lib::time::Time wrapper objects. When time values actually need to be quantised (aligned to a frame grid), this is expressed at the API through using the lib::time::QuTime type, which then in turn can be materialised into a number of timecode formats. These definitions ensure that whenever an actual quantisation (rounding) operation is performed, the link to the appropriate time grid is available, so that multiple output or rendering operations can use differing time origins and frame rates simultaneously on the same model.
The Lumiera Vault Layer functions mostly operate on raw frame counts, which in this model are defined to be a special kind of timecode, and thus dependent on a preceding time quantisation.
Definition in file time.h.
Functions | |
gavl_time_t | lumiera_build_time (long millis, uint secs, uint mins, uint hours) |
Build a time value by summing up the given components. More... | |
gavl_time_t | lumiera_build_time_fps (uint fps, uint frames, uint secs, uint mins, uint hours) |
Builds a time value by summing up the given components. More... | |
gavl_time_t | lumiera_build_time_ntsc_drop (uint frames, uint secs, uint mins, uint hours) |
Builds a time value by summing up the given components. More... | |
gavl_time_t | lumiera_frame_duration (lib::time::FrameRate const &fps) |
Calculates the duration of one frame in Lumiera time units. More... | |
gavl_time_t | lumiera_framecount_to_time (uint64_t frameCount, lib::time::FrameRate const &fps) |
Converts a frame count into Lumiera's internal time scale. More... | |
int64_t | lumiera_quantise_frames (gavl_time_t time, gavl_time_t origin, gavl_time_t grid) |
Quantise the given time into a fixed grid, relative to the origin. More... | |
int64_t | lumiera_quantise_frames_fps (gavl_time_t time, gavl_time_t origin, uint framerate) |
gavl_time_t | lumiera_quantise_time (gavl_time_t time, gavl_time_t origin, gavl_time_t grid) |
Similar to lumiera_quantise_frames, but returns a grid aligned relative time. More... | |
gavl_time_t | lumiera_rational_to_time (lib::time::FSecs const &fractionalSeconds) |
Converts a fraction of seconds to Lumiera's internal opaque time scale. More... | |
int | lumiera_time_frames (gavl_time_t time, uint fps) |
Extract the remaining frame part of given time. More... | |
int | lumiera_time_hours (gavl_time_t time) |
Extract the hour part of given time. More... | |
int | lumiera_time_millis (gavl_time_t time) |
Extract the milliseconds part of given time. More... | |
int | lumiera_time_minutes (gavl_time_t time) |
Extract the minute part of given time. More... | |
int | lumiera_time_ntsc_drop_frames (gavl_time_t time) |
Extract the frame part of given time, using NTSC drop-frame timecode. | |
int | lumiera_time_ntsc_drop_hours (gavl_time_t time) |
Extract the hour part of given time, using NTSC drop-frame timecode. | |
int | lumiera_time_ntsc_drop_minutes (gavl_time_t time) |
Extract the minute part of given time, using NTSC drop-frame timecode. | |
int | lumiera_time_ntsc_drop_seconds (gavl_time_t time) |
Extract the second part of given time, using NTSC drop-frame timecode. | |
gavl_time_t | lumiera_time_of_gridpoint (int64_t nr, gavl_time_t origin, gavl_time_t grid) |
Calculate time of a grid point (frame start) More... | |
int | lumiera_time_seconds (gavl_time_t time) |
Extract the seconds part of given time. More... | |
char * | lumiera_tmpbuf_print_time (gavl_time_t time) |
gavl_time_t lumiera_rational_to_time | ( | lib::time::FSecs const & | fractionalSeconds | ) |
Converts a fraction of seconds to Lumiera's internal opaque time scale.
fractionalSeconds | given as rational number |
gavl_time_t lumiera_framecount_to_time | ( | uint64_t | frameCount, |
lib::time::FrameRate const & | fps | ||
) |
Converts a frame count into Lumiera's internal time scale.
based on a framerate given as rational number (e.g. NTSC)
Definition at line 436 of file time.cpp.
Referenced by Offset::Offset().
gavl_time_t lumiera_frame_duration | ( | lib::time::FrameRate const & | fps | ) |
int64_t lumiera_quantise_frames | ( | gavl_time_t | time, |
gavl_time_t | origin, | ||
gavl_time_t | grid | ||
) |
Quantise the given time into a fixed grid, relative to the origin.
The time grid used for quantisation is comprised of equally spaced intervals, rooted at the given origin. The interval starting with the origin is numbered as zero. Each interval includes its lower bound, but excludes its upper bound.
grid | spacing of the grid intervals, measured in GAVL_TIME_SCALE |
Definition at line 494 of file time.cpp.
Referenced by FixedFrameQuantiser::gridPoint().
gavl_time_t lumiera_quantise_time | ( | gavl_time_t | time, |
gavl_time_t | origin, | ||
gavl_time_t | grid | ||
) |
Similar to lumiera_quantise_frames, but returns a grid aligned relative time.
Definition at line 506 of file time.cpp.
Referenced by FixedFrameQuantiser::gridLocal().
gavl_time_t lumiera_time_of_gridpoint | ( | int64_t | nr, |
gavl_time_t | origin, | ||
gavl_time_t | grid | ||
) |
Calculate time of a grid point (frame start)
nr | index number of the grid point (0 is at origin) |
grid | spacing of the grid intervals, measured in GAVL_TIME_SCALE |
Definition at line 514 of file time.cpp.
Referenced by FixedFrameQuantiser::timeOf().
gavl_time_t lumiera_build_time | ( | long | millis, |
uint | secs, | ||
uint | mins, | ||
uint | hours | ||
) |
gavl_time_t lumiera_build_time_fps | ( | uint | fps, |
uint | frames, | ||
uint | secs, | ||
uint | mins, | ||
uint | hours | ||
) |
gavl_time_t lumiera_build_time_ntsc_drop | ( | uint | frames, |
uint | secs, | ||
uint | mins, | ||
uint | hours | ||
) |
int lumiera_time_hours | ( | gavl_time_t | time | ) |
Extract the hour part of given time.
Definition at line 544 of file time.cpp.
References TIME_SCALE_MS.
int lumiera_time_minutes | ( | gavl_time_t | time | ) |
Extract the minute part of given time.
Definition at line 550 of file time.cpp.
References TIME_SCALE_MS.
int lumiera_time_seconds | ( | gavl_time_t | time | ) |
Extract the seconds part of given time.
Definition at line 556 of file time.cpp.
References TIME_SCALE_MS.
int lumiera_time_millis | ( | gavl_time_t | time | ) |
Extract the milliseconds part of given time.
Definition at line 562 of file time.cpp.
References TIME_SCALE_MS.
int lumiera_time_frames | ( | gavl_time_t | time, |
uint | fps | ||
) |
char* lumiera_tmpbuf_print_time | ( | gavl_time_t | time | ) |
Diagnostics helper: render time value in H:MM:SS.mmm format.
safeclib
temporary buffer containing formatted time string Definition at line 395 of file time.cpp.
References lumiera_tmpbuf_snprintf(), and TIME_SCALE_MS.