Fixed a few bugs including one with setting extended styles and
[wine] / include / vfw.h
1 #ifndef __WINE_VFW_H
2 #define __WINE_VFW_H
3
4 #include "windef.h"
5 #include "mmsystem.h"
6 #include "wingdi.h"
7 #include "wine/obj_base.h"
8 #include "unknwn.h"
9
10 #define VFWAPI  WINAPI
11 #define VFWAPIV WINAPIV
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif  /* __cplusplus */
16
17 typedef HANDLE16 HDRAWDIB16;
18 typedef HANDLE HDRAWDIB;
19
20 HWND        VFWAPIV MCIWndCreateA(HWND hwndParent, HINSTANCE hInstance, DWORD dwStyle, LPCSTR szFile);
21 HWND        VFWAPIV MCIWndCreateW(HWND hwndParent, HINSTANCE hInstance, DWORD dwStyle, LPCWSTR szFile);
22 #define     MCIWndCreate WINELIB_NAME_AW(MCIWndCreate)
23 DWORD       VFWAPI  VideoForWindowsVersion(void);
24 LONG        VFWAPI  InitVFW(void);
25 LONG        VFWAPI  TermVFW(void);
26
27 #ifndef mmioFOURCC
28 #define mmioFOURCC( ch0, ch1, ch2, ch3 )                                \
29         ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) |            \
30         ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
31 #endif
32
33 #ifndef aviTWOCC
34 #define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
35 #endif
36
37 #define ICTYPE_VIDEO    mmioFOURCC('v', 'i', 'd', 'c')
38 #define ICTYPE_AUDIO    mmioFOURCC('a', 'u', 'd', 'c')
39
40 /*****************************************************************************
41  * Predeclare the interfaces
42  */
43 typedef struct IAVIStream IAVIStream,*PAVISTREAM;
44 typedef struct IAVIFile IAVIFile,*PAVIFILE;
45 typedef struct IGetFrame IGetFrame,*PGETFRAME;
46
47 /* Installable Compressor Manager */
48
49 DECLARE_HANDLE(HIC);
50
51 #ifdef __WINE__
52 /* HIC struct (same layout as Win95 one) */
53 typedef struct tagWINE_HIC {
54         DWORD           magic;          /* 00: 'Smag' */
55         HANDLE          curthread;      /* 04: */
56         DWORD           type;           /* 08: */
57         DWORD           handler;        /* 0C: */
58         HDRVR           hdrv;           /* 10: */
59         DWORD           private;        /* 14:(handled by SendDriverMessage)*/
60         FARPROC         driverproc;     /* 18:(handled by SendDriverMessage)*/
61         DWORD           x1;             /* 1c: name? */
62         WORD            x2;             /* 20: */
63         DWORD           x3;             /* 22: */
64                                         /* 26: */
65 } WINE_HIC;
66 #endif
67
68 /* error return codes */
69 #define ICERR_OK                0
70 #define ICERR_DONTDRAW          1
71 #define ICERR_NEWPALETTE        2
72 #define ICERR_GOTOKEYFRAME      3
73 #define ICERR_STOPDRAWING       4
74
75 #define ICERR_UNSUPPORTED       -1
76 #define ICERR_BADFORMAT         -2
77 #define ICERR_MEMORY            -3
78 #define ICERR_INTERNAL          -4
79 #define ICERR_BADFLAGS          -5
80 #define ICERR_BADPARAM          -6
81 #define ICERR_BADSIZE           -7
82 #define ICERR_BADHANDLE         -8
83 #define ICERR_CANTUPDATE        -9
84 #define ICERR_ABORT             -10
85 #define ICERR_ERROR             -100
86 #define ICERR_BADBITDEPTH       -200
87 #define ICERR_BADIMAGESIZE      -201
88
89 #define ICERR_CUSTOM            -400
90
91 /* ICM Messages */
92 #define ICM_USER                (DRV_USER+0x0000)
93
94 /* ICM driver message range */
95 #define ICM_RESERVED_LOW        (DRV_USER+0x1000)
96 #define ICM_RESERVED_HIGH       (DRV_USER+0x2000)
97 #define ICM_RESERVED            ICM_RESERVED_LOW
98
99 #define ICM_GETSTATE            (ICM_RESERVED+0)
100 #define ICM_SETSTATE            (ICM_RESERVED+1)
101 #define ICM_GETINFO             (ICM_RESERVED+2)
102
103 #define ICM_CONFIGURE           (ICM_RESERVED+10)
104 #define ICM_ABOUT               (ICM_RESERVED+11)
105 /* */
106
107 #define ICM_GETDEFAULTQUALITY   (ICM_RESERVED+30)
108 #define ICM_GETQUALITY          (ICM_RESERVED+31)
109 #define ICM_SETQUALITY          (ICM_RESERVED+32)
110
111 #define ICM_SET                 (ICM_RESERVED+40)
112 #define ICM_GET                 (ICM_RESERVED+41)
113
114 /* 2 constant FOURCC codes */
115 #define ICM_FRAMERATE           mmioFOURCC('F','r','m','R')
116 #define ICM_KEYFRAMERATE        mmioFOURCC('K','e','y','R')
117
118 #define ICM_COMPRESS_GET_FORMAT         (ICM_USER+4)
119 #define ICM_COMPRESS_GET_SIZE           (ICM_USER+5)
120 #define ICM_COMPRESS_QUERY              (ICM_USER+6)
121 #define ICM_COMPRESS_BEGIN              (ICM_USER+7)
122 #define ICM_COMPRESS                    (ICM_USER+8)
123 #define ICM_COMPRESS_END                (ICM_USER+9)
124
125 #define ICM_DECOMPRESS_GET_FORMAT       (ICM_USER+10)
126 #define ICM_DECOMPRESS_QUERY            (ICM_USER+11)
127 #define ICM_DECOMPRESS_BEGIN            (ICM_USER+12)
128 #define ICM_DECOMPRESS                  (ICM_USER+13)
129 #define ICM_DECOMPRESS_END              (ICM_USER+14)
130 #define ICM_DECOMPRESS_SET_PALETTE      (ICM_USER+29)
131 #define ICM_DECOMPRESS_GET_PALETTE      (ICM_USER+30)
132
133 #define ICM_DRAW_QUERY                  (ICM_USER+31)
134 #define ICM_DRAW_BEGIN                  (ICM_USER+15)
135 #define ICM_DRAW_GET_PALETTE            (ICM_USER+16)
136 #define ICM_DRAW_START                  (ICM_USER+18)
137 #define ICM_DRAW_STOP                   (ICM_USER+19)
138 #define ICM_DRAW_END                    (ICM_USER+21)
139 #define ICM_DRAW_GETTIME                (ICM_USER+32)
140 #define ICM_DRAW                        (ICM_USER+33)
141 #define ICM_DRAW_WINDOW                 (ICM_USER+34)
142 #define ICM_DRAW_SETTIME                (ICM_USER+35)
143 #define ICM_DRAW_REALIZE                (ICM_USER+36)
144 #define ICM_DRAW_FLUSH                  (ICM_USER+37)
145 #define ICM_DRAW_RENDERBUFFER           (ICM_USER+38)
146
147 #define ICM_DRAW_START_PLAY             (ICM_USER+39)
148 #define ICM_DRAW_STOP_PLAY              (ICM_USER+40)
149
150 #define ICM_DRAW_SUGGESTFORMAT          (ICM_USER+50)
151 #define ICM_DRAW_CHANGEPALETTE          (ICM_USER+51)
152
153 #define ICM_GETBUFFERSWANTED            (ICM_USER+41)
154
155 #define ICM_GETDEFAULTKEYFRAMERATE      (ICM_USER+42)
156
157 #define ICM_DECOMPRESSEX_BEGIN          (ICM_USER+60)
158 #define ICM_DECOMPRESSEX_QUERY          (ICM_USER+61)
159 #define ICM_DECOMPRESSEX                (ICM_USER+62)
160 #define ICM_DECOMPRESSEX_END            (ICM_USER+63)
161
162 #define ICM_COMPRESS_FRAMES_INFO        (ICM_USER+70)
163 #define ICM_SET_STATUS_PROC             (ICM_USER+72)
164
165 /* structs */
166
167 /* NOTE: Only the 16 bit structs are packed. Structs that are packed anyway
168  * have not been changed. If a structure is later extended, you may need to create
169  * two versions of it.
170  */
171
172 typedef struct {
173         DWORD   dwSize;         /* 00: size */
174         DWORD   fccType;        /* 04: type 'vidc' usually */
175         DWORD   fccHandler;     /* 08: */
176         DWORD   dwVersion;      /* 0c: version of compman opening you */
177         DWORD   dwFlags;        /* 10: LOWORD is type specific */
178         LRESULT dwError;        /* 14: */
179         LPVOID  pV1Reserved;    /* 18: */
180         LPVOID  pV2Reserved;    /* 1c: */
181         DWORD   dnDevNode;      /* 20: */
182                                 /* 24: */
183 } ICOPEN,*LPICOPEN;
184
185 #define ICCOMPRESS_KEYFRAME     0x00000001L
186
187 typedef struct {
188     DWORD               dwFlags;
189     LPBITMAPINFOHEADER  lpbiOutput;
190     LPVOID              lpOutput;
191     LPBITMAPINFOHEADER  lpbiInput;
192     LPVOID              lpInput;
193     LPDWORD             lpckid;
194     LPDWORD             lpdwFlags;
195     LONG                lFrameNum;
196     DWORD               dwFrameSize;
197     DWORD               dwQuality;
198     LPBITMAPINFOHEADER  lpbiPrev;
199     LPVOID              lpPrev;
200 } ICCOMPRESS;
201
202 DWORD VFWAPIV ICCompress(
203         HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiOutput,LPVOID lpData,
204         LPBITMAPINFOHEADER lpbiInput,LPVOID lpBits,LPDWORD lpckid,
205         LPDWORD lpdwFlags,LONG lFrameNum,DWORD dwFrameSize,DWORD dwQuality,
206         LPBITMAPINFOHEADER lpbiPrev,LPVOID lpPrev
207 );
208
209 #define ICCompressGetFormat(hic, lpbiInput, lpbiOutput)                 \
210         ICSendMessage(                                                  \
211             hic,ICM_COMPRESS_GET_FORMAT,(DWORD)(LPVOID)(lpbiInput),     \
212             (DWORD)(LPVOID)(lpbiOutput)                                 \
213         )
214
215 #define ICCompressGetFormatSize(hic,lpbi) ICCompressGetFormat(hic,lpbi,NULL)
216
217 #define ICCompressBegin(hic, lpbiInput, lpbiOutput)                     \
218     ICSendMessage(                                                      \
219         hic, ICM_COMPRESS_BEGIN, (DWORD)(LPVOID)(lpbiInput),            \
220         (DWORD)(LPVOID)(lpbiOutput)                                     \
221     )
222
223 #define ICCompressGetSize(hic, lpbiInput, lpbiOutput)                   \
224     ICSendMessage(                                                      \
225         hic, ICM_COMPRESS_GET_SIZE, (DWORD)(LPVOID)(lpbiInput),         \
226         (DWORD)(LPVOID)(lpbiOutput)                                     \
227     )
228
229 #define ICCompressQuery(hic, lpbiInput, lpbiOutput)             \
230     ICSendMessage(                                              \
231         hic, ICM_COMPRESS_QUERY, (DWORD)(LPVOID)(lpbiInput),    \
232         (DWORD)(LPVOID)(lpbiOutput)                             \
233     )
234
235 #define ICCompressEnd(hic) ICSendMessage(hic, ICM_COMPRESS_END, 0, 0)
236
237 /* ICCOMPRESSFRAMES.dwFlags */
238 #define ICCOMPRESSFRAMES_PADDING        0x00000001
239 typedef struct {
240     DWORD               dwFlags;
241     LPBITMAPINFOHEADER  lpbiOutput;
242     LPARAM              lOutput;
243     LPBITMAPINFOHEADER  lpbiInput;
244     LPARAM              lInput;
245     LONG                lStartFrame;
246     LONG                lFrameCount;
247     LONG                lQuality;
248     LONG                lDataRate;
249     LONG                lKeyRate;
250     DWORD               dwRate;
251     DWORD               dwScale;
252     DWORD               dwOverheadPerFrame;
253     DWORD               dwReserved2;
254     LONG CALLBACK (*GetData)(LPARAM lInput,LONG lFrame,LPVOID lpBits,LONG len);
255     LONG CALLBACK (*PutData)(LPARAM lOutput,LONG lFrame,LPVOID lpBits,LONG len);
256 } ICCOMPRESSFRAMES;
257
258 typedef struct {
259     DWORD               dwFlags;
260     LPARAM              lParam;
261    /* messages for Status callback */
262 #define ICSTATUS_START      0
263 #define ICSTATUS_STATUS     1
264 #define ICSTATUS_END        2
265 #define ICSTATUS_ERROR      3
266 #define ICSTATUS_YIELD      4
267     /* FIXME: some X11 libs define Status as int... */
268     /* LONG CALLBACK (*zStatus)(LPARAM lParam, UINT message, LONG l); */
269     LONG CALLBACK (*zStatus)(LPARAM lParam, UINT message, LONG l);
270 } ICSETSTATUSPROC;
271
272 /* Values for wMode of ICOpen() */
273 #define ICMODE_COMPRESS         1
274 #define ICMODE_DECOMPRESS       2
275 #define ICMODE_FASTDECOMPRESS   3
276 #define ICMODE_QUERY            4
277 #define ICMODE_FASTCOMPRESS     5
278 #define ICMODE_DRAW             8
279
280 /* quality flags */
281 #define ICQUALITY_LOW       0
282 #define ICQUALITY_HIGH      10000
283 #define ICQUALITY_DEFAULT   -1
284
285 typedef struct {
286         DWORD   dwSize;         /* 00: */
287         DWORD   fccType;        /* 04:compressor type     'vidc' 'audc' */
288         DWORD   fccHandler;     /* 08:compressor sub-type 'rle ' 'jpeg' 'pcm '*/
289         DWORD   dwFlags;        /* 0c:flags LOWORD is type specific */
290         DWORD   dwVersion;      /* 10:version of the driver */
291         DWORD   dwVersionICM;   /* 14:version of the ICM used */
292         /*
293          * under Win32, the driver always returns UNICODE strings.
294          */
295         WCHAR   szName[16];             /* 18:short name */
296         WCHAR   szDescription[128];     /* 38:long name */
297         WCHAR   szDriver[128];          /* 138:driver that contains compressor*/
298                                         /* 238: */
299 } ICINFO;
300
301 #include "pshpack1.h"
302
303 typedef struct {
304         DWORD dwSize;
305         DWORD fccType;
306         DWORD fccHandler;
307         DWORD dwFlags;
308         DWORD dwVersion;
309         DWORD dwVersionICM;
310         /*
311          * under Win16, normal chars are used
312          */
313         CHAR szName[16];
314         CHAR szDescription[128];
315         CHAR szDriver[128];
316 } ICINFO16;
317
318 #include "poppack.h"
319
320 /* ICINFO.dwFlags */
321 #define VIDCF_QUALITY           0x0001  /* supports quality */
322 #define VIDCF_CRUNCH            0x0002  /* supports crunching to a frame size */
323 #define VIDCF_TEMPORAL          0x0004  /* supports inter-frame compress */
324 #define VIDCF_COMPRESSFRAMES    0x0008  /* wants the compress all frames message */
325 #define VIDCF_DRAW              0x0010  /* supports drawing */
326 #define VIDCF_FASTTEMPORALC     0x0020  /* does not need prev frame on compress */
327 #define VIDCF_FASTTEMPORALD     0x0080  /* does not need prev frame on decompress */
328 #define VIDCF_QUALITYTIME       0x0040  /* supports temporal quality */
329
330 #define VIDCF_FASTTEMPORAL      (VIDCF_FASTTEMPORALC|VIDCF_FASTTEMPORALD)
331
332
333 /* function shortcuts */
334 /* ICM_ABOUT */
335 #define ICMF_ABOUT_QUERY         0x00000001
336
337 #define ICQueryAbout(hic) \
338         (ICSendMessage(hic,ICM_ABOUT,(DWORD)-1,ICMF_ABOUT_QUERY)==ICERR_OK)
339
340 #define ICAbout(hic, hwnd) ICSendMessage(hic,ICM_ABOUT,(DWORD)(UINT)(hwnd),0)
341
342 /* ICM_CONFIGURE */
343 #define ICMF_CONFIGURE_QUERY    0x00000001
344 #define ICQueryConfigure(hic) \
345         (ICSendMessage(hic,ICM_CONFIGURE,(DWORD)-1,ICMF_CONFIGURE_QUERY)==ICERR_OK)
346
347 #define ICConfigure(hic,hwnd) \
348         ICSendMessage(hic,ICM_CONFIGURE,(DWORD)(UINT)(hwnd),0)
349
350 /* Decompression stuff */
351 #define ICDECOMPRESS_HURRYUP            0x80000000      /* don't draw just buffer (hurry up!) */
352 #define ICDECOMPRESS_UPDATE             0x40000000      /* don't draw just update screen */
353 #define ICDECOMPRESS_PREROLL            0x20000000      /* this frame is before real start */
354 #define ICDECOMPRESS_NULLFRAME          0x10000000      /* repeat last frame */
355 #define ICDECOMPRESS_NOTKEYFRAME        0x08000000      /* this frame is not a key frame */
356
357 typedef struct {
358     DWORD               dwFlags;        /* flags (from AVI index...) */
359     LPBITMAPINFOHEADER  lpbiInput;      /* BITMAPINFO of compressed data */
360     LPVOID              lpInput;        /* compressed data */
361     LPBITMAPINFOHEADER  lpbiOutput;     /* DIB to decompress to */
362     LPVOID              lpOutput;
363     DWORD               ckid;           /* ckid from AVI file */
364 } ICDECOMPRESS;
365
366 typedef struct {
367     DWORD               dwFlags;
368     LPBITMAPINFOHEADER  lpbiSrc;
369     LPVOID              lpSrc;
370     LPBITMAPINFOHEADER  lpbiDst;
371     LPVOID              lpDst;
372
373     /* changed for ICM_DECOMPRESSEX */
374     INT                 xDst;       /* destination rectangle */
375     INT                 yDst;
376     INT                 dxDst;
377     INT                 dyDst;
378
379     INT                 xSrc;       /* source rectangle */
380     INT                 ySrc;
381     INT                 dxSrc;
382     INT                 dySrc;
383 } ICDECOMPRESSEX;
384
385 #include "pshpack1.h"
386
387 typedef struct {
388     DWORD               dwFlags;
389     LPBITMAPINFOHEADER  lpbiSrc;
390     LPVOID              lpSrc;
391     LPBITMAPINFOHEADER  lpbiDst;
392     LPVOID              lpDst;
393
394     INT16               xDst;       /* destination rectangle */
395     INT16               yDst;
396     INT16               dxDst;
397     INT16               dyDst;
398
399     INT16               xSrc;       /* source rectangle */
400     INT16               ySrc;
401     INT16               dxSrc;
402     INT16               dySrc;
403 } ICDECOMPRESSEX16;
404
405 #include "poppack.h"
406
407 DWORD VFWAPIV ICDecompress(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiFormat,LPVOID lpData,LPBITMAPINFOHEADER lpbi,LPVOID lpBits);
408
409 #define ICDecompressBegin(hic, lpbiInput, lpbiOutput)   \
410     ICSendMessage(                                              \
411         hic, ICM_DECOMPRESS_BEGIN, (DWORD)(LPVOID)(lpbiInput),  \
412         (DWORD)(LPVOID)(lpbiOutput)                             \
413     )
414
415 #define ICDecompressQuery(hic, lpbiInput, lpbiOutput)   \
416     ICSendMessage(                                              \
417         hic,ICM_DECOMPRESS_QUERY, (DWORD)(LPVOID)(lpbiInput),   \
418         (DWORD) (LPVOID)(lpbiOutput)                            \
419     )
420
421 #define ICDecompressGetFormat(hic, lpbiInput, lpbiOutput)               \
422     ((LONG)ICSendMessage(                                               \
423         hic,ICM_DECOMPRESS_GET_FORMAT, (DWORD)(LPVOID)(lpbiInput),      \
424         (DWORD)(LPVOID)(lpbiOutput)                                     \
425     ))
426
427 #define ICDecompressGetFormatSize(hic, lpbi)                            \
428         ICDecompressGetFormat(hic, lpbi, NULL)
429
430 #define ICDecompressGetPalette(hic, lpbiInput, lpbiOutput)              \
431     ICSendMessage(                                                      \
432         hic, ICM_DECOMPRESS_GET_PALETTE, (DWORD)(LPVOID)(lpbiInput),    \
433         (DWORD)(LPVOID)(lpbiOutput)                                     \
434     )
435
436 #define ICDecompressSetPalette(hic,lpbiPalette) \
437         ICSendMessage(                          \
438                 hic,ICM_DECOMPRESS_SET_PALETTE,         \
439                 (DWORD)(LPVOID)(lpbiPalette),0          \
440         )
441
442 #define ICDecompressEnd(hic) ICSendMessage(hic, ICM_DECOMPRESS_END, 0, 0)
443
444 LRESULT VFWAPI  ICSendMessage(HIC hic, UINT msg, DWORD dw1, DWORD dw2);
445 LRESULT VFWAPI  ICSendMessage16(HIC16 hic, UINT16 msg, DWORD dw1, DWORD dw2);
446
447 static LRESULT VFWAPI inline ICDecompressEx(HIC hic, DWORD dwFlags, 
448                                             LPBITMAPINFOHEADER lpbiSrc, LPVOID lpSrc,
449                                             int xSrc, int ySrc, int dxSrc, int dySrc,
450                                             LPBITMAPINFOHEADER lpbiDst, LPVOID lpDst,
451                                             int xDst, int yDst, int dxDst, int dyDst)
452 {
453     ICDECOMPRESSEX ic;
454
455     ic.dwFlags = dwFlags;
456     ic.lpbiSrc = lpbiSrc;
457     ic.lpSrc = lpSrc;
458     ic.xSrc = xSrc;
459     ic.ySrc = ySrc;
460     ic.dxSrc = dxSrc;
461     ic.dySrc = dySrc;
462     ic.lpbiDst = lpbiDst;
463     ic.lpDst = lpDst;
464     ic.xDst = xDst;
465     ic.yDst = yDst;
466     ic.dxDst = dxDst;
467     ic.dyDst = dyDst;
468     return ICSendMessage(hic, ICM_DECOMPRESSEX, (DWORD)&ic, sizeof(ic));
469 }
470
471 static LRESULT VFWAPI inline ICDecompressExBegin(HIC hic, DWORD dwFlags,
472                                                  LPBITMAPINFOHEADER lpbiSrc,
473                                                  LPVOID lpSrc,
474                                                  int xSrc, int ySrc, int dxSrc, int dySrc,
475                                                  LPBITMAPINFOHEADER lpbiDst,
476                                                  LPVOID lpDst,
477                                                  int xDst,
478                                                  int yDst,
479                                                  int dxDst,
480                                                  int dyDst)
481 {
482     ICDECOMPRESSEX ic;
483
484     ic.dwFlags = dwFlags;
485     ic.lpbiSrc = lpbiSrc;
486     ic.lpSrc = lpSrc;
487     ic.xSrc = xSrc;
488     ic.ySrc = ySrc;
489     ic.dxSrc = dxSrc;
490     ic.dySrc = dySrc;
491     ic.lpbiDst = lpbiDst;
492     ic.lpDst = lpDst;
493     ic.xDst = xDst;
494     ic.yDst = yDst;
495     ic.dxDst = dxDst;
496     ic.dyDst = dyDst;
497     return ICSendMessage(hic, ICM_DECOMPRESSEX_BEGIN, (DWORD)&ic, sizeof(ic));
498 }
499 static LRESULT VFWAPI inline ICDecompressExQuery(HIC hic, DWORD dwFlags,
500                                                  LPBITMAPINFOHEADER lpbiSrc,
501                                                  LPVOID lpSrc,
502                                                  int xSrc, int ySrc, int dxSrc, int dySrc,
503                                                  LPBITMAPINFOHEADER lpbiDst,
504                                                  LPVOID lpDst,
505                                                  int xDst,
506                                                  int yDst,
507                                                  int dxDst,
508                                                  int dyDst)
509 {
510     ICDECOMPRESSEX ic;
511
512     ic.dwFlags = dwFlags;
513     ic.lpbiSrc = lpbiSrc;
514     ic.lpSrc = lpSrc;
515     ic.xSrc = xSrc;
516     ic.ySrc = ySrc;
517     ic.dxSrc = dxSrc;
518     ic.dySrc = dySrc;
519     ic.lpbiDst = lpbiDst;
520     ic.lpDst = lpDst;
521     ic.xDst = xDst;
522     ic.yDst = yDst;
523     ic.dxDst = dxDst;
524     ic.dyDst = dyDst;
525     return ICSendMessage(hic, ICM_DECOMPRESSEX_QUERY, (DWORD)&ic, sizeof(ic));
526 }
527
528 #define ICDecompressExEnd(hic) \
529     ICSendMessage(hic, ICM_DECOMPRESSEX_END, 0, 0)
530
531 #define ICDRAW_QUERY        0x00000001L   /* test for support */
532 #define ICDRAW_FULLSCREEN   0x00000002L   /* draw to full screen */
533 #define ICDRAW_HDC          0x00000004L   /* draw to a HDC/HWND */
534 #define ICDRAW_ANIMATE      0x00000008L   /* expect palette animation */
535 #define ICDRAW_CONTINUE     0x00000010L   /* draw is a continuation of previous draw */
536 #define ICDRAW_MEMORYDC     0x00000020L   /* DC is offscreen, by the way */
537 #define ICDRAW_UPDATING     0x00000040L   /* We're updating, as opposed to playing */
538 #define ICDRAW_RENDER       0x00000080L   /* used to render data not draw it */
539 #define ICDRAW_BUFFER       0x00000100L   /* buffer data offscreen, we will need to update it */
540
541 #define ICDecompressOpen(fccType, fccHandler, lpbiIn, lpbiOut) \
542     ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, ICMODE_DECOMPRESS)
543
544 #define ICDrawOpen(fccType, fccHandler, lpbiIn) \
545     ICLocate(fccType, fccHandler, lpbiIn, NULL, ICMODE_DRAW)
546
547 HANDLE VFWAPI ICImageCompress(HIC hic, UINT uiFlags, LPBITMAPINFO lpbiIn, 
548                               LPVOID lpBits, LPBITMAPINFO lpbiOut, LONG lQuality,
549                               LONG* plSize);
550
551 HANDLE VFWAPI ICImageDecompress(HIC hic, UINT uiFlags, LPBITMAPINFO lpbiIn,
552                                 LPVOID lpBits, LPBITMAPINFO lpbiOut);
553
554 BOOL    VFWAPI  ICInfo(DWORD fccType, DWORD fccHandler, ICINFO * lpicinfo);
555 BOOL    VFWAPI  ICInstall(DWORD fccType, DWORD fccHandler, LPARAM lParam, LPSTR szDesc, UINT wFlags);
556 BOOL    VFWAPI  ICRemove(DWORD fccType, DWORD fccHandler, UINT wFlags);
557 LRESULT VFWAPI  ICGetInfo(HIC hic,ICINFO *picinfo, DWORD cb);
558 HIC     VFWAPI  ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode);
559 HIC16   VFWAPI  ICOpen16(DWORD fccType, DWORD fccHangler, UINT16 wMode);
560 HIC     VFWAPI  ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, FARPROC lpfnHandler);
561
562 LRESULT VFWAPI  ICClose(HIC hic);
563 HIC     VFWAPI  ICLocate(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wFlags);
564 HIC16   VFWAPI  ICLocate16(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wFlags);
565 HIC     VFWAPI  ICGetDisplayFormat(HIC hic, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, int BitDepth, int dx, int dy);
566
567 /* Values for wFlags of ICInstall() */
568 #define ICINSTALL_UNICODE       0x8000
569 #define ICINSTALL_FUNCTION      0x0001
570 #define ICINSTALL_DRIVER        0x0002
571 #define ICINSTALL_HDRV          0x0004
572 #define ICINSTALL_DRIVERW       0x8002
573
574 #define ICGetState(hic, pv, cb) \
575     ICSendMessage(hic, ICM_GETSTATE, (DWORD)(LPVOID)(pv), (DWORD)(cb))
576 #define ICSetState(hic, pv, cb) \
577     ICSendMessage(hic, ICM_SETSTATE, (DWORD)(LPVOID)(pv), (DWORD)(cb))
578 #define ICGetStateSize(hic) \
579     ICGetState(hic, NULL, 0)
580
581 static DWORD inline ICGetDefaultQuality(HIC hic)
582 {
583    DWORD dwICValue;
584    ICSendMessage(hic, ICM_GETDEFAULTQUALITY, (DWORD)(LPVOID)&dwICValue, sizeof(DWORD));
585    return dwICValue;
586 }
587
588 static DWORD inline ICGetDefaultKeyFrameRate(HIC hic)
589 {
590    DWORD dwICValue;
591    ICSendMessage(hic, ICM_GETDEFAULTKEYFRAMERATE, (DWORD)(LPVOID)&dwICValue, sizeof(DWORD));
592    return dwICValue;
593 }
594
595 #define ICDrawWindow(hic, prc) \
596     ICSendMessage(hic, ICM_DRAW_WINDOW, (DWORD)(LPVOID)(prc), sizeof(RECT))
597
598 /* As passed to ICM_DRAW_SUGGESTFORMAT */
599 typedef struct {
600         DWORD dwFlags;
601         LPBITMAPINFOHEADER lpbiIn;
602         LPBITMAPINFOHEADER lpbiSuggest;
603         INT dxSrc;
604         INT dySrc;
605         INT dxDst;
606         INT dyDst;
607         HIC hicDecompressor;
608 } ICDRAWSUGGEST;
609
610 typedef struct {
611         DWORD dwFlags;
612         LPBITMAPINFOHEADER lpbiIn;
613         LPBITMAPINFOHEADER lpbiSuggest;
614         INT16 dxSrc;
615         INT16 dySrc;
616         INT16 dxDst;
617         INT16 dyDst;
618         HIC16 hicDecompressor;
619 } ICDRAWSUGGEST16;
620
621 typedef struct {
622     DWORD               dwFlags;
623     int                 iStart;
624     int                 iLen;
625     LPPALETTEENTRY      lppe;
626 } ICPALETTE;
627
628 DWORD   VFWAPIV ICDrawBegin(
629         HIC                     hic,
630         DWORD                   dwFlags,/* flags */
631         HPALETTE                hpal,   /* palette to draw with */
632         HWND                    hwnd,   /* window to draw to */
633         HDC                     hdc,    /* HDC to draw to */
634         INT                     xDst,   /* destination rectangle */
635         INT                     yDst,
636         INT                     dxDst,
637         INT                     dyDst,
638         LPBITMAPINFOHEADER      lpbi,   /* format of frame to draw */
639         INT                     xSrc,   /* source rectangle */
640         INT                     ySrc,
641         INT                     dxSrc,
642         INT                     dySrc,
643         DWORD                   dwRate, /* frames/second = (dwRate/dwScale) */
644         DWORD                   dwScale
645 );
646
647 DWORD   VFWAPIV ICDrawBegin16(
648         HIC16                   hic,
649         DWORD                   dwFlags,/* flags */
650         HPALETTE16              hpal,   /* palette to draw with */
651         HWND16                  hwnd,   /* window to draw to */
652         HDC16                   hdc,    /* HDC to draw to */
653         INT16                   xDst,   /* destination rectangle */
654         INT16                   yDst,
655         INT16                   dxDst,
656         INT16                   dyDst,
657         LPBITMAPINFOHEADER      lpbi,   /* format of frame to draw */
658         INT16                   xSrc,   /* source rectangle */
659         INT16                   ySrc,
660         INT16                   dxSrc,
661         INT16                   dySrc,
662         DWORD                   dwRate, /* frames/second = (dwRate/dwScale) */
663         DWORD                   dwScale
664 );
665
666 /* as passed to ICM_DRAW_BEGIN */
667 typedef struct {
668         DWORD           dwFlags;
669         HPALETTE        hpal;
670         HWND            hwnd;
671         HDC             hdc;
672         INT             xDst;
673         INT             yDst;
674         INT             dxDst;
675         INT             dyDst;
676         LPBITMAPINFOHEADER      lpbi;
677         INT             xSrc;
678         INT             ySrc;
679         INT             dxSrc;
680         INT             dySrc;
681         DWORD           dwRate;
682         DWORD           dwScale;
683 } ICDRAWBEGIN;
684
685 #include "pshpack1.h"
686
687 typedef struct {
688         DWORD           dwFlags;
689         HPALETTE16      hpal;
690         HWND16          hwnd;
691         HDC16           hdc;
692         INT16           xDst;
693         INT16           yDst;
694         INT16           dxDst;
695         INT16           dyDst;
696         LPBITMAPINFOHEADER      lpbi;
697         INT16           xSrc;
698         INT16           ySrc;
699         INT16           dxSrc;
700         INT16           dySrc;
701         DWORD           dwRate;
702         DWORD           dwScale;
703 } ICDRAWBEGIN16;
704
705 #include "poppack.h"
706
707 #define ICDRAW_HURRYUP      0x80000000L   /* don't draw just buffer (hurry up!) */
708 #define ICDRAW_UPDATE       0x40000000L   /* don't draw just update screen */
709 #define ICDRAW_PREROLL      0x20000000L   /* this frame is before real start */
710 #define ICDRAW_NULLFRAME    0x10000000L   /* repeat last frame */
711 #define ICDRAW_NOTKEYFRAME  0x08000000L   /* this frame is not a key frame */
712
713 typedef struct {
714         DWORD   dwFlags;
715         LPVOID  lpFormat;
716         LPVOID  lpData;
717         DWORD   cbData;
718         LONG    lTime;
719 } ICDRAW;
720
721 DWORD VFWAPIV ICDraw(HIC hic,DWORD dwFlags,LPVOID lpFormat,LPVOID lpData,DWORD cbData,LONG lTime);
722
723 static LRESULT VFWAPI inline ICDrawSuggestFormat(HIC hic, LPBITMAPINFOHEADER lpbiIn,
724                                                  LPBITMAPINFOHEADER lpbiOut,
725                                                  int dxSrc, int dySrc, 
726                                                  int dxDst, int dyDst,
727                                                  HIC hicDecomp)
728 {
729     ICDRAWSUGGEST ic;
730
731     ic.lpbiIn = lpbiIn;
732     ic.lpbiSuggest = lpbiOut;
733     ic.dxSrc = dxSrc;
734     ic.dySrc = dySrc;
735     ic.dxDst = dxDst;
736     ic.dyDst = dyDst;
737     ic.hicDecompressor = hicDecomp;
738     return ICSendMessage(hic, ICM_DRAW_SUGGESTFORMAT, (DWORD)&ic, sizeof(ic));
739 }
740
741 #define ICDrawQuery(hic, lpbiInput) \
742     ICSendMessage(hic, ICM_DRAW_QUERY, (DWORD)(LPVOID)(lpbiInput), 0L)
743
744 #define ICDrawChangePalette(hic, lpbiInput) \
745     ICSendMessage(hic, ICM_DRAW_CHANGEPALETTE, (DWORD)(LPVOID)(lpbiInput), 0L)
746
747 #define ICGetBuffersWanted(hic, lpdwBuffers) \
748     ICSendMessage(hic, ICM_GETBUFFERSWANTED, (DWORD)(LPVOID)(lpdwBuffers), 0)
749
750 #define ICDrawEnd(hic) \
751     ICSendMessage(hic, ICM_DRAW_END, 0, 0)
752
753 #define ICDrawStart(hic) \
754     ICSendMessage(hic, ICM_DRAW_START, 0, 0)
755
756 #define ICDrawStartPlay(hic, lFrom, lTo) \
757     ICSendMessage(hic, ICM_DRAW_START_PLAY, (DWORD)(lFrom), (DWORD)(lTo))
758
759 #define ICDrawStop(hic) \
760     ICSendMessage(hic, ICM_DRAW_STOP, 0, 0)
761
762 #define ICDrawStopPlay(hic) \
763     ICSendMessage(hic, ICM_DRAW_STOP_PLAY, 0, 0)
764
765 #define ICDrawGetTime(hic, lplTime) \
766     ICSendMessage(hic, ICM_DRAW_GETTIME, (DWORD)(LPVOID)(lplTime), 0)
767
768 #define ICDrawSetTime(hic, lTime) \
769     ICSendMessage(hic, ICM_DRAW_SETTIME, (DWORD)lTime, 0)
770
771 #define ICDrawRealize(hic, hdc, fBackground) \
772     ICSendMessage(hic, ICM_DRAW_REALIZE, (DWORD)(UINT)(HDC)(hdc), (DWORD)(BOOL)(fBackground))
773
774 #define ICDrawFlush(hic) \
775     ICSendMessage(hic, ICM_DRAW_FLUSH, 0, 0)
776
777 #define ICDrawRenderBuffer(hic) \
778     ICSendMessage(hic, ICM_DRAW_RENDERBUFFER, 0, 0)
779
780 static LRESULT VFWAPI inline ICSetStatusProc(HIC hic, DWORD dwFlags, LRESULT lParam,
781                                              LONG (CALLBACK *fpfnStatus)(LPARAM, UINT, LONG))
782 {
783     ICSETSTATUSPROC ic;
784
785     ic.dwFlags = dwFlags;
786     ic.lParam = lParam;
787     /* FIXME: see comment in ICSETSTATUSPROC definition */
788     ic.zStatus = fpfnStatus;
789
790     return ICSendMessage(hic, ICM_SET_STATUS_PROC, (DWORD)&ic, sizeof(ic));
791 }
792
793 typedef struct {
794     LONG                cbSize;
795     DWORD               dwFlags;
796     HIC                 hic;
797     DWORD               fccType;
798     DWORD               fccHandler;
799     LPBITMAPINFO        lpbiIn;
800     LPBITMAPINFO        lpbiOut;
801     LPVOID              lpBitsOut;
802     LPVOID              lpBitsPrev;
803     LONG                lFrame;
804     LONG                lKey;
805     LONG                lDataRate;
806     LONG                lQ;
807     LONG                lKeyCount;
808     LPVOID              lpState;
809     LONG                cbState;
810 } COMPVARS, *PCOMPVARS;
811
812 #define ICMF_COMPVARS_VALID     0x00000001
813
814 BOOL VFWAPI ICCompressorChoose(HWND hwnd, UINT uiFlags, LPVOID pvIn, LPVOID lpData,
815                                PCOMPVARS pc, LPSTR lpszTitle);
816
817 #define ICMF_CHOOSE_KEYFRAME            0x0001
818 #define ICMF_CHOOSE_DATARATE            0x0002
819 #define ICMF_CHOOSE_PREVIEW             0x0004
820 #define ICMF_CHOOSE_ALLCOMPRESSORS      0x0008
821
822 BOOL VFWAPI ICSeqCompressFrameStart(PCOMPVARS pc, LPBITMAPINFO lpbiIn);
823 void VFWAPI ICSeqCompressFrameEnd(PCOMPVARS pc);
824
825 LPVOID VFWAPI ICSeqCompressFrame(PCOMPVARS pc, UINT uiFlags, LPVOID lpBits,
826                                  BOOL *pfKey, LONG *plSize);
827 void VFWAPI ICCompressorFree(PCOMPVARS pc);
828
829 /********************* AVIFILE function declarations *************************/
830 #define formtypeAVI             mmioFOURCC('A', 'V', 'I', ' ')
831 #define listtypeAVIHEADER       mmioFOURCC('h', 'd', 'r', 'l')
832 #define ckidAVIMAINHDR          mmioFOURCC('a', 'v', 'i', 'h')
833 #define listtypeSTREAMHEADER    mmioFOURCC('s', 't', 'r', 'l')
834 #define ckidSTREAMHEADER        mmioFOURCC('s', 't', 'r', 'h')
835 #define ckidSTREAMFORMAT        mmioFOURCC('s', 't', 'r', 'f')
836 #define ckidSTREAMHANDLERDATA   mmioFOURCC('s', 't', 'r', 'd')
837 #define ckidSTREAMNAME          mmioFOURCC('s', 't', 'r', 'n')
838
839 #define listtypeAVIMOVIE        mmioFOURCC('m', 'o', 'v', 'i')
840 #define listtypeAVIRECORD       mmioFOURCC('r', 'e', 'c', ' ')
841
842 #define ckidAVINEWINDEX         mmioFOURCC('i', 'd', 'x', '1')
843
844 #define streamtypeVIDEO         mmioFOURCC('v', 'i', 'd', 's')
845 #define streamtypeAUDIO         mmioFOURCC('a', 'u', 'd', 's')
846 #define streamtypeMIDI          mmioFOURCC('m', 'i', 'd', 's')
847 #define streamtypeTEXT          mmioFOURCC('t', 'x', 't', 's')
848
849 /* Basic chunk types */
850 #define cktypeDIBbits           aviTWOCC('d', 'b')
851 #define cktypeDIBcompressed     aviTWOCC('d', 'c')
852 #define cktypePALchange         aviTWOCC('p', 'c')
853 #define cktypeWAVEbytes         aviTWOCC('w', 'b')
854
855 /* Chunk id to use for extra chunks for padding. */
856 #define ckidAVIPADDING          mmioFOURCC('J', 'U', 'N', 'K')
857
858 /* AVIFileHdr.dwFlags */
859 #define AVIF_HASINDEX           0x00000010      /* Index at end of file? */
860 #define AVIF_MUSTUSEINDEX       0x00000020
861 #define AVIF_ISINTERLEAVED      0x00000100
862 #define AVIF_TRUSTCKTYPE        0x00000800      /* Use CKType to find key frames*/
863 #define AVIF_WASCAPTUREFILE     0x00010000
864 #define AVIF_COPYRIGHTED        0x00020000
865
866 #define AVI_HEADERSIZE  2048
867
868 typedef struct _MainAVIHeader
869 {
870     DWORD       dwMicroSecPerFrame;
871     DWORD       dwMaxBytesPerSec;
872     DWORD       dwPaddingGranularity;
873     DWORD       dwFlags;
874     DWORD       dwTotalFrames;
875     DWORD       dwInitialFrames;
876     DWORD       dwStreams;
877     DWORD       dwSuggestedBufferSize;
878     DWORD       dwWidth;
879     DWORD       dwHeight;
880     DWORD       dwReserved[4];
881 } MainAVIHeader;
882
883 /* AVIStreamHeader.dwFlags */
884 #define AVISF_DISABLED                  0x00000001
885 #define AVISF_VIDEO_PALCHANGES          0x00010000
886
887 typedef struct {
888     FOURCC      fccType;
889     FOURCC      fccHandler;
890     DWORD       dwFlags;        /* AVISF_* */
891     WORD        wPriority;
892     WORD        wLanguage;
893     DWORD       dwInitialFrames;
894     DWORD       dwScale;        
895     DWORD       dwRate; /* dwRate / dwScale == samples/second */
896     DWORD       dwStart;
897     DWORD       dwLength; /* In units above... */
898     DWORD       dwSuggestedBufferSize;
899     DWORD       dwQuality;
900     DWORD       dwSampleSize;
901     RECT16      rcFrame;        /* word.word - word.word in file */
902 } AVIStreamHeader;
903
904 /* AVIINDEXENTRY.dwFlags */
905 #define AVIIF_LIST      0x00000001      /* chunk is a 'LIST' */
906 #define AVIIF_TWOCC     0x00000002
907 #define AVIIF_KEYFRAME  0x00000010      /* this frame is a key frame. */
908
909 #define AVIIF_NOTIME    0x00000100      /* this frame doesn't take any time */
910 #define AVIIF_COMPUSE   0x0FFF0000
911
912 typedef struct _AVIINDEXENTRY {
913     DWORD       ckid;
914     DWORD       dwFlags;
915     DWORD       dwChunkOffset;
916     DWORD       dwChunkLength;
917 } AVIINDEXENTRY;
918
919 typedef struct _AVIPALCHANGE {
920     BYTE                bFirstEntry;
921     BYTE                bNumEntries;
922     WORD                wFlags;         /* pad */
923     PALETTEENTRY        peNew[1];
924 } AVIPALCHANGE;
925
926 #define AVIIF_KEYFRAME  0x00000010      /* this frame is a key frame. */
927
928 #define AVIGETFRAMEF_BESTDISPLAYFMT     1
929
930 typedef struct _AVISTREAMINFOA {
931     DWORD       fccType;
932     DWORD       fccHandler;
933     DWORD       dwFlags;        /* AVIIF_* */
934     DWORD       dwCaps;
935     WORD        wPriority;
936     WORD        wLanguage;
937     DWORD       dwScale;
938     DWORD       dwRate;         /* dwRate / dwScale == samples/second */
939     DWORD       dwStart;
940     DWORD       dwLength;       /* In units above... */
941     DWORD       dwInitialFrames;
942     DWORD       dwSuggestedBufferSize;
943     DWORD       dwQuality;
944     DWORD       dwSampleSize;
945     RECT        rcFrame;
946     DWORD       dwEditCount;
947     DWORD       dwFormatChangeCount;
948     CHAR        szName[64];
949 } AVISTREAMINFOA, * LPAVISTREAMINFOA, *PAVISTREAMINFOA;
950
951 typedef struct _AVISTREAMINFOW {
952     DWORD       fccType;
953     DWORD       fccHandler;
954     DWORD       dwFlags;
955     DWORD       dwCaps;
956     WORD        wPriority;
957     WORD        wLanguage;
958     DWORD       dwScale;
959     DWORD       dwRate;         /* dwRate / dwScale == samples/second */
960     DWORD       dwStart;
961     DWORD       dwLength;       /* In units above... */
962     DWORD       dwInitialFrames;
963     DWORD       dwSuggestedBufferSize;
964     DWORD       dwQuality;
965     DWORD       dwSampleSize;
966     RECT        rcFrame;
967     DWORD       dwEditCount;
968     DWORD       dwFormatChangeCount;
969     WCHAR       szName[64];
970 } AVISTREAMINFOW, * LPAVISTREAMINFOW, *PAVISTREAMINFOW;
971 DECL_WINELIB_TYPE_AW(AVISTREAMINFO)
972 DECL_WINELIB_TYPE_AW(LPAVISTREAMINFO)
973 DECL_WINELIB_TYPE_AW(PAVISTREAMINFO)
974
975 #define AVISTREAMINFO_DISABLED          0x00000001
976 #define AVISTREAMINFO_FORMATCHANGES     0x00010000
977
978 /* AVIFILEINFO.dwFlags */
979 #define AVIFILEINFO_HASINDEX            0x00000010
980 #define AVIFILEINFO_MUSTUSEINDEX        0x00000020
981 #define AVIFILEINFO_ISINTERLEAVED       0x00000100
982 #define AVIFILEINFO_WASCAPTUREFILE      0x00010000
983 #define AVIFILEINFO_COPYRIGHTED         0x00020000
984
985 /* AVIFILEINFO.dwCaps */
986 #define AVIFILECAPS_CANREAD             0x00000001
987 #define AVIFILECAPS_CANWRITE            0x00000002
988 #define AVIFILECAPS_ALLKEYFRAMES        0x00000010
989 #define AVIFILECAPS_NOCOMPRESSION       0x00000020
990
991 typedef struct _AVIFILEINFOW {
992     DWORD               dwMaxBytesPerSec;
993     DWORD               dwFlags;
994     DWORD               dwCaps;
995     DWORD               dwStreams;
996     DWORD               dwSuggestedBufferSize;
997     DWORD               dwWidth;
998     DWORD               dwHeight;
999     DWORD               dwScale;        
1000     DWORD               dwRate;
1001     DWORD               dwLength;
1002     DWORD               dwEditCount;
1003     WCHAR               szFileType[64];
1004 } AVIFILEINFOW, * LPAVIFILEINFOW, *PAVIFILEINFOW;
1005 typedef struct _AVIFILEINFOA {
1006     DWORD               dwMaxBytesPerSec;
1007     DWORD               dwFlags;
1008     DWORD               dwCaps;
1009     DWORD               dwStreams;
1010     DWORD               dwSuggestedBufferSize;
1011     DWORD               dwWidth;
1012     DWORD               dwHeight;
1013     DWORD               dwScale;        
1014     DWORD               dwRate;
1015     DWORD               dwLength;
1016     DWORD               dwEditCount;
1017     CHAR                szFileType[64];
1018 } AVIFILEINFOA, * LPAVIFILEINFOA, *PAVIFILEINFOA;
1019 DECL_WINELIB_TYPE_AW(AVIFILEINFO)
1020 DECL_WINELIB_TYPE_AW(PAVIFILEINFO)
1021 DECL_WINELIB_TYPE_AW(LPAVIFILEINFO)
1022
1023 /* AVICOMPRESSOPTIONS.dwFlags. determines presence of fields in below struct */
1024 #define AVICOMPRESSF_INTERLEAVE 0x00000001
1025 #define AVICOMPRESSF_DATARATE   0x00000002
1026 #define AVICOMPRESSF_KEYFRAMES  0x00000004
1027 #define AVICOMPRESSF_VALID      0x00000008
1028
1029 typedef struct {
1030     DWORD       fccType;                /* stream type, for consistency */
1031     DWORD       fccHandler;             /* compressor */
1032     DWORD       dwKeyFrameEvery;        /* keyframe rate */
1033     DWORD       dwQuality;              /* compress quality 0-10,000 */
1034     DWORD       dwBytesPerSecond;       /* bytes per second */
1035     DWORD       dwFlags;                /* flags... see below */
1036     LPVOID      lpFormat;               /* save format */
1037     DWORD       cbFormat;
1038     LPVOID      lpParms;                /* compressor options */
1039     DWORD       cbParms;
1040     DWORD       dwInterleaveEvery;      /* for non-video streams only */
1041 } AVICOMPRESSOPTIONS, *LPAVICOMPRESSOPTIONS,*PAVICOMPRESSOPTIONS;
1042
1043
1044
1045 #define DEFINE_AVIGUID(name, l, w1, w2) \
1046     DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
1047
1048 DEFINE_AVIGUID(IID_IAVIFile,            0x00020020, 0, 0);
1049 DEFINE_AVIGUID(IID_IAVIStream,          0x00020021, 0, 0);
1050 DEFINE_AVIGUID(IID_IAVIStreaming,       0x00020022, 0, 0);
1051 DEFINE_AVIGUID(IID_IGetFrame,           0x00020023, 0, 0);
1052 DEFINE_AVIGUID(IID_IAVIEditStream,      0x00020024, 0, 0);
1053
1054 DEFINE_AVIGUID(CLSID_AVIFile,           0x00020000, 0, 0);
1055
1056 /*****************************************************************************
1057  * IAVIStream interface
1058  */
1059 #define ICOM_INTERFACE IAVIStream
1060 #define IAVIStream_METHODS                                              \
1061     ICOM_METHOD2(HRESULT,Create,     LPARAM,lParam1, LPARAM,lParam2) \
1062     ICOM_METHOD2(HRESULT,Info,       AVISTREAMINFOW*,psi, LONG,lSize) \
1063     ICOM_METHOD2(LONG,   FindSample, LONG,lPos, LONG,lFlags) \
1064     ICOM_METHOD3(HRESULT,ReadFormat, LONG,lPos, LPVOID,lpFormat, LONG*,lpcbFormat) \
1065     ICOM_METHOD3(HRESULT,SetFormat,  LONG,lPos, LPVOID,lpFormat, LONG,cbFormat) \
1066     ICOM_METHOD6(HRESULT,Read,       LONG,lStart, LONG,lSamples, LPVOID,lpBuffer, LONG,cbBuffer, LONG*,plBytes, LONG*,plSamples) \
1067     ICOM_METHOD7(HRESULT,Write,      LONG,lStart, LONG,lSamples, LPVOID,lpBuffer, LONG,cbBuffer, DWORD,dwFlags, LONG*,plSampWritten, LONG*,plBytesWritten) \
1068     ICOM_METHOD2(HRESULT,Delete,     LONG,lStart, LONG,lSamples) \
1069     ICOM_METHOD3(HRESULT,ReadData,   DWORD,fcc, LPVOID,lpBuffer, LONG*,lpcbBuffer) \
1070     ICOM_METHOD3(HRESULT,WriteData,  DWORD,fcc, LPVOID,lpBuffer, LONG,cbBuffer) \
1071     ICOM_METHOD2(HRESULT,SetInfo,    AVISTREAMINFOW*,plInfo, LONG,cbInfo)
1072 #define IAVIStream_IMETHODS     \
1073         IUnknown_IMETHODS       \
1074         IAVIStream_METHODS
1075 ICOM_DEFINE(IAVIStream, IUnknown)
1076 #undef ICOM_INTERFACE
1077
1078 /*** IUnknown methods ***/
1079 #define IAVIStream_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
1080 #define IAVIStream_AddRef(p)             ICOM_CALL (AddRef,p)
1081 #define IAVIStream_Release(p)            ICOM_CALL (Release,p)
1082 /*** IAVIStream methods ***/
1083 #define IAVIStream_Create(p,a,b)          ICOM_CALL2(Create,p,a,b)
1084 #define IAVIStream_Info(p,a,b)            ICOM_CALL2(Info,p,a,b)
1085 #define IAVIStream_FindSample(p,a,b)      ICOM_CALL2(FindSample,p,a,b)
1086 #define IAVIStream_ReadFormat(p,a,b,c)    ICOM_CALL3(ReadFormat,p,a,b,c)
1087 #define IAVIStream_SetFormat(p,a,b,c)     ICOM_CALL3(SetFormat,p,a,b,c)
1088 #define IAVIStream_Read(p,a,b,c,d,e,f)    ICOM_CALL6(Read,p,a,b,c,d,e,f)
1089 #define IAVIStream_Write(p,a,b,c,d,e,f,g) ICOM_CALL7(Write,p,a,b,c,d,e,f,g)
1090 #define IAVIStream_Delete(p,a,b)          ICOM_CALL2(Delete,p,a,b)
1091 #define IAVIStream_ReadData(p,a,b,c)      ICOM_CALL3(ReadData,p,a,b,c)
1092 #define IAVIStream_WriteData(p,a,b,c)     ICOM_CALL3(WriteData,p,a,b,c)
1093 #define IAVIStream_SetInfo(p,a,b)         ICOM_CALL2(SetInfo,p,a,b)
1094
1095 HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM*ppsCompressed,PAVISTREAM ppsSource,AVICOMPRESSOPTIONS *lpOptions,CLSID*pclsidHandler); 
1096
1097 HRESULT WINAPI AVIStreamInfoA(PAVISTREAM iface,AVISTREAMINFOA *asi,LONG size);
1098 HRESULT WINAPI AVIStreamInfoW(PAVISTREAM iface,AVISTREAMINFOW *asi,LONG size);
1099 #define AVIStreamInfo WINELIB_NAME_AW(AVIStreamInfo)
1100 LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg,LONG pos);
1101 HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg);
1102 PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM pavi,LPBITMAPINFOHEADER lpbiWanted);
1103 LONG WINAPI AVIStreamLength(PAVISTREAM iface);
1104 HRESULT WINAPI AVIStreamRead(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread);
1105 HRESULT WINAPI AVIStreamReadData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG *lpread);
1106 HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG *formatsize);
1107 ULONG WINAPI AVIStreamRelease(PAVISTREAM iface);
1108 HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG formatsize);
1109 LONG WINAPI AVIStreamStart(PAVISTREAM iface);
1110 HRESULT WINAPI AVIStreamWrite(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten);
1111 HRESULT WINAPI AVIStreamWriteData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG size);
1112 HRESULT WINAPI AVIStreamOpenFromFileA(PAVISTREAM *ppavi, LPCSTR szFile,
1113                                       DWORD fccType, LONG lParam,
1114                                       UINT mode, CLSID *pclsidHandler);
1115 HRESULT WINAPI AVIStreamOpenFromFileW(PAVISTREAM *ppavi, LPCWSTR szFile,
1116                                       DWORD fccType, LONG lParam,
1117                                       UINT mode, CLSID *pclsidHandler);
1118 #define AVIStreamOpenFromFile WINELIB_NAME_AW(AVIStreamOpenFromFile)
1119
1120 #define AVIStreamFormatSize(pavi, lPos, plSize) \
1121     AVIStreamReadFormat(pavi, lPos, NULL, plSize) 
1122
1123 /*****************************************************************************
1124  * IAVIFile interface
1125  */
1126 /* In Win32 this interface uses UNICODE only */
1127 #define ICOM_INTERFACE IAVIFile
1128 #define IAVIFile_METHODS                                                \
1129     ICOM_METHOD2(HRESULT,Info,         AVIFILEINFOW*,pfi, LONG,lSize) \
1130     ICOM_METHOD3(HRESULT,GetStream,    PAVISTREAM*,ppStream, DWORD,fccType, LONG,lParam) \
1131     ICOM_METHOD2(HRESULT,CreateStream, PAVISTREAM*,ppStream, AVISTREAMINFOW*,psi) \
1132     ICOM_METHOD3(HRESULT,WriteData,    DWORD,fcc, LPVOID,lpBuffer, LONG,cbBuffer) \
1133     ICOM_METHOD3(HRESULT,ReadData,     DWORD,fcc, LPVOID,lpBuffer, LONG*,lpcbBuffer) \
1134         ICOM_METHOD (HRESULT,EndRecord)                                 \
1135     ICOM_METHOD2(HRESULT,DeleteStream, DWORD,fccType, LONG,lParam)
1136 #define IAVIFile_IMETHODS       \
1137         IUnknown_IMETHODS       \
1138         IAVIFile_METHODS
1139 ICOM_DEFINE(IAVIFile,IUnknown)
1140 #undef ICOM_INTERFACE
1141
1142 /*** IUnknown methods ***/
1143 #define IAVIFile_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
1144 #define IAVIFile_AddRef(p)             ICOM_CALL (AddRef,p)
1145 #define IAVIFile_Release(p)            ICOM_CALL (Release,p)
1146 /*** IAVIFile methods ***/
1147 #define IAVIFile_Info(p,a,b)         ICOM_CALL2(Info,p,a,b)
1148 #define IAVIFile_GetStream(p,a,b,c)  ICOM_CALL3(GetStream,p,a,b,c)
1149 #define IAVIFile_CreateStream(p,a,b) ICOM_CALL2(CreateStream,p,a,b)
1150 #define IAVIFile_WriteData(p,a,b,c)  ICOM_CALL3(WriteData,p,a,b,c)
1151 #define IAVIFile_ReadData(p,a,b,c)   ICOM_CALL3(ReadData,p,a,b,c)
1152 #define IAVIFile_EndRecord(p)        ICOM_CALL (EndRecord,p)
1153 #define IAVIFile_DeleteStream(p,a,b) ICOM_CALL2(DeleteStream,p,a,b)
1154
1155 HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE pfile,PAVISTREAM* ppavi,AVISTREAMINFOA* psi);
1156 HRESULT WINAPI AVIFileCreateStreamW(PAVIFILE pfile,PAVISTREAM* ppavi,AVISTREAMINFOW* psi);
1157 #define AVIFileCreateStream WINELIB_NAME_AW(AVIFileCreateStream)
1158 void WINAPI AVIFileExit(void);
1159 HRESULT WINAPI AVIFileGetStream(PAVIFILE pfile,PAVISTREAM* avis,DWORD fccType,LONG lParam);
1160 HRESULT WINAPI AVIFileInfoA(PAVIFILE pfile,PAVIFILEINFOA pfi,LONG lSize);
1161 HRESULT WINAPI AVIFileInfoW(PAVIFILE pfile,PAVIFILEINFOW pfi,LONG lSize);
1162 #define AVIFileInfo WINELIB_NAME_AW(AVIFileInfo)
1163 void WINAPI AVIFileInit(void);
1164 HRESULT WINAPI AVIFileOpenA(PAVIFILE* ppfile,LPCSTR szFile,UINT uMode,LPCLSID lpHandler);
1165 HRESULT WINAPI AVIFileOpenW(PAVIFILE* ppfile,LPCWSTR szFile,UINT uMode,LPCLSID lpHandler);
1166 #define AVIFileOpen WINELIB_NAME_AW(AVIFileOpen)
1167 ULONG WINAPI AVIFileRelease(PAVIFILE iface);
1168
1169
1170 /*****************************************************************************
1171  * IGetFrame interface
1172  */
1173 #define ICOM_INTERFACE IGetFrame
1174 #define IGetFrame_METHODS                                       \
1175     ICOM_METHOD1(LPVOID, GetFrame,  LONG,lPos) \
1176     ICOM_METHOD3(HRESULT,Begin,     LONG,lStart, LONG,lEnd, LONG,lRate) \
1177         ICOM_METHOD (HRESULT,End)                               \
1178     ICOM_METHOD6(HRESULT,SetFormat, LPBITMAPINFOHEADER,lpbi, LPVOID,lpBits, INT,x, INT,y, INT,dx, INT,dy)
1179 #define IGetFrame_IMETHODS      \
1180         IUnknown_IMETHODS       \
1181         IGetFrame_METHODS
1182 ICOM_DEFINE(IGetFrame,IUnknown)
1183 #undef ICOM_INTERFACE
1184
1185 /*** IUnknown methods ***/
1186 #define IGetFrame_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
1187 #define IGetFrame_AddRef(p)             ICOM_CALL (AddRef,p)
1188 #define IGetFrame_Release(p)            ICOM_CALL (Release,p)
1189 /*** IGetFrame methods ***/
1190 #define IGetFrame_GetFrame(p,a)            ICOM_CALL1(GetFrame,p,a)
1191 #define IGetFrame_Begin(p,a,b,c)           ICOM_CALL3(Begin,p,a,b,c)
1192 #define IGetFrame_End(p)                   ICOM_CALL (End,p)
1193 #define IGetFrame_SetFormat(p,a,b,c,d,e,f) ICOM_CALL6(SetFormat,p,a,b,c,d,e,f)
1194
1195 #define AVIERR_OK               0
1196 #define MAKE_AVIERR(error)      MAKE_SCODE(SEVERITY_ERROR,FACILITY_ITF,0x4000+error)
1197
1198 #define AVIERR_UNSUPPORTED      MAKE_AVIERR(101)
1199 #define AVIERR_BADFORMAT        MAKE_AVIERR(102)
1200 #define AVIERR_MEMORY           MAKE_AVIERR(103)
1201 #define AVIERR_INTERNAL         MAKE_AVIERR(104)
1202 #define AVIERR_BADFLAGS         MAKE_AVIERR(105)
1203 #define AVIERR_BADPARAM         MAKE_AVIERR(106)
1204 #define AVIERR_BADSIZE          MAKE_AVIERR(107)
1205 #define AVIERR_BADHANDLE        MAKE_AVIERR(108)
1206 #define AVIERR_FILEREAD         MAKE_AVIERR(109)
1207 #define AVIERR_FILEWRITE        MAKE_AVIERR(110)
1208 #define AVIERR_FILEOPEN         MAKE_AVIERR(111)
1209 #define AVIERR_COMPRESSOR       MAKE_AVIERR(112)
1210 #define AVIERR_NOCOMPRESSOR     MAKE_AVIERR(113)
1211 #define AVIERR_READONLY         MAKE_AVIERR(114)
1212 #define AVIERR_NODATA           MAKE_AVIERR(115)
1213 #define AVIERR_BUFFERTOOSMALL   MAKE_AVIERR(116)
1214 #define AVIERR_CANTCOMPRESS     MAKE_AVIERR(117)
1215 #define AVIERR_USERABORT        MAKE_AVIERR(198)
1216 #define AVIERR_ERROR            MAKE_AVIERR(199)
1217
1218 /********************************************
1219  * DrawDib declarations
1220  */
1221
1222 HDRAWDIB VFWAPI DrawDibOpen( void );
1223 UINT VFWAPI DrawDibRealize(HDRAWDIB hdd, HDC hdc, BOOL fBackground);
1224
1225 BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd, HDC hdc, INT dxDst, INT dyDst,
1226                          LPBITMAPINFOHEADER lpbi, INT dxSrc, INT dySrc, UINT wFlags);
1227
1228 BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd, HDC hdc, INT xDst, INT yDst, INT dxDst, INT dyDst,
1229                         LPBITMAPINFOHEADER lpbi, LPVOID lpBits, 
1230                         INT xSrc, INT ySrc, INT dxSrc, INT dySrc, UINT wFlags);
1231
1232 /* DrawDibDraw flags */
1233
1234 #define DDF_UPDATE                      0x0002
1235 #define DDF_SAME_HDC                    0x0004
1236 #define DDF_SAME_DRAW                   0x0008
1237 #define DDF_DONTDRAW                    0x0010
1238 #define DDF_ANIMATE                     0x0020
1239 #define DDF_BUFFER                      0x0040
1240 #define DDF_JUSTDRAWIT                  0x0080
1241 #define DDF_FULLSCREEN                  0x0100
1242 #define DDF_BACKGROUNDPAL               0x0200
1243 #define DDF_NOTKEYFRAME                 0x0400
1244 #define DDF_HURRYUP                     0x0800
1245 #define DDF_HALFTONE                    0x1000
1246
1247 #define DDF_PREROLL                     DDF_DONTDRAW
1248 #define DDF_SAME_DIB                    DDF_SAME_DRAW
1249 #define DDF_SAME_SIZE                   DDF_SAME_DRAW
1250
1251 BOOL VFWAPI DrawDibSetPalette(HDRAWDIB hdd, HPALETTE hpal);
1252 HPALETTE VFWAPI DrawDibGetPalette(HDRAWDIB hdd);
1253 BOOL VFWAPI DrawDibChangePalette(HDRAWDIB hdd, int iStart, int iLen, LPPALETTEENTRY lppe);
1254 LPVOID VFWAPI DrawDibGetBuffer(HDRAWDIB hdd, LPBITMAPINFOHEADER lpbi, DWORD dwSize, DWORD dwFlags);
1255
1256 BOOL VFWAPI DrawDibStart(HDRAWDIB hdd, DWORD rate);
1257 BOOL VFWAPI DrawDibStop(HDRAWDIB hdd);
1258 #define DrawDibUpdate(hdd, hdc, x, y) \
1259         DrawDibDraw(hdd, hdc, x, y, 0, 0, NULL, NULL, 0, 0, 0, 0, DDF_UPDATE)
1260
1261 BOOL VFWAPI DrawDibEnd(HDRAWDIB hdd);
1262 BOOL VFWAPI DrawDibClose(HDRAWDIB hdd);
1263
1264 /* display profiling */
1265 #define PD_CAN_DRAW_DIB         0x0001
1266 #define PD_CAN_STRETCHDIB       0x0002
1267 #define PD_STRETCHDIB_1_1_OK    0x0004
1268 #define PD_STRETCHDIB_1_2_OK    0x0008
1269 #define PD_STRETCHDIB_1_N_OK    0x0010
1270
1271 DWORD VFWAPI DrawDibProfileDisplay(LPBITMAPINFOHEADER lpbi);
1272
1273 #ifdef __cplusplus
1274 }
1275 #endif  /* __cplusplus */
1276
1277 #endif /* __WINE_VFW_H */