xref: /reactos/sdk/include/dxsdk/aviriff.h (revision 8c2e9189)
1 /*
2  * Copyright (C) 2003 Robert Shearman
3  * Copyright (C) 2008 Maarten Lankhorst
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19 
20 #pragma once
21 
22 /* All definitions here are packed structures of on-disk formats */
23 #include <pshpack2.h>
24 
25 typedef struct _riffchunk
26 {
27     FOURCC fcc;
28     DWORD cb;
29 } RIFFCHUNK, * LPRIFFCHUNK;
30 
31 typedef struct _rifflist
32 {
33     FOURCC fcc;
34     DWORD cb;
35     FOURCC fccListType;
36 } RIFFLIST, * LPRIFFLIST;
37 
38 #define FCC( ch0, ch1, ch2, ch3 ) \
39     ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) <<  8 ) | \
40     ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
41 
42 #define RIFFROUND(cb) ((cb) + ((cb)&1))
43 #define RIFFNEXT(pChunk) (LPRIFFCHUNK)((LPBYTE)(pChunk)+sizeof(RIFFCHUNK)+RIFFROUND(((LPRIFFCHUNK)pChunk)->cb))
44 
45 /* flags for dwFlags member of AVIMAINHEADER */
46 #define AVIF_HASINDEX       0x00000010
47 #define AVIF_MUSTUSEINDEX   0x00000020
48 #define AVIF_ISINTERLEAVED  0x00000100
49 #define AVIF_TRUSTCKTYPE    0x00000800
50 #define AVIF_WASCAPTUREFILE 0x00010000
51 #define AVIF_COPYRIGHTED    0x00020000
52 
53 #define ckidMAINAVIHEADER FCC('a','v','i','h')
54 typedef struct _avimainheader
55 {
56     FOURCC fcc;
57     DWORD cb;
58     DWORD dwMicroSecPerFrame;
59     DWORD dwMaxBytesPerSec;
60     DWORD dwPaddingGranularity;
61     DWORD dwFlags;
62     DWORD dwTotalFrames;
63     DWORD dwInitialFrames;
64     DWORD dwStreams;
65     DWORD dwSuggestedBufferSize;
66     DWORD dwWidth;
67     DWORD dwHeight;
68     DWORD dwReserved[4];
69 } AVIMAINHEADER;
70 
71 #define ckidODML FCC('o','d','m','l')
72 #define ckidAVIEXTHEADER  FCC('d','m','l','h')
73 typedef struct _aviextheader
74 {
75     FOURCC fcc;
76     DWORD cb;
77     DWORD dwGrandFrames;
78     DWORD dwFuture[61];
79 } AVIEXTHEADER;
80 
81 #define ckidSTREAMLIST FCC('s','t','r','l')
82 
83 /* flags for dwFlags member of AVISTREAMHEADER */
84 #define AVISF_DISABLED         0x00000001
85 #define AVISF_VIDEO_PALCHANGES 0x00010000
86 
87 #ifndef ckidSTREAMHEADER
88 #define ckidSTREAMHEADER FCC('s','t','r','h')
89 #endif
90 
91 #ifndef streamtypeVIDEO
92 #define streamtypeVIDEO FCC('v','i','d','s')
93 #define streamtypeAUDIO FCC('a','u','d','s')
94 #define streamtypeMIDI FCC('m','i','d','s')
95 #define streamtypeTEXT FCC('t','x','t','s')
96 #endif
97 
98 typedef struct _avistreamheader
99 {
100     FOURCC fcc;
101     DWORD cb;
102     FOURCC fccType;
103     FOURCC fccHandler;
104     DWORD dwFlags;
105     WORD wPriority;
106     WORD wLanguage;
107     DWORD dwInitialFrames;
108     DWORD dwScale;
109     DWORD dwRate;
110     DWORD dwStart;
111     DWORD dwLength;
112     DWORD dwSuggestedBufferSize;
113     DWORD dwQuality;
114     DWORD dwSampleSize;
115     struct
116     {
117         short int left;
118         short int top;
119         short int right;
120         short int bottom;
121     } rcFrame;
122 } AVISTREAMHEADER;
123 
124 #ifndef ckidSTREAMFORMAT
125 #define ckidSTREAMFORMAT FCC('s','t','r','f')
126 #endif
127 #define ckidAVIOLDINDEX FCC('i','d','x','1')
128 
129 /* flags for dwFlags member of _avioldindex_entry */
130 #define AVIIF_LIST       0x00000001
131 #define AVIIF_KEYFRAME   0x00000010
132 #define AVIIF_NO_TIME    0x00000100
133 #define AVIIF_COMPRESSOR 0x0FFF0000
134 
135 typedef struct _avioldindex
136 {
137     FOURCC fcc;
138     DWORD cb;
139     struct _avioldindex_entry
140     {
141         DWORD dwChunkId;
142         DWORD dwFlags;
143         DWORD dwOffset;
144         DWORD dwSize;
145     } aIndex[ANYSIZE_ARRAY];
146 } AVIOLDINDEX;
147 
148 typedef union _timecode
149 {
150     struct
151     {
152         WORD wFrameRate;
153         WORD wFrameFract;
154         LONG cFrames;
155     } DUMMYSTRUCTNAME;
156     DWORDLONG qw;
157 } TIMECODE;
158 
159 #define TIMECODE_RATE_30DROP 0
160 
161 /* flags for dwSMPTEflags member of TIMECODEDATA */
162 #define TIMECODE_SMPTE_BINARY_GROUP 0x07
163 #define TIMECODE_SMPTE_COLOR_FRAME  0x08
164 
165 typedef struct _timecodedata
166 {
167     TIMECODE time;
168     DWORD dwSMPTEflags;
169     DWORD dwUser;
170 } TIMECODEDATA;
171 
172 #define AVI_INDEX_OF_INDEXES      0x00
173 #define AVI_INDEX_OF_CHUNKS       0x01
174 #define AVI_INDEX_OF_TIMED_CHUNKS 0x02
175 #define AVI_INDEX_OF_SUB_2FIELD   0x03
176 #define AVI_INDEX_IS_DATA         0x80
177 
178 #define AVI_INDEX_SUB_DEFAULT     0x00
179 #define AVI_INDEX_SUB_2FIELD      0x01
180 
181 typedef struct _avimetaindex
182 {
183     FOURCC fcc;
184     UINT cb;
185     WORD wLongsPerEntry;
186     BYTE bIndexSubType;
187     BYTE bIndexType;
188     DWORD nEntriesInUse;
189     DWORD dwChunkId;
190     DWORD dwReserved[3];
191     DWORD adwIndex[ANYSIZE_ARRAY];
192 } AVIMETAINDEX;
193 
194 #define ckidAVISUPERINDEX FCC('i','n','d','x')
195 typedef struct _avisuperindex {
196     FOURCC fcc;
197     UINT cb;
198     WORD wLongsPerEntry;
199     BYTE bIndexSubType;
200     BYTE bIndexType;
201     DWORD nEntriesInUse;
202     DWORD dwChunkId;
203     DWORD dwReserved[3];
204     struct _avisuperindex_entry {
205         DWORDLONG qwOffset;
206         DWORD dwSize;
207         DWORD dwDuration;
208     } aIndex[ANYSIZE_ARRAY];
209 } AVISUPERINDEX;
210 
211 #define AVISTDINDEX_DELTAFRAME (0x80000000)
212 #define AVISTDINDEX_SIZEMASK (~0x80000000)
213 
214 typedef struct _avistdindex_entry {
215     DWORD dwOffset;
216     DWORD dwSize;
217 } AVISTDINDEX_ENTRY;
218 
219 typedef struct _avistdindex {
220     FOURCC fcc;
221     UINT cb;
222     WORD wLongsPerEntry;
223     BYTE bIndexSubType;
224     BYTE bIndexType;
225     DWORD    nEntriesInUse;
226     DWORD    dwChunkId;
227     DWORDLONG qwBaseOffset;
228     DWORD    dwReserved_3;
229     AVISTDINDEX_ENTRY aIndex[ANYSIZE_ARRAY];
230 } AVISTDINDEX;
231 
232 typedef struct _avitimedindex_entry {
233     DWORD dwOffset;
234     DWORD dwSize;
235     DWORD dwDuration;
236 } AVITIMEDINDEX_ENTRY;
237 
238 typedef struct _avitimedindex {
239     FOURCC fcc;
240     UINT cb;
241     WORD wLongsPerEntry;
242     BYTE bIndexSubType;
243     BYTE bIndexType;
244     DWORD nEntriesInUse;
245     DWORD dwChunkId;
246     DWORDLONG qwBaseOffset;
247     DWORD dwReserved_3;
248     AVITIMEDINDEX_ENTRY aIndex[ANYSIZE_ARRAY];
249     /* DWORD adwTrailingFill[ANYSIZE_ARRAY]; */
250 } AVITIMEDINDEX;
251 
252 typedef struct _avitimecodeindex {
253     FOURCC fcc;
254     UINT cb;
255     WORD wLongsPerEntry;
256     BYTE bIndexSubType;
257     BYTE bIndexType;
258     DWORD nEntriesInUse;
259     DWORD dwChunkId;
260     DWORD dwReserved[3];
261     TIMECODEDATA aIndex[ANYSIZE_ARRAY];
262 } AVITIMECODEINDEX;
263 
264 typedef struct _avitcdlindex_entryA {
265     DWORD dwTick;
266     TIMECODE time;
267     DWORD dwSMPTEflags;
268     DWORD dwUser;
269     CHAR szReelId[12];
270 } AVITCDLINDEX_ENTRYA;
271 
272 typedef struct _avitcdlindex_entryW {
273     DWORD dwTick;
274     TIMECODE time;
275     DWORD dwSMPTEflags;
276     DWORD dwUser;
277     WCHAR szReelId[12];
278 } AVITCDLINDEX_ENTRYW;
279 
280 typedef struct _avitcdlindexA {
281     FOURCC fcc;
282     UINT cb;
283     WORD wLongsPerEntry;
284     BYTE bIndexSubType;
285     BYTE bIndexType;
286     DWORD nEntriesInUse;
287     DWORD dwChunkId;
288     DWORD dwReserved[3];
289     AVITCDLINDEX_ENTRYA aIndex[ANYSIZE_ARRAY];
290     /* DWORD adwTrailingFill[ANYSIZE_ARRAY]; */
291 } AVITCDLINDEXA;
292 
293 typedef struct _avitcdlindexW {
294     FOURCC fcc;
295     UINT cb;
296     WORD wLongsPerEntry;
297     BYTE bIndexSubType;
298     BYTE bIndexType;
299     DWORD nEntriesInUse;
300     DWORD dwChunkId;
301     DWORD dwReserved[3];
302     AVITCDLINDEX_ENTRYW aIndex[ANYSIZE_ARRAY];
303     /* DWORD adwTrailingFill[ANYSIZE_ARRAY]; */
304 } AVITCDLINDEXW;
305 
306 #define AVITCDLINDEX_ENTRY WINELIB_NAME_AW(AVITCDLINDEX_ENTRY)
307 #define AVITCDLINDEX WINELIB_NAME_AW(AVITCDLINDEX)
308 
309 typedef struct _avifieldindex_chunk {
310     FOURCC fcc;
311     DWORD cb;
312     WORD wLongsPerEntry;
313     BYTE bIndexSubType;
314     BYTE bIndexType;
315     DWORD nEntriesInUse;
316     DWORD dwChunkId;
317     DWORDLONG qwBaseOffset;
318     DWORD dwReserved3;
319     struct _avifieldindex_entry {
320         DWORD dwOffset;
321         DWORD dwSize;
322         DWORD dwOffsetField2;
323     } aIndex[ANYSIZE_ARRAY];
324 } AVIFIELDINDEX, * PAVIFIELDINDEX;
325 
326 #include <poppack.h>
327