# MPA, M1A
# updated by Joerg Jenderek
# GRR the original test are too common for many DOS files, so test 32 <= kbits <= 448
-0 beshort&0xFFFE 0xFFFE
->2 ubyte&0xF0 >0x0F
->>2 ubyte&0xF0 <0xE1 MPEG ADTS, layer I, v1
-# rate
->>>2 byte&0xF0 0x10 \b, 32 kBits
->>>2 byte&0xF0 0x20 \b, 64 kBits
->>>2 byte&0xF0 0x30 \b, 96 kBits
->>>2 byte&0xF0 0x40 \b, 128 kBits
->>>2 byte&0xF0 0x50 \b, 160 kBits
->>>2 byte&0xF0 0x60 \b, 192 kBits
->>>2 byte&0xF0 0x70 \b, 224 kBits
->>>2 byte&0xF0 0x80 \b, 256 kBits
->>>2 byte&0xF0 0x90 \b, 288 kBits
->>>2 byte&0xF0 0xA0 \b, 320 kBits
->>>2 byte&0xF0 0xB0 \b, 352 kBits
->>>2 byte&0xF0 0xC0 \b, 384 kBits
->>>2 byte&0xF0 0xD0 \b, 416 kBits
->>>2 byte&0xF0 0xE0 \b, 448 kBits
-# timing
->>>2 byte&0x0C 0x00 \b, 44.1 kHz
->>>2 byte&0x0C 0x04 \b, 48 kHz
->>>2 byte&0x0C 0x08 \b, 32 kHz
-# channels/options
->>>3 byte&0xC0 0x00 \b, Stereo
->>>3 byte&0xC0 0x40 \b, JntStereo
->>>3 byte&0xC0 0x80 \b, 2x Monaural
->>>3 byte&0xC0 0xC0 \b, Monaural
-#>1 byte ^0x01 \b, Data Verify
-#>2 byte &0x02 \b, Packet Pad
-#>2 byte &0x01 \b, Custom Flag
-#>3 byte &0x08 \b, Copyrighted
-#>3 byte &0x04 \b, Original Source
-#>3 byte&0x03 1 \b, NR: 50/15 ms
-#>3 byte&0x03 3 \b, NR: CCIT J.17
+# GRR this test is still too general as it catches a BOM of UTF-16 files (0xFFFE)
+#0 beshort&0xFFFE 0xFFFE
+#>2 ubyte&0xF0 >0x0F
+#>>2 ubyte&0xF0 <0xE1 MPEG ADTS, layer I, v1
+## rate
+#>>>2 byte&0xF0 0x10 \b, 32 kBits
+#>>>2 byte&0xF0 0x20 \b, 64 kBits
+#>>>2 byte&0xF0 0x30 \b, 96 kBits
+#>>>2 byte&0xF0 0x40 \b, 128 kBits
+#>>>2 byte&0xF0 0x50 \b, 160 kBits
+#>>>2 byte&0xF0 0x60 \b, 192 kBits
+#>>>2 byte&0xF0 0x70 \b, 224 kBits
+#>>>2 byte&0xF0 0x80 \b, 256 kBits
+#>>>2 byte&0xF0 0x90 \b, 288 kBits
+#>>>2 byte&0xF0 0xA0 \b, 320 kBits
+#>>>2 byte&0xF0 0xB0 \b, 352 kBits
+#>>>2 byte&0xF0 0xC0 \b, 384 kBits
+#>>>2 byte&0xF0 0xD0 \b, 416 kBits
+#>>>2 byte&0xF0 0xE0 \b, 448 kBits
+## timing
+#>>>2 byte&0x0C 0x00 \b, 44.1 kHz
+#>>>2 byte&0x0C 0x04 \b, 48 kHz
+#>>>2 byte&0x0C 0x08 \b, 32 kHz
+## channels/options
+#>>>3 byte&0xC0 0x00 \b, Stereo
+#>>>3 byte&0xC0 0x40 \b, JntStereo
+#>>>3 byte&0xC0 0x80 \b, 2x Monaural
+#>>>3 byte&0xC0 0xC0 \b, Monaural
+##>1 byte ^0x01 \b, Data Verify
+##>2 byte &0x02 \b, Packet Pad
+##>2 byte &0x01 \b, Custom Flag
+##>3 byte &0x08 \b, Copyrighted
+##>3 byte &0x04 \b, Original Source
+##>3 byte&0x03 1 \b, NR: 50/15 ms
+##>3 byte&0x03 3 \b, NR: CCIT J.17
# MP3, M2A
0 beshort&0xFFFE 0xFFF2 MPEG ADTS, layer III, v2
>>4 byte&0x78 0x18 \b, 3 streams
>>4 byte &0x20 \b, 4 or more streams
>>4 byte &0x40 \b, 8 or more streams
-0 beshort 0x4DE1 MPEG-4 LO-EP audio stream
-!:mime audio/x-mp4a-latm
+# This magic isn't strong enough (matches plausible ISO-8859-1 text)
+#0 beshort 0x4DE1 MPEG-4 LO-EP audio stream
+#!:mime audio/x-mp4a-latm
# FLI animation format
4 leshort 0xAF11 FLI file
# shorter than 32 bytes must be terminated with NULL" so I'll treat it as a
# cstring. Of course, partitions can contain more than four entries, but
# what're you gonna do?
-0x200 beshort 0x504D Apple Partition data
->0x2 beshort x (block size: %d):
->0x230 string x first type: %s,
->0x210 string x name: %s,
->0x254 belong x number of blocks: %d,
->0x400 beshort 0x504D
->>0x430 string x second type: %s,
->>0x410 string x name: %s,
->>0x454 belong x number of blocks: %d,
->>0x600 beshort 0x504D
->>>0x630 string x third type: %s,
->>>0x610 string x name: %s,
->>>0x654 belong x number of blocks: %d,
->>0x800 beshort 0x504D
->>>0x830 string x fourth type: %s,
->>>0x810 string x name: %s,
->>>0x854 belong x number of blocks: %d,
->>>0xa00 beshort 0x504D
->>>>0xa30 string x fifth type: %s,
->>>>0xa10 string x name: %s,
->>>>0xa54 belong x number of blocks: %d
->>>0xc00 beshort 0x504D
->>>>0xc30 string x sixth type: %s,
->>>>0xc10 string x name: %s,
->>>>0xc54 belong x number of blocks: %d
-# AFAIK, only the signature is different
-0x200 beshort 0x5453 Apple Old Partition data
->0x2 beshort x block size: %d,
->0x230 string x first type: %s,
->0x210 string x name: %s,
->0x254 belong x number of blocks: %d,
->0x400 beshort 0x504D
->>0x430 string x second type: %s,
->>0x410 string x name: %s,
->>0x454 belong x number of blocks: %d,
->>0x800 beshort 0x504D
->>>0x830 string x third type: %s,
->>>0x810 string x name: %s,
->>>0x854 belong x number of blocks: %d,
->>>0xa00 beshort 0x504D
->>>>0xa30 string x fourth type: %s,
->>>>0xa10 string x name: %s,
->>>>0xa54 belong x number of blocks: %d
+# GRR: This magic is too weak, it is just "PM"
+#0x200 beshort 0x504D Apple Partition data
+#>0x2 beshort x (block size: %d):
+#>0x230 string x first type: %s,
+#>0x210 string x name: %s,
+#>0x254 belong x number of blocks: %d,
+#>0x400 beshort 0x504D
+#>>0x430 string x second type: %s,
+#>>0x410 string x name: %s,
+#>>0x454 belong x number of blocks: %d,
+#>>0x600 beshort 0x504D
+#>>>0x630 string x third type: %s,
+#>>>0x610 string x name: %s,
+#>>>0x654 belong x number of blocks: %d,
+#>>0x800 beshort 0x504D
+#>>>0x830 string x fourth type: %s,
+#>>>0x810 string x name: %s,
+#>>>0x854 belong x number of blocks: %d,
+#>>>0xa00 beshort 0x504D
+#>>>>0xa30 string x fifth type: %s,
+#>>>>0xa10 string x name: %s,
+#>>>>0xa54 belong x number of blocks: %d
+#>>>0xc00 beshort 0x504D
+#>>>>0xc30 string x sixth type: %s,
+#>>>>0xc10 string x name: %s,
+#>>>>0xc54 belong x number of blocks: %d
+## AFAIK, only the signature is different
+#0x200 beshort 0x5453 Apple Old Partition data
+#>0x2 beshort x block size: %d,
+#>0x230 string x first type: %s,
+#>0x210 string x name: %s,
+#>0x254 belong x number of blocks: %d,
+#>0x400 beshort 0x504D
+#>>0x430 string x second type: %s,
+#>>0x410 string x name: %s,
+#>>0x454 belong x number of blocks: %d,
+#>>0x800 beshort 0x504D
+#>>>0x830 string x third type: %s,
+#>>>0x810 string x name: %s,
+#>>>0x854 belong x number of blocks: %d,
+#>>>0xa00 beshort 0x504D
+#>>>>0xa30 string x fourth type: %s,
+#>>>>0xa10 string x name: %s,
+#>>>>0xa54 belong x number of blocks: %d
# From: Remi Mommsen <mommsen@slac.stanford.edu>
0 string BOMStore Mac OS X bill of materials (BOM) file