Skip to main content

Crate alpha2_time

Crate alpha2_time 

Source
Expand description

Deterministic timeline primitives.

Structs§

AudioFrameGrid
The source samples an audio stream’s frames start at, read from its first packets’ timestamps (audio_frame_grid): every period samples from anchor, at the stream’s rate.
FrameRate
A positive rational frame rate in reduced form, at most one frame per tick (120 000 frames per second).
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
The largest number of ticks a serialized time holds, either way: the largest integer a JavaScript number holds exactly (about 2,378 years). A document read from JSON is read the same by every host.
PRESENTATION_SLACK
How much later than a source time t a decoded frame’s timestamp may be and still be the frame shown at t, for a stream whose time base is not known: 0.5 ms and one tick (61 ticks), a millisecond time base’s presentation_slack. It is also the most a stream whose timestamps show no rounding of their own is given.
ROUNDING_SCAN_BYTES
The packet bytes past which a host reads no more of a stream’s first packets for rounding_quantum (16 MiB): a native decoder keeps the packets it read until it decodes them, so a 4K stream is held to about a second of them.
ROUNDING_SCAN_FRAMES
How many of a stream’s first packets rounding_quantum reads the timestamps of: at most this many, and none once the packets read hold ROUNDING_SCAN_BYTES.
TICKS_PER_SECOND
Fixed alpha2 timeline ticks per second.

Functions§

audio_frame_grid
The frame grid an audio stream’s first packet timestamps show, at sample_rate, in a stream whose timestamps are whole multiples of num / den seconds; None when they show none to place frames on.
presentation_slack
How much later than a source time t a decoded frame’s timestamp may be and still be the frame shown at t, for a stream whose timestamps are whole multiples of num / den seconds and are rounded to quantum of those units (rounding_quantum; 0 for none shown).
rounding_quantum
The unit a stream’s timestamps are rounded to, as their spacing shows, in the units of the stream’s time base; 0 when they show none.