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