riff revision 133359
1 2#------------------------------------------------------------------------------ 3# riff: file(1) magic for RIFF format 4# See 5# 6# http://www.seanet.com/users/matts/riffmci/riffmci.htm 7# 8# AVI section extended by Patrik R�dman <patrik+file-magic@iki.fi> 9# 100 string RIFF RIFF (little-endian) data 11# RIFF Palette format 12>8 string PAL \b, palette 13>>16 leshort x \b, version %d 14>>18 leshort x \b, %d entries 15# RIFF Device Independent Bitmap format 16>8 string RDIB \b, device-independent bitmap 17>>16 string BM 18>>>30 leshort 12 \b, OS/2 1.x format 19>>>>34 leshort x \b, %d x 20>>>>36 leshort x %d 21>>>30 leshort 64 \b, OS/2 2.x format 22>>>>34 leshort x \b, %d x 23>>>>36 leshort x %d 24>>>30 leshort 40 \b, Windows 3.x format 25>>>>34 lelong x \b, %d x 26>>>>38 lelong x %d x 27>>>>44 leshort x %d 28# RIFF MIDI format 29>8 string RMID \b, MIDI 30# RIFF Multimedia Movie File format 31>8 string RMMP \b, multimedia movie 32# Microsoft WAVE format (*.wav) 33>8 string WAVE \b, WAVE audio 34>>20 leshort 1 \b, Microsoft PCM 35>>>34 leshort >0 \b, %d bit 36>>20 leshort 2 \b, Microsoft ADPCM 37>>20 leshort 6 \b, ITU G.711 A-law 38>>20 leshort 7 \b, ITU G.711 mu-law 39>>20 leshort 17 \b, IMA ADPCM 40>>20 leshort 20 \b, ITU G.723 ADPCM (Yamaha) 41>>20 leshort 49 \b, GSM 6.10 42>>20 leshort 64 \b, ITU G.721 ADPCM 43>>20 leshort 80 \b, MPEG 44>>20 leshort 85 \b, MPEG Layer 3 45>>22 leshort =1 \b, mono 46>>22 leshort =2 \b, stereo 47>>22 leshort >2 \b, %d channels 48>>24 lelong >0 %d Hz 49# Corel Draw Picture 50>8 string CDRA \b, Corel Draw Picture 51# AVI == Audio Video Interleave 52>8 string AVI\040 \b, AVI 53>>12 string LIST 54>>>20 string hdrlavih 55>>>>&36 lelong x \b, %lu x 56>>>>&40 lelong x %lu, 57>>>>&4 lelong >1000000 <1 fps, 58>>>>&4 lelong 1000000 1.00 fps, 59>>>>&4 lelong 500000 2.00 fps, 60>>>>&4 lelong 333333 3.00 fps, 61>>>>&4 lelong 250000 4.00 fps, 62>>>>&4 lelong 200000 5.00 fps, 63>>>>&4 lelong 166667 6.00 fps, 64>>>>&4 lelong 142857 7.00 fps, 65>>>>&4 lelong 125000 8.00 fps, 66>>>>&4 lelong 111111 9.00 fps, 67>>>>&4 lelong 100000 10.00 fps, 68# ]9.9,10.1[ 69>>>>&4 lelong <101010 70>>>>>&-4 lelong >99010 71>>>>>>&-4 lelong !100000 ~10 fps, 72>>>>&4 lelong 83333 12.00 fps, 73# ]11.9,12.1[ 74>>>>&4 lelong <84034 75>>>>>&-4 lelong >82645 76>>>>>>&-4 lelong !83333 ~12 fps, 77>>>>&4 lelong 66667 15.00 fps, 78# ]14.9,15.1[ 79>>>>&4 lelong <67114 80>>>>>&-4 lelong >66225 81>>>>>>&-4 lelong !66667 ~15 fps, 82>>>>&4 lelong 50000 20.00 fps, 83>>>>&4 lelong 41708 23.98 fps, 84>>>>&4 lelong 41667 24.00 fps, 85# ]23.9,24.1[ 86>>>>&4 lelong <41841 87>>>>>&-4 lelong >41494 88>>>>>>&-4 lelong !41708 89>>>>>>>&-4 lelong !41667 ~24 fps, 90>>>>&4 lelong 40000 25.00 fps, 91# ]24.9,25.1[ 92>>>>&4 lelong <40161 93>>>>>&-4 lelong >39841 94>>>>>>&-4 lelong !40000 ~25 fps, 95>>>>&4 lelong 33367 29.97 fps, 96>>>>&4 lelong 33333 30.00 fps, 97# ]29.9,30.1[ 98>>>>&4 lelong <33445 99>>>>>&-4 lelong >33223 100>>>>>>&-4 lelong !33367 101>>>>>>>&-4 lelong !33333 ~30 fps, 102>>>>&4 lelong <32224 >30 fps, 103##>>>>&4 lelong x (%lu) 104##>>>>&20 lelong x %lu frames, 105# Note: The tests below assume that the AVI has 1 or 2 streams, 106# "vids" optionally followed by "auds". 107# (Should cover 99.9% of all AVIs.) 108# assuming avih length = 56 109>>>88 string LIST 110>>>>96 string strlstrh 111>>>>>108 string vids video: 112>>>>>>&0 lelong 0 uncompressed 113# skip past vids strh 114>>>>>>(104.l+108) string strf 115>>>>>>>(104.l+132) lelong 1 RLE 8bpp 116>>>>>>>(104.l+132) string/c cvid Cinepak 117>>>>>>>(104.l+132) string/c i263 Intel I.263 118>>>>>>>(104.l+132) string/c iv32 Indeo 3.2 119>>>>>>>(104.l+132) string/c iv41 Indeo 4.1 120>>>>>>>(104.l+132) string/c iv50 Indeo 5.0 121>>>>>>>(104.l+132) string/c mp42 Microsoft MPEG-4 v2 122>>>>>>>(104.l+132) string/c mp43 Microsoft MPEG-4 v3 123>>>>>>>(104.l+132) string/c mjpg Motion JPEG 124>>>>>>>(104.l+132) string/c div3 DivX 3 125>>>>>>>>112 string/c div3 Low-Motion 126>>>>>>>>112 string/c div4 Fast-Motion 127>>>>>>>(104.l+132) string/c divx DivX 4 128>>>>>>>(104.l+132) string/c dx50 DivX 5 129>>>>>>>(104.l+132) string/c xvid XviD 130>>>>>>>(104.l+132) lelong 0 131##>>>>>>>(104.l+132) string x (%.4s) 132# skip past first (video) LIST 133>>>>(92.l+96) string LIST 134>>>>>(92.l+104) string strlstrh 135>>>>>>(92.l+116) string auds \b, audio: 136# auds strh length = 56: 137>>>>>>>(92.l+172) string strf 138>>>>>>>>(92.l+180) leshort 0x0001 uncompressed PCM 139>>>>>>>>(92.l+180) leshort 0x0002 ADPCM 140>>>>>>>>(92.l+180) leshort 0x0055 MPEG-1 Layer 3 141>>>>>>>>(92.l+180) leshort 0x2000 Dolby AC3 142>>>>>>>>(92.l+180) leshort 0x0161 DivX 143##>>>>>>>>(92.l+180) leshort x (0x%.4x) 144>>>>>>>>(92.l+182) leshort 1 (mono, 145>>>>>>>>(92.l+182) leshort 2 (stereo, 146>>>>>>>>(92.l+182) leshort >2 (%d channels, 147>>>>>>>>(92.l+184) lelong x %d Hz) 148# auds strh length = 64: 149>>>>>>>(92.l+180) string strf 150>>>>>>>>(92.l+188) leshort 0x0001 uncompressed PCM 151>>>>>>>>(92.l+188) leshort 0x0002 ADPCM 152>>>>>>>>(92.l+188) leshort 0x0055 MPEG-1 Layer 3 153>>>>>>>>(92.l+188) leshort 0x2000 Dolby AC3 154>>>>>>>>(92.l+188) leshort 0x0161 DivX 155##>>>>>>>>(92.l+188) leshort x (0x%.4x) 156>>>>>>>>(92.l+190) leshort 1 (mono, 157>>>>>>>>(92.l+190) leshort 2 (stereo, 158>>>>>>>>(92.l+190) leshort >2 (%d channels, 159>>>>>>>>(92.l+192) lelong x %d Hz) 160# Animated Cursor format 161>8 string ACON \b, animated cursor 162# SoundFont 2 <mpruett@sgi.com> 163>8 string sfbk SoundFont/Bank 164# MPEG-1 wrapped in a RIFF, apparently 165>8 string CDXA \b, wrapped MPEG-1 (CDXA) 166>8 string 4XMV \b, 4X Movie file 167 168# 169# XXX - some of the below may only appear in little-endian form. 170# 171# Also "MV93" appears to be for one form of Macromedia Director 172# files, and "GDMF" appears to be another multimedia format. 173# 1740 string RIFX RIFF (big-endian) data 175# RIFF Palette format 176>8 string PAL \b, palette 177>>16 beshort x \b, version %d 178>>18 beshort x \b, %d entries 179# RIFF Device Independent Bitmap format 180>8 string RDIB \b, device-independent bitmap 181>>16 string BM 182>>>30 beshort 12 \b, OS/2 1.x format 183>>>>34 beshort x \b, %d x 184>>>>36 beshort x %d 185>>>30 beshort 64 \b, OS/2 2.x format 186>>>>34 beshort x \b, %d x 187>>>>36 beshort x %d 188>>>30 beshort 40 \b, Windows 3.x format 189>>>>34 belong x \b, %d x 190>>>>38 belong x %d x 191>>>>44 beshort x %d 192# RIFF MIDI format 193>8 string RMID \b, MIDI 194# RIFF Multimedia Movie File format 195>8 string RMMP \b, multimedia movie 196# Microsoft WAVE format (*.wav) 197>8 string WAVE \b, WAVE audio 198>>20 leshort 1 \b, Microsoft PCM 199>>>34 leshort >0 \b, %d bit 200>>22 beshort =1 \b, mono 201>>22 beshort =2 \b, stereo 202>>22 beshort >2 \b, %d channels 203>>24 belong >0 %d Hz 204# Corel Draw Picture 205>8 string CDRA \b, Corel Draw Picture 206# AVI == Audio Video Interleave 207>8 string AVI\040 \b, AVI 208# Animated Cursor format 209>8 string ACON \b, animated cursor 210# Notation Interchange File Format (big-endian only) 211>8 string NIFF \b, Notation Interchange File Format 212# SoundFont 2 <mpruett@sgi.com> 213>8 string sfbk SoundFont/Bank 214