riff revision 169942
168349Sobrien 268349Sobrien#------------------------------------------------------------------------------ 368349Sobrien# riff: file(1) magic for RIFF format 468349Sobrien# See 568349Sobrien# 668349Sobrien# http://www.seanet.com/users/matts/riffmci/riffmci.htm 768349Sobrien# 8133359Sobrien# AVI section extended by Patrik R�dman <patrik+file-magic@iki.fi> 968349Sobrien# 1068349Sobrien0 string RIFF RIFF (little-endian) data 1168349Sobrien# RIFF Palette format 1268349Sobrien>8 string PAL \b, palette 1368349Sobrien>>16 leshort x \b, version %d 1468349Sobrien>>18 leshort x \b, %d entries 1568349Sobrien# RIFF Device Independent Bitmap format 1668349Sobrien>8 string RDIB \b, device-independent bitmap 1768349Sobrien>>16 string BM 1868349Sobrien>>>30 leshort 12 \b, OS/2 1.x format 1968349Sobrien>>>>34 leshort x \b, %d x 2068349Sobrien>>>>36 leshort x %d 2168349Sobrien>>>30 leshort 64 \b, OS/2 2.x format 2268349Sobrien>>>>34 leshort x \b, %d x 2368349Sobrien>>>>36 leshort x %d 2468349Sobrien>>>30 leshort 40 \b, Windows 3.x format 2568349Sobrien>>>>34 lelong x \b, %d x 2668349Sobrien>>>>38 lelong x %d x 2768349Sobrien>>>>44 leshort x %d 2868349Sobrien# RIFF MIDI format 2968349Sobrien>8 string RMID \b, MIDI 3068349Sobrien# RIFF Multimedia Movie File format 3168349Sobrien>8 string RMMP \b, multimedia movie 32169942Sobrien# RIFF wrapper for MP3 33169942Sobrien>8 string RMP3 \b, MPEG Layer 3 audio 3468349Sobrien# Microsoft WAVE format (*.wav) 3568349Sobrien>8 string WAVE \b, WAVE audio 3668349Sobrien>>20 leshort 1 \b, Microsoft PCM 3768349Sobrien>>>34 leshort >0 \b, %d bit 3880588Sobrien>>20 leshort 2 \b, Microsoft ADPCM 39133359Sobrien>>20 leshort 6 \b, ITU G.711 A-law 40133359Sobrien>>20 leshort 7 \b, ITU G.711 mu-law 4180588Sobrien>>20 leshort 17 \b, IMA ADPCM 4280588Sobrien>>20 leshort 20 \b, ITU G.723 ADPCM (Yamaha) 4380588Sobrien>>20 leshort 49 \b, GSM 6.10 4480588Sobrien>>20 leshort 64 \b, ITU G.721 ADPCM 4580588Sobrien>>20 leshort 80 \b, MPEG 4680588Sobrien>>20 leshort 85 \b, MPEG Layer 3 4768349Sobrien>>22 leshort =1 \b, mono 4868349Sobrien>>22 leshort =2 \b, stereo 4968349Sobrien>>22 leshort >2 \b, %d channels 5068349Sobrien>>24 lelong >0 %d Hz 51133359Sobrien# Corel Draw Picture 52133359Sobrien>8 string CDRA \b, Corel Draw Picture 5368349Sobrien# AVI == Audio Video Interleave 54133359Sobrien>8 string AVI\040 \b, AVI 55133359Sobrien>>12 string LIST 56133359Sobrien>>>20 string hdrlavih 57133359Sobrien>>>>&36 lelong x \b, %lu x 58133359Sobrien>>>>&40 lelong x %lu, 59133359Sobrien>>>>&4 lelong >1000000 <1 fps, 60133359Sobrien>>>>&4 lelong 1000000 1.00 fps, 61133359Sobrien>>>>&4 lelong 500000 2.00 fps, 62133359Sobrien>>>>&4 lelong 333333 3.00 fps, 63133359Sobrien>>>>&4 lelong 250000 4.00 fps, 64133359Sobrien>>>>&4 lelong 200000 5.00 fps, 65133359Sobrien>>>>&4 lelong 166667 6.00 fps, 66133359Sobrien>>>>&4 lelong 142857 7.00 fps, 67133359Sobrien>>>>&4 lelong 125000 8.00 fps, 68133359Sobrien>>>>&4 lelong 111111 9.00 fps, 69133359Sobrien>>>>&4 lelong 100000 10.00 fps, 70133359Sobrien# ]9.9,10.1[ 71133359Sobrien>>>>&4 lelong <101010 72133359Sobrien>>>>>&-4 lelong >99010 73133359Sobrien>>>>>>&-4 lelong !100000 ~10 fps, 74133359Sobrien>>>>&4 lelong 83333 12.00 fps, 75133359Sobrien# ]11.9,12.1[ 76133359Sobrien>>>>&4 lelong <84034 77133359Sobrien>>>>>&-4 lelong >82645 78133359Sobrien>>>>>>&-4 lelong !83333 ~12 fps, 79133359Sobrien>>>>&4 lelong 66667 15.00 fps, 80133359Sobrien# ]14.9,15.1[ 81133359Sobrien>>>>&4 lelong <67114 82133359Sobrien>>>>>&-4 lelong >66225 83133359Sobrien>>>>>>&-4 lelong !66667 ~15 fps, 84133359Sobrien>>>>&4 lelong 50000 20.00 fps, 85133359Sobrien>>>>&4 lelong 41708 23.98 fps, 86133359Sobrien>>>>&4 lelong 41667 24.00 fps, 87133359Sobrien# ]23.9,24.1[ 88133359Sobrien>>>>&4 lelong <41841 89133359Sobrien>>>>>&-4 lelong >41494 90133359Sobrien>>>>>>&-4 lelong !41708 91133359Sobrien>>>>>>>&-4 lelong !41667 ~24 fps, 92133359Sobrien>>>>&4 lelong 40000 25.00 fps, 93133359Sobrien# ]24.9,25.1[ 94133359Sobrien>>>>&4 lelong <40161 95133359Sobrien>>>>>&-4 lelong >39841 96133359Sobrien>>>>>>&-4 lelong !40000 ~25 fps, 97133359Sobrien>>>>&4 lelong 33367 29.97 fps, 98133359Sobrien>>>>&4 lelong 33333 30.00 fps, 99133359Sobrien# ]29.9,30.1[ 100133359Sobrien>>>>&4 lelong <33445 101133359Sobrien>>>>>&-4 lelong >33223 102133359Sobrien>>>>>>&-4 lelong !33367 103133359Sobrien>>>>>>>&-4 lelong !33333 ~30 fps, 104133359Sobrien>>>>&4 lelong <32224 >30 fps, 105133359Sobrien##>>>>&4 lelong x (%lu) 106133359Sobrien##>>>>&20 lelong x %lu frames, 107133359Sobrien# Note: The tests below assume that the AVI has 1 or 2 streams, 108133359Sobrien# "vids" optionally followed by "auds". 109133359Sobrien# (Should cover 99.9% of all AVIs.) 110133359Sobrien# assuming avih length = 56 111133359Sobrien>>>88 string LIST 112133359Sobrien>>>>96 string strlstrh 113133359Sobrien>>>>>108 string vids video: 114133359Sobrien>>>>>>&0 lelong 0 uncompressed 115133359Sobrien# skip past vids strh 116133359Sobrien>>>>>>(104.l+108) string strf 117133359Sobrien>>>>>>>(104.l+132) lelong 1 RLE 8bpp 118133359Sobrien>>>>>>>(104.l+132) string/c cvid Cinepak 119133359Sobrien>>>>>>>(104.l+132) string/c i263 Intel I.263 120133359Sobrien>>>>>>>(104.l+132) string/c iv32 Indeo 3.2 121133359Sobrien>>>>>>>(104.l+132) string/c iv41 Indeo 4.1 122133359Sobrien>>>>>>>(104.l+132) string/c iv50 Indeo 5.0 123133359Sobrien>>>>>>>(104.l+132) string/c mp42 Microsoft MPEG-4 v2 124133359Sobrien>>>>>>>(104.l+132) string/c mp43 Microsoft MPEG-4 v3 125169942Sobrien>>>>>>>(104.l+132) string/c fmp4 FFMpeg MPEG-4 126133359Sobrien>>>>>>>(104.l+132) string/c mjpg Motion JPEG 127133359Sobrien>>>>>>>(104.l+132) string/c div3 DivX 3 128133359Sobrien>>>>>>>>112 string/c div3 Low-Motion 129133359Sobrien>>>>>>>>112 string/c div4 Fast-Motion 130133359Sobrien>>>>>>>(104.l+132) string/c divx DivX 4 131133359Sobrien>>>>>>>(104.l+132) string/c dx50 DivX 5 132133359Sobrien>>>>>>>(104.l+132) string/c xvid XviD 133169942Sobrien>>>>>>>(104.l+132) string/c wmv3 Windows Media Video 9 134159764Sobrien>>>>>>>(104.l+132) string/c h264 X.264 135133359Sobrien>>>>>>>(104.l+132) lelong 0 136133359Sobrien##>>>>>>>(104.l+132) string x (%.4s) 137133359Sobrien# skip past first (video) LIST 138133359Sobrien>>>>(92.l+96) string LIST 139133359Sobrien>>>>>(92.l+104) string strlstrh 140133359Sobrien>>>>>>(92.l+116) string auds \b, audio: 141133359Sobrien# auds strh length = 56: 142133359Sobrien>>>>>>>(92.l+172) string strf 143133359Sobrien>>>>>>>>(92.l+180) leshort 0x0001 uncompressed PCM 144133359Sobrien>>>>>>>>(92.l+180) leshort 0x0002 ADPCM 145169942Sobrien>>>>>>>>(92.l+180) leshort 0x0006 aLaw 146169942Sobrien>>>>>>>>(92.l+180) leshort 0x0007 uLaw 147169942Sobrien>>>>>>>>(92.l+180) leshort 0x0050 MPEG-1 Layer 1 or 2 148133359Sobrien>>>>>>>>(92.l+180) leshort 0x0055 MPEG-1 Layer 3 149133359Sobrien>>>>>>>>(92.l+180) leshort 0x2000 Dolby AC3 150133359Sobrien>>>>>>>>(92.l+180) leshort 0x0161 DivX 151133359Sobrien##>>>>>>>>(92.l+180) leshort x (0x%.4x) 152133359Sobrien>>>>>>>>(92.l+182) leshort 1 (mono, 153133359Sobrien>>>>>>>>(92.l+182) leshort 2 (stereo, 154133359Sobrien>>>>>>>>(92.l+182) leshort >2 (%d channels, 155133359Sobrien>>>>>>>>(92.l+184) lelong x %d Hz) 156133359Sobrien# auds strh length = 64: 157133359Sobrien>>>>>>>(92.l+180) string strf 158133359Sobrien>>>>>>>>(92.l+188) leshort 0x0001 uncompressed PCM 159133359Sobrien>>>>>>>>(92.l+188) leshort 0x0002 ADPCM 160133359Sobrien>>>>>>>>(92.l+188) leshort 0x0055 MPEG-1 Layer 3 161133359Sobrien>>>>>>>>(92.l+188) leshort 0x2000 Dolby AC3 162133359Sobrien>>>>>>>>(92.l+188) leshort 0x0161 DivX 163133359Sobrien##>>>>>>>>(92.l+188) leshort x (0x%.4x) 164133359Sobrien>>>>>>>>(92.l+190) leshort 1 (mono, 165133359Sobrien>>>>>>>>(92.l+190) leshort 2 (stereo, 166133359Sobrien>>>>>>>>(92.l+190) leshort >2 (%d channels, 167133359Sobrien>>>>>>>>(92.l+192) lelong x %d Hz) 16868349Sobrien# Animated Cursor format 16968349Sobrien>8 string ACON \b, animated cursor 170133359Sobrien# SoundFont 2 <mpruett@sgi.com> 171133359Sobrien>8 string sfbk SoundFont/Bank 172133359Sobrien# MPEG-1 wrapped in a RIFF, apparently 173133359Sobrien>8 string CDXA \b, wrapped MPEG-1 (CDXA) 174133359Sobrien>8 string 4XMV \b, 4X Movie file 17568349Sobrien 17668349Sobrien# 17768349Sobrien# XXX - some of the below may only appear in little-endian form. 17868349Sobrien# 17968349Sobrien# Also "MV93" appears to be for one form of Macromedia Director 18068349Sobrien# files, and "GDMF" appears to be another multimedia format. 18168349Sobrien# 18268349Sobrien0 string RIFX RIFF (big-endian) data 18368349Sobrien# RIFF Palette format 18468349Sobrien>8 string PAL \b, palette 18568349Sobrien>>16 beshort x \b, version %d 18668349Sobrien>>18 beshort x \b, %d entries 18768349Sobrien# RIFF Device Independent Bitmap format 18868349Sobrien>8 string RDIB \b, device-independent bitmap 18968349Sobrien>>16 string BM 19068349Sobrien>>>30 beshort 12 \b, OS/2 1.x format 19168349Sobrien>>>>34 beshort x \b, %d x 19268349Sobrien>>>>36 beshort x %d 19368349Sobrien>>>30 beshort 64 \b, OS/2 2.x format 19468349Sobrien>>>>34 beshort x \b, %d x 19568349Sobrien>>>>36 beshort x %d 19668349Sobrien>>>30 beshort 40 \b, Windows 3.x format 19768349Sobrien>>>>34 belong x \b, %d x 19868349Sobrien>>>>38 belong x %d x 19968349Sobrien>>>>44 beshort x %d 20068349Sobrien# RIFF MIDI format 20168349Sobrien>8 string RMID \b, MIDI 20268349Sobrien# RIFF Multimedia Movie File format 20368349Sobrien>8 string RMMP \b, multimedia movie 20468349Sobrien# Microsoft WAVE format (*.wav) 20568349Sobrien>8 string WAVE \b, WAVE audio 20668349Sobrien>>20 leshort 1 \b, Microsoft PCM 20768349Sobrien>>>34 leshort >0 \b, %d bit 20868349Sobrien>>22 beshort =1 \b, mono 20968349Sobrien>>22 beshort =2 \b, stereo 21068349Sobrien>>22 beshort >2 \b, %d channels 21168349Sobrien>>24 belong >0 %d Hz 212133359Sobrien# Corel Draw Picture 213133359Sobrien>8 string CDRA \b, Corel Draw Picture 21468349Sobrien# AVI == Audio Video Interleave 215133359Sobrien>8 string AVI\040 \b, AVI 21668349Sobrien# Animated Cursor format 21768349Sobrien>8 string ACON \b, animated cursor 21868349Sobrien# Notation Interchange File Format (big-endian only) 21968349Sobrien>8 string NIFF \b, Notation Interchange File Format 22069216Sobrien# SoundFont 2 <mpruett@sgi.com> 221133359Sobrien>8 string sfbk SoundFont/Bank 222