import type { AnnotationVisibility } from "supervision-js-core"; import type { MediaRendererScene, MediaRendererSceneOptions } from "./media-renderer-scene"; import type { PresentedVideoFrame } from "./presented-frame-channel"; export declare function observePixiContainerResize(container: HTMLElement, resize: () => void): () => void; type MediaCompositor = { upload(frame: VideoFrame, rotation?: PresentedVideoFrame["rotation"]): void; destroy(): void; }; /** The binding a compositor points at whichever texture holds the last frame. */ export interface MediaGpuTextureSource { resize(width: number, height: number, resolution: number): void; updateGPUTexture(texture: GPUTexture): void; } export interface MediaCompositorOptions { readonly device: GPUDevice; readonly height: number; readonly width: number; /** * Puts the compositor's first texture on screen and returns the binding every * later texture replaces it through. */ readonly attach: (texture: GPUTexture) => MediaGpuTextureSource; /** Runs after a decode of a new size swapped the texture underneath. */ readonly onTextureReplaced: () => void; } /** * Two ways to drive the same layer stack. * * Pull presentation is the default: the renderer asks the media source for the * sample it wants, hands it to `presentSample`, and Pixi's ticker paints the * scene every frame. * * A still frame is pulled once and then renders on change the way push * presentation does, with the sample it presents as one more change. The * ticker runs only while a GIF region, loading spinner, or opted-in focus * transition animates. * * Push presentation engages when the opened source carries a presented-frame * channel. The producer then decides which frame is on screen and announces it, * so every render goes through the scheduler as an explicit answer to a * change: a presented frame, a layer turned on or off, restyling, hover or * selection, a viewport move, a resize, or the swapchain coming back after the * tab was hidden, or an opted-in focus fade. A notification that describes what * is already drawn renders nothing. Once a bounded focus fade settles, a paused * scene nobody touches renders nothing at all. * * Default focus fades advance with presented media time. Hover, selection, and * presentation changes settle them immediately; content and visibility redraws * preserve their current alpha. An explicit duration instead animates alpha on * wall time outside atomic presents, with a ticker that stops after the fade. */ export declare function createPixiMediaScene(options: MediaRendererSceneOptions): Promise; export declare function canReuseMaskVisibilityArtifacts(previous: AnnotationVisibility | undefined, next: AnnotationVisibility | undefined): boolean; /** * Copies presented frames into a GPU texture Pixi samples, with no CPU readback * in between. A decode whose size changed gets a new texture, and the swap is * all-or-nothing: exactly one of the two textures survives it. */ export declare function createMediaCompositor(options: MediaCompositorOptions): MediaCompositor; /** * Whether this device's queue takes a decoded frame as a copy source. * * Chrome converts a VideoFrame. Firefox's converter accepts only ImageBitmap, * HTMLImageElement, HTMLCanvasElement and OffscreenCanvas, and rejects the * frame with a TypeError thrown from inside the present. The present abandons * the steps after the upload, so the media sprite keeps a texture nothing ever * wrote to while the redraw at the resting playhead keeps putting annotations * over it: the scene then reads as a working library over a broken video, * which is worse than an error. Answering here instead routes those frames * through the staging canvas, which every non-WebGPU scene already uses. * * The answer is a property of the browser rather than of the decode, so it is * asked once when the compositor is built and never per frame: a browser that * takes the frame pays one one-pixel copy each time media is opened, and * nothing at all while it plays. */ export declare function acceptsVideoFrameUpload(device: GPUDevice): boolean; export declare function resolvePixiResolution(maxDevicePixelRatio: number | undefined): number; export {}; //# sourceMappingURL=pixi-media-scene.d.ts.map