1 /****************************************************************************
3 * AVIFMT - AVI file format definitions
5 ****************************************************************************/
11 #ifndef __WINE_WINDEF_H
12 #include "wine/windef.h"
15 #ifndef __WINE_MMSYSTEM_H
16 #ifndef __WINE_MSACM_H
23 #pragma warning(disable:4200)
26 /* The following is a short description of the AVI file format. Please
27 * see the accompanying documentation for a full explanation.
29 * An AVI file is the following RIFF form:
33 * avih(<MainAVIHeader>)
35 * strh(<Stream header>)
36 * strf(<Stream format>)
37 * ... additional header data
47 * The main file header specifies how many streams are present. For
48 * each one, there must be a stream header chunk and a stream format
49 * chunk, enlosed in a 'strl' LIST chunk. The 'strf' chunk contains
50 * type-specific format information; for a video stream, this should
51 * be a BITMAPINFO structure, including palette. For an audio stream,
52 * this should be a WAVEFORMAT (or PCMWAVEFORMAT) structure.
54 * The actual data is contained in subchunks within the 'movi' LIST
55 * chunk. The first two characters of each data chunk are the
56 * stream number with which that data is associated.
58 * Some defined chunk types:
61 * ##dc: RLE8 compressed DIB bits
62 * ##pc: Palette Change
65 * ##wb: waveform audio bytes
67 * The grouping into LIST 'rec' chunks implies only that the contents of
68 * the chunk should be read into memory at the same time. This
69 * grouping is used for files specifically intended to be played from
72 * The index chunk at the end of the file should contain one entry for
73 * each data chunk in the file.
75 * Limitations for the current software:
76 * Only one video stream and one audio stream are allowed.
77 * The streams must start at the beginning of the file.
80 * To register codec types please obtain a copy of the Multimedia
81 * Developer Registration Kit from:
83 * Microsoft Corporation
84 * Multimedia Systems Group
87 * Redmond, WA 98052-6399
92 #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
93 ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
94 ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
97 /* Macro to make a TWOCC out of two characters */
99 #define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
104 /* form types, list types, and chunk types */
105 #define formtypeAVI mmioFOURCC('A', 'V', 'I', ' ')
106 #define listtypeAVIHEADER mmioFOURCC('h', 'd', 'r', 'l')
107 #define ckidAVIMAINHDR mmioFOURCC('a', 'v', 'i', 'h')
108 #define listtypeSTREAMHEADER mmioFOURCC('s', 't', 'r', 'l')
109 #define ckidSTREAMHEADER mmioFOURCC('s', 't', 'r', 'h')
110 #define ckidSTREAMFORMAT mmioFOURCC('s', 't', 'r', 'f')
111 #define ckidSTREAMHANDLERDATA mmioFOURCC('s', 't', 'r', 'd')
112 #define ckidSTREAMNAME mmioFOURCC('s', 't', 'r', 'n')
114 #define listtypeAVIMOVIE mmioFOURCC('m', 'o', 'v', 'i')
115 #define listtypeAVIRECORD mmioFOURCC('r', 'e', 'c', ' ')
117 #define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1')
120 ** Stream types for the <fccType> field of the stream header.
122 #define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
123 #define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
124 #define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's')
125 #define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's')
127 /* Basic chunk types */
128 #define cktypeDIBbits aviTWOCC('d', 'b')
129 #define cktypeDIBcompressed aviTWOCC('d', 'c')
130 #define cktypePALchange aviTWOCC('p', 'c')
131 #define cktypeWAVEbytes aviTWOCC('w', 'b')
133 /* Chunk id to use for extra chunks for padding. */
134 #define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K')
139 ** Warning: These are nasty macro, and MS C 6.0 compiles some of them
140 ** incorrectly if optimizations are on. Ack.
143 /* Macro to get stream number out of a FOURCC ckid */
144 #define FromHex(n) (((n) >= 'A') ? ((n) + 10 - 'A') : ((n) - '0'))
145 #define StreamFromFOURCC(fcc) ((WORD) ((FromHex(LOBYTE(LOWORD(fcc))) << 4) + \
146 (FromHex(HIBYTE(LOWORD(fcc))))))
148 /* Macro to get TWOCC chunk type out of a FOURCC ckid */
149 #define TWOCCFromFOURCC(fcc) HIWORD(fcc)
151 /* Macro to make a ckid for a chunk out of a TWOCC and a stream number
154 #define ToHex(n) ((BYTE) (((n) > 9) ? ((n) - 10 + 'A') : ((n) + '0')))
155 #define MAKEAVICKID(tcc, stream) \
156 MAKELONG((ToHex((stream) & 0x0f) << 8) | \
157 (ToHex(((stream) & 0xf0) >> 4)), tcc)
160 ** Main AVI File Header
163 /* flags for use in <dwFlags> in AVIFileHdr */
164 #define AVIF_HASINDEX 0x00000010 // Index at end of file?
165 #define AVIF_MUSTUSEINDEX 0x00000020
166 #define AVIF_ISINTERLEAVED 0x00000100
167 #define AVIF_TRUSTCKTYPE 0x00000800 // Use CKType to find key frames?
168 #define AVIF_WASCAPTUREFILE 0x00010000
169 #define AVIF_COPYRIGHTED 0x00020000
171 /* The AVI File Header LIST chunk should be padded to this size */
172 #define AVI_HEADERSIZE 2048 // size of AVI header list
176 DWORD dwMicroSecPerFrame; // frame display rate (or 0L)
177 DWORD dwMaxBytesPerSec; // max. transfer rate
178 DWORD dwPaddingGranularity; // pad to multiples of this
179 // size; normally 2K.
180 DWORD dwFlags; // the ever-present flags
181 DWORD dwTotalFrames; // # frames in file
182 DWORD dwInitialFrames;
184 DWORD dwSuggestedBufferSize;
196 #define AVISF_DISABLED 0x00000001
198 #define AVISF_VIDEO_PALCHANGES 0x00010000
204 DWORD dwFlags; /* Contains AVITF_* flags */
207 DWORD dwInitialFrames;
209 DWORD dwRate; /* dwRate / dwScale == samples/second */
211 DWORD dwLength; /* In units above... */
212 DWORD dwSuggestedBufferSize;
218 /* Flags for index */
219 #define AVIIF_LIST 0x00000001L // chunk is a 'LIST'
220 #define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame.
222 #define AVIIF_NOTIME 0x00000100L // this frame doesn't take any time
223 #define AVIIF_COMPUSE 0x0FFF0000L // these bits are for compressor use
225 #define FOURCC_RIFF mmioFOURCC('R', 'I', 'F', 'F')
226 #define FOURCC_LIST mmioFOURCC('L', 'I', 'S', 'T')
232 DWORD dwChunkOffset; // Position of chunk
233 DWORD dwChunkLength; // Length of chunk
236 #define AVISTREAMREAD_CONVENIENT (-1L)
239 ** Palette change chunk
241 ** Used in video streams.
243 #endif /* NOAVIFMT */