[SDL] MP3 detection in SDL_Mixer (was Appending resources to .exe)
Daniel K. O.
danielko.listas at gmail.com
Thu Apr 5 17:43:39 PDT 2007
Andre de Leiradella escreveu:
> I took a look at some MP3 files I have and all of them start with the same eight characters: ID3\3\0\0\0\0
>
> It is straight forward to add this test to music.c, but does anyone know if this is correct and how many characters should be tested (i.e. eight or just the first three...)?
>
On my system, `file' identifies MP3 files with:
---
# MP3, M1A
0 beshort&0xFFFE 0xFFFA MPEG ADTS, layer III, v1
---
and
---
# MP3, M2A
0 beshort&0xFFFE 0xFFF2 MPEG ADTS, layer III, v2
---
and
---
# MP3, M25A
0 beshort&0xFFFE 0xFFE2 MPEG ADTS, layer III, v2.5
---
and
---
# ID3 version 2 tags <waschk at informatik.uni-rostock.de>
0 string ID3 MP3 file with ID3 version 2.
---
For those file-magic-impaired:
"0" means the offset being tested.
"beshort" means to test 2 bytes, interpreting as a big-endian value
"&0xhhhh" means to mask the value with 0xhhhh
The value in the third column is the value that needs to be matched.
So if you want to support MP3 files without ID3 tags, you need to do
more tests.
---
Daniel K. O.
More information about the SDL
mailing list