/** * VideoDecoder - WebCodecs-based video decoder */ import type { VideoTrack } from "../types"; import { WasmBindings } from "../wasm/bindings"; export declare class MoviVideoDecoder { private decoder; private swDecoder; private bindings; private useSoftware; private pendingFrames; private pendingChunks; private isConfigured; private onFrame; private onError; private waitingForKeyframe; onKeyframeWaitChange: ((waiting: boolean) => void) | null; private errorCount; private static MAX_ERRORS; private lastConfig; private currentProfile; private currentTrack; private lastErrorTime; private openGopErrorCount; private hardwareRetryCount; private lastHardwareRetryTime; private isResurrecting; private forceSoftware; private requiresSoftware; private targetFps; private isRecovering; private lastRecreateTime; private isAnnexBSource; private _loggedConversion; private skippedWhileWaiting; private justFlushed; private skipRaslAfterResume; private postFlushKeyframeRejects; private static POST_FLUSH_REJECT_LIMIT; private static MID_STREAM_OPENGOP_REJECT_LIMIT; private static DISABLE_OPENGOP_SW_FALLBACK; constructor(forceSoftware?: boolean); setBindings(bindings: WasmBindings): void; private setWaitingForKeyframe; /** * Configure the decoder for a specific track */ configure(track: VideoTrack, extradata?: Uint8Array, targetFps?: number): Promise; private initSoftwareDecoder; /** * Recreate the decoder after a fatal error */ private recreateDecoder; private lastChunkInfo; /** * Decode an encoded video chunk */ private static MIN_DELTA_PACKET_BYTES; private static TINY_PACKET_DROP_WINDOW; private chunksSinceKeyframeWait; private playbackRate; setPlaybackRate(rate: number): void; decode(data: Uint8Array, timestamp: number, keyframe: boolean, dts?: number, isIdr?: boolean, isRasl?: boolean): void; private recoverFromError; private _doRecover; /** * Map FFmpeg codec names to WebCodecs codec strings */ private mapCodecToWebCodecs; /** * Set frame output callback */ setOnFrame(callback: (frame: VideoFrame) => void): void; /** * Set error callback */ setOnError(callback: (error: Error) => void): void; /** * Flush the decoder */ flush(): Promise; /** * Reset the decoder */ reset(): void; /** * Close the decoder */ close(): void; /** * Check if decoder is configured */ get configured(): boolean; /** * Helper to check if we should try switching back to hardware */ private shouldRetryHardware; /** * Bitwise NAL unit inspection to detect true Sync/IDR frames */ private isLikelySyncFrame; /** * Get queue size */ get queueSize(): number; /** * Check if software decoder is being used */ get isSoftware(): boolean; get isWaitingForKeyframe(): boolean; isRecentlyRecovering(graceMs?: number): boolean; /** * Get decoder stats for nerd stats overlay */ getStats(): { decoderType: string; queueSize: number; errorCount: number; }; /** * Split Annex B byte stream into individual NAL units. * Handles both 3-byte (00 00 01) and 4-byte (00 00 00 01) start codes. */ private static splitAnnexBNalUnits; /** * Remove Annex B emulation prevention bytes (00 00 03 → 00 00). * Required for parsing NAL unit content (profile_tier_level etc.) */ private static removeEpb; /** * Convert Annex B extradata to hvcC (HEVC Decoder Configuration Record). * Extracts VPS, SPS, PPS NAL units and packages them into ISO 14496-15 format. * Uses track metadata for reliable profile/tier/level (Annex B NALs have EPB that corrupt offsets). */ static annexBToHvcC(annexB: Uint8Array, track?: { profile?: number; level?: number; }): Uint8Array | null; /** * Convert Annex B extradata to avcC (AVC Decoder Configuration Record). * Extracts SPS and PPS NAL units. */ static annexBToAvcC(annexB: Uint8Array): Uint8Array | null; /** * Check if an HEVC NAL unit type should be stripped before feeding to WebCodecs. * Dolby Vision RPU (type 62), UNSPEC63 (type 63), and other non-standard * NAL types cause hardware decoder errors. */ private static isUnsupportedHevcNalType; /** * Convert Annex B packet data to 4-byte length-prefixed format. * Replaces start codes (00 00 01 or 00 00 00 01) with 4-byte NAL unit lengths. * Strips Dolby Vision RPU and other unsupported NAL unit types. */ static annexBToLengthPrefixed(data: Uint8Array): Uint8Array; static stripAudLengthPrefixed(data: Uint8Array): Uint8Array; } //# sourceMappingURL=VideoDecoder.d.ts.map