import { type AnySourceHandle } from "./decode-source"; import type { FrameId } from "./frame-timeline"; import type { DecodeDimensions } from "./decode-resolution"; import { type ScrubCursor, ScrubCursorState, type ScrubFrame, type ScrubFrameListener, type ScrubTrackInfo } from "./scrub-cursor"; import { type Sec } from "./types"; /** * Uncached cursor seam: a thin latest-wins queue and play-mode forward iterator * over an opened decode source. This is the cacheStrategy "none" backend, kept * for consumers that do not want the scheduler's memory footprint. * * Random-access seeks ride the provider's getFrame(t), which does the keyframe * walk and GOP decode internally. Forward playback uses frames(start) as a * streaming iterator, alive only between attachPlay and detachPlay so a paused * cursor never holds a decoder pipeline open. * * On the canvas source it emits CanvasScrubFrame; on the zero-copy sample source * a fresh decode emits SampleScrubFrame, whose close the controller owns after * paint. With no cache this cursor never blits a sample, so every fresh sample * is handed straight to the consumer. * * Coalescing: seekTo/seekToKey overwrite pendingSeekTargetS; drainSeek processes * only the latest target after the in-flight one settles, so a burst of scrub * seeks collapses to the most recent. */ export declare class CanvasSinkScrubCursor implements ScrubCursor { private readonly provider; private trackInfo; private outputGeneration; private readonly outputReads; private readonly disposeSource; /** * Forward-playback iterator. Lives only between attachPlay and detachPlay so * a paused cursor never holds a decoder pipeline open. */ private iterator; /** * Serializes next() calls. AsyncGenerator iterators are single-consumer; * without this chain a rAF tick racing a backup pull could double-advance * and emit duplicate frames. */ private nextInFlight; private nextPending; private currentState; private readonly listeners; private idleResolvers; private settleResolvers; private pendingSeekTargetS; private pendingSeekKeyOnly; private seekDraining; private closed; private lastEmittedFrame; constructor(source: AnySourceHandle); get state(): ScrubCursorState; get track(): ScrubTrackInfo; get isIdle(): boolean; resizeOutput({ width, height }: DecodeDimensions): Promise; private trackOutputRead; open(): Promise; /** No cache to read; the scheduler is the caching backend. */ peekCached(): ScrubFrame | null; /** * Decodes one named frame of the source and emits it. * * The retrieval is at-or-before a time the frame table produced, and the * demuxer normalises that back to the same integer tick it came from, so it * lands on that frame and no other. Nothing here walks, compares or skips, * so a step across a frame boundary needs no epsilon. */ seekToFrame(frame: FrameId, isPresentationCurrent?: () => boolean): Promise; seekTo(timestamp: Sec): void; /** * getFrame(t) lands at or before t, which is the keyframe-or-earlier * semantics seekToKey implies. The emitted frame is marked as a keyframe * result via the keyOnly flag. */ seekToKey(timestamp: Sec): void; /** Floors a seek target to the track's first timestamp. A seek below the * origin (an offset/trimmed clip) has no sample to land on, so it would * emit nothing; clamping lands it on the first frame instead. */ private clampToOrigin; attachPlay(startS: number): void; detachPlay(): void; next(): void; idle(): Promise; seekSettled(): Promise; subscribe(listener: ScrubFrameListener): () => void; close(): Promise; private drainSeek; private runSeek; private pullForwardOne; private emitFrame; private flushIdleResolvers; private flushSettleResolvers; }