Author: Alessandro AngeliAlessandro Angeli Date: Jul 22, 2008 17:56
From: "Yaerek"
> Hi. I'm writing an application that has to load/play
> audio files. It has to run on XP/Vista (and Mac OS X)
> Question is, how to recognize a type of audio file we're
> loading? Basically, I want to know what kind of audio
> file I got in order to properly handel it (mp3, wav, wma,
> aac, au). I understand I can "recognize" a file type
> based on its extension, however that does not guarantee
> what's inside; wav container can store several different
> formats. How to recognize which one I'm facing? Should it
> only be based on file extension?
As Shugo told you, there is no generic way: you need to read
the beginning of the file ad try to make sense of it
comparing its contents to a list of templates of each type
you plan on supporting. This is exactly what e.g. DirectShow
does when asked to find a source filter.
|