diff --git a/crates/ec-probe/src/lib.rs b/crates/ec-probe/src/lib.rs index 5399f6c2..2a1241b4 100644 --- a/crates/ec-probe/src/lib.rs +++ b/crates/ec-probe/src/lib.rs @@ -83,6 +83,20 @@ pub enum Format { } impl Format { + /// Every format this crate can open. + pub const ALL: [Format; 10] = [ + Format::Wav, + Format::Flac, + Format::Mp3, + Format::Adts, + Format::Dts, + Format::Ogg, + Format::Mp4, + Format::Matroska, + Format::Avi, + Format::Amr, + ]; + /// Short lowercase name for logs and capability tables. pub fn name(&self) -> &'static str { match self { @@ -258,20 +272,9 @@ impl Reader { let format = sniff(&head) .or_else(|| { let hint = hint?.to_ascii_lowercase(); - [ - Format::Wav, - Format::Flac, - Format::Mp3, - Format::Adts, - Format::Dts, - Format::Ogg, - Format::Mp4, - Format::Matroska, - Format::Avi, - Format::Amr, - ] - .into_iter() - .find(|f| f.extensions().contains(&hint.as_str())) + Format::ALL + .into_iter() + .find(|f| f.extensions().contains(&hint.as_str())) }) .ok_or_else(|| { Error::unsupported(