SoX's discrimination would be useful in libmagic (the library on which file(1)) is based, so let's not keep it to ourselves. It also will have (slight) benefits for us: we'll be able to detect sound formats we don't support (that other people add to libmagic), not to mention users trying to use SoX on other files like pictures. Because libmagic deals in MIME types, it will also make it easier to use SoX with more modern frameworks that are MIME type driven.
Due diligence: libmagic is license-compatible (BSD) and highly portable.
Logged In: YES
user_id=50145
Originator: YES
There is another reason to do this: libmagic does detection of MP3, which SoX currently doesn't. I have a use case for this: playing URLs without extensions which can be either .ogg or .mp3. Of course, I'd also need auto-filetype detection on non-seekable streams (FR #2003121) for this to work.
Logged In: YES
user_id=27473
Originator: NO
Embryonic libmagic support now in CVS branch `magic'; detects mp3, but not much use yet without FR #2003121.
Logged In: YES
user_id=50145
Originator: YES
Surely it's useful in any situation where the input is seekable? Anyway, hot stuff!
magic seems to know a few audio formats, at least here on OpenBSD 5.2.
If I wanted to push SoX's binary knowledge of audio file formats into magic,
where in the SoX codebase would I start looking for that knowledge?
It's at the top of formats.c