xref: /freebsd/contrib/file/magic/Magdir/riff (revision 2726a7014867ad7224d09b66836c5d385f0350f4)
1b6cee71dSXin LI
2b6cee71dSXin LI#------------------------------------------------------------------------------
3*2726a701SXin LI# $File: riff,v 1.35 2020/06/05 17:15:03 christos Exp $
4b6cee71dSXin LI# riff:  file(1) magic for RIFF format
5b6cee71dSXin LI# See
6b6cee71dSXin LI#
748c779cdSXin LI#	https://www.seanet.com/users/matts/riffmci/riffmci.htm
858a0f0d0SEitan Adler#	http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Docs/riffmci.pdf
9b6cee71dSXin LI#
10b6cee71dSXin LI
11b6cee71dSXin LI# audio format tag. Assume limits: max 1024 bit, 128 channels, 1 MHz
12b6cee71dSXin LI0   name    riff-wave
13b6cee71dSXin LI>0	leshort		1		\b, Microsoft PCM
14b6cee71dSXin LI>>14	leshort		>0
15b6cee71dSXin LI>>>14	leshort		<1024	\b, %d bit
16b6cee71dSXin LI>0	leshort		2		\b, Microsoft ADPCM
17b6cee71dSXin LI>0	leshort		6		\b, ITU G.711 A-law
18b6cee71dSXin LI>0	leshort		7		\b, ITU G.711 mu-law
19b6cee71dSXin LI>0	leshort		8		\b, Microsoft DTS
20b6cee71dSXin LI>0	leshort		17		\b, IMA ADPCM
21b6cee71dSXin LI>0	leshort		20		\b, ITU G.723 ADPCM (Yamaha)
22b6cee71dSXin LI>0	leshort		49		\b, GSM 6.10
23b6cee71dSXin LI>0	leshort		64		\b, ITU G.721 ADPCM
24b6cee71dSXin LI>0	leshort		80		\b, MPEG
25b6cee71dSXin LI>0	leshort		85		\b, MPEG Layer 3
26b6cee71dSXin LI>0	leshort		0x2001		\b, DTS
27b6cee71dSXin LI>2	leshort		=1		\b, mono
28b6cee71dSXin LI>2	leshort		=2		\b, stereo
29b6cee71dSXin LI>2	leshort		>2
30b6cee71dSXin LI>>2	leshort		<128	\b, %d channels
31b6cee71dSXin LI>4	lelong		>0
32b6cee71dSXin LI>>4	lelong		<1000000	%d Hz
33b6cee71dSXin LI
34b6cee71dSXin LI# try to find "fmt "
35b6cee71dSXin LI0   name    riff-walk
36b6cee71dSXin LI>0  string  fmt\x20
37b6cee71dSXin LI>>4 lelong  <0x80
38b6cee71dSXin LI>>>8 use    riff-wave
39b6cee71dSXin LI>0  string  LIST
40b6cee71dSXin LI>>&(4.l+4)  use riff-walk
41b6cee71dSXin LI>0  string  DISP
42b6cee71dSXin LI>>&(4.l+4)  use riff-walk
43b6cee71dSXin LI>0  string  bext
44b6cee71dSXin LI>>&(4.l+4)  use riff-walk
45b6cee71dSXin LI>0  string  Fake
46b6cee71dSXin LI>>&(4.l+4)  use riff-walk
47b6cee71dSXin LI>0  string  fact
48b6cee71dSXin LI>>&(4.l+4)  use riff-walk
49c2931133SXin LI>0  string  VP8
50c2931133SXin LI>>11		byte		0x9d
51c2931133SXin LI>>>12		byte		0x01
52c2931133SXin LI>>>>13		byte		0x2a	\b, VP8 encoding
53c2931133SXin LI>>>>>14		leshort&0x3fff	x	\b, %d
54c2931133SXin LI>>>>>16		leshort&0x3fff	x	\bx%d, Scaling:
55c2931133SXin LI>>>>>14		leshort&0xc000	0x0000	\b [none]
56c2931133SXin LI>>>>>14		leshort&0xc000	0x1000	\b [5/4]
57c2931133SXin LI>>>>>14		leshort&0xc000	0x2000	\b [5/3]
58c2931133SXin LI>>>>>14		leshort&0xc000	0x3000	\b [2]
59c2931133SXin LI>>>>>14		leshort&0xc000	0x0000	\bx[none]
60c2931133SXin LI>>>>>14		leshort&0xc000	0x1000	\bx[5/4]
61c2931133SXin LI>>>>>14		leshort&0xc000	0x2000	\bx[5/3]
62c2931133SXin LI>>>>>14		leshort&0xc000	0x3000	\bx[2]
63c2931133SXin LI>>>>>15		byte&0x80	=0x00	\b, YUV color
64c2931133SXin LI>>>>>15		byte&0x80	=0x80	\b, bad color specification
65c2931133SXin LI>>>>>15		byte&0x40	=0x40	\b, no clamping required
66c2931133SXin LI>>>>>15		byte&0x40	=0x00	\b, decoders should clamp
67c2931133SXin LI#>0  string  x		we got %s
68c2931133SXin LI#>>&(4.l+4)  use riff-walk
69b6cee71dSXin LI
70b6cee71dSXin LI# AVI section extended by Patrik Radman <patrik+file-magic@iki.fi>
71b6cee71dSXin LI#
72b6cee71dSXin LI0	string		RIFF		RIFF (little-endian) data
73b6cee71dSXin LI# RIFF Palette format
7458a0f0d0SEitan Adler# Update: Joerg Jenderek
7558a0f0d0SEitan Adler# URL: https://en.wikipedia.org/wiki/Resource_Interchange_File_Format
7648c779cdSXin LI# Reference: https://worms2d.info/Palette_file
7758a0f0d0SEitan Adler>8	string		PAL\ 		\b, palette
7858a0f0d0SEitan Adler!:mime	application/x-riff
7958a0f0d0SEitan Adler# color palette by Microsoft Corporation
8058a0f0d0SEitan Adler!:ext	pal
8158a0f0d0SEitan Adler# file size =  chunk size + 8 in most cases
8258a0f0d0SEitan Adler>>4	ulelong+8	x		\b, %u bytes
8358a0f0d0SEitan Adler# Extended PAL Format
8458a0f0d0SEitan Adler>>12	string		plth		\b, extended
8558a0f0d0SEitan Adler# Simple PAL Format
8658a0f0d0SEitan Adler>>12	string		data
8758a0f0d0SEitan Adler# data chunk size = color entries * 4 + 4 + sometimes extra (4) appended bytes
8858a0f0d0SEitan Adler>>>16	ulelong		x		\b, data size %u
8958a0f0d0SEitan Adler# palVersion is always 0x0300
9058a0f0d0SEitan Adler#>>>20	leshort		x		\b, version 0x%4.4x
9158a0f0d0SEitan Adler# palNumEntries specifies the number of palette color entries
9258a0f0d0SEitan Adler>>>22	uleshort	x		\b, %u entries
9358a0f0d0SEitan Adler# after palPalEntry sized (number of color entries * 4 ) vector
9458a0f0d0SEitan Adler>>>(22.s*4)	ubequad	x
9558a0f0d0SEitan Adler# jump relative 22 ( 8 + 16) bytes forward points after end of file or to
9658a0f0d0SEitan Adler# appended extra bytes like in http://safecolours.rigdenage.com/set(ms).zip/Protan(MS).pal
9758a0f0d0SEitan Adler>>>>&16		ubelong	x		\b, extra bytes
9858a0f0d0SEitan Adler>>>>>&-4	ubelong	>0		0x%8.8x
99b6cee71dSXin LI# RIFF Device Independent Bitmap format
100b6cee71dSXin LI>8	string		RDIB		\b, device-independent bitmap
101b6cee71dSXin LI>>16	string		BM
102b6cee71dSXin LI>>>30	leshort		12		\b, OS/2 1.x format
103b6cee71dSXin LI>>>>34	leshort		x		\b, %d x
104b6cee71dSXin LI>>>>36	leshort		x		%d
105b6cee71dSXin LI>>>30	leshort		64		\b, OS/2 2.x format
106b6cee71dSXin LI>>>>34	leshort		x		\b, %d x
107b6cee71dSXin LI>>>>36	leshort		x		%d
108b6cee71dSXin LI>>>30	leshort		40		\b, Windows 3.x format
109b6cee71dSXin LI>>>>34	lelong		x		\b, %d x
110b6cee71dSXin LI>>>>38	lelong		x		%d x
111b6cee71dSXin LI>>>>44	leshort		x		%d
112b6cee71dSXin LI# RIFF MIDI format
113b6cee71dSXin LI>8	string		RMID		\b, MIDI
114b6cee71dSXin LI# RIFF Multimedia Movie File format
115b6cee71dSXin LI>8	string		RMMP		\b, multimedia movie
116b6cee71dSXin LI# RIFF wrapper for MP3
117b6cee71dSXin LI>8	string		RMP3		\b, MPEG Layer 3 audio
118b6cee71dSXin LI# Microsoft WAVE format (*.wav)
119b6cee71dSXin LI>8	string		WAVE		\b, WAVE audio
120b6cee71dSXin LI!:mime	audio/x-wav
121b6cee71dSXin LI>>12    string  >\0
122b6cee71dSXin LI>>>12   use     riff-walk
123*2726a701SXin LI# Update:	Joerg Jenderek
124*2726a701SXin LI# lower case for Corel Draw version 8 Bidi
125*2726a701SXin LI>8	string/c	cdr
126*2726a701SXin LI# skip Corel CCX Clipart
127*2726a701SXin LI>>8	string		!CDRXcont
128b6cee71dSXin LI# Corel Draw Picture
129*2726a701SXin LI>>>0	use     corel-draw
130*2726a701SXin LI# URL:		http://fileformats.archiveteam.org/wiki/CCX_(Corel)
131*2726a701SXin LI# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/c/ccx-corel.trid.xml
132*2726a701SXin LI>>8	string		=CDRXcont	\b, Corel Clipart
133*2726a701SXin LI!:mime	application/x-corel-ccx
134*2726a701SXin LI!:ext	ccx
135*2726a701SXin LI# 3rd chunk data {Corel\040Binary\040Meta\040File}
136*2726a701SXin LI#>>>20	string		x		\b, 3rd '%-s'
137*2726a701SXin LI>>>4	ulelong+8	x		\b, %u bytes
138*2726a701SXin LI# From:		Joerg Jenderek
139*2726a701SXin LI# URL:		https://en.wikipedia.org/wiki/CorelDRAW
140*2726a701SXin LI# Reference:	http://fileformats.archiveteam.org/wiki/CorelDRAW
141*2726a701SXin LI# Picture templates created by newer software start with RIFF type CDT
142*2726a701SXin LI>8	string		CDT
143*2726a701SXin LI>>0	use		corel-draw
144*2726a701SXin LI# Picture templates with version 4.4
145*2726a701SXin LI>8	string		CDST
146*2726a701SXin LI>>0	use		corel-draw
147*2726a701SXin LI# pattern created by newer software start with RIFF type PAT
148*2726a701SXin LI>8	string		PAT
149*2726a701SXin LI>>0	use		corel-draw
150b6cee71dSXin LI>8	string		NUNDROOT	\b, Steinberg CuBase
151b6cee71dSXin LI# AVI == Audio Video Interleave
152b6cee71dSXin LI>8	string		AVI\040		\b, AVI
153b6cee71dSXin LI!:mime	video/x-msvideo
154b6cee71dSXin LI>>12    string          LIST
155b6cee71dSXin LI>>>20   string          hdrlavih
156b6cee71dSXin LI>>>>&36 lelong          x               \b, %u x
157b6cee71dSXin LI>>>>&40 lelong          x               %u,
158b6cee71dSXin LI>>>>&4  lelong          >1000000        <1 fps,
159b6cee71dSXin LI>>>>&4  lelong          1000000         1.00 fps,
160b6cee71dSXin LI>>>>&4  lelong          500000          2.00 fps,
161b6cee71dSXin LI>>>>&4  lelong          333333          3.00 fps,
162b6cee71dSXin LI>>>>&4  lelong          250000          4.00 fps,
163b6cee71dSXin LI>>>>&4  lelong          200000          5.00 fps,
164b6cee71dSXin LI>>>>&4  lelong          166667          6.00 fps,
165b6cee71dSXin LI>>>>&4  lelong          142857          7.00 fps,
166b6cee71dSXin LI>>>>&4  lelong          125000          8.00 fps,
167b6cee71dSXin LI>>>>&4  lelong          111111          9.00 fps,
168b6cee71dSXin LI>>>>&4  lelong          100000          10.00 fps,
169b6cee71dSXin LI# ]9.9,10.1[
170b6cee71dSXin LI>>>>&4  lelong          <101010
171b6cee71dSXin LI>>>>>&-4        lelong  >99010
172b6cee71dSXin LI>>>>>>&-4       lelong  !100000         ~10 fps,
173b6cee71dSXin LI>>>>&4  lelong          83333           12.00 fps,
174b6cee71dSXin LI# ]11.9,12.1[
175b6cee71dSXin LI>>>>&4  lelong          <84034
176b6cee71dSXin LI>>>>>&-4        lelong  >82645
177b6cee71dSXin LI>>>>>>&-4       lelong  !83333          ~12 fps,
178b6cee71dSXin LI>>>>&4  lelong          66667           15.00 fps,
179b6cee71dSXin LI# ]14.9,15.1[
180b6cee71dSXin LI>>>>&4  lelong          <67114
181b6cee71dSXin LI>>>>>&-4        lelong  >66225
182b6cee71dSXin LI>>>>>>&-4       lelong  !66667          ~15 fps,
183b6cee71dSXin LI>>>>&4  lelong          50000           20.00 fps,
184b6cee71dSXin LI>>>>&4  lelong          41708           23.98 fps,
185b6cee71dSXin LI>>>>&4  lelong          41667           24.00 fps,
186b6cee71dSXin LI# ]23.9,24.1[
187b6cee71dSXin LI>>>>&4  lelong          <41841
188b6cee71dSXin LI>>>>>&-4        lelong  >41494
189b6cee71dSXin LI>>>>>>&-4       lelong  !41708
190b6cee71dSXin LI>>>>>>>&-4      lelong  !41667          ~24 fps,
191b6cee71dSXin LI>>>>&4  lelong          40000           25.00 fps,
192b6cee71dSXin LI# ]24.9,25.1[
193b6cee71dSXin LI>>>>&4  lelong          <40161
194b6cee71dSXin LI>>>>>&-4        lelong  >39841
195b6cee71dSXin LI>>>>>>&-4       lelong  !40000          ~25 fps,
196b6cee71dSXin LI>>>>&4  lelong          33367           29.97 fps,
197b6cee71dSXin LI>>>>&4  lelong          33333           30.00 fps,
198b6cee71dSXin LI# ]29.9,30.1[
199b6cee71dSXin LI>>>>&4  lelong          <33445
200b6cee71dSXin LI>>>>>&-4        lelong  >33223
201b6cee71dSXin LI>>>>>>&-4       lelong  !33367
202b6cee71dSXin LI>>>>>>>&-4      lelong  !33333          ~30 fps,
203b6cee71dSXin LI>>>>&4  lelong          <32224          >30 fps,
204b6cee71dSXin LI##>>>>&4  lelong          x               (%lu)
205b6cee71dSXin LI##>>>>&20 lelong          x               %lu frames,
206b6cee71dSXin LI# Note: The tests below assume that the AVI has 1 or 2 streams,
207b6cee71dSXin LI#       "vids" optionally followed by "auds".
208b6cee71dSXin LI#       (Should cover 99.9% of all AVIs.)
209b6cee71dSXin LI# assuming avih length = 56
210b6cee71dSXin LI>>>88   string  LIST
211b6cee71dSXin LI>>>>96  string  strlstrh
212b6cee71dSXin LI>>>>>108        string  vids    video:
213b6cee71dSXin LI>>>>>>&0        lelong  0               uncompressed
214b6cee71dSXin LI# skip past vids strh
215b6cee71dSXin LI>>>>>>(104.l+108)       string  strf
216b6cee71dSXin LI>>>>>>>(104.l+132)      lelong          1       RLE 8bpp
217b6cee71dSXin LI>>>>>>>(104.l+132)      string/c        cvid    Cinepak
218b6cee71dSXin LI>>>>>>>(104.l+132)      string/c        i263    Intel I.263
219b6cee71dSXin LI>>>>>>>(104.l+132)      string/c        iv32    Indeo 3.2
220b6cee71dSXin LI>>>>>>>(104.l+132)      string/c        iv41    Indeo 4.1
221b6cee71dSXin LI>>>>>>>(104.l+132)      string/c        iv50    Indeo 5.0
222b6cee71dSXin LI>>>>>>>(104.l+132)      string/c        mp42    Microsoft MPEG-4 v2
223b6cee71dSXin LI>>>>>>>(104.l+132)      string/c        mp43    Microsoft MPEG-4 v3
224b6cee71dSXin LI>>>>>>>(104.l+132)      string/c        fmp4    FFMpeg MPEG-4
225b6cee71dSXin LI>>>>>>>(104.l+132)      string/c        mjpg    Motion JPEG
226b6cee71dSXin LI>>>>>>>(104.l+132)      string/c        div3    DivX 3
227b6cee71dSXin LI>>>>>>>>112             string/c        div3    Low-Motion
228b6cee71dSXin LI>>>>>>>>112             string/c        div4    Fast-Motion
229b6cee71dSXin LI>>>>>>>(104.l+132)      string/c        divx    DivX 4
230b6cee71dSXin LI>>>>>>>(104.l+132)      string/c        dx50    DivX 5
231b6cee71dSXin LI>>>>>>>(104.l+132)      string/c        xvid    XviD
232b6cee71dSXin LI>>>>>>>(104.l+132)	string/c	h264	H.264
233b6cee71dSXin LI>>>>>>>(104.l+132)      string/c        wmv3    Windows Media Video 9
234b6cee71dSXin LI>>>>>>>(104.l+132)      string/c        h264    X.264 or H.264
235b6cee71dSXin LI>>>>>>>(104.l+132)      lelong  0
236b6cee71dSXin LI##>>>>>>>(104.l+132)      string  x       (%.4s)
237b6cee71dSXin LI# skip past first (video) LIST
238b6cee71dSXin LI>>>>(92.l+96)   string  LIST
239b6cee71dSXin LI>>>>>(92.l+104) string  strlstrh
240b6cee71dSXin LI>>>>>>(92.l+116)        string          auds    \b, audio:
241b6cee71dSXin LI# auds strh length = 56:
242b6cee71dSXin LI>>>>>>>(92.l+172)       string          strf
243b6cee71dSXin LI>>>>>>>>(92.l+180)      leshort 0x0001  uncompressed PCM
244b6cee71dSXin LI>>>>>>>>(92.l+180)      leshort 0x0002  ADPCM
245b6cee71dSXin LI>>>>>>>>(92.l+180)      leshort 0x0006  aLaw
246b6cee71dSXin LI>>>>>>>>(92.l+180)      leshort 0x0007  uLaw
247b6cee71dSXin LI>>>>>>>>(92.l+180)      leshort 0x0050  MPEG-1 Layer 1 or 2
248b6cee71dSXin LI>>>>>>>>(92.l+180)      leshort 0x0055  MPEG-1 Layer 3
249b6cee71dSXin LI>>>>>>>>(92.l+180)      leshort 0x2000  Dolby AC3
250b6cee71dSXin LI>>>>>>>>(92.l+180)      leshort 0x0161  DivX
251b6cee71dSXin LI##>>>>>>>>(92.l+180)      leshort x       (0x%.4x)
252b6cee71dSXin LI>>>>>>>>(92.l+182)      leshort 1       (mono,
253b6cee71dSXin LI>>>>>>>>(92.l+182)      leshort 2       (stereo,
254b6cee71dSXin LI>>>>>>>>(92.l+182)      leshort >2      (%d channels,
255b6cee71dSXin LI>>>>>>>>(92.l+184)      lelong  x       %d Hz)
256b6cee71dSXin LI# auds strh length = 64:
257b6cee71dSXin LI>>>>>>>(92.l+180)       string          strf
258b6cee71dSXin LI>>>>>>>>(92.l+188)      leshort 0x0001  uncompressed PCM
259b6cee71dSXin LI>>>>>>>>(92.l+188)      leshort 0x0002  ADPCM
260b6cee71dSXin LI>>>>>>>>(92.l+188)      leshort 0x0055  MPEG-1 Layer 3
261b6cee71dSXin LI>>>>>>>>(92.l+188)      leshort 0x2000  Dolby AC3
262b6cee71dSXin LI>>>>>>>>(92.l+188)      leshort 0x0161  DivX
263b6cee71dSXin LI##>>>>>>>>(92.l+188)      leshort x       (0x%.4x)
264b6cee71dSXin LI>>>>>>>>(92.l+190)      leshort 1       (mono,
265b6cee71dSXin LI>>>>>>>>(92.l+190)      leshort 2       (stereo,
266b6cee71dSXin LI>>>>>>>>(92.l+190)      leshort >2      (%d channels,
267b6cee71dSXin LI>>>>>>>>(92.l+192)      lelong  x       %d Hz)
268b6cee71dSXin LI# Animated Cursor format
269b6cee71dSXin LI>8	string		ACON		\b, animated cursor
270b6cee71dSXin LI# SoundFont 2 <mpruett@sgi.com>
271b6cee71dSXin LI>8	string		sfbk		SoundFont/Bank
272b6cee71dSXin LI# MPEG-1 wrapped in a RIFF, apparently
273b6cee71dSXin LI>8      string          CDXA            \b, wrapped MPEG-1 (CDXA)
274b6cee71dSXin LI>8	string		4XMV		\b, 4X Movie file
27548c779cdSXin LI# AMV-type AVI file: https://wiki.multimedia.cx/index.php?title=AMV
276b6cee71dSXin LI>8	string		AMV\040		\b, AMV
277c2931133SXin LI>8      string          WEBP            \b, Web/P image
2785f0216bdSXin LI!:mime	image/webp
279c2931133SXin LI>>12	use		riff-walk
280*2726a701SXin LI# From:		Joerg Jenderek
281*2726a701SXin LI# URL:		https://en.wikipedia.org/wiki/CorelDRAW
282*2726a701SXin LI# Reference:	http://fileformats.archiveteam.org/wiki/CorelDRAW
283*2726a701SXin LI# Note:		Since version 3 CorelDraw Pictures are RIFF based
284*2726a701SXin LI# but data chunks remain proprietary.
285*2726a701SXin LI# Since version 14 til 15 packed as "content/riffData.cdr" and
286*2726a701SXin LI# since 16 "content/root.dat" in ZIP container
287*2726a701SXin LI# TODO:		distinguish templates with version 12.5 from Designer illustration 12
288*2726a701SXin LI#	display information of RIFF based Corel Draw pictures, templates and patterns
289*2726a701SXin LI0	name   	corel-draw
290*2726a701SXin LI# display second chunk for debugging
291*2726a701SXin LI#>8	string		x		\b, [8]=%.8s
292*2726a701SXin LI>0	string		x		\b, Corel Draw
293*2726a701SXin LI#!:mime	image/x-coreldraw
294*2726a701SXin LI!:mime	application/vnd.corel-draw
295*2726a701SXin LI# used by newer pictures templates
296*2726a701SXin LI>>8	string		CDT
297*2726a701SXin LI# used by templates with newer versions since 16
298*2726a701SXin LI>>>12	string		=fver		Picture template (root.dat)
299*2726a701SXin LI!:ext	dat
300*2726a701SXin LI# used by templates with older versions with vrsn tag
301*2726a701SXin LI>>>12	string		!fver
302*2726a701SXin LI# used by templates with older versions 14-15
303*2726a701SXin LI>>>>11	string		>E		Picture template (riffData.cdr)
304*2726a701SXin LI!:ext	cdr
305*2726a701SXin LI# used by templates with older versions 11-13
306*2726a701SXin LI>>>>11	string		<F		Picture template
307*2726a701SXin LI!:ext	cdt/cdrt
308*2726a701SXin LI# used by older templates with version 4.4
309*2726a701SXin LI>>8	string		CDST		Picture template
310*2726a701SXin LI!:ext	cdt
311*2726a701SXin LI# used by templates with version 12.5
312*2726a701SXin LI>>8	string		DESC		Picture template
313*2726a701SXin LI!:ext	cdt
314*2726a701SXin LI# used by newer patterns with version 22
315*2726a701SXin LI>>8	string		PAT		Pattern
316*2726a701SXin LI!:ext	dat
317*2726a701SXin LI# remaining older templates, patterns, drawings
318*2726a701SXin LI>>8	default		x
319*2726a701SXin LI# pattern with old version 4.y
320*2726a701SXin LI>>>26	ulelong		=0x0000206C	Pattern
321*2726a701SXin LI!:ext	pat
322*2726a701SXin LI# pattern with newer versions
323*2726a701SXin LI>>>26	ulelong		=0x00000D2C	Pattern
324*2726a701SXin LI!:ext	pat
325*2726a701SXin LI# remaining older templates or pictures
326*2726a701SXin LI>>>26	default		x
327*2726a701SXin LI# used by older versions 5 - 15
328*2726a701SXin LI>>>>12	string		=vrsn
329*2726a701SXin LI# 4th chunk size unequal 282Ch only found for CDR
330*2726a701SXin LI>>>>>26	ulelong		!0x0000282c	Picture
331*2726a701SXin LI!:ext	cdr
332*2726a701SXin LI>>>>>26	default		x		Picture or template
333*2726a701SXin LI!:ext	cdr/cdt
334*2726a701SXin LI# used by newer versions since 16
335*2726a701SXin LI>>>>12	string		=fver		Picture (root.dat)
336*2726a701SXin LI!:ext	dat
337*2726a701SXin LI# version marked by 1 ASCII char: space~3, ... , F~15,  ... , N~22, ... R~22 template
338*2726a701SXin LI>11	string		x		\b, version
339*2726a701SXin LI>11	string		>\040		'%-.1s'
340*2726a701SXin LI>0	use		corel-version
341*2726a701SXin LI>4	ulelong+8	x		\b, %u bytes
342*2726a701SXin LI#
343*2726a701SXin LI#	display numeric version of RIFF based Corel after 3rd RIFF tag
344*2726a701SXin LI0	name   	corel-version
345*2726a701SXin LI# for debugging purpose; vrsn for short content; fver for 16 byte size
346*2726a701SXin LI#>12	string		x		\b, TAG "%-4.4s"
347*2726a701SXin LI# 1st data chunk length 2 implies short content version
348*2726a701SXin LI>16	ulelong		2
349*2726a701SXin LI# vrsn chunk short content interpreted by MajorVersion * 100 + MinorVersion
350*2726a701SXin LI>>20	uleshort/100	x		%u
351*2726a701SXin LI>>20	uleshort%100	>0		\b.%u
352*2726a701SXin LI# for debugging purpose display next chunk like: DISP LIST
353*2726a701SXin LI#>>22	string		x		\b, 4th "%-4.4s"
354*2726a701SXin LI#>>26	ulelong		x		\b, 4th SIZE 0x%x
355*2726a701SXin LI# for debugging purpose display 5th chunk like: LIST DISP ccmm osfp
356*2726a701SXin LI#>>(26.l+30)	string	x		\b, 5th "%-4.4s"
357*2726a701SXin LI# 1st data chunk length 10h implies 16 byte content with version info
358*2726a701SXin LI>16	ulelong		0x10
359*2726a701SXin LI>>34	ubyte		x		%u
360*2726a701SXin LI>>>33	ubyte		>0		\b.%u
361b6cee71dSXin LI#
362b6cee71dSXin LI# XXX - some of the below may only appear in little-endian form.
363b6cee71dSXin LI#
364b6cee71dSXin LI# Also "MV93" appears to be for one form of Macromedia Director
365b6cee71dSXin LI# files, and "GDMF" appears to be another multimedia format.
366b6cee71dSXin LI#
367b6cee71dSXin LI0	string		RIFX		RIFF (big-endian) data
368b6cee71dSXin LI# RIFF Palette format
369b6cee71dSXin LI>8	string		PAL		\b, palette
370b6cee71dSXin LI>>16	beshort		x		\b, version %d
371b6cee71dSXin LI>>18	beshort		x		\b, %d entries
372b6cee71dSXin LI# RIFF Device Independent Bitmap format
373b6cee71dSXin LI>8	string		RDIB		\b, device-independent bitmap
374b6cee71dSXin LI>>16	string		BM
375b6cee71dSXin LI>>>30	beshort		12		\b, OS/2 1.x format
376b6cee71dSXin LI>>>>34	beshort		x		\b, %d x
377b6cee71dSXin LI>>>>36	beshort		x		%d
378b6cee71dSXin LI>>>30	beshort		64		\b, OS/2 2.x format
379b6cee71dSXin LI>>>>34	beshort		x		\b, %d x
380b6cee71dSXin LI>>>>36	beshort		x		%d
381b6cee71dSXin LI>>>30	beshort		40		\b, Windows 3.x format
382b6cee71dSXin LI>>>>34	belong		x		\b, %d x
383b6cee71dSXin LI>>>>38	belong		x		%d x
384b6cee71dSXin LI>>>>44	beshort		x		%d
385b6cee71dSXin LI# RIFF MIDI format
386b6cee71dSXin LI>8	string		RMID		\b, MIDI
387b6cee71dSXin LI# RIFF Multimedia Movie File format
388b6cee71dSXin LI>8	string		RMMP		\b, multimedia movie
389b6cee71dSXin LI# Microsoft WAVE format (*.wav)
390b6cee71dSXin LI>8	string		WAVE		\b, WAVE audio
391b6cee71dSXin LI>>20	leshort		1		\b, Microsoft PCM
392b6cee71dSXin LI>>>34	leshort		>0		\b, %d bit
393b6cee71dSXin LI>>22	beshort		=1		\b, mono
394b6cee71dSXin LI>>22	beshort		=2		\b, stereo
395b6cee71dSXin LI>>22	beshort		>2		\b, %d channels
396b6cee71dSXin LI>>24	belong		>0		%d Hz
397*2726a701SXin LI# Corel Draw Picture big endian not tested by real examples
398*2726a701SXin LI#>8	string		CDRA		\b, Corel Draw Picture
399*2726a701SXin LI#>8	string		CDR6		\b, Corel Draw Picture, version 6
400*2726a701SXin LI>8	string		CDR
401*2726a701SXin LI>>0	use     \^corel-draw
402*2726a701SXin LI
403b6cee71dSXin LI# AVI == Audio Video Interleave
404b6cee71dSXin LI>8	string		AVI\040		\b, AVI
405b6cee71dSXin LI# Animated Cursor format
406b6cee71dSXin LI>8	string		ACON		\b, animated cursor
407b6cee71dSXin LI# Notation Interchange File Format (big-endian only)
408b6cee71dSXin LI>8	string		NIFF		\b, Notation Interchange File Format
409b6cee71dSXin LI# SoundFont 2 <mpruett@sgi.com>
410b6cee71dSXin LI>8	string		sfbk		SoundFont/Bank
411b6cee71dSXin LI
412b6cee71dSXin LI#------------------------------------------------------------------------------
413b6cee71dSXin LI# Sony Wave64
414b6cee71dSXin LI# see http://www.vcs.de/fileadmin/user_upload/MBS/PDF/Whitepaper/Informations_about_Sony_Wave64.pdf
415b6cee71dSXin LI# 128 bit RIFF-GUID { 66666972-912E-11CF-A5D6-28DB04C10000 } in little-endian
416b6cee71dSXin LI0	string	riff\x2E\x91\xCF\x11\xA5\xD6\x28\xDB\x04\xC1\x00\x00		Sony Wave64 RIFF data
417b6cee71dSXin LI# 128 bit + total file size (64 bits) so 24 bytes
418b6cee71dSXin LI# then WAVE-GUID { 65766177-ACF3-11D3-8CD1-00C04F8EDB8A }
419b6cee71dSXin LI>24	string		wave\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A		\b, WAVE 64 audio
420b6cee71dSXin LI!:mime	audio/x-w64
421b6cee71dSXin LI# FMT-GUID { 20746D66-ACF3-11D3-8CD1-00C04F8EDB8A }
422b6cee71dSXin LI>>40	search/256	fmt\x20\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A		\b
423b6cee71dSXin LI>>>&10	leshort		=1		\b, mono
424b6cee71dSXin LI>>>&10	leshort		=2		\b, stereo
425b6cee71dSXin LI>>>&10	leshort		>2		\b, %d channels
426b6cee71dSXin LI>>>&12	lelong		>0		%d Hz
427b6cee71dSXin LI
428b6cee71dSXin LI#------------------------------------------------------------------------------
429b6cee71dSXin LI# MBWF/RF64
43048c779cdSXin LI# see EBU TECH 3306 https://tech.ebu.ch/docs/tech/tech3306-2009.pdf
431b6cee71dSXin LI0	string	RF64\xff\xff\xff\xffWAVEds64		MBWF/RF64 audio
432b6cee71dSXin LI!:mime	audio/x-wav
433b6cee71dSXin LI>40	search/256	fmt\x20		\b
434b6cee71dSXin LI>>&6	leshort		=1		\b, mono
435b6cee71dSXin LI>>&6	leshort		=2		\b, stereo
436b6cee71dSXin LI>>&6	leshort		>2		\b, %d channels
437b6cee71dSXin LI>>&8	lelong		>0		%d Hz
438