Mercurial > mplayer.hg
comparison loader/wine/avifmt.h @ 1:3b5f5d1c5041
Initial revision
author | arpi_esp |
---|---|
date | Sat, 24 Feb 2001 20:28:24 +0000 |
parents | |
children | 174e2a58b4cd |
comparison
equal
deleted
inserted
replaced
0:c1bb2c071d63 | 1:3b5f5d1c5041 |
---|---|
1 /**************************************************************************** | |
2 * | |
3 * AVIFMT - AVI file format definitions | |
4 * | |
5 ****************************************************************************/ | |
6 #ifndef AVIFMT | |
7 | |
8 #define AVIFMT | |
9 | |
10 #ifndef NOAVIFMT | |
11 | |
12 | |
13 #ifndef __WINE_WINDEF_H | |
14 #include <wine/windef.h> | |
15 #endif | |
16 | |
17 #ifndef __WINE_MMSYSTEM_H | |
18 #ifndef __WINE_MSACM_H | |
19 typedef DWORD FOURCC; | |
20 #endif | |
21 #endif | |
22 | |
23 | |
24 #ifdef _MSC_VER | |
25 #pragma warning(disable:4200) | |
26 #endif | |
27 | |
28 /* The following is a short description of the AVI file format. Please | |
29 * see the accompanying documentation for a full explanation. | |
30 * | |
31 * An AVI file is the following RIFF form: | |
32 * | |
33 * RIFF('AVI' | |
34 * LIST('hdrl' | |
35 * avih(<MainAVIHeader>) | |
36 * LIST ('strl' | |
37 * strh(<Stream header>) | |
38 * strf(<Stream format>) | |
39 * ... additional header data | |
40 * LIST('movi' | |
41 * { LIST('rec' | |
42 * SubChunk... | |
43 * ) | |
44 * | SubChunk } .... | |
45 * ) | |
46 * [ <AVIIndex> ] | |
47 * ) | |
48 * | |
49 * The main file header specifies how many streams are present. For | |
50 * each one, there must be a stream header chunk and a stream format | |
51 * chunk, enlosed in a 'strl' LIST chunk. The 'strf' chunk contains | |
52 * type-specific format information; for a video stream, this should | |
53 * be a BITMAPINFO structure, including palette. For an audio stream, | |
54 * this should be a WAVEFORMAT (or PCMWAVEFORMAT) structure. | |
55 * | |
56 * The actual data is contained in subchunks within the 'movi' LIST | |
57 * chunk. The first two characters of each data chunk are the | |
58 * stream number with which that data is associated. | |
59 * | |
60 * Some defined chunk types: | |
61 * Video Streams: | |
62 * ##db: RGB DIB bits | |
63 * ##dc: RLE8 compressed DIB bits | |
64 * ##pc: Palette Change | |
65 * | |
66 * Audio Streams: | |
67 * ##wb: waveform audio bytes | |
68 * | |
69 * The grouping into LIST 'rec' chunks implies only that the contents of | |
70 * the chunk should be read into memory at the same time. This | |
71 * grouping is used for files specifically intended to be played from | |
72 * CD-ROM. | |
73 * | |
74 * The index chunk at the end of the file should contain one entry for | |
75 * each data chunk in the file. | |
76 * | |
77 * Limitations for the current software: | |
78 * Only one video stream and one audio stream are allowed. | |
79 * The streams must start at the beginning of the file. | |
80 * | |
81 * | |
82 * To register codec types please obtain a copy of the Multimedia | |
83 * Developer Registration Kit from: | |
84 * | |
85 * Microsoft Corporation | |
86 * Multimedia Systems Group | |
87 * Product Marketing | |
88 * One Microsoft Way | |
89 * Redmond, WA 98052-6399 | |
90 * | |
91 */ | |
92 | |
93 #ifndef mmioFOURCC | |
94 #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \ | |
95 ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \ | |
96 ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) ) | |
97 #endif | |
98 | |
99 /* Macro to make a TWOCC out of two characters */ | |
100 #ifndef aviTWOCC | |
101 #define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8)) | |
102 #endif | |
103 | |
104 typedef WORD TWOCC; | |
105 | |
106 /* form types, list types, and chunk types */ | |
107 #define formtypeAVI mmioFOURCC('A', 'V', 'I', ' ') | |
108 #define listtypeAVIHEADER mmioFOURCC('h', 'd', 'r', 'l') | |
109 #define ckidAVIMAINHDR mmioFOURCC('a', 'v', 'i', 'h') | |
110 #define listtypeSTREAMHEADER mmioFOURCC('s', 't', 'r', 'l') | |
111 #define ckidSTREAMHEADER mmioFOURCC('s', 't', 'r', 'h') | |
112 #define ckidSTREAMFORMAT mmioFOURCC('s', 't', 'r', 'f') | |
113 #define ckidSTREAMHANDLERDATA mmioFOURCC('s', 't', 'r', 'd') | |
114 #define ckidSTREAMNAME mmioFOURCC('s', 't', 'r', 'n') | |
115 | |
116 #define listtypeAVIMOVIE mmioFOURCC('m', 'o', 'v', 'i') | |
117 #define listtypeAVIRECORD mmioFOURCC('r', 'e', 'c', ' ') | |
118 | |
119 #define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1') | |
120 | |
121 /* | |
122 ** Stream types for the <fccType> field of the stream header. | |
123 */ | |
124 #define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's') | |
125 #define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's') | |
126 #define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's') | |
127 #define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's') | |
128 | |
129 /* Basic chunk types */ | |
130 #define cktypeDIBbits aviTWOCC('d', 'b') | |
131 #define cktypeDIBcompressed aviTWOCC('d', 'c') | |
132 #define cktypePALchange aviTWOCC('p', 'c') | |
133 #define cktypeWAVEbytes aviTWOCC('w', 'b') | |
134 | |
135 /* Chunk id to use for extra chunks for padding. */ | |
136 #define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K') | |
137 | |
138 /* | |
139 ** Useful macros | |
140 ** | |
141 ** Warning: These are nasty macro, and MS C 6.0 compiles some of them | |
142 ** incorrectly if optimizations are on. Ack. | |
143 */ | |
144 | |
145 /* Macro to get stream number out of a FOURCC ckid */ | |
146 #define FromHex(n) (((n) >= 'A') ? ((n) + 10 - 'A') : ((n) - '0')) | |
147 #define StreamFromFOURCC(fcc) ((WORD) ((FromHex(LOBYTE(LOWORD(fcc))) << 4) + \ | |
148 (FromHex(HIBYTE(LOWORD(fcc)))))) | |
149 | |
150 /* Macro to get TWOCC chunk type out of a FOURCC ckid */ | |
151 #define TWOCCFromFOURCC(fcc) HIWORD(fcc) | |
152 | |
153 /* Macro to make a ckid for a chunk out of a TWOCC and a stream number | |
154 ** from 0-255. | |
155 */ | |
156 #define ToHex(n) ((BYTE) (((n) > 9) ? ((n) - 10 + 'A') : ((n) + '0'))) | |
157 #define MAKEAVICKID(tcc, stream) \ | |
158 MAKELONG((ToHex((stream) & 0x0f) << 8) | \ | |
159 (ToHex(((stream) & 0xf0) >> 4)), tcc) | |
160 | |
161 /* | |
162 ** Main AVI File Header | |
163 */ | |
164 | |
165 /* flags for use in <dwFlags> in AVIFileHdr */ | |
166 #define AVIF_HASINDEX 0x00000010 // Index at end of file? | |
167 #define AVIF_MUSTUSEINDEX 0x00000020 | |
168 #define AVIF_ISINTERLEAVED 0x00000100 | |
169 #define AVIF_TRUSTCKTYPE 0x00000800 // Use CKType to find key frames? | |
170 #define AVIF_WASCAPTUREFILE 0x00010000 | |
171 #define AVIF_COPYRIGHTED 0x00020000 | |
172 | |
173 /* The AVI File Header LIST chunk should be padded to this size */ | |
174 #define AVI_HEADERSIZE 2048 // size of AVI header list | |
175 | |
176 typedef struct | |
177 { | |
178 DWORD dwMicroSecPerFrame; // frame display rate (or 0L) | |
179 DWORD dwMaxBytesPerSec; // max. transfer rate | |
180 DWORD dwPaddingGranularity; // pad to multiples of this | |
181 // size; normally 2K. | |
182 DWORD dwFlags; // the ever-present flags | |
183 DWORD dwTotalFrames; // # frames in file | |
184 DWORD dwInitialFrames; | |
185 DWORD dwStreams; | |
186 DWORD dwSuggestedBufferSize; | |
187 | |
188 DWORD dwWidth; | |
189 DWORD dwHeight; | |
190 | |
191 DWORD dwReserved[4]; | |
192 } MainAVIHeader; | |
193 | |
194 /* | |
195 ** Stream header | |
196 */ | |
197 | |
198 #define AVISF_DISABLED 0x00000001 | |
199 | |
200 #define AVISF_VIDEO_PALCHANGES 0x00010000 | |
201 | |
202 | |
203 typedef struct { | |
204 FOURCC fccType; | |
205 FOURCC fccHandler; | |
206 DWORD dwFlags; /* Contains AVITF_* flags */ | |
207 WORD wPriority; | |
208 WORD wLanguage; | |
209 DWORD dwInitialFrames; | |
210 DWORD dwScale; | |
211 DWORD dwRate; /* dwRate / dwScale == samples/second */ | |
212 DWORD dwStart; | |
213 DWORD dwLength; /* In units above... */ | |
214 DWORD dwSuggestedBufferSize; | |
215 DWORD dwQuality; | |
216 DWORD dwSampleSize; | |
217 RECT rcFrame; | |
218 } AVIStreamHeader; | |
219 | |
220 /* Flags for index */ | |
221 #define AVIIF_LIST 0x00000001L // chunk is a 'LIST' | |
222 #define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame. | |
223 | |
224 #define AVIIF_NOTIME 0x00000100L // this frame doesn't take any time | |
225 #define AVIIF_COMPUSE 0x0FFF0000L // these bits are for compressor use | |
226 | |
227 #define FOURCC_RIFF mmioFOURCC('R', 'I', 'F', 'F') | |
228 #define FOURCC_LIST mmioFOURCC('L', 'I', 'S', 'T') | |
229 | |
230 typedef struct | |
231 { | |
232 DWORD ckid; | |
233 DWORD dwFlags; | |
234 DWORD dwChunkOffset; // Position of chunk | |
235 DWORD dwChunkLength; // Length of chunk | |
236 } AVIINDEXENTRY; | |
237 | |
238 #define AVISTREAMREAD_CONVENIENT (-1L) | |
239 | |
240 /* | |
241 ** Palette change chunk | |
242 ** | |
243 ** Used in video streams. | |
244 */ | |
245 #endif /* NOAVIFMT */ | |
246 #endif |