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