import { type Sec } from "./types"; /** Ticks per second, from the container's own timing grain. */ export type TickRate = number; /** * A frame of the source, named twice: by its position in presentation order and * by its presentation timestamp in the track's own integer grain. */ export interface FrameId { readonly index: number; readonly ticks: number; } /** * Where the transport has settled: the frame, and the one seconds value anyone * publishes for it. Nothing else on the wire carries a media position. */ export interface FrameLanding { readonly frame: FrameId; readonly mediaTimeS: number; } /** The clone-safe shape the timeline crosses a worker boundary as. */ export interface FrameTimelineData { readonly tickRate: TickRate; readonly ticks: Float64Array; readonly lastDurationTicks: number; /** Original source timestamps when presentation pre-roll was removed. The * public `ticks` stay zero-based while decode requests retain the addresses * needed to reach a frame straddling presentation time zero. */ readonly sourceTicks?: Float64Array; } /** * Every real frame of one track, in presentation order, by its container tick * timestamp. * * A container states its timestamps as integer multiples of 1/tickRate, so a * frame's tick count is exact and comparisons between two readers of the same * container are integer comparisons. `timeAt` is the same division of the same * two integers the demuxer itself performs, which is what lets a consumer * holding only seconds match a producer's frame with `===`. */ export declare class FrameTimeline { private readonly data; private readonly ticksArray; private constructor(); static from(data: FrameTimelineData): FrameTimeline; /** A synthetic constant-rate table. Tests and fakes only. The default tick * rate is a whole multiple of `fps`, so no test table needs rounding. */ static uniform(fps: number, frameCount: number, tickRate?: TickRate): FrameTimeline; get tickRate(): TickRate; get frameCount(): number; toData(): FrameTimelineData; ticksAt(index: number): number; timeAt(index: number): Sec; /** Timestamp passed to the decoder for the named presentation frame. */ sourceTimeAt(index: number): Sec; /** Maps a public presentation time onto the container's source clock. */ toSourceTime(timeS: number): Sec; /** Maps a decoded/container timestamp onto the public presentation clock. */ fromSourceTime(timeS: number): Sec; idAt(index: number): FrameId; landingAt(index: number): FrameLanding; /** Ticks the frame at `index` ends at, which is where the next one starts. */ endTicksAt(index: number): number; /** * The frame covering `timeS`, which is what a decode for it returns. * * The comparison divides, as `timeAt` does, so a frame's own published * second answers with that frame. */ indexAtOrBefore(timeS: number): number; /** * The frame a decoded sample is. * * A decoded timestamp has been through the WebCodecs microsecond plane, so * it can miss its own tick by up to half a microsecond. Snapping to the * nearer neighbour absorbs that by four orders of magnitude, since the * narrowest real frame gap measured across the fixtures is 31667 us. */ indexOfDecoded(timeS: number): number; private clampIndex; }