import type { DecodedMediaSource } from "#media/media-source"; import type { PresentedFrameChannel } from "#renderers/presented-frame-channel"; import type { MediaRendererSource } from "#types/media-renderer"; import type { BlobVideoSource, DecodeResolutionStrategy, DisplayBoxResolutionOptions, UrlVideoSource, WebVideoEngine, WebVideoEngineOptions } from "#web-video-engine"; export interface WebVideoEngineMediaSourceOptions extends Omit { /** * The video to open. Two readers open it here, so it has to be one that can * be opened twice: the worker-backed engine decodes playback and scrubbing, * and the analysis session behind `sampleSink` decodes thumbnails and one-off * grabs from scratch. A URL re-fetches and a Blob re-reads. A ReadableStream * yields its bytes once, and the engine's load transfers it to the worker, * which detaches it here, so the pull path would be left with nothing to * read; pass one to {@link WebVideoEngine} directly instead. */ readonly source: UrlVideoSource | BlobVideoSource; /** * The box a compositor paints these frames into, in CSS pixels, with the * viewer's device pixel ratio. * * This source runs the engine canvas-less, so nothing on the engine side ever * measures a display box and its viewport strategy has nothing to read: left * unsaid, frames decode at the source's full resolution however small the box * is. Saying it here decodes at the size the frames are actually shown at, * which cuts per-frame paint work and buys the scrub cache more slots at the * cost of preview sharpness while scrubbing. An explicit `decodeStrategy` * wins over this. */ readonly display?: DisplayBoxResolutionOptions; /** * Sizes the frames the pull path decodes. The inherited `decodeStrategy` * sizes what the engine decodes for its own presentation. */ readonly frameDecodeStrategy?: DecodeResolutionStrategy; } export interface WebVideoEngineMediaSource extends DecodedMediaSource { /** * The loaded engine. Naming the renderer's channel in the type is what fails * the build if the engine's transport stops answering that seam. */ readonly engine: WebVideoEngine & PresentedFrameChannel; } /** * Adapts the web video engine to the decoded-media source seam. * * The pull path, `sampleSink`, serves one-off reads such as thumbnails and * single frame grabs, decoding each request from scratch through the engine's * batch analysis entry. The push path serves playback and scrub presentation: * the engine holds no canvas, paints nothing, and announces every frame that * earns the screen, so a compositor subscribes to `engine` and never pulls * samples here. */ export declare function openWebVideoEngineMediaSource(options: WebVideoEngineMediaSourceOptions): Promise; export declare function createWebVideoEngineMediaRendererSource(options: WebVideoEngineMediaSourceOptions): MediaRendererSource; //# sourceMappingURL=video-engine-media-source.d.ts.map