/** * Core types shared across avbridge modules. * * The four main concepts: * - {@link MediaInput} — what the user gives us (File / Blob / URL / bytes). * - {@link MediaContext} — what we learned about it from probing. * - {@link Classification} — which playback strategy we picked. * - {@link PlaybackSession} — the running playback, returned by a strategy. */ /** * Anything we accept as a media source. We do not accept arbitrary * `ReadableStream`s in v1 because we need random access for seeking. */ export type MediaInput = File | Blob | string | URL | ArrayBuffer | Uint8Array; /** Container format families we know about. */ export type ContainerKind = | "mp4" | "mov" | "mkv" | "webm" | "avi" | "asf" | "flv" | "rm" // RealMedia (.rm / .rmvb) | "ogg" | "wav" | "mp3" | "flac" | "adts" | "mpegts" | "unknown"; /** Video codec families. Strings, not enums, so plugins can extend. */ export type VideoCodec = | "h264" | "h265" | "vp8" | "vp9" | "av1" | "mpeg4" // MPEG-4 Part 2 (DivX/Xvid) | "wmv3" | "vc1" | "rv10" // RealVideo 1.0 (H.263-like) | "rv20" // RealVideo G2 | "rv30" // RealVideo 8 | "rv40" // RealVideo 9/10 | "mpeg2" | "mpeg1" | "theora" | "dv" // DV / DVCPRO (camcorder, MiniDV) | "hq_hqa" // Canopus HQ / HQA (Grass Valley intermediate) | "rawvideo" // uncompressed frames | "qtrle" // QuickTime Animation (Apple RLE) | "png" // PNG sequence in MOV | "vp6f" // VP6 Flash variant | (string & {}); /** Audio codec families. */ export type AudioCodec = | "aac" | "mp3" | "opus" | "vorbis" | "flac" | "pcm" | "ac3" | "eac3" | "wmav2" | "wmapro" | "alac" | "cook" // RealAudio Cooker (G2/RealAudio 8) | "ra_144" // RealAudio 1.0 (14.4 kbps) | "ra_288" // RealAudio 2.0 (28.8 kbps) | "sipr" // RealAudio Sipr (voice codec) | "atrac3" // Sony ATRAC3 (sometimes seen in .rm) | "dts" // DTS (common in Blu-ray MKV rips) | "truehd" // Dolby TrueHD (Blu-ray lossless) | (string & {}); export interface VideoTrackInfo { id: number; codec: VideoCodec; /** Codec-private profile string when known (e.g. "High", "Main 10"). */ profile?: string; level?: number; width: number; height: number; /** Pixel format string in ffmpeg style (e.g. "yuv420p", "yuv420p10le"). */ pixelFormat?: string; /** Frames per second, when known. */ fps?: number; bitDepth?: number; /** RFC 6381 codec string for `MediaSource.isTypeSupported`, when computable. */ codecString?: string; } export interface AudioTrackInfo { id: number; codec: AudioCodec; channels: number; sampleRate: number; language?: string; codecString?: string; } export interface SubtitleTrackInfo { id: number; /** "vtt" | "srt" | "ass" | "pgs" | "embedded" */ format: string; language?: string; /** Set if this is a sidecar file rather than embedded in the container. */ sidecarUrl?: string; } /** * Everything the probe layer learned about a source. * This is the input to the classification engine. */ export interface MediaContext { source: MediaInput; /** Stable display name for diagnostics, if we have one. */ name?: string; byteLength?: number; container: ContainerKind; videoTracks: VideoTrackInfo[]; audioTracks: AudioTrackInfo[]; subtitleTracks: SubtitleTrackInfo[]; /** Which probe backend produced this context, for diagnostics. */ probedBy: "mediabunny" | "libav" | "sniff"; /** Total duration in seconds, if known. */ duration?: number; } /** * The four playback strategies, ordered from lightest to heaviest: * - `"native"` — direct `