server: Use attributes instead of inherit flag in dup_handle request.
[wine] / include / vfw.h
1 /*
2  * Copyright (C) the Wine project
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #ifndef __WINE_VFW_H
20 #define __WINE_VFW_H
21
22 #include <mmsystem.h>
23 #include <mmreg.h>
24 #include <msacm.h>
25
26 #define VFWAPI  WINAPI
27 #define VFWAPIV WINAPIV
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif  /* __cplusplus */
32
33 typedef HANDLE HDRAWDIB;
34
35 /*****************************************************************************
36  * Predeclare the interfaces
37  */
38 typedef struct IAVIStream *PAVISTREAM;
39 typedef struct IAVIFile *PAVIFILE;
40 typedef struct IGetFrame *PGETFRAME;
41 typedef struct IAVIEditStream *PAVIEDITSTREAM;
42
43 /* Installable Compressor Manager */
44
45 #define ICVERSION 0x0104
46
47 DECLARE_HANDLE(HIC);
48
49 /* error return codes */
50 #define ICERR_OK                0
51 #define ICERR_DONTDRAW          1
52 #define ICERR_NEWPALETTE        2
53 #define ICERR_GOTOKEYFRAME      3
54 #define ICERR_STOPDRAWING       4
55
56 #define ICERR_UNSUPPORTED       -1
57 #define ICERR_BADFORMAT         -2
58 #define ICERR_MEMORY            -3
59 #define ICERR_INTERNAL          -4
60 #define ICERR_BADFLAGS          -5
61 #define ICERR_BADPARAM          -6
62 #define ICERR_BADSIZE           -7
63 #define ICERR_BADHANDLE         -8
64 #define ICERR_CANTUPDATE        -9
65 #define ICERR_ABORT             -10
66 #define ICERR_ERROR             -100
67 #define ICERR_BADBITDEPTH       -200
68 #define ICERR_BADIMAGESIZE      -201
69
70 #define ICERR_CUSTOM            -400
71
72 /* ICM Messages */
73 #define ICM_USER                (DRV_USER+0x0000)
74
75 /* ICM driver message range */
76 #define ICM_RESERVED_LOW        (DRV_USER+0x1000)
77 #define ICM_RESERVED_HIGH       (DRV_USER+0x2000)
78 #define ICM_RESERVED            ICM_RESERVED_LOW
79
80 #define ICM_GETSTATE            (ICM_RESERVED+0)
81 #define ICM_SETSTATE            (ICM_RESERVED+1)
82 #define ICM_GETINFO             (ICM_RESERVED+2)
83
84 #define ICM_CONFIGURE           (ICM_RESERVED+10)
85 #define ICM_ABOUT               (ICM_RESERVED+11)
86 /* */
87
88 #define ICM_GETDEFAULTQUALITY   (ICM_RESERVED+30)
89 #define ICM_GETQUALITY          (ICM_RESERVED+31)
90 #define ICM_SETQUALITY          (ICM_RESERVED+32)
91
92 #define ICM_SET                 (ICM_RESERVED+40)
93 #define ICM_GET                 (ICM_RESERVED+41)
94
95 /* 2 constant FOURCC codes */
96 #define ICM_FRAMERATE           mmioFOURCC('F','r','m','R')
97 #define ICM_KEYFRAMERATE        mmioFOURCC('K','e','y','R')
98
99 #define ICM_COMPRESS_GET_FORMAT         (ICM_USER+4)
100 #define ICM_COMPRESS_GET_SIZE           (ICM_USER+5)
101 #define ICM_COMPRESS_QUERY              (ICM_USER+6)
102 #define ICM_COMPRESS_BEGIN              (ICM_USER+7)
103 #define ICM_COMPRESS                    (ICM_USER+8)
104 #define ICM_COMPRESS_END                (ICM_USER+9)
105
106 #define ICM_DECOMPRESS_GET_FORMAT       (ICM_USER+10)
107 #define ICM_DECOMPRESS_QUERY            (ICM_USER+11)
108 #define ICM_DECOMPRESS_BEGIN            (ICM_USER+12)
109 #define ICM_DECOMPRESS                  (ICM_USER+13)
110 #define ICM_DECOMPRESS_END              (ICM_USER+14)
111 #define ICM_DECOMPRESS_SET_PALETTE      (ICM_USER+29)
112 #define ICM_DECOMPRESS_GET_PALETTE      (ICM_USER+30)
113
114 #define ICM_DRAW_QUERY                  (ICM_USER+31)
115 #define ICM_DRAW_BEGIN                  (ICM_USER+15)
116 #define ICM_DRAW_GET_PALETTE            (ICM_USER+16)
117 #define ICM_DRAW_START                  (ICM_USER+18)
118 #define ICM_DRAW_STOP                   (ICM_USER+19)
119 #define ICM_DRAW_END                    (ICM_USER+21)
120 #define ICM_DRAW_GETTIME                (ICM_USER+32)
121 #define ICM_DRAW                        (ICM_USER+33)
122 #define ICM_DRAW_WINDOW                 (ICM_USER+34)
123 #define ICM_DRAW_SETTIME                (ICM_USER+35)
124 #define ICM_DRAW_REALIZE                (ICM_USER+36)
125 #define ICM_DRAW_FLUSH                  (ICM_USER+37)
126 #define ICM_DRAW_RENDERBUFFER           (ICM_USER+38)
127
128 #define ICM_DRAW_START_PLAY             (ICM_USER+39)
129 #define ICM_DRAW_STOP_PLAY              (ICM_USER+40)
130
131 #define ICM_DRAW_SUGGESTFORMAT          (ICM_USER+50)
132 #define ICM_DRAW_CHANGEPALETTE          (ICM_USER+51)
133
134 #define ICM_GETBUFFERSWANTED            (ICM_USER+41)
135
136 #define ICM_GETDEFAULTKEYFRAMERATE      (ICM_USER+42)
137
138 #define ICM_DECOMPRESSEX_BEGIN          (ICM_USER+60)
139 #define ICM_DECOMPRESSEX_QUERY          (ICM_USER+61)
140 #define ICM_DECOMPRESSEX                (ICM_USER+62)
141 #define ICM_DECOMPRESSEX_END            (ICM_USER+63)
142
143 #define ICM_COMPRESS_FRAMES_INFO        (ICM_USER+70)
144 #define ICM_SET_STATUS_PROC             (ICM_USER+72)
145
146 /* structs */
147
148 /* NOTE: Only the 16 bit structs are packed. Structs that are packed anyway
149  * have not been changed. If a structure is later extended, you may need to create
150  * two versions of it.
151  */
152
153 typedef struct {
154         DWORD   dwSize;         /* 00: size */
155         DWORD   fccType;        /* 04: type 'vidc' usually */
156         DWORD   fccHandler;     /* 08: */
157         DWORD   dwVersion;      /* 0c: version of compman opening you */
158         DWORD   dwFlags;        /* 10: LOWORD is type specific */
159         LRESULT dwError;        /* 14: */
160         LPVOID  pV1Reserved;    /* 18: */
161         LPVOID  pV2Reserved;    /* 1c: */
162         DWORD   dnDevNode;      /* 20: */
163                                 /* 24: */
164 } ICOPEN,*LPICOPEN;
165
166 #define ICCOMPRESS_KEYFRAME     0x00000001L
167
168 typedef struct {
169     DWORD               dwFlags;
170     LPBITMAPINFOHEADER  lpbiOutput;
171     LPVOID              lpOutput;
172     LPBITMAPINFOHEADER  lpbiInput;
173     LPVOID              lpInput;
174     LPDWORD             lpckid;
175     LPDWORD             lpdwFlags;
176     LONG                lFrameNum;
177     DWORD               dwFrameSize;
178     DWORD               dwQuality;
179     LPBITMAPINFOHEADER  lpbiPrev;
180     LPVOID              lpPrev;
181 } ICCOMPRESS;
182
183 DWORD VFWAPIV ICCompress(
184         HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiOutput,LPVOID lpData,
185         LPBITMAPINFOHEADER lpbiInput,LPVOID lpBits,LPDWORD lpckid,
186         LPDWORD lpdwFlags,LONG lFrameNum,DWORD dwFrameSize,DWORD dwQuality,
187         LPBITMAPINFOHEADER lpbiPrev,LPVOID lpPrev
188 );
189
190 #define ICCompressGetFormat(hic, lpbiInput, lpbiOutput)                 \
191         ICSendMessage(                                                  \
192             hic,ICM_COMPRESS_GET_FORMAT,(DWORD_PTR)(LPVOID)(lpbiInput), \
193             (DWORD_PTR)(LPVOID)(lpbiOutput)                                     \
194         )
195
196 #define ICCompressGetFormatSize(hic,lpbi) ICCompressGetFormat(hic,lpbi,NULL)
197
198 #define ICCompressBegin(hic, lpbiInput, lpbiOutput)                     \
199     ICSendMessage(                                                      \
200         hic, ICM_COMPRESS_BEGIN, (DWORD_PTR)(LPVOID)(lpbiInput),                \
201         (DWORD_PTR)(LPVOID)(lpbiOutput)                                 \
202     )
203
204 #define ICCompressGetSize(hic, lpbiInput, lpbiOutput)                   \
205     ICSendMessage(                                                      \
206         hic, ICM_COMPRESS_GET_SIZE, (DWORD_PTR)(LPVOID)(lpbiInput),     \
207         (DWORD_PTR)(LPVOID)(lpbiOutput)                                 \
208     )
209
210 #define ICCompressQuery(hic, lpbiInput, lpbiOutput)             \
211     ICSendMessage(                                              \
212         hic, ICM_COMPRESS_QUERY, (DWORD_PTR)(LPVOID)(lpbiInput),        \
213         (DWORD_PTR)(LPVOID)(lpbiOutput)                         \
214     )
215
216 #define ICCompressEnd(hic) ICSendMessage(hic, ICM_COMPRESS_END, 0, 0)
217
218 /* ICCOMPRESSFRAMES.dwFlags */
219 #define ICCOMPRESSFRAMES_PADDING        0x00000001
220 typedef struct {
221     DWORD               dwFlags;
222     LPBITMAPINFOHEADER  lpbiOutput;
223     LPARAM              lOutput;
224     LPBITMAPINFOHEADER  lpbiInput;
225     LPARAM              lInput;
226     LONG                lStartFrame;
227     LONG                lFrameCount;
228     LONG                lQuality;
229     LONG                lDataRate;
230     LONG                lKeyRate;
231     DWORD               dwRate;
232     DWORD               dwScale;
233     DWORD               dwOverheadPerFrame;
234     DWORD               dwReserved2;
235     LONG (CALLBACK *GetData)(LPARAM lInput,LONG lFrame,LPVOID lpBits,LONG len);
236     LONG (CALLBACK *PutData)(LPARAM lOutput,LONG lFrame,LPVOID lpBits,LONG len);
237 } ICCOMPRESSFRAMES;
238
239 typedef struct {
240     DWORD               dwFlags;
241     LPARAM              lParam;
242    /* messages for Status callback */
243 #define ICSTATUS_START      0
244 #define ICSTATUS_STATUS     1
245 #define ICSTATUS_END        2
246 #define ICSTATUS_ERROR      3
247 #define ICSTATUS_YIELD      4
248     /* FIXME: some X11 libs define Status as int... */
249     /* LONG (CALLBACK *zStatus)(LPARAM lParam, UINT message, LONG l); */
250     LONG (CALLBACK *zStatus)(LPARAM lParam, UINT message, LONG l);
251 } ICSETSTATUSPROC;
252
253 /* Values for wMode of ICOpen() */
254 #define ICMODE_COMPRESS         1
255 #define ICMODE_DECOMPRESS       2
256 #define ICMODE_FASTDECOMPRESS   3
257 #define ICMODE_QUERY            4
258 #define ICMODE_FASTCOMPRESS     5
259 #define ICMODE_DRAW             8
260
261 /* quality flags */
262 #define ICQUALITY_LOW       0
263 #define ICQUALITY_HIGH      10000
264 #define ICQUALITY_DEFAULT   -1
265
266 typedef struct {
267         DWORD   dwSize;         /* 00: */
268         DWORD   fccType;        /* 04:compressor type     'vidc' 'audc' */
269         DWORD   fccHandler;     /* 08:compressor sub-type 'rle ' 'jpeg' 'pcm '*/
270         DWORD   dwFlags;        /* 0c:flags LOWORD is type specific */
271         DWORD   dwVersion;      /* 10:version of the driver */
272         DWORD   dwVersionICM;   /* 14:version of the ICM used */
273         /*
274          * under Win32, the driver always returns UNICODE strings.
275          */
276         WCHAR   szName[16];             /* 18:short name */
277         WCHAR   szDescription[128];     /* 38:long name */
278         WCHAR   szDriver[128];          /* 138:driver that contains compressor*/
279                                         /* 238: */
280 } ICINFO;
281
282 /* ICINFO.dwFlags */
283 #define VIDCF_QUALITY           0x0001  /* supports quality */
284 #define VIDCF_CRUNCH            0x0002  /* supports crunching to a frame size */
285 #define VIDCF_TEMPORAL          0x0004  /* supports inter-frame compress */
286 #define VIDCF_COMPRESSFRAMES    0x0008  /* wants the compress all frames message */
287 #define VIDCF_DRAW              0x0010  /* supports drawing */
288 #define VIDCF_FASTTEMPORALC     0x0020  /* does not need prev frame on compress */
289 #define VIDCF_FASTTEMPORALD     0x0080  /* does not need prev frame on decompress */
290 #define VIDCF_QUALITYTIME       0x0040  /* supports temporal quality */
291
292 #define VIDCF_FASTTEMPORAL      (VIDCF_FASTTEMPORALC|VIDCF_FASTTEMPORALD)
293
294
295 /* function shortcuts */
296 /* ICM_ABOUT */
297 #define ICMF_ABOUT_QUERY         0x00000001
298
299 #define ICQueryAbout(hic) \
300         (ICSendMessage(hic,ICM_ABOUT,(DWORD_PTR)-1,ICMF_ABOUT_QUERY)==ICERR_OK)
301
302 #define ICAbout(hic, hwnd) ICSendMessage(hic,ICM_ABOUT,(DWORD_PTR)(UINT_PTR)(hwnd),0)
303
304 /* ICM_CONFIGURE */
305 #define ICMF_CONFIGURE_QUERY    0x00000001
306 #define ICQueryConfigure(hic) \
307         (ICSendMessage(hic,ICM_CONFIGURE,(DWORD_PTR)-1,ICMF_CONFIGURE_QUERY)==ICERR_OK)
308
309 #define ICConfigure(hic,hwnd) \
310         ICSendMessage(hic,ICM_CONFIGURE,(DWORD_PTR)(UINT_PTR)(hwnd),0)
311
312 /* Decompression stuff */
313 #define ICDECOMPRESS_HURRYUP            0x80000000      /* don't draw just buffer (hurry up!) */
314 #define ICDECOMPRESS_UPDATE             0x40000000      /* don't draw just update screen */
315 #define ICDECOMPRESS_PREROLL            0x20000000      /* this frame is before real start */
316 #define ICDECOMPRESS_NULLFRAME          0x10000000      /* repeat last frame */
317 #define ICDECOMPRESS_NOTKEYFRAME        0x08000000      /* this frame is not a key frame */
318
319 typedef struct {
320     DWORD               dwFlags;        /* flags (from AVI index...) */
321     LPBITMAPINFOHEADER  lpbiInput;      /* BITMAPINFO of compressed data */
322     LPVOID              lpInput;        /* compressed data */
323     LPBITMAPINFOHEADER  lpbiOutput;     /* DIB to decompress to */
324     LPVOID              lpOutput;
325     DWORD               ckid;           /* ckid from AVI file */
326 } ICDECOMPRESS;
327
328 typedef struct {
329     DWORD               dwFlags;
330     LPBITMAPINFOHEADER  lpbiSrc;
331     LPVOID              lpSrc;
332     LPBITMAPINFOHEADER  lpbiDst;
333     LPVOID              lpDst;
334
335     /* changed for ICM_DECOMPRESSEX */
336     INT                 xDst;       /* destination rectangle */
337     INT                 yDst;
338     INT                 dxDst;
339     INT                 dyDst;
340
341     INT                 xSrc;       /* source rectangle */
342     INT                 ySrc;
343     INT                 dxSrc;
344     INT                 dySrc;
345 } ICDECOMPRESSEX;
346
347 DWORD VFWAPIV ICDecompress(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiFormat,LPVOID lpData,LPBITMAPINFOHEADER lpbi,LPVOID lpBits);
348
349 #define ICDecompressBegin(hic, lpbiInput, lpbiOutput)   \
350     ICSendMessage(                                              \
351         hic, ICM_DECOMPRESS_BEGIN, (DWORD_PTR)(LPVOID)(lpbiInput),      \
352         (DWORD_PTR)(LPVOID)(lpbiOutput)                         \
353     )
354
355 #define ICDecompressQuery(hic, lpbiInput, lpbiOutput)   \
356     ICSendMessage(                                              \
357         hic,ICM_DECOMPRESS_QUERY, (DWORD_PTR)(LPVOID)(lpbiInput),       \
358         (DWORD_PTR) (LPVOID)(lpbiOutput)                                \
359     )
360
361 #define ICDecompressGetFormat(hic, lpbiInput, lpbiOutput)               \
362     ((LONG)ICSendMessage(                                               \
363         hic,ICM_DECOMPRESS_GET_FORMAT, (DWORD_PTR)(LPVOID)(lpbiInput),  \
364         (DWORD_PTR)(LPVOID)(lpbiOutput)                                 \
365     ))
366
367 #define ICDecompressGetFormatSize(hic, lpbi)                            \
368         ICDecompressGetFormat(hic, lpbi, NULL)
369
370 #define ICDecompressGetPalette(hic, lpbiInput, lpbiOutput)              \
371     ICSendMessage(                                                      \
372         hic, ICM_DECOMPRESS_GET_PALETTE, (DWORD_PTR)(LPVOID)(lpbiInput),        \
373         (DWORD_PTR)(LPVOID)(lpbiOutput)                                 \
374     )
375
376 #define ICDecompressSetPalette(hic,lpbiPalette) \
377         ICSendMessage(                          \
378                 hic,ICM_DECOMPRESS_SET_PALETTE,         \
379                 (DWORD_PTR)(LPVOID)(lpbiPalette),0              \
380         )
381
382 #define ICDecompressEnd(hic) ICSendMessage(hic, ICM_DECOMPRESS_END, 0, 0)
383
384 LRESULT VFWAPI  ICSendMessage(HIC hic, UINT msg, DWORD_PTR dw1, DWORD_PTR dw2);
385
386 inline static LRESULT VFWAPI ICDecompressEx(HIC hic, DWORD dwFlags,
387                                             LPBITMAPINFOHEADER lpbiSrc, LPVOID lpSrc,
388                                             int xSrc, int ySrc, int dxSrc, int dySrc,
389                                             LPBITMAPINFOHEADER lpbiDst, LPVOID lpDst,
390                                             int xDst, int yDst, int dxDst, int dyDst)
391 {
392     ICDECOMPRESSEX ic;
393
394     ic.dwFlags = dwFlags;
395     ic.lpbiSrc = lpbiSrc;
396     ic.lpSrc = lpSrc;
397     ic.xSrc = xSrc;
398     ic.ySrc = ySrc;
399     ic.dxSrc = dxSrc;
400     ic.dySrc = dySrc;
401     ic.lpbiDst = lpbiDst;
402     ic.lpDst = lpDst;
403     ic.xDst = xDst;
404     ic.yDst = yDst;
405     ic.dxDst = dxDst;
406     ic.dyDst = dyDst;
407     return ICSendMessage(hic, ICM_DECOMPRESSEX, (DWORD_PTR)&ic, sizeof(ic));
408 }
409
410 inline static LRESULT VFWAPI ICDecompressExBegin(HIC hic, DWORD dwFlags,
411                                                  LPBITMAPINFOHEADER lpbiSrc,
412                                                  LPVOID lpSrc,
413                                                  int xSrc, int ySrc, int dxSrc, int dySrc,
414                                                  LPBITMAPINFOHEADER lpbiDst,
415                                                  LPVOID lpDst,
416                                                  int xDst,
417                                                  int yDst,
418                                                  int dxDst,
419                                                  int dyDst)
420 {
421     ICDECOMPRESSEX ic;
422
423     ic.dwFlags = dwFlags;
424     ic.lpbiSrc = lpbiSrc;
425     ic.lpSrc = lpSrc;
426     ic.xSrc = xSrc;
427     ic.ySrc = ySrc;
428     ic.dxSrc = dxSrc;
429     ic.dySrc = dySrc;
430     ic.lpbiDst = lpbiDst;
431     ic.lpDst = lpDst;
432     ic.xDst = xDst;
433     ic.yDst = yDst;
434     ic.dxDst = dxDst;
435     ic.dyDst = dyDst;
436     return ICSendMessage(hic, ICM_DECOMPRESSEX_BEGIN, (DWORD_PTR)&ic, sizeof(ic));
437 }
438 inline static LRESULT VFWAPI ICDecompressExQuery(HIC hic, DWORD dwFlags,
439                                                  LPBITMAPINFOHEADER lpbiSrc,
440                                                  LPVOID lpSrc,
441                                                  int xSrc, int ySrc, int dxSrc, int dySrc,
442                                                  LPBITMAPINFOHEADER lpbiDst,
443                                                  LPVOID lpDst,
444                                                  int xDst,
445                                                  int yDst,
446                                                  int dxDst,
447                                                  int dyDst)
448 {
449     ICDECOMPRESSEX ic;
450
451     ic.dwFlags = dwFlags;
452     ic.lpbiSrc = lpbiSrc;
453     ic.lpSrc = lpSrc;
454     ic.xSrc = xSrc;
455     ic.ySrc = ySrc;
456     ic.dxSrc = dxSrc;
457     ic.dySrc = dySrc;
458     ic.lpbiDst = lpbiDst;
459     ic.lpDst = lpDst;
460     ic.xDst = xDst;
461     ic.yDst = yDst;
462     ic.dxDst = dxDst;
463     ic.dyDst = dyDst;
464     return ICSendMessage(hic, ICM_DECOMPRESSEX_QUERY, (DWORD_PTR)&ic, sizeof(ic));
465 }
466
467 #define ICDecompressExEnd(hic) \
468     ICSendMessage(hic, ICM_DECOMPRESSEX_END, 0, 0)
469
470 #define ICDRAW_QUERY        0x00000001L   /* test for support */
471 #define ICDRAW_FULLSCREEN   0x00000002L   /* draw to full screen */
472 #define ICDRAW_HDC          0x00000004L   /* draw to a HDC/HWND */
473 #define ICDRAW_ANIMATE      0x00000008L   /* expect palette animation */
474 #define ICDRAW_CONTINUE     0x00000010L   /* draw is a continuation of previous draw */
475 #define ICDRAW_MEMORYDC     0x00000020L   /* DC is offscreen, by the way */
476 #define ICDRAW_UPDATING     0x00000040L   /* We're updating, as opposed to playing */
477 #define ICDRAW_RENDER       0x00000080L   /* used to render data not draw it */
478 #define ICDRAW_BUFFER       0x00000100L   /* buffer data offscreen, we will need to update it */
479
480 #define ICDecompressOpen(fccType, fccHandler, lpbiIn, lpbiOut) \
481     ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, ICMODE_DECOMPRESS)
482
483 #define ICDrawOpen(fccType, fccHandler, lpbiIn) \
484     ICLocate(fccType, fccHandler, lpbiIn, NULL, ICMODE_DRAW)
485
486 HANDLE VFWAPI ICImageCompress(HIC hic, UINT uiFlags, LPBITMAPINFO lpbiIn,
487                               LPVOID lpBits, LPBITMAPINFO lpbiOut, LONG lQuality,
488                               LONG* plSize);
489
490 HANDLE VFWAPI ICImageDecompress(HIC hic, UINT uiFlags, LPBITMAPINFO lpbiIn,
491                                 LPVOID lpBits, LPBITMAPINFO lpbiOut);
492
493 BOOL    VFWAPI  ICInfo(DWORD fccType, DWORD fccHandler, ICINFO * lpicinfo);
494 BOOL    VFWAPI  ICInstall(DWORD fccType, DWORD fccHandler, LPARAM lParam, LPSTR szDesc, UINT wFlags);
495 BOOL    VFWAPI  ICRemove(DWORD fccType, DWORD fccHandler, UINT wFlags);
496 LRESULT VFWAPI  ICGetInfo(HIC hic,ICINFO *picinfo, DWORD cb);
497 HIC     VFWAPI  ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode);
498 HIC     VFWAPI  ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, FARPROC lpfnHandler);
499
500 LRESULT VFWAPI  ICClose(HIC hic);
501 HIC     VFWAPI  ICLocate(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wFlags);
502 HIC     VFWAPI  ICGetDisplayFormat(HIC hic, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, int BitDepth, int dx, int dy);
503
504 /* Values for wFlags of ICInstall() */
505 #define ICINSTALL_UNICODE       0x8000
506 #define ICINSTALL_FUNCTION      0x0001
507 #define ICINSTALL_DRIVER        0x0002
508 #define ICINSTALL_HDRV          0x0004
509 #define ICINSTALL_DRIVERW       0x8002
510
511 #define ICGetState(hic, pv, cb) \
512     ICSendMessage(hic, ICM_GETSTATE, (DWORD_PTR)(LPVOID)(pv), (DWORD_PTR)(cb))
513 #define ICSetState(hic, pv, cb) \
514     ICSendMessage(hic, ICM_SETSTATE, (DWORD_PTR)(LPVOID)(pv), (DWORD_PTR)(cb))
515 #define ICGetStateSize(hic) \
516     ICGetState(hic, NULL, 0)
517
518 inline static DWORD ICGetDefaultQuality(HIC hic)
519 {
520    DWORD dwICValue;
521    ICSendMessage(hic, ICM_GETDEFAULTQUALITY, (DWORD_PTR)(LPVOID)&dwICValue, sizeof(DWORD));
522    return dwICValue;
523 }
524
525 inline static DWORD ICGetDefaultKeyFrameRate(HIC hic)
526 {
527    DWORD dwICValue;
528    ICSendMessage(hic, ICM_GETDEFAULTKEYFRAMERATE, (DWORD_PTR)(LPVOID)&dwICValue, sizeof(DWORD));
529    return dwICValue;
530 }
531
532 #define ICDrawWindow(hic, prc) \
533     ICSendMessage(hic, ICM_DRAW_WINDOW, (DWORD_PTR)(LPVOID)(prc), sizeof(RECT))
534
535 /* As passed to ICM_DRAW_SUGGESTFORMAT */
536 typedef struct {
537         DWORD dwFlags;
538         LPBITMAPINFOHEADER lpbiIn;
539         LPBITMAPINFOHEADER lpbiSuggest;
540         INT dxSrc;
541         INT dySrc;
542         INT dxDst;
543         INT dyDst;
544         HIC hicDecompressor;
545 } ICDRAWSUGGEST;
546
547 typedef struct {
548     DWORD               dwFlags;
549     int                 iStart;
550     int                 iLen;
551     LPPALETTEENTRY      lppe;
552 } ICPALETTE;
553
554 DWORD   VFWAPIV ICDrawBegin(
555         HIC                     hic,
556         DWORD                   dwFlags,/* flags */
557         HPALETTE                hpal,   /* palette to draw with */
558         HWND                    hwnd,   /* window to draw to */
559         HDC                     hdc,    /* HDC to draw to */
560         INT                     xDst,   /* destination rectangle */
561         INT                     yDst,
562         INT                     dxDst,
563         INT                     dyDst,
564         LPBITMAPINFOHEADER      lpbi,   /* format of frame to draw */
565         INT                     xSrc,   /* source rectangle */
566         INT                     ySrc,
567         INT                     dxSrc,
568         INT                     dySrc,
569         DWORD                   dwRate, /* frames/second = (dwRate/dwScale) */
570         DWORD                   dwScale
571 );
572
573 /* as passed to ICM_DRAW_BEGIN */
574 typedef struct {
575         DWORD           dwFlags;
576         HPALETTE        hpal;
577         HWND            hwnd;
578         HDC             hdc;
579         INT             xDst;
580         INT             yDst;
581         INT             dxDst;
582         INT             dyDst;
583         LPBITMAPINFOHEADER      lpbi;
584         INT             xSrc;
585         INT             ySrc;
586         INT             dxSrc;
587         INT             dySrc;
588         DWORD           dwRate;
589         DWORD           dwScale;
590 } ICDRAWBEGIN;
591
592 #define ICDRAW_HURRYUP      0x80000000L   /* don't draw just buffer (hurry up!) */
593 #define ICDRAW_UPDATE       0x40000000L   /* don't draw just update screen */
594 #define ICDRAW_PREROLL      0x20000000L   /* this frame is before real start */
595 #define ICDRAW_NULLFRAME    0x10000000L   /* repeat last frame */
596 #define ICDRAW_NOTKEYFRAME  0x08000000L   /* this frame is not a key frame */
597
598 typedef struct {
599         DWORD   dwFlags;
600         LPVOID  lpFormat;
601         LPVOID  lpData;
602         DWORD   cbData;
603         LONG    lTime;
604 } ICDRAW;
605
606 DWORD VFWAPIV ICDraw(HIC hic,DWORD dwFlags,LPVOID lpFormat,LPVOID lpData,DWORD cbData,LONG lTime);
607
608 inline static LRESULT VFWAPI ICDrawSuggestFormat(HIC hic, LPBITMAPINFOHEADER lpbiIn,
609                                                  LPBITMAPINFOHEADER lpbiOut,
610                                                  int dxSrc, int dySrc,
611                                                  int dxDst, int dyDst,
612                                                  HIC hicDecomp)
613 {
614     ICDRAWSUGGEST ic;
615
616     ic.lpbiIn = lpbiIn;
617     ic.lpbiSuggest = lpbiOut;
618     ic.dxSrc = dxSrc;
619     ic.dySrc = dySrc;
620     ic.dxDst = dxDst;
621     ic.dyDst = dyDst;
622     ic.hicDecompressor = hicDecomp;
623     return ICSendMessage(hic, ICM_DRAW_SUGGESTFORMAT, (DWORD_PTR)&ic, sizeof(ic));
624 }
625
626 #define ICDrawQuery(hic, lpbiInput) \
627     ICSendMessage(hic, ICM_DRAW_QUERY, (DWORD_PTR)(LPVOID)(lpbiInput), 0L)
628
629 #define ICDrawChangePalette(hic, lpbiInput) \
630     ICSendMessage(hic, ICM_DRAW_CHANGEPALETTE, (DWORD_PTR)(LPVOID)(lpbiInput), 0L)
631
632 #define ICGetBuffersWanted(hic, lpdwBuffers) \
633     ICSendMessage(hic, ICM_GETBUFFERSWANTED, (DWORD_PTR)(LPVOID)(lpdwBuffers), 0)
634
635 #define ICDrawEnd(hic) \
636     ICSendMessage(hic, ICM_DRAW_END, 0, 0)
637
638 #define ICDrawStart(hic) \
639     ICSendMessage(hic, ICM_DRAW_START, 0, 0)
640
641 #define ICDrawStartPlay(hic, lFrom, lTo) \
642     ICSendMessage(hic, ICM_DRAW_START_PLAY, (DWORD_PTR)(lFrom), (DWORD_PTR)(lTo))
643
644 #define ICDrawStop(hic) \
645     ICSendMessage(hic, ICM_DRAW_STOP, 0, 0)
646
647 #define ICDrawStopPlay(hic) \
648     ICSendMessage(hic, ICM_DRAW_STOP_PLAY, 0, 0)
649
650 #define ICDrawGetTime(hic, lplTime) \
651     ICSendMessage(hic, ICM_DRAW_GETTIME, (DWORD_PTR)(LPVOID)(lplTime), 0)
652
653 #define ICDrawSetTime(hic, lTime) \
654     ICSendMessage(hic, ICM_DRAW_SETTIME, (DWORD_PTR)lTime, 0)
655
656 #define ICDrawRealize(hic, hdc, fBackground) \
657     ICSendMessage(hic, ICM_DRAW_REALIZE, (DWORD_PTR)(UINT_PTR)(HDC)(hdc), (DWORD_PTR)(BOOL)(fBackground))
658
659 #define ICDrawFlush(hic) \
660     ICSendMessage(hic, ICM_DRAW_FLUSH, 0, 0)
661
662 #define ICDrawRenderBuffer(hic) \
663     ICSendMessage(hic, ICM_DRAW_RENDERBUFFER, 0, 0)
664
665 inline static LRESULT VFWAPI ICSetStatusProc(HIC hic, DWORD dwFlags, LRESULT lParam,
666                                              LONG (CALLBACK *fpfnStatus)(LPARAM, UINT, LONG))
667 {
668     ICSETSTATUSPROC ic;
669
670     ic.dwFlags = dwFlags;
671     ic.lParam = lParam;
672     /* FIXME: see comment in ICSETSTATUSPROC definition */
673     ic.zStatus = fpfnStatus;
674
675     return ICSendMessage(hic, ICM_SET_STATUS_PROC, (DWORD_PTR)&ic, sizeof(ic));
676 }
677
678 typedef struct {
679     LONG                cbSize;
680     DWORD               dwFlags;
681     HIC                 hic;
682     DWORD               fccType;
683     DWORD               fccHandler;
684     LPBITMAPINFO        lpbiIn;
685     LPBITMAPINFO        lpbiOut;
686     LPVOID              lpBitsOut;
687     LPVOID              lpBitsPrev;
688     LONG                lFrame;
689     LONG                lKey;
690     LONG                lDataRate;
691     LONG                lQ;
692     LONG                lKeyCount;
693     LPVOID              lpState;
694     LONG                cbState;
695 } COMPVARS, *PCOMPVARS;
696
697 #define ICMF_COMPVARS_VALID     0x00000001
698
699 BOOL VFWAPI ICCompressorChoose(HWND hwnd, UINT uiFlags, LPVOID pvIn, LPVOID lpData,
700                                PCOMPVARS pc, LPSTR lpszTitle);
701
702 #define ICMF_CHOOSE_KEYFRAME            0x0001
703 #define ICMF_CHOOSE_DATARATE            0x0002
704 #define ICMF_CHOOSE_PREVIEW             0x0004
705 #define ICMF_CHOOSE_ALLCOMPRESSORS      0x0008
706
707 BOOL VFWAPI ICSeqCompressFrameStart(PCOMPVARS pc, LPBITMAPINFO lpbiIn);
708 void VFWAPI ICSeqCompressFrameEnd(PCOMPVARS pc);
709
710 LPVOID VFWAPI ICSeqCompressFrame(PCOMPVARS pc, UINT uiFlags, LPVOID lpBits,
711                                  BOOL *pfKey, LONG *plSize);
712 void VFWAPI ICCompressorFree(PCOMPVARS pc);
713
714 /********************* AVIFILE function declarations *************************/
715
716 #ifndef mmioFOURCC
717 #define mmioFOURCC( ch0, ch1, ch2, ch3 )                                \
718         ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) |            \
719         ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
720 #endif
721
722 #ifndef aviTWOCC
723 #define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
724 #endif
725
726 typedef WORD TWOCC;
727
728 #define ICTYPE_VIDEO            mmioFOURCC('v', 'i', 'd', 'c')
729 #define ICTYPE_AUDIO            mmioFOURCC('a', 'u', 'd', 'c')
730
731 #define formtypeAVI             mmioFOURCC('A', 'V', 'I', ' ')
732 #define listtypeAVIHEADER       mmioFOURCC('h', 'd', 'r', 'l')
733 #define ckidAVIMAINHDR          mmioFOURCC('a', 'v', 'i', 'h')
734 #define listtypeSTREAMHEADER    mmioFOURCC('s', 't', 'r', 'l')
735 #define ckidSTREAMHEADER        mmioFOURCC('s', 't', 'r', 'h')
736 #define ckidSTREAMFORMAT        mmioFOURCC('s', 't', 'r', 'f')
737 #define ckidSTREAMHANDLERDATA   mmioFOURCC('s', 't', 'r', 'd')
738 #define ckidSTREAMNAME          mmioFOURCC('s', 't', 'r', 'n')
739
740 #define listtypeAVIMOVIE        mmioFOURCC('m', 'o', 'v', 'i')
741 #define listtypeAVIRECORD       mmioFOURCC('r', 'e', 'c', ' ')
742
743 #define ckidAVINEWINDEX         mmioFOURCC('i', 'd', 'x', '1')
744
745 #define streamtypeANY           0UL
746 #define streamtypeVIDEO         mmioFOURCC('v', 'i', 'd', 's')
747 #define streamtypeAUDIO         mmioFOURCC('a', 'u', 'd', 's')
748 #define streamtypeMIDI          mmioFOURCC('m', 'i', 'd', 's')
749 #define streamtypeTEXT          mmioFOURCC('t', 'x', 't', 's')
750
751 /* Basic chunk types */
752 #define cktypeDIBbits           aviTWOCC('d', 'b')
753 #define cktypeDIBcompressed     aviTWOCC('d', 'c')
754 #define cktypePALchange         aviTWOCC('p', 'c')
755 #define cktypeWAVEbytes         aviTWOCC('w', 'b')
756
757 /* Chunk id to use for extra chunks for padding. */
758 #define ckidAVIPADDING          mmioFOURCC('J', 'U', 'N', 'K')
759
760 #define FromHex(n)              (((n) >= 'A') ? ((n) + 10 - 'A') : ((n) - '0'))
761 #define StreamFromFOURCC(fcc)   ((WORD)((FromHex(LOBYTE(LOWORD(fcc))) << 4) + \
762                                         (FromHex(HIBYTE(LOWORD(fcc))))))
763 #define TWOCCFromFOURCC(fcc)    HIWORD(fcc)
764 #define ToHex(n)                ((BYTE)(((n) > 9) ? ((n) - 10 + 'A') : ((n) + '0')))
765 #define MAKEAVICKID(tcc, stream) \
766                                 MAKELONG((ToHex((stream) & 0x0f) << 8) | \
767                                          (ToHex(((stream) & 0xf0) >> 4)), tcc)
768
769 /* AVIFileHdr.dwFlags */
770 #define AVIF_HASINDEX           0x00000010      /* Index at end of file? */
771 #define AVIF_MUSTUSEINDEX       0x00000020
772 #define AVIF_ISINTERLEAVED      0x00000100
773 #define AVIF_TRUSTCKTYPE        0x00000800      /* Use CKType to find key frames*/
774 #define AVIF_WASCAPTUREFILE     0x00010000
775 #define AVIF_COPYRIGHTED        0x00020000
776
777 #define AVI_HEADERSIZE  2048
778
779 typedef BOOL (CALLBACK *AVISAVECALLBACK)(INT);
780
781 typedef struct _MainAVIHeader
782 {
783     DWORD       dwMicroSecPerFrame;
784     DWORD       dwMaxBytesPerSec;
785     DWORD       dwPaddingGranularity;
786     DWORD       dwFlags;
787     DWORD       dwTotalFrames;
788     DWORD       dwInitialFrames;
789     DWORD       dwStreams;
790     DWORD       dwSuggestedBufferSize;
791     DWORD       dwWidth;
792     DWORD       dwHeight;
793     DWORD       dwReserved[4];
794 } MainAVIHeader;
795
796 /* AVIStreamHeader.dwFlags */
797 #define AVISF_DISABLED                  0x00000001
798 #define AVISF_VIDEO_PALCHANGES          0x00010000
799
800 typedef struct {
801     FOURCC      fccType;
802     FOURCC      fccHandler;
803     DWORD       dwFlags;        /* AVISF_* */
804     WORD        wPriority;
805     WORD        wLanguage;
806     DWORD       dwInitialFrames;
807     DWORD       dwScale;
808     DWORD       dwRate; /* dwRate / dwScale == samples/second */
809     DWORD       dwStart;
810     DWORD       dwLength; /* In units above... */
811     DWORD       dwSuggestedBufferSize;
812     DWORD       dwQuality;
813     DWORD       dwSampleSize;
814     struct { SHORT left, top, right, bottom; } rcFrame; /* word.word - word.word in file */
815 } AVIStreamHeader;
816
817 /* AVIINDEXENTRY.dwFlags */
818 #define AVIIF_LIST      0x00000001      /* chunk is a 'LIST' */
819 #define AVIIF_TWOCC     0x00000002
820 #define AVIIF_KEYFRAME  0x00000010      /* this frame is a key frame. */
821
822 #define AVIIF_NOTIME    0x00000100      /* this frame doesn't take any time */
823 #define AVIIF_COMPUSE   0x0FFF0000
824
825 typedef struct _AVIINDEXENTRY {
826     DWORD       ckid;
827     DWORD       dwFlags;
828     DWORD       dwChunkOffset;
829     DWORD       dwChunkLength;
830 } AVIINDEXENTRY;
831
832 typedef struct _AVIPALCHANGE {
833     BYTE                bFirstEntry;
834     BYTE                bNumEntries;
835     WORD                wFlags;         /* pad */
836     PALETTEENTRY        peNew[1];
837 } AVIPALCHANGE;
838
839 #define AVIIF_KEYFRAME  0x00000010      /* this frame is a key frame. */
840
841 #define AVIGETFRAMEF_BESTDISPLAYFMT     1
842
843 typedef struct _AVISTREAMINFOA {
844     DWORD       fccType;
845     DWORD       fccHandler;
846     DWORD       dwFlags;        /* AVIIF_* */
847     DWORD       dwCaps;
848     WORD        wPriority;
849     WORD        wLanguage;
850     DWORD       dwScale;
851     DWORD       dwRate;         /* dwRate / dwScale == samples/second */
852     DWORD       dwStart;
853     DWORD       dwLength;       /* In units above... */
854     DWORD       dwInitialFrames;
855     DWORD       dwSuggestedBufferSize;
856     DWORD       dwQuality;
857     DWORD       dwSampleSize;
858     RECT        rcFrame;
859     DWORD       dwEditCount;
860     DWORD       dwFormatChangeCount;
861     CHAR        szName[64];
862 } AVISTREAMINFOA, * LPAVISTREAMINFOA, *PAVISTREAMINFOA;
863
864 typedef struct _AVISTREAMINFOW {
865     DWORD       fccType;
866     DWORD       fccHandler;
867     DWORD       dwFlags;
868     DWORD       dwCaps;
869     WORD        wPriority;
870     WORD        wLanguage;
871     DWORD       dwScale;
872     DWORD       dwRate;         /* dwRate / dwScale == samples/second */
873     DWORD       dwStart;
874     DWORD       dwLength;       /* In units above... */
875     DWORD       dwInitialFrames;
876     DWORD       dwSuggestedBufferSize;
877     DWORD       dwQuality;
878     DWORD       dwSampleSize;
879     RECT        rcFrame;
880     DWORD       dwEditCount;
881     DWORD       dwFormatChangeCount;
882     WCHAR       szName[64];
883 } AVISTREAMINFOW, * LPAVISTREAMINFOW, *PAVISTREAMINFOW;
884 DECL_WINELIB_TYPE_AW(AVISTREAMINFO)
885 DECL_WINELIB_TYPE_AW(LPAVISTREAMINFO)
886 DECL_WINELIB_TYPE_AW(PAVISTREAMINFO)
887
888 #define AVISTREAMINFO_DISABLED          0x00000001
889 #define AVISTREAMINFO_FORMATCHANGES     0x00010000
890
891 /* AVIFILEINFO.dwFlags */
892 #define AVIFILEINFO_HASINDEX            0x00000010
893 #define AVIFILEINFO_MUSTUSEINDEX        0x00000020
894 #define AVIFILEINFO_ISINTERLEAVED       0x00000100
895 #define AVIFILEINFO_TRUSTCKTYPE         0x00000800
896 #define AVIFILEINFO_WASCAPTUREFILE      0x00010000
897 #define AVIFILEINFO_COPYRIGHTED         0x00020000
898
899 /* AVIFILEINFO.dwCaps */
900 #define AVIFILECAPS_CANREAD             0x00000001
901 #define AVIFILECAPS_CANWRITE            0x00000002
902 #define AVIFILECAPS_ALLKEYFRAMES        0x00000010
903 #define AVIFILECAPS_NOCOMPRESSION       0x00000020
904
905 typedef struct _AVIFILEINFOW {
906     DWORD               dwMaxBytesPerSec;
907     DWORD               dwFlags;
908     DWORD               dwCaps;
909     DWORD               dwStreams;
910     DWORD               dwSuggestedBufferSize;
911     DWORD               dwWidth;
912     DWORD               dwHeight;
913     DWORD               dwScale;
914     DWORD               dwRate;
915     DWORD               dwLength;
916     DWORD               dwEditCount;
917     WCHAR               szFileType[64];
918 } AVIFILEINFOW, * LPAVIFILEINFOW, *PAVIFILEINFOW;
919 typedef struct _AVIFILEINFOA {
920     DWORD               dwMaxBytesPerSec;
921     DWORD               dwFlags;
922     DWORD               dwCaps;
923     DWORD               dwStreams;
924     DWORD               dwSuggestedBufferSize;
925     DWORD               dwWidth;
926     DWORD               dwHeight;
927     DWORD               dwScale;
928     DWORD               dwRate;
929     DWORD               dwLength;
930     DWORD               dwEditCount;
931     CHAR                szFileType[64];
932 } AVIFILEINFOA, * LPAVIFILEINFOA, *PAVIFILEINFOA;
933 DECL_WINELIB_TYPE_AW(AVIFILEINFO)
934 DECL_WINELIB_TYPE_AW(PAVIFILEINFO)
935 DECL_WINELIB_TYPE_AW(LPAVIFILEINFO)
936
937 /* AVICOMPRESSOPTIONS.dwFlags. determines presence of fields in below struct */
938 #define AVICOMPRESSF_INTERLEAVE 0x00000001
939 #define AVICOMPRESSF_DATARATE   0x00000002
940 #define AVICOMPRESSF_KEYFRAMES  0x00000004
941 #define AVICOMPRESSF_VALID      0x00000008
942
943 typedef struct {
944     DWORD       fccType;                /* stream type, for consistency */
945     DWORD       fccHandler;             /* compressor */
946     DWORD       dwKeyFrameEvery;        /* keyframe rate */
947     DWORD       dwQuality;              /* compress quality 0-10,000 */
948     DWORD       dwBytesPerSecond;       /* bytes per second */
949     DWORD       dwFlags;                /* flags... see below */
950     LPVOID      lpFormat;               /* save format */
951     DWORD       cbFormat;
952     LPVOID      lpParms;                /* compressor options */
953     DWORD       cbParms;
954     DWORD       dwInterleaveEvery;      /* for non-video streams only */
955 } AVICOMPRESSOPTIONS, *LPAVICOMPRESSOPTIONS,*PAVICOMPRESSOPTIONS;
956
957 #define FIND_DIR        0x0000000FL     /* direction mask */
958 #define FIND_NEXT       0x00000001L     /* search forward */
959 #define FIND_PREV       0x00000004L     /* search backward */
960 #define FIND_FROM_START 0x00000008L     /* start at the logical beginning */
961
962 #define FIND_TYPE       0x000000F0L     /* type mask */
963 #define FIND_KEY        0x00000010L     /* find a key frame */
964 #define FIND_ANY        0x00000020L     /* find any (non-empty) sample */
965 #define FIND_FORMAT     0x00000040L     /* find a formatchange */
966
967 #define FIND_RET        0x0000F000L     /* return mask */
968 #define FIND_POS        0x00000000L     /* return logical position */
969 #define FIND_LENGTH     0x00001000L     /* return logical size */
970 #define FIND_OFFSET     0x00002000L     /* return physical position */
971 #define FIND_SIZE       0x00003000L     /* return physical size */
972 #define FIND_INDEX      0x00004000L     /* return physical index position */
973
974 #include <ole2.h>
975
976 #define DEFINE_AVIGUID(name, l, w1, w2) \
977     DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
978
979 DEFINE_AVIGUID(IID_IAVIFile,            0x00020020, 0, 0);
980 DEFINE_AVIGUID(IID_IAVIStream,          0x00020021, 0, 0);
981 DEFINE_AVIGUID(IID_IAVIStreaming,       0x00020022, 0, 0);
982 DEFINE_AVIGUID(IID_IGetFrame,           0x00020023, 0, 0);
983 DEFINE_AVIGUID(IID_IAVIEditStream,      0x00020024, 0, 0);
984
985 DEFINE_AVIGUID(CLSID_AVISimpleUnMarshal,0x00020009, 0, 0);
986 DEFINE_AVIGUID(CLSID_AVIFile,           0x00020000, 0, 0);
987
988 /*****************************************************************************
989  * IAVIStream interface
990  */
991 #define INTERFACE IAVIStream
992 DECLARE_INTERFACE_(IAVIStream,IUnknown)
993 {
994     /*** IUnknown methods ***/
995     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
996     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
997     STDMETHOD_(ULONG,Release)(THIS) PURE;
998     /*** IAVIStream methods ***/
999     STDMETHOD(Create)(THIS_ LPARAM lParam1, LPARAM lParam2) PURE;
1000     STDMETHOD(Info)(THIS_ AVISTREAMINFOW *psi, LONG lSize) PURE;
1001     STDMETHOD_(LONG,FindSample)(THIS_ LONG lPos, LONG lFlags) PURE;
1002     STDMETHOD(ReadFormat)(THIS_ LONG lPos, LPVOID lpFormat, LONG *lpcbFormat) PURE;
1003     STDMETHOD(SetFormat)(THIS_ LONG lPos, LPVOID lpFormat, LONG cbFormat) PURE;
1004     STDMETHOD(Read)(THIS_ LONG lStart, LONG lSamples, LPVOID lpBuffer, LONG cbBuffer, LONG *plBytes, LONG *plSamples) PURE;
1005     STDMETHOD(Write)(THIS_ LONG lStart, LONG lSamples, LPVOID lpBuffer, LONG cbBuffer, DWORD dwFlags, LONG *plSampWritten, LONG *plBytesWritten) PURE;
1006     STDMETHOD(Delete)(THIS_ LONG lStart, LONG lSamples) PURE;
1007     STDMETHOD(ReadData)(THIS_ DWORD fcc, LPVOID lpBuffer, LONG *lpcbBuffer) PURE;
1008     STDMETHOD(WriteData)(THIS_ DWORD fcc, LPVOID lpBuffer, LONG cbBuffer) PURE;
1009     STDMETHOD(SetInfo)(THIS_ AVISTREAMINFOW *plInfo, LONG cbInfo) PURE;
1010 };
1011 #undef INTERFACE
1012
1013 #if !defined(__cplusplus) || defined(CINTERFACE)
1014 /*** IUnknown methods ***/
1015 #define IAVIStream_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
1016 #define IAVIStream_AddRef(p)             (p)->lpVtbl->AddRef(p)
1017 #define IAVIStream_Release(p)            (p)->lpVtbl->Release(p)
1018 /*** IAVIStream methods ***/
1019 #define IAVIStream_Create(p,a,b)          (p)->lpVtbl->Create(p,a,b)
1020 #define IAVIStream_Info(p,a,b)            (p)->lpVtbl->Info(p,a,b)
1021 #define IAVIStream_FindSample(p,a,b)      (p)->lpVtbl->FindSample(p,a,b)
1022 #define IAVIStream_ReadFormat(p,a,b,c)    (p)->lpVtbl->ReadFormat(p,a,b,c)
1023 #define IAVIStream_SetFormat(p,a,b,c)     (p)->lpVtbl->SetFormat(p,a,b,c)
1024 #define IAVIStream_Read(p,a,b,c,d,e,f)    (p)->lpVtbl->Read(p,a,b,c,d,e,f)
1025 #define IAVIStream_Write(p,a,b,c,d,e,f,g) (p)->lpVtbl->Write(p,a,b,c,d,e,f,g)
1026 #define IAVIStream_Delete(p,a,b)          (p)->lpVtbl->Delete(p,a,b)
1027 #define IAVIStream_ReadData(p,a,b,c)      (p)->lpVtbl->ReadData(p,a,b,c)
1028 #define IAVIStream_WriteData(p,a,b,c)     (p)->lpVtbl->WriteData(p,a,b,c)
1029 #define IAVIStream_SetInfo(p,a,b)         (p)->lpVtbl->SetInfo(p,a,b)
1030 #endif
1031
1032 #define AVISTREAMREAD_CONVENIENT          (-1L)
1033
1034 ULONG WINAPI AVIStreamAddRef(PAVISTREAM iface);
1035 ULONG WINAPI AVIStreamRelease(PAVISTREAM iface);
1036 HRESULT WINAPI AVIStreamCreate(PAVISTREAM*,LONG,LONG,CLSID*);
1037 HRESULT WINAPI AVIStreamInfoA(PAVISTREAM iface,AVISTREAMINFOA *asi,LONG size);
1038 HRESULT WINAPI AVIStreamInfoW(PAVISTREAM iface,AVISTREAMINFOW *asi,LONG size);
1039 #define AVIStreamInfo WINELIB_NAME_AW(AVIStreamInfo)
1040 HRESULT WINAPI AVIStreamFindSample(PAVISTREAM pstream, LONG pos, DWORD flags);
1041 HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG *formatsize);
1042 HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG formatsize);
1043 HRESULT WINAPI AVIStreamRead(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread);
1044 HRESULT WINAPI AVIStreamWrite(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten);
1045 HRESULT WINAPI AVIStreamReadData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG *lpread);
1046 HRESULT WINAPI AVIStreamWriteData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG size);
1047
1048 PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM pavi,LPBITMAPINFOHEADER lpbiWanted);
1049 LPVOID  WINAPI AVIStreamGetFrame(PGETFRAME pg,LONG pos);
1050 HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg);
1051
1052 HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM*ppsCompressed,PAVISTREAM ppsSource,AVICOMPRESSOPTIONS *lpOptions,CLSID*pclsidHandler);
1053 HRESULT WINAPI AVIMakeFileFromStreams(PAVIFILE *ppfile, int nStreams, PAVISTREAM *ppStreams);
1054 HRESULT WINAPI AVIMakeStreamFromClipboard(UINT cfFormat, HANDLE hGlobal, PAVISTREAM * ppstream);
1055
1056 HRESULT WINAPI AVIStreamOpenFromFileA(PAVISTREAM *ppavi, LPCSTR szFile,
1057                                       DWORD fccType, LONG lParam,
1058                                       UINT mode, CLSID *pclsidHandler);
1059 HRESULT WINAPI AVIStreamOpenFromFileW(PAVISTREAM *ppavi, LPCWSTR szFile,
1060                                       DWORD fccType, LONG lParam,
1061                                       UINT mode, CLSID *pclsidHandler);
1062 #define AVIStreamOpenFromFile WINELIB_NAME_AW(AVIStreamOpenFromFile)
1063
1064 LONG WINAPI AVIStreamBeginStreaming(PAVISTREAM pavi, LONG lStart, LONG lEnd, LONG lRate);
1065 LONG WINAPI AVIStreamEndStreaming(PAVISTREAM pavi);
1066
1067 HRESULT WINAPI AVIBuildFilterA(LPSTR szFilter, LONG cbFilter, BOOL fSaving);
1068 HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving);
1069 #define AVIBuildFilter WINELIB_NAME_AW(AVIBuildFilter)
1070
1071 BOOL WINAPI AVISaveOptions(HWND hWnd,UINT uFlags,INT nStream,
1072                            PAVISTREAM *ppavi,LPAVICOMPRESSOPTIONS *ppOptions);
1073 HRESULT WINAPI AVISaveOptionsFree(INT nStreams,LPAVICOMPRESSOPTIONS*ppOptions);
1074
1075 HRESULT CDECL AVISaveA(LPCSTR szFile, CLSID *pclsidHandler,
1076              AVISAVECALLBACK lpfnCallback, int nStreams,
1077              PAVISTREAM pavi, LPAVICOMPRESSOPTIONS lpOptions, ...);
1078 HRESULT CDECL AVISaveW(LPCWSTR szFile, CLSID *pclsidHandler,
1079              AVISAVECALLBACK lpfnCallback, int nStreams,
1080              PAVISTREAM pavi, LPAVICOMPRESSOPTIONS lpOptions, ...);
1081 #define AVISave WINELIB_NAME_AW(AVISave)
1082
1083 HRESULT WINAPI AVISaveVA(LPCSTR szFile, CLSID *pclsidHandler,
1084                          AVISAVECALLBACK lpfnCallback, int nStream,
1085                          PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *plpOptions);
1086 HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
1087                          AVISAVECALLBACK lpfnCallback, int nStream,
1088                          PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *plpOptions);
1089 #define AVISaveV WINELIB_NAME_AW(AVISaveV)
1090
1091 LONG WINAPI AVIStreamStart(PAVISTREAM iface);
1092 LONG WINAPI AVIStreamLength(PAVISTREAM iface);
1093 LONG WINAPI AVIStreamSampleToTime(PAVISTREAM pstream, LONG lSample);
1094 LONG WINAPI AVIStreamTimeToSample(PAVISTREAM pstream, LONG lTime);
1095
1096 #define AVIFileClose(pavi) \
1097     AVIFileRelease(pavi)
1098 #define AVIStreamClose(pavi) \
1099     AVIStreamRelease(pavi);
1100 #define AVIStreamEnd(pavi) \
1101     (AVIStreamStart(pavi) + AVIStreamLength(pavi))
1102 #define AVIStreamEndTime(pavi) \
1103     AVIStreamSampleToTime(pavi, AVIStreamEnd(pavi))
1104 #define AVIStreamFormatSize(pavi, lPos, plSize) \
1105     AVIStreamReadFormat(pavi, lPos, NULL, plSize)
1106 #define AVIStreamLengthTime(pavi) \
1107     AVIStreamSampleToTime(pavi, AVIStreamLength(pavi))
1108 #define AVIStreamSampleSize(pavi,pos,psize) \
1109     AVIStreamRead(pavi,pos,1,NULL,0,psize,NULL)
1110 #define AVIStreamSampleToSample(pavi1, pavi2, samp2) \
1111     AVIStreamTimeToSample(pavi1, AVIStreamSampleToTime(pavi2, samp2))
1112 #define AVIStreamStartTime(pavi) \
1113     AVIStreamSampleToTime(pavi, AVIStreamStart(pavi))
1114
1115 #define AVIStreamNextSample(pavi, pos) \
1116     AVIStreamFindSample(pavi, pos + 1, FIND_NEXT | FIND_ANY)
1117 #define AVIStreamPrevSample(pavi, pos) \
1118     AVIStreamFindSample(pavi, pos - 1, FIND_PREV | FIND_ANY)
1119 #define AVIStreamNearestSample(pavi, pos) \
1120     AVIStreamFindSample(pavi, pos, FIND_PREV | FIND_ANY)
1121 #define AVStreamNextKeyFrame(pavi,pos) \
1122     AVIStreamFindSample(pavi, pos + 1, FIND_NEXT | FIND_KEY)
1123 #define AVStreamPrevKeyFrame(pavi,pos) \
1124     AVIStreamFindSample(pavi, pos - 1, FIND_NEXT | FIND_KEY)
1125 #define AVIStreamNearestKeyFrame(pavi,pos) \
1126     AVIStreamFindSample(pavi, pos, FIND_PREV | FIND_KEY)
1127 #define AVIStreamIsKeyFrame(pavi, pos) \
1128     (AVIStreamNearestKeyFrame(pavi, pos) == pos)
1129
1130 /*****************************************************************************
1131  * IAVIStreaming interface
1132  */
1133 #define INTERFACE IAVIStreaming
1134 DECLARE_INTERFACE_(IAVIStreaming,IUnknown)
1135 {
1136     /*** IUnknown methods ***/
1137     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
1138     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
1139     STDMETHOD_(ULONG,Release)(THIS) PURE;
1140     /*** IAVIStreaming methods ***/
1141     STDMETHOD(Begin)(IAVIStreaming*iface,LONG lStart,LONG lEnd,LONG lRate) PURE;
1142     STDMETHOD(End)(IAVIStreaming*iface) PURE;
1143 };
1144 #undef INTERFACE
1145
1146 #if !defined(__cplusplus) || defined(CINTERFACE)
1147 /*** IUnknown methods ***/
1148 #define IAVIStreaming_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
1149 #define IAVIStreaming_AddRef(p)             (p)->lpVtbl->AddRef(p)
1150 #define IAVIStreaming_Release(p)            (p)->lpVtbl->Release(p)
1151 /*** IAVIStreaming methods ***/
1152 #define IAVIStreaming_Begin(p,a,b,c)        (p)->lpVtbl->Begin(p,a,b,c)
1153 #define IAVIStreaming_End(p)                (p)->lpVtbl->End(p)
1154 #endif
1155
1156 /*****************************************************************************
1157  * IAVIEditStream interface
1158  */
1159 #define INTERFACE IAVIEditStream
1160 DECLARE_INTERFACE_(IAVIEditStream,IUnknown)
1161 {
1162     /*** IUnknown methods ***/
1163     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
1164     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
1165     STDMETHOD_(ULONG,Release)(THIS) PURE;
1166     /*** IAVIEditStream methods ***/
1167     STDMETHOD(Cut)(IAVIEditStream*iface,LONG*plStart,LONG*plLength,PAVISTREAM*ppResult) PURE;
1168     STDMETHOD(Copy)(IAVIEditStream*iface,LONG*plStart,LONG*plLength,PAVISTREAM*ppResult) PURE;
1169     STDMETHOD(Paste)(IAVIEditStream*iface,LONG*plStart,LONG*plLength,PAVISTREAM pSource,LONG lStart,LONG lEnd) PURE;
1170     STDMETHOD(Clone)(IAVIEditStream*iface,PAVISTREAM*ppResult) PURE;
1171     STDMETHOD(SetInfo)(IAVIEditStream*iface,LPAVISTREAMINFOW asi, LONG size) PURE;
1172 };
1173 #undef INTERFACE
1174
1175 #if !defined(__cplusplus) || defined(CINTERFACE)
1176 /*** IUnknown methods ***/
1177 #define IAVIEditStream_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
1178 #define IAVIEditStream_AddRef(p)             (p)->lpVtbl->AddRef(p)
1179 #define IAVIEditStream_Release(p)            (p)->lpVtbl->Release(p)
1180 /*** IAVIEditStream methods ***/
1181 #define IAVIEditStream_Cut(p,a,b,c)          (p)->lpVtbl->Cut(p,a,b,c)
1182 #define IAVIEditStream_Copy(p,a,b,c)         (p)->lpVtbl->Copy(p,a,b,c)
1183 #define IAVIEditStream_Paste(p,a,b,c,d,e)    (p)->lpVtbl->Paste(p,a,b,c,d,e)
1184 #define IAVIEditStream_Clone(p,a)            (p)->lpVtbl->Clone(p,a)
1185 #define IAVIEditStream_SetInfo(p,a,b)        (p)->lpVtbl->SetInfo(p,a,b)
1186 #endif
1187
1188 HRESULT WINAPI CreateEditableStream(PAVISTREAM *ppEditable,PAVISTREAM pSource);
1189 HRESULT WINAPI EditStreamClone(PAVISTREAM pStream, PAVISTREAM *ppResult);
1190 HRESULT WINAPI EditStreamCopy(PAVISTREAM pStream, LONG *plStart,
1191                               LONG *plLength, PAVISTREAM *ppResult);
1192 HRESULT WINAPI EditStreamCut(PAVISTREAM pStream, LONG *plStart,
1193                              LONG *plLength, PAVISTREAM *ppResult);
1194 HRESULT WINAPI EditStreamPaste(PAVISTREAM pDest, LONG *plStart, LONG *plLength,
1195                                PAVISTREAM pSource, LONG lStart, LONG lEnd);
1196
1197 HRESULT WINAPI EditStreamSetInfoA(PAVISTREAM pstream, LPAVISTREAMINFOA asi,
1198                                   LONG size);
1199 HRESULT WINAPI EditStreamSetInfoW(PAVISTREAM pstream, LPAVISTREAMINFOW asi,
1200                                   LONG size);
1201 #define EditStreamSetInfo WINELIB_NAME_AW(EditStreamSetInfo)
1202
1203 HRESULT WINAPI EditStreamSetNameA(PAVISTREAM pstream, LPCSTR szName);
1204 HRESULT WINAPI EditStreamSetNameW(PAVISTREAM pstream, LPCWSTR szName);
1205 #define EditStreamSetName WINELIB_NAME_AW(EditStreamSetName)
1206
1207 /*****************************************************************************
1208  * IAVIFile interface
1209  */
1210 /* In Win32 this interface uses UNICODE only */
1211 #define INTERFACE IAVIFile
1212 DECLARE_INTERFACE_(IAVIFile,IUnknown)
1213 {
1214     /*** IUnknown methods ***/
1215     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
1216     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
1217     STDMETHOD_(ULONG,Release)(THIS) PURE;
1218     /*** IAVIFile methods ***/
1219     STDMETHOD(Info)(THIS_ AVIFILEINFOW *pfi, LONG lSize) PURE;
1220     STDMETHOD(GetStream)(THIS_ PAVISTREAM *ppStream, DWORD fccType, LONG lParam) PURE;
1221     STDMETHOD(CreateStream)(THIS_ PAVISTREAM *ppStream, AVISTREAMINFOW *psi) PURE;
1222     STDMETHOD(WriteData)(THIS_ DWORD fcc, LPVOID lpBuffer, LONG cbBuffer) PURE;
1223     STDMETHOD(ReadData)(THIS_ DWORD fcc, LPVOID lpBuffer, LONG *lpcbBuffer) PURE;
1224     STDMETHOD(EndRecord)(THIS) PURE;
1225     STDMETHOD(DeleteStream)(THIS_ DWORD fccType, LONG lParam) PURE;
1226 };
1227 #undef INTERFACE
1228
1229 #if !defined(__cplusplus) || defined(CINTERFACE)
1230 /*** IUnknown methods ***/
1231 #define IAVIFile_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
1232 #define IAVIFile_AddRef(p)             (p)->lpVtbl->AddRef(p)
1233 #define IAVIFile_Release(p)            (p)->lpVtbl->Release(p)
1234 /*** IAVIFile methods ***/
1235 #define IAVIFile_Info(p,a,b)         (p)->lpVtbl->Info(p,a,b)
1236 #define IAVIFile_GetStream(p,a,b,c)  (p)->lpVtbl->GetStream(p,a,b,c)
1237 #define IAVIFile_CreateStream(p,a,b) (p)->lpVtbl->CreateStream(p,a,b)
1238 #define IAVIFile_WriteData(p,a,b,c)  (p)->lpVtbl->WriteData(p,a,b,c)
1239 #define IAVIFile_ReadData(p,a,b,c)   (p)->lpVtbl->ReadData(p,a,b,c)
1240 #define IAVIFile_EndRecord(p)        (p)->lpVtbl->EndRecord(p)
1241 #define IAVIFile_DeleteStream(p,a,b) (p)->lpVtbl->DeleteStream(p,a,b)
1242 #endif
1243
1244 void WINAPI AVIFileInit(void);
1245 void WINAPI AVIFileExit(void);
1246
1247 HRESULT WINAPI AVIFileOpenA(PAVIFILE* ppfile,LPCSTR szFile,UINT uMode,LPCLSID lpHandler);
1248 HRESULT WINAPI AVIFileOpenW(PAVIFILE* ppfile,LPCWSTR szFile,UINT uMode,LPCLSID lpHandler);
1249 #define AVIFileOpen WINELIB_NAME_AW(AVIFileOpen)
1250
1251 ULONG   WINAPI AVIFileAddRef(PAVIFILE pfile);
1252 ULONG   WINAPI AVIFileRelease(PAVIFILE pfile);
1253 HRESULT WINAPI AVIFileInfoA(PAVIFILE pfile,PAVIFILEINFOA pfi,LONG lSize);
1254 HRESULT WINAPI AVIFileInfoW(PAVIFILE pfile,PAVIFILEINFOW pfi,LONG lSize);
1255 #define AVIFileInfo WINELIB_NAME_AW(AVIFileInfo)
1256 HRESULT WINAPI AVIFileGetStream(PAVIFILE pfile,PAVISTREAM* avis,DWORD fccType,LONG lParam);
1257 HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE pfile,PAVISTREAM* ppavi,AVISTREAMINFOA* psi);
1258 HRESULT WINAPI AVIFileCreateStreamW(PAVIFILE pfile,PAVISTREAM* ppavi,AVISTREAMINFOW* psi);
1259 #define AVIFileCreateStream WINELIB_NAME_AW(AVIFileCreateStream)
1260 HRESULT WINAPI AVIFileWriteData(PAVIFILE pfile,DWORD fcc,LPVOID lp,LONG size);
1261 HRESULT WINAPI AVIFileReadData(PAVIFILE pfile,DWORD fcc,LPVOID lp,LPLONG size);
1262 HRESULT WINAPI AVIFileEndRecord(PAVIFILE pfile);
1263
1264 /*****************************************************************************
1265  * IGetFrame interface
1266  */
1267 #define INTERFACE IGetFrame
1268 DECLARE_INTERFACE_(IGetFrame,IUnknown)
1269 {
1270     /*** IUnknown methods ***/
1271     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
1272     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
1273     STDMETHOD_(ULONG,Release)(THIS) PURE;
1274     /*** IGetFrame methods ***/
1275     STDMETHOD_(LPVOID,GetFrame)(THIS_ LONG lPos) PURE;
1276     STDMETHOD(Begin)(THIS_ LONG lStart, LONG lEnd, LONG lRate) PURE;
1277     STDMETHOD(End)(THIS) PURE;
1278     STDMETHOD(SetFormat)(THIS_ LPBITMAPINFOHEADER lpbi, LPVOID lpBits, INT x, INT y, INT dx, INT dy) PURE;
1279 };
1280 #undef INTERFACE
1281
1282 #if !defined(__cplusplus) || defined(CINTERFACE)
1283 /*** IUnknown methods ***/
1284 #define IGetFrame_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
1285 #define IGetFrame_AddRef(p)             (p)->lpVtbl->AddRef(p)
1286 #define IGetFrame_Release(p)            (p)->lpVtbl->Release(p)
1287 /*** IGetFrame methods ***/
1288 #define IGetFrame_GetFrame(p,a)            (p)->lpVtbl->GetFrame(p,a)
1289 #define IGetFrame_Begin(p,a,b,c)           (p)->lpVtbl->Begin(p,a,b,c)
1290 #define IGetFrame_End(p)                   (p)->lpVtbl->End(p)
1291 #define IGetFrame_SetFormat(p,a,b,c,d,e,f) (p)->lpVtbl->SetFormat(p,a,b,c,d,e,f)
1292 #endif
1293
1294 HRESULT WINAPI AVIClearClipboard(void);
1295 HRESULT WINAPI AVIGetFromClipboard(PAVIFILE *ppfile);
1296 HRESULT WINAPI AVIPutFileOnClipboard(PAVIFILE pfile);
1297
1298 #ifdef OFN_READONLY
1299 BOOL WINAPI GetOpenFileNamePreviewA(LPOPENFILENAMEA lpofn);
1300 BOOL WINAPI GetOpenFileNamePreviewW(LPOPENFILENAMEW lpofn);
1301 #define GetOpenFileNamePreview WINELIB_NAME_AW(GetOpenFileNamePreview)
1302 BOOL WINAPI GetSaveFileNamePreviewA(LPOPENFILENAMEA lpofn);
1303 BOOL WINAPI GetSaveFileNamePreviewW(LPOPENFILENAMEW lpofn);
1304 #define GetSaveFileNamePreview WINELIB_NAME_AW(GetSaveFileNamePreview)
1305 #endif
1306
1307 #define AVIERR_OK               0
1308 #define MAKE_AVIERR(error)      MAKE_SCODE(SEVERITY_ERROR,FACILITY_ITF,0x4000+error)
1309
1310 #define AVIERR_UNSUPPORTED      MAKE_AVIERR(101)
1311 #define AVIERR_BADFORMAT        MAKE_AVIERR(102)
1312 #define AVIERR_MEMORY           MAKE_AVIERR(103)
1313 #define AVIERR_INTERNAL         MAKE_AVIERR(104)
1314 #define AVIERR_BADFLAGS         MAKE_AVIERR(105)
1315 #define AVIERR_BADPARAM         MAKE_AVIERR(106)
1316 #define AVIERR_BADSIZE          MAKE_AVIERR(107)
1317 #define AVIERR_BADHANDLE        MAKE_AVIERR(108)
1318 #define AVIERR_FILEREAD         MAKE_AVIERR(109)
1319 #define AVIERR_FILEWRITE        MAKE_AVIERR(110)
1320 #define AVIERR_FILEOPEN         MAKE_AVIERR(111)
1321 #define AVIERR_COMPRESSOR       MAKE_AVIERR(112)
1322 #define AVIERR_NOCOMPRESSOR     MAKE_AVIERR(113)
1323 #define AVIERR_READONLY         MAKE_AVIERR(114)
1324 #define AVIERR_NODATA           MAKE_AVIERR(115)
1325 #define AVIERR_BUFFERTOOSMALL   MAKE_AVIERR(116)
1326 #define AVIERR_CANTCOMPRESS     MAKE_AVIERR(117)
1327 #define AVIERR_USERABORT        MAKE_AVIERR(198)
1328 #define AVIERR_ERROR            MAKE_AVIERR(199)
1329
1330 BOOL VFWAPIV MCIWndRegisterClass(void);
1331
1332 HWND VFWAPIV MCIWndCreateA(HWND, HINSTANCE, DWORD, LPCSTR);
1333 HWND VFWAPIV MCIWndCreateW(HWND, HINSTANCE, DWORD, LPCWSTR);
1334 #define     MCIWndCreate WINELIB_NAME_AW(MCIWndCreate)
1335
1336 #define MCIWNDOPENF_NEW                 0x0001
1337
1338 #define MCIWNDF_NOAUTOSIZEWINDOW        0x0001
1339 #define MCIWNDF_NOPLAYBAR               0x0002
1340 #define MCIWNDF_NOAUTOSIZEMOVIE         0x0004
1341 #define MCIWNDF_NOMENU                  0x0008
1342 #define MCIWNDF_SHOWNAME                0x0010
1343 #define MCIWNDF_SHOWPOS                 0x0020
1344 #define MCIWNDF_SHOWMODE                0x0040
1345 #define MCIWNDF_SHOWALL                 0x0070
1346
1347 #define MCIWNDF_NOTIFYMODE              0x0100
1348 #define MCIWNDF_NOTIFYPOS               0x0200
1349 #define MCIWNDF_NOTIFYSIZE              0x0400
1350 #define MCIWNDF_NOTIFYERROR             0x1000
1351 #define MCIWNDF_NOTIFYALL               0x1F00
1352
1353 #define MCIWNDF_NOTIFYANSI              0x0080
1354
1355 #define MCIWNDF_NOTIFYMEDIAA            0x0880
1356 #define MCIWNDF_NOTIFYMEDIAW            0x0800
1357 #define MCIWNDF_NOTIFYMEDIA WINELIB_NAME_AW(MCIWNDF_NOTIFYMEDIA)
1358
1359 #define MCIWNDF_RECORD                  0x2000
1360 #define MCIWNDF_NOERRORDLG              0x4000
1361 #define MCIWNDF_NOOPEN                  0x8000
1362
1363 #ifdef __cplusplus
1364 #define MCIWndSM ::SendMessage
1365 #else
1366 #define MCIWndSM SendMessage
1367 #endif
1368
1369 #define MCIWndCanPlay(hWnd)         (BOOL)MCIWndSM(hWnd,MCIWNDM_CAN_PLAY,0,0)
1370 #define MCIWndCanRecord(hWnd)       (BOOL)MCIWndSM(hWnd,MCIWNDM_CAN_RECORD,0,0)
1371 #define MCIWndCanSave(hWnd)         (BOOL)MCIWndSM(hWnd,MCIWNDM_CAN_SAVE,0,0)
1372 #define MCIWndCanWindow(hWnd)       (BOOL)MCIWndSM(hWnd,MCIWNDM_CAN_WINDOW,0,0)
1373 #define MCIWndCanEject(hWnd)        (BOOL)MCIWndSM(hWnd,MCIWNDM_CAN_EJECT,0,0)
1374 #define MCIWndCanConfig(hWnd)       (BOOL)MCIWndSM(hWnd,MCIWNDM_CAN_CONFIG,0,0)
1375 #define MCIWndPaletteKick(hWnd)     (BOOL)MCIWndSM(hWnd,MCIWNDM_PALETTEKICK,0,0)
1376
1377 #define MCIWndSave(hWnd,szFile)     (LONG)MCIWndSM(hWnd,MCI_SAVE,0,(LPARAM)(LPVOID)(szFile))
1378 #define MCIWndSaveDialog(hWnd)      MCIWndSave(hWnd,-1)
1379
1380 #define MCIWndNew(hWnd,lp)          (LONG)MCIWndSM(hWnd,MCIWNDM_NEW,0,(LPARAM)(LPVOID)(lp))
1381
1382 #define MCIWndRecord(hWnd)          (LONG)MCIWndSM(hWnd,MCI_RECORD,0,0)
1383 #define MCIWndOpen(hWnd,sz,f)       (LONG)MCIWndSM(hWnd,MCIWNDM_OPEN,(WPARAM)(UINT)(f),(LPARAM)(LPVOID)(sz))
1384 #define MCIWndOpenDialog(hWnd)      MCIWndOpen(hWnd,-1,0)
1385 #define MCIWndClose(hWnd)           (LONG)MCIWndSM(hWnd,MCI_CLOSE,0,0)
1386 #define MCIWndPlay(hWnd)            (LONG)MCIWndSM(hWnd,MCI_PLAY,0,0)
1387 #define MCIWndStop(hWnd)            (LONG)MCIWndSM(hWnd,MCI_STOP,0,0)
1388 #define MCIWndPause(hWnd)           (LONG)MCIWndSM(hWnd,MCI_PAUSE,0,0)
1389 #define MCIWndResume(hWnd)          (LONG)MCIWndSM(hWnd,MCI_RESUME,0,0)
1390 #define MCIWndSeek(hWnd,lPos)       (LONG)MCIWndSM(hWnd,MCI_SEEK,0,(LPARAM)(LONG)(lPos))
1391 #define MCIWndEject(hWnd)           (LONG)MCIWndSM(hWnd,MCIWNDM_EJECT,0,0)
1392
1393 #define MCIWndHome(hWnd)            MCIWndSeek(hWnd,MCIWND_START)
1394 #define MCIWndEnd(hWnd)             MCIWndSeek(hWnd,MCIWND_END)
1395
1396 #define MCIWndGetSource(hWnd,prc)   (LONG)MCIWndSM(hWnd,MCIWNDM_GET_SOURCE,0,(LPARAM)(LPRECT)(prc))
1397 #define MCIWndPutSource(hWnd,prc)   (LONG)MCIWndSM(hWnd,MCIWNDM_PUT_SOURCE,0,(LPARAM)(LPRECT)(prc))
1398
1399 #define MCIWndGetDest(hWnd,prc)     (LONG)MCIWndSM(hWnd,MCIWNDM_GET_DEST,0,(LPARAM)(LPRECT)(prc))
1400 #define MCIWndPutDest(hWnd,prc)     (LONG)MCIWndSM(hWnd,MCIWNDM_PUT_DEST,0,(LPARAM)(LPRECT)(prc))
1401
1402 #define MCIWndPlayReverse(hWnd)     (LONG)MCIWndSM(hWnd,MCIWNDM_PLAYREVERSE,0,0)
1403 #define MCIWndPlayFrom(hWnd,lPos)   (LONG)MCIWndSM(hWnd,MCIWNDM_PLAYFROM,0,(LPARAM)(LONG)(lPos))
1404 #define MCIWndPlayTo(hWnd,lPos)     (LONG)MCIWndSM(hWnd,MCIWNDM_PLAYTO,  0,(LPARAM)(LONG)(lPos))
1405 #define MCIWndPlayFromTo(hWnd,lStart,lEnd) (MCIWndSeek(hWnd,lStart),MCIWndPlayTo(hWnd,lEnd))
1406
1407 #define MCIWndGetDeviceID(hWnd)     (UINT)MCIWndSM(hWnd,MCIWNDM_GETDEVICEID,0,0)
1408 #define MCIWndGetAlias(hWnd)        (UINT)MCIWndSM(hWnd,MCIWNDM_GETALIAS,0,0)
1409 #define MCIWndGetMode(hWnd,lp,len)  (LONG)MCIWndSM(hWnd,MCIWNDM_GETMODE,(WPARAM)(UINT)(len),(LPARAM)(LPTSTR)(lp))
1410 #define MCIWndGetPosition(hWnd)     (LONG)MCIWndSM(hWnd,MCIWNDM_GETPOSITION,0,0)
1411 #define MCIWndGetPositionString(hWnd,lp,len) (LONG)MCIWndSM(hWnd,MCIWNDM_GETPOSITION,(WPARAM)(UINT)(len),(LPARAM)(LPTSTR)(lp))
1412 #define MCIWndGetStart(hWnd)        (LONG)MCIWndSM(hWnd,MCIWNDM_GETSTART,0,0)
1413 #define MCIWndGetLength(hWnd)       (LONG)MCIWndSM(hWnd,MCIWNDM_GETLENGTH,0,0)
1414 #define MCIWndGetEnd(hWnd)          (LONG)MCIWndSM(hWnd,MCIWNDM_GETEND,0,0)
1415
1416 #define MCIWndStep(hWnd,n)          (LONG)MCIWndSM(hWnd,MCI_STEP,0,(LPARAM)(long)(n))
1417
1418 #define MCIWndDestroy(hWnd)         (VOID)MCIWndSM(hWnd,WM_CLOSE,0,0)
1419 #define MCIWndSetZoom(hWnd,iZoom)   (VOID)MCIWndSM(hWnd,MCIWNDM_SETZOOM,0,(LPARAM)(UINT)(iZoom))
1420 #define MCIWndGetZoom(hWnd)         (UINT)MCIWndSM(hWnd,MCIWNDM_GETZOOM,0,0)
1421 #define MCIWndSetVolume(hWnd,iVol)  (LONG)MCIWndSM(hWnd,MCIWNDM_SETVOLUME,0,(LPARAM)(UINT)(iVol))
1422 #define MCIWndGetVolume(hWnd)       (LONG)MCIWndSM(hWnd,MCIWNDM_GETVOLUME,0,0)
1423 #define MCIWndSetSpeed(hWnd,iSpeed) (LONG)MCIWndSM(hWnd,MCIWNDM_SETSPEED,0,(LPARAM)(UINT)(iSpeed))
1424 #define MCIWndGetSpeed(hWnd)        (LONG)MCIWndSM(hWnd,MCIWNDM_GETSPEED,0,0)
1425 #define MCIWndSetTimeFormat(hWnd,lp) (LONG)MCIWndSM(hWnd,MCIWNDM_SETTIMEFORMAT,0,(LPARAM)(LPTSTR)(lp))
1426 #define MCIWndGetTimeFormat(hWnd,lp,len) (LONG)MCIWndSM(hWnd,MCIWNDM_GETTIMEFORMAT,(WPARAM)(UINT)(len),(LPARAM)(LPTSTR)(lp))
1427 #define MCIWndValidateMedia(hWnd)   (VOID)MCIWndSM(hWnd,MCIWNDM_VALIDATEMEDIA,0,0)
1428
1429 #define MCIWndSetRepeat(hWnd,f)     (void)MCIWndSM(hWnd,MCIWNDM_SETREPEAT,0,(LPARAM)(BOOL)(f))
1430 #define MCIWndGetRepeat(hWnd)       (BOOL)MCIWndSM(hWnd,MCIWNDM_GETREPEAT,0,0)
1431
1432 #define MCIWndUseFrames(hWnd)       MCIWndSetTimeFormat(hWnd,TEXT("frames"))
1433 #define MCIWndUseTime(hWnd)         MCIWndSetTimeFormat(hWnd,TEXT("ms"))
1434
1435 #define MCIWndSetActiveTimer(hWnd,active)                               \
1436         (VOID)MCIWndSM(hWnd,MCIWNDM_SETACTIVETIMER,                     \
1437         (WPARAM)(UINT)(active),0L)
1438 #define MCIWndSetInactiveTimer(hWnd,inactive)                           \
1439         (VOID)MCIWndSM(hWnd,MCIWNDM_SETINACTIVETIMER,                   \
1440         (WPARAM)(UINT)(inactive),0L)
1441 #define MCIWndSetTimers(hWnd,active,inactive)                           \
1442             (VOID)MCIWndSM(hWnd,MCIWNDM_SETTIMERS,(WPARAM)(UINT)(active),\
1443             (LPARAM)(UINT)(inactive))
1444 #define MCIWndGetActiveTimer(hWnd)                                      \
1445         (UINT)MCIWndSM(hWnd,MCIWNDM_GETACTIVETIMER,0,0L);
1446 #define MCIWndGetInactiveTimer(hWnd)                                    \
1447         (UINT)MCIWndSM(hWnd,MCIWNDM_GETINACTIVETIMER,0,0L);
1448
1449 #define MCIWndRealize(hWnd,fBkgnd) (LONG)MCIWndSM(hWnd,MCIWNDM_REALIZE,(WPARAM)(BOOL)(fBkgnd),0)
1450
1451 #define MCIWndSendString(hWnd,sz)  (LONG)MCIWndSM(hWnd,MCIWNDM_SENDSTRING,0,(LPARAM)(LPTSTR)(sz))
1452 #define MCIWndReturnString(hWnd,lp,len)  (LONG)MCIWndSM(hWnd,MCIWNDM_RETURNSTRING,(WPARAM)(UINT)(len),(LPARAM)(LPVOID)(lp))
1453 #define MCIWndGetError(hWnd,lp,len) (LONG)MCIWndSM(hWnd,MCIWNDM_GETERROR,(WPARAM)(UINT)(len),(LPARAM)(LPVOID)(lp))
1454
1455 #define MCIWndGetPalette(hWnd)      (HPALETTE)MCIWndSM(hWnd,MCIWNDM_GETPALETTE,0,0)
1456 #define MCIWndSetPalette(hWnd,hpal) (LONG)MCIWndSM(hWnd,MCIWNDM_SETPALETTE,(WPARAM)(HPALETTE)(hpal),0)
1457
1458 #define MCIWndGetFileName(hWnd,lp,len) (LONG)MCIWndSM(hWnd,MCIWNDM_GETFILENAME,(WPARAM)(UINT)(len),(LPARAM)(LPVOID)(lp))
1459 #define MCIWndGetDevice(hWnd,lp,len)   (LONG)MCIWndSM(hWnd,MCIWNDM_GETDEVICE,(WPARAM)(UINT)(len),(LPARAM)(LPVOID)(lp))
1460
1461 #define MCIWndGetStyles(hWnd) (UINT)MCIWndSM(hWnd,MCIWNDM_GETSTYLES,0,0L)
1462 #define MCIWndChangeStyles(hWnd,mask,value) (LONG)MCIWndSM(hWnd,MCIWNDM_CHANGESTYLES,(WPARAM)(UINT)(mask),(LPARAM)(LONG)(value))
1463
1464 #define MCIWndOpenInterface(hWnd,pUnk)  (LONG)MCIWndSM(hWnd,MCIWNDM_OPENINTERFACE,0,(LPARAM)(LPUNKNOWN)(pUnk))
1465
1466 #define MCIWndSetOwner(hWnd,hWndP)  (LONG)MCIWndSM(hWnd,MCIWNDM_SETOWNER,(WPARAM)(hWndP),0)
1467
1468 #define MCIWNDM_GETDEVICEID     (WM_USER + 100)
1469 #define MCIWNDM_GETSTART        (WM_USER + 103)
1470 #define MCIWNDM_GETLENGTH       (WM_USER + 104)
1471 #define MCIWNDM_GETEND          (WM_USER + 105)
1472 #define MCIWNDM_EJECT           (WM_USER + 107)
1473 #define MCIWNDM_SETZOOM         (WM_USER + 108)
1474 #define MCIWNDM_GETZOOM         (WM_USER + 109)
1475 #define MCIWNDM_SETVOLUME       (WM_USER + 110)
1476 #define MCIWNDM_GETVOLUME       (WM_USER + 111)
1477 #define MCIWNDM_SETSPEED        (WM_USER + 112)
1478 #define MCIWNDM_GETSPEED        (WM_USER + 113)
1479 #define MCIWNDM_SETREPEAT       (WM_USER + 114)
1480 #define MCIWNDM_GETREPEAT       (WM_USER + 115)
1481 #define MCIWNDM_REALIZE         (WM_USER + 118)
1482 #define MCIWNDM_VALIDATEMEDIA   (WM_USER + 121)
1483 #define MCIWNDM_PLAYFROM        (WM_USER + 122)
1484 #define MCIWNDM_PLAYTO          (WM_USER + 123)
1485 #define MCIWNDM_GETPALETTE      (WM_USER + 126)
1486 #define MCIWNDM_SETPALETTE      (WM_USER + 127)
1487 #define MCIWNDM_SETTIMERS       (WM_USER + 129)
1488 #define MCIWNDM_SETACTIVETIMER  (WM_USER + 130)
1489 #define MCIWNDM_SETINACTIVETIMER (WM_USER + 131)
1490 #define MCIWNDM_GETACTIVETIMER  (WM_USER + 132)
1491 #define MCIWNDM_GETINACTIVETIMER (WM_USER + 133)
1492 #define MCIWNDM_CHANGESTYLES    (WM_USER + 135)
1493 #define MCIWNDM_GETSTYLES       (WM_USER + 136)
1494 #define MCIWNDM_GETALIAS        (WM_USER + 137)
1495 #define MCIWNDM_PLAYREVERSE     (WM_USER + 139)
1496 #define MCIWNDM_GET_SOURCE      (WM_USER + 140)
1497 #define MCIWNDM_PUT_SOURCE      (WM_USER + 141)
1498 #define MCIWNDM_GET_DEST        (WM_USER + 142)
1499 #define MCIWNDM_PUT_DEST        (WM_USER + 143)
1500 #define MCIWNDM_CAN_PLAY        (WM_USER + 144)
1501 #define MCIWNDM_CAN_WINDOW      (WM_USER + 145)
1502 #define MCIWNDM_CAN_RECORD      (WM_USER + 146)
1503 #define MCIWNDM_CAN_SAVE        (WM_USER + 147)
1504 #define MCIWNDM_CAN_EJECT       (WM_USER + 148)
1505 #define MCIWNDM_CAN_CONFIG      (WM_USER + 149)
1506 #define MCIWNDM_PALETTEKICK     (WM_USER + 150)
1507 #define MCIWNDM_OPENINTERFACE   (WM_USER + 151)
1508 #define MCIWNDM_SETOWNER        (WM_USER + 152)
1509
1510 #define MCIWNDM_SENDSTRINGA     (WM_USER + 101)
1511 #define MCIWNDM_GETPOSITIONA    (WM_USER + 102)
1512 #define MCIWNDM_GETMODEA        (WM_USER + 106)
1513 #define MCIWNDM_SETTIMEFORMATA  (WM_USER + 119)
1514 #define MCIWNDM_GETTIMEFORMATA  (WM_USER + 120)
1515 #define MCIWNDM_GETFILENAMEA    (WM_USER + 124)
1516 #define MCIWNDM_GETDEVICEA      (WM_USER + 125)
1517 #define MCIWNDM_GETERRORA       (WM_USER + 128)
1518 #define MCIWNDM_NEWA            (WM_USER + 134)
1519 #define MCIWNDM_RETURNSTRINGA   (WM_USER + 138)
1520 #define MCIWNDM_OPENA           (WM_USER + 153)
1521
1522 #define MCIWNDM_SENDSTRINGW     (WM_USER + 201)
1523 #define MCIWNDM_GETPOSITIONW    (WM_USER + 202)
1524 #define MCIWNDM_GETMODEW        (WM_USER + 206)
1525 #define MCIWNDM_SETTIMEFORMATW  (WM_USER + 219)
1526 #define MCIWNDM_GETTIMEFORMATW  (WM_USER + 220)
1527 #define MCIWNDM_GETFILENAMEW    (WM_USER + 224)
1528 #define MCIWNDM_GETDEVICEW      (WM_USER + 225)
1529 #define MCIWNDM_GETERRORW       (WM_USER + 228)
1530 #define MCIWNDM_NEWW            (WM_USER + 234)
1531 #define MCIWNDM_RETURNSTRINGW   (WM_USER + 238)
1532 #define MCIWNDM_OPENW           (WM_USER + 252)
1533
1534 #define MCIWNDM_SENDSTRING      WINELIB_NAME_AW(MCIWNDM_SENDSTRING)
1535 #define MCIWNDM_GETPOSITION     WINELIB_NAME_AW(MCIWNDM_GETPOSITION)
1536 #define MCIWNDM_GETMODE         WINELIB_NAME_AW(MCIWNDM_GETMODE)
1537 #define MCIWNDM_SETTIMEFORMAT   WINELIB_NAME_AW(MCIWNDM_SETTIMEFORMAT)
1538 #define MCIWNDM_GETTIMEFORMAT   WINELIB_NAME_AW(MCIWNDM_GETTIMEFORMAT)
1539 #define MCIWNDM_GETFILENAME     WINELIB_NAME_AW(MCIWNDM_GETFILENAME)
1540 #define MCIWNDM_GETDEVICE       WINELIB_NAME_AW(MCIWNDM_GETDEVICE)
1541 #define MCIWNDM_GETERROR        WINELIB_NAME_AW(MCIWNDM_GETERROR)
1542 #define MCIWNDM_NEW             WINELIB_NAME_AW(MCIWNDM_NEW)
1543 #define MCIWNDM_RETURNSTRING    WINELIB_NAME_AW(MCIWNDM_RETURNSTRING)
1544 #define MCIWNDM_OPEN            WINELIB_NAME_AW(MCIWNDM_OPEN)
1545
1546 #define MCIWNDM_NOTIFYMODE      (WM_USER + 200)
1547 #define MCIWNDM_NOTIFYPOS       (WM_USER + 201)
1548 #define MCIWNDM_NOTIFYSIZE      (WM_USER + 202)
1549 #define MCIWNDM_NOTIFYMEDIA     (WM_USER + 203)
1550 #define MCIWNDM_NOTIFYERROR     (WM_USER + 205)
1551
1552 #define MCIWND_START                -1
1553 #define MCIWND_END                  -2
1554
1555 /********************************************
1556  * DrawDib declarations
1557  */
1558
1559 typedef struct
1560
1561     LONG    timeCount; 
1562     LONG    timeDraw; 
1563     LONG    timeDecompress; 
1564     LONG    timeDither; 
1565     LONG    timeStretch; 
1566     LONG    timeBlt; 
1567     LONG    timeSetDIBits; 
1568 } DRAWDIBTIME, *LPDRAWDIBTIME; 
1569
1570 HDRAWDIB VFWAPI DrawDibOpen( void );
1571 UINT VFWAPI DrawDibRealize(HDRAWDIB hdd, HDC hdc, BOOL fBackground);
1572
1573 BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd, HDC hdc, INT dxDst, INT dyDst,
1574                          LPBITMAPINFOHEADER lpbi, INT dxSrc, INT dySrc, UINT wFlags);
1575
1576 BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd, HDC hdc, INT xDst, INT yDst, INT dxDst, INT dyDst,
1577                         LPBITMAPINFOHEADER lpbi, LPVOID lpBits,
1578                         INT xSrc, INT ySrc, INT dxSrc, INT dySrc, UINT wFlags);
1579
1580 /* DrawDibDraw flags */
1581
1582 #define DDF_UPDATE                      0x0002
1583 #define DDF_SAME_HDC                    0x0004
1584 #define DDF_SAME_DRAW                   0x0008
1585 #define DDF_DONTDRAW                    0x0010
1586 #define DDF_ANIMATE                     0x0020
1587 #define DDF_BUFFER                      0x0040
1588 #define DDF_JUSTDRAWIT                  0x0080
1589 #define DDF_FULLSCREEN                  0x0100
1590 #define DDF_BACKGROUNDPAL               0x0200
1591 #define DDF_NOTKEYFRAME                 0x0400
1592 #define DDF_HURRYUP                     0x0800
1593 #define DDF_HALFTONE                    0x1000
1594
1595 #define DDF_PREROLL                     DDF_DONTDRAW
1596 #define DDF_SAME_DIB                    DDF_SAME_DRAW
1597 #define DDF_SAME_SIZE                   DDF_SAME_DRAW
1598
1599 BOOL VFWAPI DrawDibSetPalette(HDRAWDIB hdd, HPALETTE hpal);
1600 HPALETTE VFWAPI DrawDibGetPalette(HDRAWDIB hdd);
1601 BOOL VFWAPI DrawDibChangePalette(HDRAWDIB hdd, int iStart, int iLen, LPPALETTEENTRY lppe);
1602 LPVOID VFWAPI DrawDibGetBuffer(HDRAWDIB hdd, LPBITMAPINFOHEADER lpbi, DWORD dwSize, DWORD dwFlags);
1603
1604 BOOL VFWAPI DrawDibStart(HDRAWDIB hdd, DWORD rate);
1605 BOOL VFWAPI DrawDibStop(HDRAWDIB hdd);
1606 #define DrawDibUpdate(hdd, hdc, x, y) \
1607         DrawDibDraw(hdd, hdc, x, y, 0, 0, NULL, NULL, 0, 0, 0, 0, DDF_UPDATE)
1608
1609 BOOL VFWAPI DrawDibEnd(HDRAWDIB hdd);
1610 BOOL VFWAPI DrawDibClose(HDRAWDIB hdd);
1611 BOOL VFWAPI DrawDibTime(HDRAWDIB hdd, LPDRAWDIBTIME lpddtime);
1612
1613 /* display profiling */
1614 #define PD_CAN_DRAW_DIB         0x0001
1615 #define PD_CAN_STRETCHDIB       0x0002
1616 #define PD_STRETCHDIB_1_1_OK    0x0004
1617 #define PD_STRETCHDIB_1_2_OK    0x0008
1618 #define PD_STRETCHDIB_1_N_OK    0x0010
1619
1620 DWORD VFWAPI DrawDibProfileDisplay(LPBITMAPINFOHEADER lpbi);
1621
1622 DECLARE_HANDLE(HVIDEO);
1623 typedef HVIDEO *LPHVIDEO;
1624
1625 DWORD VFWAPI VideoForWindowsVersion(void);
1626
1627 LONG  VFWAPI InitVFW(void);
1628 LONG  VFWAPI TermVFW(void);
1629
1630 #define DV_ERR_OK            (0)
1631 #define DV_ERR_BASE          (1)
1632 #define DV_ERR_NONSPECIFIC   (DV_ERR_BASE)
1633 #define DV_ERR_BADFORMAT     (DV_ERR_BASE + 1)
1634 #define DV_ERR_STILLPLAYING  (DV_ERR_BASE + 2)
1635 #define DV_ERR_UNPREPARED    (DV_ERR_BASE + 3)
1636 #define DV_ERR_SYNC          (DV_ERR_BASE + 4)
1637 #define DV_ERR_TOOMANYCHANNELS (DV_ERR_BASE + 5)
1638 #define DV_ERR_NOTDETECTED   (DV_ERR_BASE + 6)
1639 #define DV_ERR_BADINSTALL    (DV_ERR_BASE + 7)
1640 #define DV_ERR_CREATEPALETTE (DV_ERR_BASE + 8)
1641 #define DV_ERR_SIZEFIELD     (DV_ERR_BASE + 9)
1642 #define DV_ERR_PARAM1        (DV_ERR_BASE + 10)
1643 #define DV_ERR_PARAM2        (DV_ERR_BASE + 11)
1644 #define DV_ERR_CONFIG1       (DV_ERR_BASE + 12)
1645 #define DV_ERR_CONFIG2       (DV_ERR_BASE + 13)
1646 #define DV_ERR_FLAGS         (DV_ERR_BASE + 14)
1647 #define DV_ERR_13            (DV_ERR_BASE + 15)
1648
1649 #define DV_ERR_NOTSUPPORTED  (DV_ERR_BASE + 16)
1650 #define DV_ERR_NOMEM         (DV_ERR_BASE + 17)
1651 #define DV_ERR_ALLOCATED     (DV_ERR_BASE + 18)
1652 #define DV_ERR_BADDEVICEID   (DV_ERR_BASE + 19)
1653 #define DV_ERR_INVALHANDLE   (DV_ERR_BASE + 20)
1654 #define DV_ERR_BADERRNUM     (DV_ERR_BASE + 21)
1655 #define DV_ERR_NO_BUFFERS    (DV_ERR_BASE + 22)
1656
1657 #define DV_ERR_MEM_CONFLICT  (DV_ERR_BASE + 23)
1658 #define DV_ERR_IO_CONFLICT   (DV_ERR_BASE + 24)
1659 #define DV_ERR_DMA_CONFLICT  (DV_ERR_BASE + 25)
1660 #define DV_ERR_INT_CONFLICT  (DV_ERR_BASE + 26)
1661 #define DV_ERR_PROTECT_ONLY  (DV_ERR_BASE + 27)
1662 #define DV_ERR_LASTERROR     (DV_ERR_BASE + 27)
1663
1664 #define DV_ERR_USER_MSG      (DV_ERR_BASE + 1000)
1665
1666 #ifndef MM_DRVM_OPEN
1667 #define MM_DRVM_OPEN       0x3D0
1668 #define MM_DRVM_CLOSE      0x3D1
1669 #define MM_DRVM_DATA       0x3D2
1670 #define MM_DRVM_ERROR      0x3D3
1671
1672 #define DV_VM_OPEN         MM_DRVM_OPEN
1673 #define DV_VM_CLOSE        MM_DRVM_CLOSE
1674 #define DV_VM_DATA         MM_DRVM_DATA
1675 #define DV_VM_ERROR        MM_DRVM_ERROR
1676 #endif
1677
1678 typedef struct videohdr_tag {
1679     LPBYTE      lpData;
1680     DWORD       dwBufferLength;
1681     DWORD       dwBytesUsed;
1682     DWORD       dwTimeCaptured;
1683     DWORD       dwUser;
1684     DWORD       dwFlags;
1685     DWORD       dwReserved[4];
1686 } VIDEOHDR, *PVIDEOHDR, *LPVIDEOHDR;
1687
1688 #define VHDR_DONE       0x00000001
1689 #define VHDR_PREPARED   0x00000002
1690 #define VHDR_INQUEUE    0x00000004
1691 #define VHDR_KEYFRAME   0x00000008
1692
1693 typedef struct channel_caps_tag {
1694     DWORD       dwFlags;
1695     DWORD       dwSrcRectXMod;
1696     DWORD       dwSrcRectYMod;
1697     DWORD       dwSrcRectWidthMod;
1698     DWORD       dwSrcRectHeightMod;
1699     DWORD       dwDstRectXMod;
1700     DWORD       dwDstRectYMod;
1701     DWORD       dwDstRectWidthMod;
1702     DWORD       dwDstRectHeightMod;
1703 } CHANNEL_CAPS, *PCHANNEL_CAPS, *LPCHANNEL_CAPS;
1704
1705 #define VCAPS_OVERLAY       0x00000001
1706 #define VCAPS_SRC_CAN_CLIP  0x00000002
1707 #define VCAPS_DST_CAN_CLIP  0x00000004
1708 #define VCAPS_CAN_SCALE     0x00000008
1709
1710 #define VIDEO_EXTERNALIN        0x0001
1711 #define VIDEO_EXTERNALOUT       0x0002
1712 #define VIDEO_IN                0x0004
1713 #define VIDEO_OUT               0x0008
1714
1715 #define VIDEO_DLG_QUERY         0x0010
1716
1717 #define VIDEO_CONFIGURE_QUERY   0x8000
1718
1719 #define VIDEO_CONFIGURE_SET     0x1000
1720
1721 #define VIDEO_CONFIGURE_GET     0x2000
1722 #define VIDEO_CONFIGURE_QUERYSIZE 0x0001
1723
1724 #define VIDEO_CONFIGURE_CURRENT 0x0010
1725 #define VIDEO_CONFIGURE_NOMINAL 0x0020
1726 #define VIDEO_CONFIGURE_MIN     0x0040
1727 #define VIDEO_CONFIGURE_MAX     0x0080
1728
1729 #define DVM_USER                0x4000
1730
1731 #define DVM_CONFIGURE_START     0x1000
1732 #define DVM_CONFIGURE_END       0x1FFF
1733
1734 #define DVM_PALETTE             (DVM_CONFIGURE_START + 1)
1735 #define DVM_FORMAT              (DVM_CONFIGURE_START + 2)
1736 #define DVM_PALETTERGB555       (DVM_CONFIGURE_START + 3)
1737 #define DVM_SRC_RECT            (DVM_CONFIGURE_START + 4)
1738 #define DVM_DST_RECT            (DVM_CONFIGURE_START + 5)
1739
1740 #define AVICapSM(hwnd,m,w,l) ((IsWindow(hwnd)) ? SendMessage(hwnd,m,w,l) : 0)
1741
1742 #define WM_CAP_START                    WM_USER
1743
1744 #define WM_CAP_UNICODE_START            WM_USER+100
1745
1746 #define WM_CAP_GET_CAPSTREAMPTR         (WM_CAP_START + 1)
1747
1748 #define WM_CAP_SET_CALLBACK_ERRORW      (WM_CAP_UNICODE_START + 2)
1749 #define WM_CAP_SET_CALLBACK_STATUSW     (WM_CAP_UNICODE_START + 3)
1750 #define WM_CAP_SET_CALLBACK_ERRORA      (WM_CAP_START + 2)
1751 #define WM_CAP_SET_CALLBACK_STATUSA     (WM_CAP_START+ 3)
1752
1753 #define WM_CAP_SET_CALLBACK_ERROR       WINELIB_NAME_AW(WM_CAP_SET_CALLBACK_ERROR)
1754 #define WM_CAP_SET_CALLBACK_STATUS      WINELIB_NAME_AW(WM_CAP_SET_CALLBACK_STATUS)
1755
1756 #define WM_CAP_SET_CALLBACK_YIELD       (WM_CAP_START +  4)
1757 #define WM_CAP_SET_CALLBACK_FRAME       (WM_CAP_START +  5)
1758 #define WM_CAP_SET_CALLBACK_VIDEOSTREAM (WM_CAP_START +  6)
1759 #define WM_CAP_SET_CALLBACK_WAVESTREAM  (WM_CAP_START +  7)
1760 #define WM_CAP_GET_USER_DATA            (WM_CAP_START +  8)
1761 #define WM_CAP_SET_USER_DATA            (WM_CAP_START +  9)
1762
1763 #define WM_CAP_DRIVER_CONNECT           (WM_CAP_START +  10)
1764 #define WM_CAP_DRIVER_DISCONNECT        (WM_CAP_START +  11)
1765
1766 #define WM_CAP_DRIVER_GET_NAMEA         (WM_CAP_START +  12)
1767 #define WM_CAP_DRIVER_GET_VERSIONA      (WM_CAP_START +  13)
1768 #define WM_CAP_DRIVER_GET_NAMEW         (WM_CAP_UNICODE_START +  12)
1769 #define WM_CAP_DRIVER_GET_VERSIONW      (WM_CAP_UNICODE_START +  13)
1770
1771 #define WM_CAP_DRIVER_GET_NAME          WINELIB_NAME_AW(WM_CAP_DRIVER_GET_NAME)
1772 #define WM_CAP_DRIVER_GET_VERSION       WINELIB_NAME_AW(WM_CAP_DRIVER_GET_VERSION)
1773
1774 #define WM_CAP_DRIVER_GET_CAPS          (WM_CAP_START +  14)
1775
1776 #define WM_CAP_FILE_SET_CAPTURE_FILEA   (WM_CAP_START +  20)
1777 #define WM_CAP_FILE_GET_CAPTURE_FILEA   (WM_CAP_START +  21)
1778 #define WM_CAP_FILE_ALLOCATE            (WM_CAP_START +  22)
1779 #define WM_CAP_FILE_SAVEASA             (WM_CAP_START +  23)
1780 #define WM_CAP_FILE_SET_INFOCHUNK       (WM_CAP_START +  24)
1781 #define WM_CAP_FILE_SAVEDIBA            (WM_CAP_START +  25)
1782 #define WM_CAP_FILE_SET_CAPTURE_FILEW   (WM_CAP_UNICODE_START +  20)
1783 #define WM_CAP_FILE_GET_CAPTURE_FILEW   (WM_CAP_UNICODE_START +  21)
1784 #define WM_CAP_FILE_SAVEASW             (WM_CAP_UNICODE_START +  23)
1785 #define WM_CAP_FILE_SAVEDIBW            (WM_CAP_UNICODE_START +  25)
1786
1787 #define WM_CAP_FILE_SET_CAPTURE_FILE    WINELIB_NAME_AW(WM_CAP_FILE_SET_CAPTURE_FILE)
1788 #define WM_CAP_FILE_GET_CAPTURE_FILE    WINELIB_NAME_AW(WM_CAP_FILE_GET_CAPTURE_FILE)
1789 #define WM_CAP_FILE_SAVEAS              WINELIB_NAME_AW(WM_CAP_FILE_SAVEAS)
1790 #define WM_CAP_FILE_SAVEDIB             WINELIB_NAME_AW(WM_CAP_FILE_SAVEDIB)
1791
1792 #define WM_CAP_EDIT_COPY                (WM_CAP_START +  30)
1793
1794 #define WM_CAP_SET_AUDIOFORMAT          (WM_CAP_START +  35)
1795 #define WM_CAP_GET_AUDIOFORMAT          (WM_CAP_START +  36)
1796
1797 #define WM_CAP_DLG_VIDEOFORMAT          (WM_CAP_START +  41)
1798 #define WM_CAP_DLG_VIDEOSOURCE          (WM_CAP_START +  42)
1799 #define WM_CAP_DLG_VIDEODISPLAY         (WM_CAP_START +  43)
1800 #define WM_CAP_GET_VIDEOFORMAT          (WM_CAP_START +  44)
1801 #define WM_CAP_SET_VIDEOFORMAT          (WM_CAP_START +  45)
1802 #define WM_CAP_DLG_VIDEOCOMPRESSION     (WM_CAP_START +  46)
1803
1804 #define WM_CAP_SET_PREVIEW              (WM_CAP_START +  50)
1805 #define WM_CAP_SET_OVERLAY              (WM_CAP_START +  51)
1806 #define WM_CAP_SET_PREVIEWRATE          (WM_CAP_START +  52)
1807 #define WM_CAP_SET_SCALE                (WM_CAP_START +  53)
1808 #define WM_CAP_GET_STATUS               (WM_CAP_START +  54)
1809 #define WM_CAP_SET_SCROLL               (WM_CAP_START +  55)
1810
1811 #define WM_CAP_GRAB_FRAME               (WM_CAP_START +  60)
1812 #define WM_CAP_GRAB_FRAME_NOSTOP        (WM_CAP_START +  61)
1813
1814 #define WM_CAP_SEQUENCE                 (WM_CAP_START +  62)
1815 #define WM_CAP_SEQUENCE_NOFILE          (WM_CAP_START +  63)
1816 #define WM_CAP_SET_SEQUENCE_SETUP       (WM_CAP_START +  64)
1817 #define WM_CAP_GET_SEQUENCE_SETUP       (WM_CAP_START +  65)
1818
1819 #define WM_CAP_SET_MCI_DEVICEA          (WM_CAP_START +  66)
1820 #define WM_CAP_GET_MCI_DEVICEA          (WM_CAP_START +  67)
1821 #define WM_CAP_SET_MCI_DEVICEW          (WM_CAP_UNICODE_START +  66)
1822 #define WM_CAP_GET_MCI_DEVICEW          (WM_CAP_UNICODE_START +  67)
1823
1824 #define WM_CAP_SET_MCI_DEVICE           WINELIB_NAME_AW(WM_CAP_SET_MCI_DEVICE)
1825 #define WM_CAP_GET_MCI_DEVICE           WINELIB_NAME_AW(WM_CAP_GET_MCI_DEVICE)
1826
1827 #define WM_CAP_STOP                     (WM_CAP_START +  68)
1828 #define WM_CAP_ABORT                    (WM_CAP_START +  69)
1829
1830 #define WM_CAP_SINGLE_FRAME_OPEN        (WM_CAP_START +  70)
1831 #define WM_CAP_SINGLE_FRAME_CLOSE       (WM_CAP_START +  71)
1832 #define WM_CAP_SINGLE_FRAME             (WM_CAP_START +  72)
1833
1834 #define WM_CAP_PAL_OPENA                (WM_CAP_START +  80)
1835 #define WM_CAP_PAL_SAVEA                (WM_CAP_START +  81)
1836 #define WM_CAP_PAL_OPENW                (WM_CAP_UNICODE_START +  80)
1837 #define WM_CAP_PAL_SAVEW                (WM_CAP_UNICODE_START +  81)
1838
1839 #define WM_CAP_PAL_OPEN                 WINELIB_NAME_AW(WM_CAP_PAL_OPEN)
1840 #define WM_CAP_PAL_SAVE                 WINELIB_NAME_AW(WM_CAP_PAL_SAVE)
1841
1842 #define WM_CAP_PAL_PASTE                (WM_CAP_START +  82)
1843 #define WM_CAP_PAL_AUTOCREATE           (WM_CAP_START +  83)
1844 #define WM_CAP_PAL_MANUALCREATE         (WM_CAP_START +  84)
1845
1846 #define WM_CAP_SET_CALLBACK_CAPCONTROL  (WM_CAP_START +  85)
1847
1848 #define WM_CAP_UNICODE_END              WM_CAP_PAL_SAVEW
1849 #define WM_CAP_END                      WM_CAP_UNICODE_END
1850
1851 typedef struct tagCapDriverCaps {
1852     UINT        wDeviceIndex;
1853     BOOL        fHasOverlay;
1854     BOOL        fHasDlgVideoSource;
1855     BOOL        fHasDlgVideoFormat;
1856     BOOL        fHasDlgVideoDisplay;
1857     BOOL        fCaptureInitialized;
1858     BOOL        fDriverSuppliesPalettes;
1859     HANDLE      hVideoIn;
1860     HANDLE      hVideoOut;
1861     HANDLE      hVideoExtIn;
1862     HANDLE      hVideoExtOut;
1863 } CAPDRIVERCAPS, *PCAPDRIVERCAPS, *LPCAPDRIVERCAPS;
1864
1865 typedef struct tagCapStatus {
1866     UINT        uiImageWidth;
1867     UINT        uiImageHeight;
1868     BOOL        fLiveWindow;
1869     BOOL        fOverlayWindow;
1870     BOOL        fScale;
1871     POINT       ptScroll;
1872     BOOL        fUsingDefaultPalette;
1873     BOOL        fAudioHardware;
1874     BOOL        fCapFileExists;
1875     DWORD       dwCurrentVideoFrame;
1876     DWORD       dwCurrentVideoFramesDropped;
1877     DWORD       dwCurrentWaveSamples;
1878     DWORD       dwCurrentTimeElapsedMS;
1879     HPALETTE    hPalCurrent;
1880     BOOL        fCapturingNow;
1881     DWORD       dwReturn;
1882     UINT        wNumVideoAllocated;
1883     UINT        wNumAudioAllocated;
1884 } CAPSTATUS, *PCAPSTATUS, *LPCAPSTATUS;
1885
1886
1887 typedef struct tagCaptureParms {
1888     DWORD       dwRequestMicroSecPerFrame;
1889     BOOL        fMakeUserHitOKToCapture;
1890     UINT        wPercentDropForError;
1891     BOOL        fYield;
1892     DWORD       dwIndexSize;
1893     UINT        wChunkGranularity;
1894     BOOL        fUsingDOSMemory;
1895     UINT        wNumVideoRequested;
1896     BOOL        fCaptureAudio;
1897     UINT        wNumAudioRequested;
1898     UINT        vKeyAbort;
1899     BOOL        fAbortLeftMouse;
1900     BOOL        fAbortRightMouse;
1901     BOOL        fLimitEnabled;
1902     UINT        wTimeLimit;
1903     BOOL        fMCIControl;
1904     BOOL        fStepMCIDevice;
1905     DWORD       dwMCIStartTime;
1906     DWORD       dwMCIStopTime;
1907     BOOL        fStepCaptureAt2x;
1908     UINT        wStepCaptureAverageFrames;
1909     DWORD       dwAudioBufferSize;
1910     BOOL        fDisableWriteCache;
1911     UINT        AVStreamMaster;
1912 } CAPTUREPARMS, *PCAPTUREPARMS, *LPCAPTUREPARMS;
1913
1914 typedef LRESULT (CALLBACK* CAPYIELDCALLBACK)  (HWND hWnd);
1915 typedef LRESULT (CALLBACK* CAPSTATUSCALLBACKW) (HWND hWnd, int nID, LPCWSTR lpsz);
1916 typedef LRESULT (CALLBACK* CAPERRORCALLBACKW)  (HWND hWnd, int nID, LPCWSTR lpsz);
1917 typedef LRESULT (CALLBACK* CAPSTATUSCALLBACKA) (HWND hWnd, int nID, LPCSTR lpsz);
1918 typedef LRESULT (CALLBACK* CAPERRORCALLBACKA)  (HWND hWnd, int nID, LPCSTR lpsz);
1919 typedef LRESULT (CALLBACK* CAPVIDEOCALLBACK)  (HWND hWnd, LPVIDEOHDR lpVHdr);
1920 typedef LRESULT (CALLBACK* CAPWAVECALLBACK)   (HWND hWnd, LPWAVEHDR lpWHdr);
1921 typedef LRESULT (CALLBACK* CAPCONTROLCALLBACK)(HWND hWnd, int nState);
1922
1923 HWND VFWAPI capCreateCaptureWindowA(LPCSTR,DWORD,INT,INT,INT,INT,HWND,INT);
1924 HWND VFWAPI capCreateCaptureWindowW(LPCWSTR,DWORD,INT,INT,INT,INT,HWND,INT);
1925 #define     capCreateCaptureWindow WINELIB_NAME_AW(capCreateCaptureWindow)
1926 BOOL VFWAPI capGetDriverDescriptionA(WORD,LPSTR,INT,LPSTR,INT);
1927 BOOL VFWAPI capGetDriverDescriptionW(WORD,LPWSTR,INT,LPWSTR,INT);
1928 #define     capGetDriverDescription WINELIB_NAME_AW(capGetDriverDescription)
1929
1930 #ifdef __cplusplus
1931 }
1932 #endif  /* __cplusplus */
1933
1934 #endif /* __WINE_VFW_H */