View Single Post
Old 04 June 2005, 09:55 pm   #1
George_007
Member
 
Join Date: Jun 2005
Posts: 1
Default MPC detection for magic file

Hi, it would be nice if the Linux utility 'file' could recognize mpc files and report some useful information about them. I have begun with the code below. You can add this to /etc/magic and test it with: 'file file.mpc'. I am no expert so any corrections and suggestions are welcomed.

The format is simple. First number is offset in bytes. > is additional level of tests.

Code:
# Magic local data for file(1) command.
# Insert here your local magic data. Format is described in magic(5).
0	string	   MP+	 Musepack audio data
>3	byte	   	255	\b, SV pre8   
>3	byte&0xF  	0x6	\b, SV 6
>3	byte&0xF	0x8	\b, SV 8
>3	byte&0xF  	0x7	\b, SV 7
>>3	byte&0xF0	0x0	\b.0
>>3	byte&0xF0	0x10	\b.1
>>3	byte&0xF0	240	\b.15
>>10	byte&0xF0	0x0	\b, No profile 
>>10	byte&0xF0	0x10	\b, Profile 'Unstable/Experimental'
>>10	byte&0xF0	0x50	\b, Profile 'quality 0'
>>10	byte&0xF0	0x60	\b, Profile 'quality 1'
>>10	byte&0xF0	0x70	\b, Profile 'Telephone'
>>10	byte&0xF0	0x80	\b, Profile 'Thumb'
>>10	byte&0xF0	0x90	\b, Profile 'Radio'
>>10	byte&0xF0	0xA0	\b, Profile 'Standard'
>>10	byte&0xF0	0xB0	\b, Profile 'Xtreme'
>>10	byte&0xF0	0xC0	\b, Profile 'Insane'
>>10	byte&0xF0	0xD0	\b, Profile 'BrainDead'
>>10	byte&0xF0	0xE0	\b, Profile 'quality 9'
>>10	byte&0xF0	0xF0	\b, Profile 'quality 10'
>>27	byte		0x0	\b, Buschmann 1.7.0-9, Klemm 0.90-1.05
#EncoderVersion %  2 == 1        Alpha (1.05a...z)
>>27	byte&0x1	0x1	\b (Alpha
#EncoderVersion %  2 == 0        Beta (1.06)
#EncoderVersion % 10 == 0        Release (1.0)
>>27	byte		>0
>>>27	byte&0x1	0x0	\b (Release or Beta
#Encoder version * 100
#fixme? this should be 1.06 instead of 106
>>27	byte		>0	\b v%d)
>>10	byte&0x3	0x0	\b, 44.1 kHz
>>10	byte&0x3	0x1	\b, 48 kHz
>>10	byte&0x3	0x2	\b, 37.8 kHz
>>10	byte&0x3	0x3	\b, 32 kHz
George_007 is offline   Reply With Quote