use ec_core::CodecId; use crate::boxes::FourCc; pub(crate) fn video_codec( kind: &FourCc, video_track: bool, ) -> Option<(CodecId, Option<&'static FourCc>)> { Some(match kind { b"avc1" | b"avc3" => (CodecId::H264, Some(b"avcC")), b"hvc1" | b"hev1" => (CodecId::H265, Some(b"hvcC")), b"vp08" => (CodecId::Vp8, Some(b"vpcC")), b"vp09" => (CodecId::Vp9, Some(b"vpcC")), b"av01" => (CodecId::Av1, Some(b"av1C")), // Motion JPEG: QuickTime `jpeg` (Photo JPEG) and `mjpa` (MJPEG-A) carry whole JFIF // frames and no configuration box. `mjpb` (MJPEG-B) packets have a different layout // (no SOI, marker-less blocks at header offsets); ec-mjpeg detects and rewraps them. // Uncompressed video; `raw ` is also the 8-bit PCM audio entry, so it needs a `vide` track. // The decoder (ec-riff `RawVideoDecoder`) reads the layout from the synthesized header. b"raw " | b"yuvs" if !video_track => return None, b"raw " | b"yuvs" | b"2vuy" | b"yuv2" | b"v210" | b"v410" | b"b16g" => { (CodecId::RawVideo, None) } b"jpeg" | b"mjpa" | b"mjpb" => (CodecId::Mjpeg, None), // ProRes entries carry no configuration box: the frame header is self-describing. b"apco" | b"apcs" | b"apcn" | b"apch" | b"ap4h" | b"ap4x" => (CodecId::ProRes, None), // Avid DNxHD (`AVdn`) and DNxHR (`AVdh`); the optional `DNxD` box is // the only child worth keeping as extradata. b"AVdn" | b"AVdh" => (CodecId::Dnxhd, Some(b"DNxD")), // MPEG-4 Part 2 Visual: `mp4v` carries the VOL header in the `esds` // DecoderSpecificInfo; the 3GPP/QuickTime H.263 entries (`s263`, `h263`) // carry no configuration the baseline decoder needs (`d263` is ignored). b"mp4v" => (CodecId::Mpeg4Part2, Some(b"esds")), b"s263" | b"h263" => (CodecId::Mpeg4Part2, None), // DV: QuickTime sample entries for DV25/DVCPRO25 (`dvc `/`dvcp`/`dvpp`), DVCPRO50 // (`dv5n`/`dv5p`) and DVCPRO HD (`dvhq`/`dvh3`/`dvh5`/`dvh6`/`dvhp`...). The frame is // self-describing: no configuration box. b"dvc " | b"dvcp" | b"dvpp" | b"dvcs" | b"dvis" | b"dv5n" | b"dv5p" | b"dv5q" | b"dvhq" | b"dvh1" | b"dvh2" | b"dvh3" | b"dvh4" | b"dvh5" | b"dvh6" | b"dvhp" | b"dvhs" | b"dvhn" | b"dvhr" => (CodecId::DvVideo, None), _ => return None, }) }