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