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