/** * 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. */ type MediaInput = File | Blob | string | URL | ArrayBuffer | Uint8Array; /** Container format families we know about. */ type ContainerKind = "mp4" | "mov" | "mkv" | "webm" | "avi" | "asf" | "flv" | "rm" | "ogg" | "wav" | "mp3" | "flac" | "adts" | "mpegts" | "unknown"; /** Video codec families. Strings, not enums, so plugins can extend. */ type VideoCodec = "h264" | "h265" | "vp8" | "vp9" | "av1" | "mpeg4" | "wmv3" | "vc1" | "rv10" | "rv20" | "rv30" | "rv40" | "mpeg2" | "mpeg1" | "theora" | "dv" | "hq_hqa" | "rawvideo" | "qtrle" | "png" | "vp6f" | (string & {}); /** Audio codec families. */ type AudioCodec = "aac" | "mp3" | "opus" | "vorbis" | "flac" | "pcm" | "ac3" | "eac3" | "wmav2" | "wmapro" | "alac" | "cook" | "ra_144" | "ra_288" | "sipr" | "atrac3" | "dts" | "truehd" | (string & {}); 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; } interface AudioTrackInfo { id: number; codec: AudioCodec; channels: number; sampleRate: number; language?: string; codecString?: string; } 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. */ 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 `