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