/** * ThumbnailRenderer - WebGL2-based thumbnail rendering with HDR support * Uses browser-specific rendering paths for optimal quality: * - Chromium: Native HDR via drawingBufferColorSpace * - Non-Chromium: Shader-based PQ tone mapping */ import type { VRView } from "../render/CanvasRenderer"; export interface ThumbnailRenderOptions { width: number; height: number; rotation?: number; colorPrimaries?: string; colorTransfer?: string; hdrEnabled?: boolean; } export declare class ThumbnailRenderer { private canvas; private gl; private program; private texture; private vao; private rotation; private vrProgram; private vrVao; private vrLocs; private vrView; private flatWidth; private flatHeight; private static readonly VR_PREVIEW_HEIGHT; private static readonly VR_FISHEYE_FOV; private static readonly VR_PLANET_SCALE; private decoder; private pendingDecodeResolve; private lastDecoderConfig; private decoderRevivedUnproven; private hasNativeHDRSupport; private isHDRSource; private isAnnexBSource; private hdrEnabled; private lastColorPrimaries?; private lastColorTransfer?; constructor(); /** * Detect if browser supports native HDR (Chromium-based) */ private detectChromium; /** * Detect HDR color space from metadata */ private detectHDRColorSpace; /** * Initialize WebGL2 context with appropriate shader for browser */ initialize(options: ThumbnailRenderOptions): void; /** * Simple WebGL initialization for Chromium (native HDR support) */ private initWebGLSimple; /** * WebGL initialization with HDR tone mapping for non-Chromium browsers */ private initWebGLWithHDR; /** * Create and compile shader program */ private createProgram; /** * Setup geometry (fullscreen quad) */ private setupGeometry; /** * Configure WebCodecs VideoDecoder */ configureDecoder(codec: string, extradata: Uint8Array | null, width: number, height: number, profile?: number, level?: number): Promise; /** * Map FFmpeg codec names to WebCodecs codec strings * (Copied from MoviVideoDecoder for consistency) */ private mapCodecToWebCodecs; /** * Decode and render a packet using WebCodecs */ decodeAndRender(packetData: Uint8Array, pts: number, duration?: number): Promise; /** * Recreate the WebCodecs decoder from the last-used config. Called when the * decoder has died (closed / errored) so a single decode failure doesn't * disable thumbnails for the whole session. Returns false if there is no * saved config or reconfiguration fails. */ private recreateDecoder; /** * Render RGBA data to canvas */ render(rgbaData: Uint8Array, width: number, height: number): void; /** * Render VideoFrame to canvas */ renderVideoFrame(frame: VideoFrame): void; /** * Set (or clear) the 360° reprojection view. When non-null, the next draw() * reprojects the equirectangular texture to this camera angle; null restores * the flat passthrough. Must be set BEFORE render()/decodeAndRender(), since * draw() runs synchronously inside those. */ setProjection(view: VRView | null): void; /** * Lazily compile the equirect/fisheye/stereographic raycast program (ported * verbatim from CanvasRenderer.initVRProgram) plus its own unrotated * fullscreen quad feeding v_ndc. Returns true when ready. */ private initVRProgram; /** Reproject the bound equirect texture to the current 360 view. */ private drawVR; private draw; /** * Setup texture */ private setupTexture; /** * Set HDR enabled state */ setHDREnabled(enabled: boolean): void; /** * Get the rendered canvas */ getCanvas(): HTMLCanvasElement; /** * Destroy WebGL resources */ destroy(): void; } //# sourceMappingURL=ThumbnailRenderer.d.ts.map