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