Skip to main content

Crate alpha2_time

Crate alpha2_time 

Source
Expand description

Deterministic timeline primitives.

Structs§

AudioFrameGrid
Frame start samples of an audio stream, every period samples from anchor, inferred from its first packet timestamps (audio_frame_grid).
FrameRate
A positive rational frame rate in reduced form, at most one frame per tick (120 000 fps).
MediaTime
A signed position or duration in timeline ticks (120 000 per second).
TimeRange
A half-open timeline interval [start, end).

Enums§

FrameRateError
Invalid rational frame rate.
TimeRangeError
Invalid time range.

Constants§

MAX_SERIALIZED_TICKS
Largest magnitude of a serialized time: 2^53 - 1 ticks (about 2,378 years), the largest integer a JavaScript number holds exactly, so every host reads JSON times the same.
PRESENTATION_SLACK
presentation_slack for an unknown time base: 0.5 ms plus one tick (61 ticks), as for milliseconds. Also the cap for streams whose timestamps show no rounding.
ROUNDING_SCAN_BYTES
Byte cap on the leading packets read for rounding_quantum. A native decoder holds the packets it read until it decodes them, so this keeps a 4K stream to about a second.
ROUNDING_SCAN_FRAMES
Most leading packets whose timestamps feed rounding_quantum, also capped by ROUNDING_SCAN_BYTES.
TICKS_PER_SECOND
Fixed alpha2 timeline ticks per second.

Functions§

audio_frame_grid
The frame grid shown by an audio stream’s first packet timestamps (any order, in num / den second units) at sample_rate, or None.
presentation_slack
How much later than source time t a decoded frame’s timestamp may be and still be the frame shown at t, for a num / den time base rounded to quantum units (rounding_quantum, 0 for none).
rounding_quantum
The unit a stream’s timestamps are rounded to, in time-base units, or 0 when none shows.