Mercurial > mplayer.hg
annotate loader/wine/avifmt.h @ 25195:1aec672af2d2
Fix ao_null with float samples
ao_null accepts float input, but the code calculating ao_data.bps only
checked for 1-byte formats and used samplesize 2 for everything else.
Because ao_null uses the bps value in its timing calculations this
effectively made "playback" advance at half the correct speed.
Fixed by calculating samplesize with af_fmt2bits() instead.
author | uau |
---|---|
date | Sat, 01 Dec 2007 05:17:08 +0000 |
parents | c98c9e7f3bd0 |
children | a8ea87c71d18 |
rev | line source |
---|---|
1 | 1 /**************************************************************************** |
2 * | |
3 * AVIFMT - AVI file format definitions | |
4 * | |
5 ****************************************************************************/ | |
24413 | 6 #ifndef WINE_AVIFMT_H |
7 #define WINE_AVIFMT_H | |
1 | 8 |
24413 | 9 #ifndef WINE_NOAVIFMT_H |
1 | 10 |
24421 | 11 #include "windef.h" |
1 | 12 |
24422
c98c9e7f3bd0
Remove leading underscores from multiple inclusion guards,
diego
parents:
24421
diff
changeset
|
13 #ifndef WINE_MSACM_H |
1 | 14 typedef DWORD FOURCC; |
15 #endif | |
16 | |
17 | |
18 #ifdef _MSC_VER | |
19 #pragma warning(disable:4200) | |
20 #endif | |
21 | |
22 /* The following is a short description of the AVI file format. Please | |
23 * see the accompanying documentation for a full explanation. | |
24 * | |
25 * An AVI file is the following RIFF form: | |
26 * | |
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 * ) | |
42 * | |
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. | |
49 * | |
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. | |
53 * | |
54 * Some defined chunk types: | |
55 * Video Streams: | |
56 * ##db: RGB DIB bits | |
57 * ##dc: RLE8 compressed DIB bits | |
58 * ##pc: Palette Change | |
59 * | |
60 * Audio Streams: | |
61 * ##wb: waveform audio bytes | |
62 * | |
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. | |
67 * | |
68 * The index chunk at the end of the file should contain one entry for | |
69 * each data chunk in the file. | |
70 * | |
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. | |
74 * | |
75 * | |
76 * To register codec types please obtain a copy of the Multimedia | |
77 * Developer Registration Kit from: | |
78 * | |
79 * Microsoft Corporation | |
80 * Multimedia Systems Group | |
81 * Product Marketing | |
82 * One Microsoft Way | |
83 * Redmond, WA 98052-6399 | |
84 * | |
85 */ | |
86 | |
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 | |
92 | |
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 | |
97 | |
98 typedef WORD TWOCC; | |
99 | |
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') | |
109 | |
110 #define listtypeAVIMOVIE mmioFOURCC('m', 'o', 'v', 'i') | |
111 #define listtypeAVIRECORD mmioFOURCC('r', 'e', 'c', ' ') | |
112 | |
113 #define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1') | |
114 | |
115 /* | |
116 ** Stream types for the <fccType> field of the stream header. | |
117 */ | |
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') | |
122 | |
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') | |
128 | |
129 /* Chunk id to use for extra chunks for padding. */ | |
130 #define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K') | |
131 | |
132 /* | |
133 ** Useful macros | |
134 ** | |
135 ** Warning: These are nasty macro, and MS C 6.0 compiles some of them | |
136 ** incorrectly if optimizations are on. Ack. | |
137 */ | |
138 | |
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)))))) | |
143 | |
144 /* Macro to get TWOCC chunk type out of a FOURCC ckid */ | |
145 #define TWOCCFromFOURCC(fcc) HIWORD(fcc) | |
146 | |
147 /* Macro to make a ckid for a chunk out of a TWOCC and a stream number | |
148 ** from 0-255. | |
149 */ | |
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) | |
154 | |
155 /* | |
156 ** Main AVI File Header | |
157 */ | |
158 | |
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 | |
166 | |
167 /* The AVI File Header LIST chunk should be padded to this size */ | |
168 #define AVI_HEADERSIZE 2048 // size of AVI header list | |
169 | |
170 typedef struct | |
171 { | |
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; | |
181 | |
182 DWORD dwWidth; | |
183 DWORD dwHeight; | |
184 | |
185 DWORD dwReserved[4]; | |
186 } MainAVIHeader; | |
187 | |
188 /* | |
189 ** Stream header | |
190 */ | |
191 | |
192 #define AVISF_DISABLED 0x00000001 | |
193 | |
194 #define AVISF_VIDEO_PALCHANGES 0x00010000 | |
195 | |
196 | |
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; | |
213 | |
214 /* Flags for index */ | |
215 #define AVIIF_LIST 0x00000001L // chunk is a 'LIST' | |
216 #define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame. | |
217 | |
218 #define AVIIF_NOTIME 0x00000100L // this frame doesn't take any time | |
219 #define AVIIF_COMPUSE 0x0FFF0000L // these bits are for compressor use | |
220 | |
221 #define FOURCC_RIFF mmioFOURCC('R', 'I', 'F', 'F') | |
222 #define FOURCC_LIST mmioFOURCC('L', 'I', 'S', 'T') | |
223 | |
224 typedef struct | |
225 { | |
226 DWORD ckid; | |
227 DWORD dwFlags; | |
228 DWORD dwChunkOffset; // Position of chunk | |
229 DWORD dwChunkLength; // Length of chunk | |
230 } AVIINDEXENTRY; | |
231 | |
232 #define AVISTREAMREAD_CONVENIENT (-1L) | |
233 | |
234 /* | |
235 ** Palette change chunk | |
236 ** | |
237 ** Used in video streams. | |
238 */ | |
24413 | 239 #endif /* WINE_NOAVIFMT_H */ |
240 #endif /* WINE_AVIFMT_H */ |