Menu

#96 Push file detection into libmagic and use that

open
nobody
None
5
2007-04-23
2007-04-23
No

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.

Discussion

  • Reuben Thomas

    Reuben Thomas - 2008-06-26

    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.

     
  • robs

    robs - 2008-07-17

    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.

     
  • Reuben Thomas

    Reuben Thomas - 2008-07-17

    Logged In: YES
    user_id=50145
    Originator: YES

    Surely it's useful in any situation where the input is seekable? Anyway, hot stuff!

     
  • Jan Starý

    Jan Starý - 2013-02-02

    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?

     
  • robs

    robs - 2013-02-03

    It's at the top of formats.c

     

Log in to post a comment.