import { type PreparedMaskFrame } from "#render-preparation/mask-frame-preparer"; import type { SerializableMaskInstruction } from "#render-preparation/mask-preparation-worker-protocol"; import { type PreparedRenderTimelineContext } from "#render-preparation/prepared-window-timeline"; import { type BufferedDetectionTimeline } from "supervision-js-core"; import type { DetectionFrame } from "supervision-js-core"; import type { MaskStyle } from "supervision-js-core"; import { RenderPreparationArtifactKind, type RenderPreparationOptions, type ResolvedRenderPreparationGateThresholds } from "#types/render-preparation"; export declare enum PreparedRasterTier { Coarse = "coarse", Fine = "fine" } export declare const DEFAULT_MASK_SCHEDULE_BATCH_SIZE = 2; export interface PreparedRenderFrame { readonly detectionFrame: DetectionFrame; readonly key: string; readonly maskFrame?: PreparedMaskFrame; readonly maskStatus: PreparedRenderFrameMaskStatus; } export declare enum PreparedRenderFrameMaskStatus { Disabled = "disabled", Empty = "empty", Pending = "pending", Prepared = "prepared" } export interface PreparedRenderWindow { getFrame(mediaTime: number): PreparedRenderFrame | undefined; /** Revision of the prepared artifact, including replacements at the same time. */ getArtifactRevision(mediaTime: number): number; /** Recooks the active frame and its targets after the display raster size changes. */ invalidateRasterSize(): void; invalidateMaskDisplayWidth(): void; /** * Whether this window's artifact for a media time is cooked, scheduling * nothing. True when there is nothing to cook: no style, no frame there. */ isArtifactPrepared(mediaTime: number): boolean; /** * Frames preparation has finished, counted up across the window's life. Read * twice, it separates preparation that is slow from preparation that is * stuck: the count moves for a cook that lands however far behind the * playhead it is, and a cook that lands and is then evicted still counts. */ getPreparationProgress(): number; /** * Whether `waitForReady` would wait, answered without scheduling anything. * Asked on every playhead move of a source that has to be stopped to be * held, where opening a wait that resolves immediately still costs the stop. */ needsPlaybackGateWait(mediaTime: number, options: ResolvedRenderPreparationGateThresholds): boolean; /** * Resolves once the media time may be presented. `signal` is how a caller * that has moved on says so: aborting resolves the wait and drops the hold it * was placing on preparation, because a caller that walked away re-checks * whatever it does next anyway. Without one, an abandoned wait holds forever. */ waitForReady(mediaTime: number, options: ResolvedRenderPreparationGateThresholds, signal?: AbortSignal): Promise; /** * Whether the playhead is moving. A window over a resting playhead covers a * paused margin instead of the full prefetch span. */ setPlaybackActive(active: boolean): void; setTimelineContext(context: PreparedRenderTimelineContext): void; setMaskStyle(maskStyle: MaskStyle | null | undefined): void; destroy(): void; } export type { PreparedMaskFrame } from "./mask-frame-preparer"; export type { PreparedRenderTimelineContext } from "./prepared-window-timeline"; /** How many frames ahead of the playhead a prepared window aims to cover. */ export declare function resolvePreparedWindowFrameCount(options: { readonly prefetchFrameCount?: number; readonly renderPreparation?: RenderPreparationOptions; }): number; export declare function createPreparedRenderWindow(options: { readonly artifactKind?: RenderPreparationArtifactKind; readonly independentMasks?: boolean; readonly detectionTimeline: BufferedDetectionTimeline; readonly maskStyle?: MaskStyle | null; readonly maxMaskFrameCacheSize?: number; readonly maxMaskFrameCacheBytes?: number; /** Reserves renderer backing before a prepared frame can be drawn. */ readonly resolveMaskFrameBackingBytes?: (frame: PreparedMaskFrame) => number; readonly onMaskFrameEvicted?: (key: string) => void; readonly onMaskFramePrepared?: (maskFrame: PreparedMaskFrame) => void; readonly onMaskFramesCleared?: () => void; /** Fires whenever what the window covers may have changed. */ readonly onPreparedWindowChange?: () => void; readonly prefetchFrameCount?: number; readonly preparedWindowScanIntervalSeconds?: number; readonly renderPreparation?: RenderPreparationOptions; readonly resolveInstructions?: (options: { readonly frame: DetectionFrame; readonly maskStyle: MaskStyle; readonly mediaTime: number; }) => readonly SerializableMaskInstruction[]; /** * The widest id raster a cook may produce. A function because the raster is * sized against media dimensions the caller only learns once its display * exists, which is after this window does. */ readonly resolveMaxRasterWidth?: () => number | undefined; readonly resolveMaskDisplayWidth?: () => number | undefined; }): PreparedRenderWindow; //# sourceMappingURL=prepared-render-window.d.ts.map