import type { EncodedPacket } from "mediabunny"; import { type DepthPreviewLumaCopier, type DepthPreviewLumaPath } from "#render-preparation/depth/preview-luma"; import { type TrackFrameIndex } from "./track-frame-index"; /** How long the browser may take to say whether it decodes the preview. */ export declare const DECODER_SUPPORT_MILLISECONDS = 3000; export type DepthPreviewTrackInput = string | URL | ArrayBuffer | Uint8Array; export interface DepthPreviewTrackOptions { /** Defaults to the browser's own choice. */ readonly hardwareAcceleration?: HardwareAcceleration; /** * Maps each code the decoder returns to the code written, for a decoder * known to change them. */ readonly correction?: Uint8Array | null; /** * Copies decoded frames' luma out: the render-preparation worker's, to * keep the copies off the page. Defaults to copying on the page. */ readonly copier?: DepthPreviewLumaCopier; /** Stops opening: the container's reads are cancelled. */ readonly signal?: AbortSignal; } export type { DepthPreviewLumaPath }; /** One decoded preview frame's luma, one byte per map pixel. */ export interface DepthPreviewLumaFrame { /** Frame index on the preview's own timeline, in presentation order. */ readonly index: number; readonly luma: Uint8Array; readonly width: number; readonly height: number; } /** One pass of decoding, from a key frame forward. */ export interface DepthPreviewDecodeRun { /** * The next decoded frame, or null once the track has ended or the run was * cancelled. Frames arrive in the decoder's output order, which is * presentation order except on browsers that reorder late. */ next(): Promise; cancel(): void; } export interface DepthPreviewDecodeOptions { /** Frames this answers false for are closed without copying their pixels. */ readonly keep?: (index: number) => boolean; } /** * The 8-bit preview video of a depth clip, decoded to luma codes. * * It holds one `VideoDecoder` for its whole life and resets it for each new * run, so a seek or a drag never has two of its decoders alive at once, * however slowly the browser tears an old one down. */ export interface DepthPreviewTrackReader { readonly width: number; readonly height: number; readonly frameCount: number; /** Frame start times, in seconds from the preview's first frame. */ readonly times: Float64Array; keyIndexAtOrBefore(index: number): number; /** * Starts decoding at the key frame at or before `fromIndex`. The run * replaces the previous one, whose `next` answers null from then on. */ decode(fromIndex: number, options?: DepthPreviewDecodeOptions): DepthPreviewDecodeRun; /** How decoded frames reached their codes; null before the first. */ lumaPath(): DepthPreviewLumaPath | null; dispose(): void; } /** * Opens a depth preview video: an 8-bit grayscale H.264 whose luma codes are * depth. Mediabunny is loaded on first use, so a page without a preview never * downloads it. */ export declare function openDepthPreviewTrack(input: DepthPreviewTrackInput, options?: DepthPreviewTrackOptions): Promise; interface PacketReader { getKeyPacket(timestamp: number, options: { verifyKeyPackets: boolean; }): Promise; getFirstKeyPacket(options: { verifyKeyPackets: boolean; }): Promise; packets(start?: EncodedPacket, end?: EncodedPacket): AsyncGenerator; } /** The decoding half, apart from the container so it can be driven directly. */ export declare function createDepthPreviewTrackReader(options: { readonly config: VideoDecoderConfig; readonly copier?: DepthPreviewLumaCopier; readonly correction?: Uint8Array | null; readonly packetSink: PacketReader; readonly timeline: TrackFrameIndex; readonly width: number; readonly height: number; readonly dispose?: () => void; readonly VideoDecoder?: typeof VideoDecoder; }): DepthPreviewTrackReader; //# sourceMappingURL=depth-preview-track.d.ts.map