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