AIFF support w/ infer backend
This commit is contained in:
parent
7c36061e03
commit
74ae55ac52
3 changed files with 18 additions and 7 deletions
|
@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
### Added
|
||||||
|
- AIFF (Audio Interchange File Format, a PCM audio format like WAV) detection to [`infer`]
|
||||||
### Other
|
### Other
|
||||||
- Refactoring - split fif into main.rs and lib.rs, moved file-related functionality (directory scanning, etc.) into
|
- Refactoring - split fif into main.rs and lib.rs, moved file-related functionality (directory scanning, etc.) into
|
||||||
files module, removed string module, etc.
|
files module, removed string module, etc.
|
||||||
|
|
|
@ -43,9 +43,23 @@ cfg_if! {
|
||||||
buf.len() >= 34 && buf.starts_with(b"RPA-") && buf[7] == b' ' && buf[24] ==b' '
|
buf.len() >= 34 && buf.starts_with(b"RPA-") && buf[7] == b' ' && buf[24] ==b' '
|
||||||
});
|
});
|
||||||
|
|
||||||
|
info.add("audio/x-aiff", "aiff", |buf| {
|
||||||
|
// as added by https://github.com/bojand/infer/pull/48/files
|
||||||
|
// this should be removed when (if) that PR is accepted
|
||||||
|
buf.len() > 11
|
||||||
|
&& buf[0] == 0x46
|
||||||
|
&& buf[1] == 0x4F
|
||||||
|
&& buf[2] == 0x52
|
||||||
|
&& buf[3] == 0x4D
|
||||||
|
&& buf[8] == 0x41
|
||||||
|
&& buf[9] == 0x49
|
||||||
|
&& buf[10] == 0x46
|
||||||
|
&& buf[11] == 0x46
|
||||||
|
});
|
||||||
|
|
||||||
info.add("image/svg+xml", "svg", |buf| {
|
info.add("image/svg+xml", "svg", |buf| {
|
||||||
// before doing the moderately expensive SVG check, we should make sure that the input is actually SGML-ish
|
// before doing the moderately expensive SVG check, we should make sure that the input is actually SGML-ish,
|
||||||
// by "SGML-ish", i mean starts with anywhere from zero to ∞-1 whitespace characters, and then a less than sign,
|
// by which i mean, starts with anywhere from zero to ∞-1 whitespace characters, and then a less than sign,
|
||||||
// and then there's some other stuff we don't care about right now
|
// and then there's some other stuff we don't care about right now
|
||||||
|
|
||||||
// so, here comes our fancy pants """""SGML-ish validator"""""
|
// so, here comes our fancy pants """""SGML-ish validator"""""
|
||||||
|
@ -72,9 +86,6 @@ cfg_if! {
|
||||||
.any(|buf| identifiers.iter().any(|id| buf.starts_with(id)))
|
.any(|buf| identifiers.iter().any(|id| buf.starts_with(id)))
|
||||||
});
|
});
|
||||||
|
|
||||||
// unmut
|
|
||||||
let info = info;
|
|
||||||
|
|
||||||
Self { db: info }
|
Self { db: info }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,6 @@ pub enum OutputFormat {
|
||||||
Json,
|
Json,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: convert this to macro style?: https://docs.rs/clap/3.0.0-beta.2/clap/index.html#using-macros
|
|
||||||
|
|
||||||
#[derive(Clap, Debug)]
|
#[derive(Clap, Debug)]
|
||||||
#[allow(clippy::struct_excessive_bools)]
|
#[allow(clippy::struct_excessive_bools)]
|
||||||
#[clap(
|
#[clap(
|
||||||
|
|
Loading…
Reference in a new issue