Declaraciones públicas de media-core/engine/timebase.zig (media-core: motor de medios).
apps/docs/generated/zig/media-engine.jsonPágina generada desde
native/zig/media-core/media_engine.zig. No se edita a mano:bun run docs:genla regenera ybun run docs:checkfalla si difiere.
Time-base arithmetic shared by both engines and the packager. One place decides rounding, so a keyframe index, a segment plan and a packet compare equal when they describe the same instant.
Intermediate products are exact: i128 when every time-base term fits 32
bits (the common case: ISOBMFF timescales, libav AVRational), i256 when
a term does not (a Matroska TimestampScale is an untrusted u64). Results
that do not fit i64 saturate instead of wrapping or trapping (inputs are
untrusted).
timebase.max_timeline_ticksconst · línea 33
pub const max_timeline_ticks: i64 = (1 << 62) - 1Timeline bound of the engine (ZC6-P1-01). Every timestamp or duration a
demuxer hands out, in its own ticks, satisfies inTimeline: at most
2^62 - 1 ticks in magnitude (so the sum or difference of any two fits
i64: DTS synthesis, pts - dts, dts + duration, segment spans), and an
instant of at most 2^52 µs (~142 years; epoch timestamps fit) once
converted (so the µs arithmetic of plans and indexes cannot saturate).
Parsers check it where they read a timestamp from the file; the contract
checks it again on every packet of either engine.
timebase.max_timeline_usconst · línea 34
pub const max_timeline_us: i64 = 1 << 52Sin ///.
timebase.inTimelinefn · línea 36
pub fn inTimeline(v: i64, tb: Rational) boolSin ///.
timebase.toUsfn · línea 42
pub fn toUs(v: i64, tb: Rational) i64v (in tb units) to microseconds, rounding toward -inf. Same rule as the
container parsers use for keyframe indexes (ticksToUs).
timebase.rescalefn · línea 56
pub fn rescale(v: i64, from: Rational, to: Rational) i64v from time base from to to, rounding to nearest with ties away from
zero (libavutil av_rescale_q, AV_ROUND_NEAR_INF): both engines map a
source timestamp to the same output tick.
timebase.outputTimescalefn · línea 75
pub fn outputTimescale(kind: facts.Kind, source: Rational, sample_rate: ?u32) u32Output timescale of a track in fMP4 (the rule movenc applies, so both engines emit the same one): audio at its sample rate; video at the source time-base denominator, doubled until it reaches 10000 (a 1/1000 Matroska time base becomes 1/16000, an exact multiple).