Solaris C/C++ compile fix.
[wine] / include / vfw.h
1 #ifndef __WINE_VFW_H
2 #define __WINE_VFW_H
3
4 #include "windef.h"
5 #include "mmsystem.h"
6 #include "wingdi.h"
7 #include "wine/obj_base.h"
8 #include "unknwn.h"
9
10 #define VFWAPI  WINAPI
11 #define VFWAPIV WINAPIV
12
13 DWORD VFWAPI VideoForWindowsVersion(void);
14
15 #ifndef mmioFOURCC
16 #define mmioFOURCC( ch0, ch1, ch2, ch3 )                                \
17         ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) |            \
18         ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
19 #endif
20
21 #ifndef aviTWOCC
22 #define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
23 #endif
24
25 #define ICTYPE_VIDEO    mmioFOURCC('v', 'i', 'd', 'c')
26 #define ICTYPE_AUDIO    mmioFOURCC('a', 'u', 'd', 'c')
27
28 /*****************************************************************************
29  * Predeclare the interfaces
30  */
31 typedef struct IAVIStream IAVIStream,*PAVISTREAM;
32 typedef struct IAVIFile IAVIFile,*PAVIFILE;
33 typedef struct IGetFrame IGetFrame,*PGETFRAME;
34
35 /* Installable Compressor M? */
36
37 /* HIC struct (same layout as Win95 one) */
38 typedef struct tagWINE_HIC {
39         DWORD           magic;          /* 00: 'Smag' */
40         HANDLE  curthread;      /* 04: */
41         DWORD           type;           /* 08: */
42         DWORD           handler;        /* 0C: */
43         HDRVR           hdrv;           /* 10: */
44         DWORD           private;        /* 14:(handled by SendDriverMessage)*/
45         FARPROC driverproc;     /* 18:(handled by SendDriverMessage)*/
46         DWORD           x1;             /* 1c: name? */
47         WORD            x2;             /* 20: */
48         DWORD           x3;             /* 22: */
49                                         /* 26: */
50 } WINE_HIC;
51
52 /* error return codes */
53 #define ICERR_OK                0
54 #define ICERR_DONTDRAW          1
55 #define ICERR_NEWPALETTE        2
56 #define ICERR_GOTOKEYFRAME      3
57 #define ICERR_STOPDRAWING       4
58
59 #define ICERR_UNSUPPORTED       -1
60 #define ICERR_BADFORMAT         -2
61 #define ICERR_MEMORY            -3
62 #define ICERR_INTERNAL          -4
63 #define ICERR_BADFLAGS          -5
64 #define ICERR_BADPARAM          -6
65 #define ICERR_BADSIZE           -7
66 #define ICERR_BADHANDLE         -8
67 #define ICERR_CANTUPDATE        -9
68 #define ICERR_ABORT             -10
69 #define ICERR_ERROR             -100
70 #define ICERR_BADBITDEPTH       -200
71 #define ICERR_BADIMAGESIZE      -201
72
73 #define ICERR_CUSTOM            -400
74
75 /* ICM Messages */
76 #define ICM_USER                (DRV_USER+0x0000)
77
78 /* ICM driver message range */
79 #define ICM_RESERVED_LOW        (DRV_USER+0x1000)
80 #define ICM_RESERVED_HIGH       (DRV_USER+0x2000)
81 #define ICM_RESERVED            ICM_RESERVED_LOW
82
83 #define ICM_GETSTATE            (ICM_RESERVED+0)
84 #define ICM_SETSTATE            (ICM_RESERVED+1)
85 #define ICM_GETINFO             (ICM_RESERVED+2)
86
87 #define ICM_CONFIGURE           (ICM_RESERVED+10)
88 #define ICM_ABOUT               (ICM_RESERVED+11)
89 /* */
90
91 #define ICM_GETDEFAULTQUALITY   (ICM_RESERVED+30)
92 #define ICM_GETQUALITY          (ICM_RESERVED+31)
93 #define ICM_SETQUALITY          (ICM_RESERVED+32)
94
95 #define ICM_SET                 (ICM_RESERVED+40)
96 #define ICM_GET                 (ICM_RESERVED+41)
97
98 /* 2 constant FOURCC codes */
99 #define ICM_FRAMERATE           mmioFOURCC('F','r','m','R')
100 #define ICM_KEYFRAMERATE        mmioFOURCC('K','e','y','R')
101
102 #define ICM_COMPRESS_GET_FORMAT         (ICM_USER+4)
103 #define ICM_COMPRESS_GET_SIZE           (ICM_USER+5)
104 #define ICM_COMPRESS_QUERY              (ICM_USER+6)
105 #define ICM_COMPRESS_BEGIN              (ICM_USER+7)
106 #define ICM_COMPRESS                    (ICM_USER+8)
107 #define ICM_COMPRESS_END                (ICM_USER+9)
108
109 #define ICM_DECOMPRESS_GET_FORMAT       (ICM_USER+10)
110 #define ICM_DECOMPRESS_QUERY            (ICM_USER+11)
111 #define ICM_DECOMPRESS_BEGIN            (ICM_USER+12)
112 #define ICM_DECOMPRESS                  (ICM_USER+13)
113 #define ICM_DECOMPRESS_END              (ICM_USER+14)
114 #define ICM_DECOMPRESS_SET_PALETTE      (ICM_USER+29)
115 #define ICM_DECOMPRESS_GET_PALETTE      (ICM_USER+30)
116
117 #define ICM_DRAW_QUERY                  (ICM_USER+31)
118 #define ICM_DRAW_BEGIN                  (ICM_USER+15)
119 #define ICM_DRAW_GET_PALETTE            (ICM_USER+16)
120 #define ICM_DRAW_START                  (ICM_USER+18)
121 #define ICM_DRAW_STOP                   (ICM_USER+19)
122 #define ICM_DRAW_END                    (ICM_USER+21)
123 #define ICM_DRAW_GETTIME                (ICM_USER+32)
124 #define ICM_DRAW                        (ICM_USER+33)
125 #define ICM_DRAW_WINDOW                 (ICM_USER+34)
126 #define ICM_DRAW_SETTIME                (ICM_USER+35)
127 #define ICM_DRAW_REALIZE                (ICM_USER+36)
128 #define ICM_DRAW_FLUSH                  (ICM_USER+37)
129 #define ICM_DRAW_RENDERBUFFER           (ICM_USER+38)
130
131 #define ICM_DRAW_START_PLAY             (ICM_USER+39)
132 #define ICM_DRAW_STOP_PLAY              (ICM_USER+40)
133
134 #define ICM_DRAW_SUGGESTFORMAT          (ICM_USER+50)
135 #define ICM_DRAW_CHANGEPALETTE          (ICM_USER+51)
136
137 #define ICM_GETBUFFERSWANTED            (ICM_USER+41)
138
139 #define ICM_GETDEFAULTKEYFRAMERATE      (ICM_USER+42)
140
141 #define ICM_DECOMPRESSEX_BEGIN          (ICM_USER+60)
142 #define ICM_DECOMPRESSEX_QUERY          (ICM_USER+61)
143 #define ICM_DECOMPRESSEX                (ICM_USER+62)
144 #define ICM_DECOMPRESSEX_END            (ICM_USER+63)
145
146 #define ICM_COMPRESS_FRAMES_INFO        (ICM_USER+70)
147 #define ICM_SET_STATUS_PROC             (ICM_USER+72)
148
149 /* structs */
150
151 typedef struct {
152         DWORD   dwSize;         /* 00: size */
153         DWORD   fccType;        /* 04: type 'vidc' usually */
154         DWORD   fccHandler;     /* 08: */
155         DWORD   dwVersion;      /* 0c: version of compman opening you */
156         DWORD   dwFlags;        /* 10: LOWORD is type specific */
157         LRESULT dwError;        /* 14: */
158         LPVOID  pV1Reserved;    /* 18: */
159         LPVOID  pV2Reserved;    /* 1c: */
160         DWORD   dnDevNode;      /* 20: */
161                                 /* 24: */
162 } ICOPEN,*LPICOPEN;
163
164 #define ICCOMPRESS_KEYFRAME     0x00000001L
165
166 typedef struct {
167     DWORD               dwFlags;
168     LPBITMAPINFOHEADER  lpbiOutput;
169     LPVOID              lpOutput;
170     LPBITMAPINFOHEADER  lpbiInput;
171     LPVOID              lpInput;
172     LPDWORD             lpckid;
173     LPDWORD             lpdwFlags;
174     LONG                lFrameNum;
175     DWORD               dwFrameSize;
176     DWORD               dwQuality;
177     LPBITMAPINFOHEADER  lpbiPrev;
178     LPVOID              lpPrev;
179 } ICCOMPRESS;
180
181 DWORD VFWAPIV ICCompress(
182         HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiOutput,LPVOID lpData,
183         LPBITMAPINFOHEADER lpbiInput,LPVOID lpBits,LPDWORD lpckid,
184         LPDWORD lpdwFlags,LONG lFrameNum,DWORD dwFrameSize,DWORD dwQuality,
185         LPBITMAPINFOHEADER lpbiPrev,LPVOID lpPrev
186 );
187
188 #define ICCompressGetFormat(hic, lpbiInput, lpbiOutput)                 \
189         ICSendMessage(                                          \
190             hic,ICM_COMPRESS_GET_FORMAT,(DWORD)(LPVOID)(lpbiInput),     \
191             (DWORD)(LPVOID)(lpbiOutput)                                 \
192         )
193
194 #define ICCompressGetFormatSize(hic,lpbi) ICCompressGetFormat(hic,lpbi,NULL)
195
196 #define ICCompressBegin(hic, lpbiInput, lpbiOutput)                     \
197     ICSendMessage(                                                      \
198         hic, ICM_COMPRESS_BEGIN, (DWORD)(LPVOID)(lpbiInput),            \
199         (DWORD)(LPVOID)(lpbiOutput)                                     \
200     )
201
202 #define ICCompressGetSize(hic, lpbiInput, lpbiOutput)           \
203     ICSendMessage(                                                      \
204         hic, ICM_COMPRESS_GET_SIZE, (DWORD)(LPVOID)(lpbiInput),         \
205         (DWORD)(LPVOID)(lpbiOutput)                                     \
206     )
207
208 #define ICCompressQuery(hic, lpbiInput, lpbiOutput)             \
209     ICSendMessage(                                              \
210         hic, ICM_COMPRESS_QUERY, (DWORD)(LPVOID)(lpbiInput),    \
211         (DWORD)(LPVOID)(lpbiOutput)                             \
212     )
213
214
215 #define ICCompressEnd(hic) ICSendMessage(hic, ICM_COMPRESS_END, 0, 0)
216
217 /* ICCOMPRESSFRAMES.dwFlags */
218 #define ICCOMPRESSFRAMES_PADDING        0x00000001
219 typedef struct {
220     DWORD               dwFlags;
221     LPBITMAPINFOHEADER  lpbiOutput;
222     LPARAM              lOutput;
223     LPBITMAPINFOHEADER  lpbiInput;
224     LPARAM              lInput;
225     LONG                lStartFrame;
226     LONG                lFrameCount;
227     LONG                lQuality;
228     LONG                lDataRate;
229     LONG                lKeyRate;
230     DWORD               dwRate;
231     DWORD               dwScale;
232     DWORD               dwOverheadPerFrame;
233     DWORD               dwReserved2;
234     LONG (CALLBACK *GetData)(LPARAM lInput,LONG lFrame,LPVOID lpBits,LONG len);
235     LONG (CALLBACK *PutData)(LPARAM lOutput,LONG lFrame,LPVOID lpBits,LONG len);
236 } ICCOMPRESSFRAMES;
237
238 /* Values for wMode of ICOpen() */
239 #define ICMODE_COMPRESS         1
240 #define ICMODE_DECOMPRESS       2
241 #define ICMODE_FASTDECOMPRESS   3
242 #define ICMODE_QUERY            4
243 #define ICMODE_FASTCOMPRESS     5
244 #define ICMODE_DRAW             8
245
246 /* quality flags */
247 #define ICQUALITY_LOW       0
248 #define ICQUALITY_HIGH      10000
249 #define ICQUALITY_DEFAULT   -1
250
251 typedef struct {
252         DWORD   dwSize;         /* 00: */
253         DWORD   fccType;        /* 04:compressor type     'vidc' 'audc' */
254         DWORD   fccHandler;     /* 08:compressor sub-type 'rle ' 'jpeg' 'pcm '*/
255         DWORD   dwFlags;        /* 0c:flags LOWORD is type specific */
256         DWORD   dwVersion;      /* 10:version of the driver */
257         DWORD   dwVersionICM;   /* 14:version of the ICM used */
258         /*
259          * under Win32, the driver always returns UNICODE strings.
260          */
261         WCHAR   szName[16];             /* 18:short name */
262         WCHAR   szDescription[128];     /* 38:long name */
263         WCHAR   szDriver[128];          /* 138:driver that contains compressor*/
264                                         /* 238: */
265 } ICINFO;
266
267 /* ICINFO.dwFlags */
268 #define VIDCF_QUALITY           0x0001  /* supports quality */
269 #define VIDCF_CRUNCH            0x0002  /* supports crunching to a frame size */
270 #define VIDCF_TEMPORAL          0x0004  /* supports inter-frame compress */
271 #define VIDCF_COMPRESSFRAMES    0x0008  /* wants the compress all frames message */
272 #define VIDCF_DRAW              0x0010  /* supports drawing */
273 #define VIDCF_FASTTEMPORALC     0x0020  /* does not need prev frame on compress */
274 #define VIDCF_FASTTEMPORALD     0x0080  /* does not need prev frame on decompress */
275 #define VIDCF_QUALITYTIME       0x0040  /* supports temporal quality */
276
277 #define VIDCF_FASTTEMPORAL      (VIDCF_FASTTEMPORALC|VIDCF_FASTTEMPORALD)
278
279
280 /* function shortcuts */
281 /* ICM_ABOUT */
282 #define ICMF_ABOUT_QUERY         0x00000001
283
284 #define ICQueryAbout(hic) \
285         (ICSendMessage(hic,ICM_ABOUT,(DWORD)-1,ICMF_ABOUT_QUERY)==ICERR_OK)
286
287 #define ICAbout(hic, hwnd) ICSendMessage(hic,ICM_ABOUT,(DWORD)(UINT)(hwnd),0)
288
289 /* ICM_CONFIGURE */
290 #define ICMF_CONFIGURE_QUERY    0x00000001
291 #define ICQueryConfigure(hic) \
292         (ICSendMessage(hic,ICM_CONFIGURE,(DWORD)-1,ICMF_CONFIGURE_QUERY)==ICERR_OK)
293
294 #define ICConfigure(hic,hwnd) \
295         ICSendMessage(hic,ICM_CONFIGURE,(DWORD)(UINT)(hwnd),0)
296
297 /* Decompression stuff */
298 #define ICDECOMPRESS_HURRYUP            0x80000000      /* don't draw just buffer (hurry up!) */
299 #define ICDECOMPRESS_UPDATE             0x40000000      /* don't draw just update screen */
300 #define ICDECOMPRESS_PREROL             0x20000000      /* this frame is before real start */
301 #define ICDECOMPRESS_NULLFRAME          0x10000000      /* repeat last frame */
302 #define ICDECOMPRESS_NOTKEYFRAME        0x08000000      /* this frame is not a key frame */
303
304 typedef struct {
305     DWORD               dwFlags;        /* flags (from AVI index...) */
306     LPBITMAPINFOHEADER  lpbiInput;      /* BITMAPINFO of compressed data */
307     LPVOID              lpInput;        /* compressed data */
308     LPBITMAPINFOHEADER  lpbiOutput;     /* DIB to decompress to */
309     LPVOID              lpOutput;
310     DWORD               ckid;           /* ckid from AVI file */
311 } ICDECOMPRESS;
312
313 typedef struct {
314     DWORD               dwFlags;
315     LPBITMAPINFOHEADER  lpbiSrc;
316     LPVOID              lpSrc;
317     LPBITMAPINFOHEADER  lpbiDst;
318     LPVOID              lpDst;
319
320     /* changed for ICM_DECOMPRESSEX */
321     INT         xDst;       /* destination rectangle */
322     INT         yDst;
323     INT         dxDst;
324     INT         dyDst;
325
326     INT         xSrc;       /* source rectangle */
327     INT         ySrc;
328     INT         dxSrc;
329     INT         dySrc;
330 } ICDECOMPRESSEX;
331
332 DWORD VFWAPIV ICDecompress(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiFormat,LPVOID lpData,LPBITMAPINFOHEADER lpbi,LPVOID lpBits);
333
334
335 #define ICDecompressBegin(hic, lpbiInput, lpbiOutput)   \
336     ICSendMessage(                                              \
337         hic, ICM_DECOMPRESS_BEGIN, (DWORD)(LPVOID)(lpbiInput),  \
338         (DWORD)(LPVOID)(lpbiOutput)                             \
339     )
340
341 #define ICDecompressQuery(hic, lpbiInput, lpbiOutput)   \
342     ICSendMessage(                                              \
343         hic,ICM_DECOMPRESS_QUERY, (DWORD)(LPVOID)(lpbiInput),   \
344         (DWORD) (LPVOID)(lpbiOutput)                            \
345     )
346
347 #define ICDecompressGetFormat(hic, lpbiInput, lpbiOutput)               \
348     ((LONG)ICSendMessage(                                               \
349         hic,ICM_DECOMPRESS_GET_FORMAT, (DWORD)(LPVOID)(lpbiInput),      \
350         (DWORD)(LPVOID)(lpbiOutput)                                     \
351     ))
352
353 #define ICDecompressGetFormatSize(hic, lpbi)                            \
354         ICDecompressGetFormat(hic, lpbi, NULL)
355
356 #define ICDecompressGetPalette(hic, lpbiInput, lpbiOutput)              \
357     ICSendMessage(                                                      \
358         hic, ICM_DECOMPRESS_GET_PALETTE, (DWORD)(LPVOID)(lpbiInput),    \
359         (DWORD)(LPVOID)(lpbiOutput)                                     \
360     )
361
362 #define ICDecompressSetPalette(hic,lpbiPalette) \
363         ICSendMessage(                          \
364                 hic,ICM_DECOMPRESS_SET_PALETTE,         \
365                 (DWORD)(LPVOID)(lpbiPalette),0          \
366         )
367
368 #define ICDecompressEnd(hic) ICSendMessage(hic, ICM_DECOMPRESS_END, 0, 0)
369
370
371 #define ICDRAW_QUERY        0x00000001L   /* test for support */
372 #define ICDRAW_FULLSCREEN   0x00000002L   /* draw to full screen */
373 #define ICDRAW_HDC          0x00000004L   /* draw to a HDC/HWND */
374
375 BOOL    VFWAPI  ICInfo(DWORD fccType, DWORD fccHandler, ICINFO * lpicinfo);
376 LRESULT VFWAPI  ICGetInfo(HIC hic,ICINFO *picinfo, DWORD cb);
377 HIC     VFWAPI  ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode);
378 HIC     VFWAPI  ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, FARPROC lpfnHandler);
379
380 LRESULT VFWAPI ICClose(HIC hic);
381 LRESULT VFWAPI  ICSendMessage(HIC hic, UINT msg, DWORD dw1, DWORD dw2);
382 HIC     VFWAPI ICLocate(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wFlags);
383
384 DWORD   VFWAPIV ICDrawBegin(
385         HIC                     hic,
386         DWORD                   dwFlags,/* flags */
387         HPALETTE                hpal,   /* palette to draw with */
388         HWND                    hwnd,   /* window to draw to */
389         HDC                     hdc,    /* HDC to draw to */
390         INT                     xDst,   /* destination rectangle */
391         INT                     yDst,
392         INT                     dxDst,
393         INT                     dyDst,
394         LPBITMAPINFOHEADER      lpbi,   /* format of frame to draw */
395         INT                     xSrc,   /* source rectangle */
396         INT                     ySrc,
397         INT                     dxSrc,
398         INT                     dySrc,
399         DWORD                   dwRate, /* frames/second = (dwRate/dwScale) */
400         DWORD                   dwScale
401 );
402
403 /* as passed to ICM_DRAW_BEGIN (FIXME: correct only for Win32?)  */
404 typedef struct {
405         DWORD           dwFlags;
406         HPALETTE        hpal;
407         HWND            hwnd;
408         HDC             hdc;
409         INT             xDst;
410         INT             yDst;
411         INT             dxDst;
412         INT             dyDst;
413         LPBITMAPINFOHEADER      lpbi;
414         INT             xSrc;
415         INT             ySrc;
416         INT             dxSrc;
417         INT             dySrc;
418         DWORD           dwRate;
419         DWORD           dwScale;
420 } ICDRAWBEGIN;
421
422 #define ICDRAW_HURRYUP      0x80000000L   /* don't draw just buffer (hurry up!) */
423 #define ICDRAW_UPDATE       0x40000000L   /* don't draw just update screen */
424 #define ICDRAW_PREROLL      0x20000000L   /* this frame is before real start */
425 #define ICDRAW_NULLFRAME    0x10000000L   /* repeat last frame */
426 #define ICDRAW_NOTKEYFRAME  0x08000000L   /* this frame is not a key frame */
427
428 typedef struct {
429         DWORD   dwFlags;
430         LPVOID  lpFormat;
431         LPVOID  lpData;
432         DWORD   cbData;
433         LONG    lTime;
434 } ICDRAW;
435
436 DWORD VFWAPIV ICDraw(HIC hic,DWORD dwFlags,LPVOID lpFormat,LPVOID lpData,DWORD cbData,LONG lTime);
437
438 /********************* AVIFILE function declarations *************************/
439
440 #define streamtypeVIDEO         mmioFOURCC('v', 'i', 'd', 's')
441 #define streamtypeAUDIO         mmioFOURCC('a', 'u', 'd', 's')
442 #define streamtypeMIDI          mmioFOURCC('m', 'i', 'd', 's')
443 #define streamtypeTEXT          mmioFOURCC('t', 'x', 't', 's')
444
445 /* Basic chunk types */
446 #define cktypeDIBbits           aviTWOCC('d', 'b')
447 #define cktypeDIBcompressed     aviTWOCC('d', 'c')
448 #define cktypePALchange         aviTWOCC('p', 'c')
449 #define cktypeWAVEbytes         aviTWOCC('w', 'b')
450
451 /* Chunk id to use for extra chunks for padding. */
452 #define ckidAVIPADDING          mmioFOURCC('J', 'U', 'N', 'K')
453
454 /* AVIFileHdr.dwFlags */
455 #define AVIF_HASINDEX           0x00000010      /* Index at end of file? */
456 #define AVIF_MUSTUSEINDEX       0x00000020
457 #define AVIF_ISINTERLEAVED      0x00000100
458 #define AVIF_TRUSTCKTYPE        0x00000800      /* Use CKType to find key frames*/
459 #define AVIF_WASCAPTUREFILE     0x00010000
460 #define AVIF_COPYRIGHTED        0x00020000
461
462 #define AVI_HEADERSIZE  2048
463
464 typedef struct _MainAVIHeader
465 {
466     DWORD       dwMicroSecPerFrame;
467     DWORD       dwMaxBytesPerSec;
468     DWORD       dwPaddingGranularity;
469     DWORD       dwFlags;
470     DWORD       dwTotalFrames;
471     DWORD       dwInitialFrames;
472     DWORD       dwStreams;
473     DWORD       dwSuggestedBufferSize;
474     DWORD       dwWidth;
475     DWORD       dwHeight;
476     DWORD       dwReserved[4];
477 } MainAVIHeader;
478
479 /* AVIStreamHeader.dwFlags */
480 #define AVISF_DISABLED                  0x00000001
481 #define AVISF_VIDEO_PALCHANGES          0x00010000
482
483 typedef struct {
484     FOURCC      fccType;
485     FOURCC      fccHandler;
486     DWORD       dwFlags;        /* AVISF_* */
487     WORD        wPriority;
488     WORD        wLanguage;
489     DWORD       dwInitialFrames;
490     DWORD       dwScale;        
491     DWORD       dwRate; /* dwRate / dwScale == samples/second */
492     DWORD       dwStart;
493     DWORD       dwLength; /* In units above... */
494     DWORD       dwSuggestedBufferSize;
495     DWORD       dwQuality;
496     DWORD       dwSampleSize;
497     RECT16      rcFrame;        /* word.word - word.word in file */
498 } AVIStreamHeader;
499
500 /* AVIINDEXENTRY.dwFlags */
501 #define AVIIF_LIST      0x00000001      /* chunk is a 'LIST' */
502 #define AVIIF_KEYFRAME  0x00000010      /* this frame is a key frame. */
503
504 #define AVIIF_NOTIME    0x00000100      /* this frame doesn't take any time */
505 #define AVIIF_COMPUSE   0x0FFF0000
506
507 typedef struct _AVIINDEXENTRY {
508     DWORD       ckid;
509     DWORD       dwFlags;
510     DWORD       dwChunkOffset;
511     DWORD       dwChunkLength;
512 } AVIINDEXENTRY;
513
514 typedef struct _AVIPALCHANGE {
515     BYTE                bFirstEntry;
516     BYTE                bNumEntries;
517     WORD                wFlags;         /* pad */
518     PALETTEENTRY        peNew[1];
519 } AVIPALCHANGE;
520
521 #define AVIIF_KEYFRAME  0x00000010      /* this frame is a key frame. */
522
523 #define AVIGETFRAMEF_BESTDISPLAYFMT     1
524
525 typedef struct _AVISTREAMINFOA {
526     DWORD       fccType;
527     DWORD       fccHandler;
528     DWORD       dwFlags;        /* AVIIF_* */
529     DWORD       dwCaps;
530     WORD        wPriority;
531     WORD        wLanguage;
532     DWORD       dwScale;
533     DWORD       dwRate;         /* dwRate / dwScale == samples/second */
534     DWORD       dwStart;
535     DWORD       dwLength;       /* In units above... */
536     DWORD       dwInitialFrames;
537     DWORD       dwSuggestedBufferSize;
538     DWORD       dwQuality;
539     DWORD       dwSampleSize;
540     RECT        rcFrame;
541     DWORD       dwEditCount;
542     DWORD       dwFormatChangeCount;
543     CHAR        szName[64];
544 } AVISTREAMINFOA, * LPAVISTREAMINFOA, *PAVISTREAMINFOA;
545
546 typedef struct _AVISTREAMINFOW {
547     DWORD       fccType;
548     DWORD       fccHandler;
549     DWORD       dwFlags;
550     DWORD       dwCaps;
551     WORD        wPriority;
552     WORD        wLanguage;
553     DWORD       dwScale;
554     DWORD       dwRate;         /* dwRate / dwScale == samples/second */
555     DWORD       dwStart;
556     DWORD       dwLength;       /* In units above... */
557     DWORD       dwInitialFrames;
558     DWORD       dwSuggestedBufferSize;
559     DWORD       dwQuality;
560     DWORD       dwSampleSize;
561     RECT        rcFrame;
562     DWORD       dwEditCount;
563     DWORD       dwFormatChangeCount;
564     WCHAR       szName[64];
565 } AVISTREAMINFOW, * LPAVISTREAMINFOW, *PAVISTREAMINFOW;
566 DECL_WINELIB_TYPE_AW(AVISTREAMINFO)
567 DECL_WINELIB_TYPE_AW(LPAVISTREAMINFO)
568 DECL_WINELIB_TYPE_AW(PAVISTREAMINFO)
569
570 #define AVISTREAMINFO_DISABLED          0x00000001
571 #define AVISTREAMINFO_FORMATCHANGES     0x00010000
572
573 /* AVIFILEINFO.dwFlags */
574 #define AVIFILEINFO_HASINDEX            0x00000010
575 #define AVIFILEINFO_MUSTUSEINDEX        0x00000020
576 #define AVIFILEINFO_ISINTERLEAVED       0x00000100
577 #define AVIFILEINFO_WASCAPTUREFILE      0x00010000
578 #define AVIFILEINFO_COPYRIGHTED         0x00020000
579
580 /* AVIFILEINFO.dwCaps */
581 #define AVIFILECAPS_CANREAD             0x00000001
582 #define AVIFILECAPS_CANWRITE            0x00000002
583 #define AVIFILECAPS_ALLKEYFRAMES        0x00000010
584 #define AVIFILECAPS_NOCOMPRESSION       0x00000020
585
586 typedef struct _AVIFILEINFOW {
587     DWORD               dwMaxBytesPerSec;
588     DWORD               dwFlags;
589     DWORD               dwCaps;
590     DWORD               dwStreams;
591     DWORD               dwSuggestedBufferSize;
592     DWORD               dwWidth;
593     DWORD               dwHeight;
594     DWORD               dwScale;        
595     DWORD               dwRate;
596     DWORD               dwLength;
597     DWORD               dwEditCount;
598     WCHAR               szFileType[64];
599 } AVIFILEINFOW, * LPAVIFILEINFOW, *PAVIFILEINFOW;
600 typedef struct _AVIFILEINFOA {
601     DWORD               dwMaxBytesPerSec;
602     DWORD               dwFlags;
603     DWORD               dwCaps;
604     DWORD               dwStreams;
605     DWORD               dwSuggestedBufferSize;
606     DWORD               dwWidth;
607     DWORD               dwHeight;
608     DWORD               dwScale;        
609     DWORD               dwRate;
610     DWORD               dwLength;
611     DWORD               dwEditCount;
612     CHAR                szFileType[64];
613 } AVIFILEINFOA, * LPAVIFILEINFOA, *PAVIFILEINFOA;
614 DECL_WINELIB_TYPE_AW(AVIFILEINFO)
615 DECL_WINELIB_TYPE_AW(PAVIFILEINFO)
616 DECL_WINELIB_TYPE_AW(LPAVIFILEINFO)
617
618 /* AVICOMPRESSOPTIONS.dwFlags. determines presence of fields in below struct */
619 #define AVICOMPRESSF_INTERLEAVE 0x00000001
620 #define AVICOMPRESSF_DATARATE   0x00000002
621 #define AVICOMPRESSF_KEYFRAMES  0x00000004
622 #define AVICOMPRESSF_VALID      0x00000008
623
624 typedef struct {
625     DWORD       fccType;                /* stream type, for consistency */
626     DWORD       fccHandler;             /* compressor */
627     DWORD       dwKeyFrameEvery;        /* keyframe rate */
628     DWORD       dwQuality;              /* compress quality 0-10,000 */
629     DWORD       dwBytesPerSecond;       /* bytes per second */
630     DWORD       dwFlags;                /* flags... see below */
631     LPVOID      lpFormat;               /* save format */
632     DWORD       cbFormat;
633     LPVOID      lpParms;                /* compressor options */
634     DWORD       cbParms;
635     DWORD       dwInterleaveEvery;      /* for non-video streams only */
636 } AVICOMPRESSOPTIONS, *LPAVICOMPRESSOPTIONS,*PAVICOMPRESSOPTIONS;
637
638
639
640 #define DEFINE_AVIGUID(name, l, w1, w2) \
641     DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
642
643 DEFINE_AVIGUID(IID_IAVIFile,            0x00020020, 0, 0);
644 DEFINE_AVIGUID(IID_IAVIStream,          0x00020021, 0, 0);
645 DEFINE_AVIGUID(IID_IAVIStreaming,       0x00020022, 0, 0);
646 DEFINE_AVIGUID(IID_IGetFrame,           0x00020023, 0, 0);
647 DEFINE_AVIGUID(IID_IAVIEditStream,      0x00020024, 0, 0);
648
649 DEFINE_AVIGUID(CLSID_AVIFile,           0x00020000, 0, 0);
650
651 /*****************************************************************************
652  * IAVIStream interface
653  */
654 #define ICOM_INTERFACE IAVIStream
655 #define IAVIStream_METHODS                                              \
656     ICOM_METHOD2(HRESULT,Create,     LPARAM,lParam1, LPARAM,lParam2) \
657     ICOM_METHOD2(HRESULT,Info,       AVISTREAMINFOW*,psi, LONG,lSize) \
658     ICOM_METHOD2(LONG,   FindSample, LONG,lPos, LONG,lFlags) \
659     ICOM_METHOD3(HRESULT,ReadFormat, LONG,lPos, LPVOID,lpFormat, LONG*,lpcbFormat) \
660     ICOM_METHOD3(HRESULT,SetFormat,  LONG,lPos, LPVOID,lpFormat, LONG,cbFormat) \
661     ICOM_METHOD6(HRESULT,Read,       LONG,lStart, LONG,lSamples, LPVOID,lpBuffer, LONG,cbBuffer, LONG*,plBytes, LONG*,plSamples) \
662     ICOM_METHOD7(HRESULT,Write,      LONG,lStart, LONG,lSamples, LPVOID,lpBuffer, LONG,cbBuffer, DWORD,dwFlags, LONG*,plSampWritten, LONG*,plBytesWritten) \
663     ICOM_METHOD2(HRESULT,Delete,     LONG,lStart, LONG,lSamples) \
664     ICOM_METHOD3(HRESULT,ReadData,   DWORD,fcc, LPVOID,lpBuffer, LONG*,lpcbBuffer) \
665     ICOM_METHOD3(HRESULT,WriteData,  DWORD,fcc, LPVOID,lpBuffer, LONG,cbBuffer) \
666     ICOM_METHOD2(HRESULT,SetInfo,    AVISTREAMINFOW*,plInfo, LONG,cbInfo)
667 #define IAVIStream_IMETHODS     \
668         IUnknown_IMETHODS       \
669         IAVIStream_METHODS
670 ICOM_DEFINE(IAVIStream, IUnknown)
671 #undef ICOM_INTERFACE
672
673 #ifdef ICOM_CINTERFACE
674 /*** IUnknown methods ***/
675 #define IAVIStream_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
676 #define IAVIStream_AddRef(p)             ICOM_CALL (AddRef,p)
677 #define IAVIStream_Release(p)            ICOM_CALL (Release,p)
678 /*** IAVIStream methods ***/
679 #define IAVIStream_Create(p,a,b)          ICOM_CALL2(Create,p,a,b)
680 #define IAVIStream_Info(p,a,b)            ICOM_CALL2(Info,p,a,b)
681 #define IAVIStream_FindSample(p,a,b)      ICOM_CALL2(FindSample,p,a,b)
682 #define IAVIStream_ReadFormat(p,a,b,c)    ICOM_CALL3(ReadFormat,p,a,b,c)
683 #define IAVIStream_SetFormat(p,a,b,c)     ICOM_CALL3(SetFormat,p,a,b,c)
684 #define IAVIStream_Read(p,a,b,c,d,e,f)    ICOM_CALL6(Read,p,a,b,c,d,e,f)
685 #define IAVIStream_Write(p,a,b,c,d,e,f,g) ICOM_CALL7(Write,p,a,b,c,d,e,f,g)
686 #define IAVIStream_Delete(p,a,b)          ICOM_CALL2(Delete,p,a,b)
687 #define IAVIStream_ReadData(p,a,b,c)      ICOM_CALL3(ReadData,p,a,b,c)
688 #define IAVIStream_WriteData(p,a,b,c)     ICOM_CALL3(WriteData,p,a,b,c)
689 #define IAVIStream_SetInfo(p,a,b)         ICOM_CALL2(SetInfo,p,a,b)
690 #endif
691
692 HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM*ppsCompressed,PAVISTREAM ppsSource,AVICOMPRESSOPTIONS *lpOptions,CLSID*pclsidHandler); 
693
694 HRESULT WINAPI AVIStreamInfoA(PAVISTREAM iface,AVISTREAMINFOA *asi,LONG size);
695 HRESULT WINAPI AVIStreamInfoW(PAVISTREAM iface,AVISTREAMINFOW *asi,LONG size);
696 #define AVIStreamInfo WINELIB_NAME_AW(AVIStreamInfo)
697 LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg,LONG pos);
698 HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg);
699 PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM pavi,LPBITMAPINFOHEADER lpbiWanted);
700 LONG WINAPI AVIStreamLength(PAVISTREAM iface);
701 HRESULT WINAPI AVIStreamRead(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread);
702 HRESULT WINAPI AVIStreamReadData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG *lpread);
703 HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG *formatsize);
704 ULONG WINAPI AVIStreamRelease(PAVISTREAM iface);
705 HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG formatsize);
706 LONG WINAPI AVIStreamStart(PAVISTREAM iface);
707 HRESULT WINAPI AVIStreamWrite(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten);
708 HRESULT WINAPI AVIStreamWriteData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG size);
709
710
711 /*****************************************************************************
712  * IAVIFile interface
713  */
714 /* In Win32 this interface uses UNICODE only */
715 #define ICOM_INTERFACE IAVIFile
716 #define IAVIFile_METHODS                                                \
717     ICOM_METHOD2(HRESULT,Info,         AVIFILEINFOW*,pfi, LONG,lSize) \
718     ICOM_METHOD3(HRESULT,GetStream,    PAVISTREAM*,ppStream, DWORD,fccType, LONG,lParam) \
719     ICOM_METHOD2(HRESULT,CreateStream, PAVISTREAM*,ppStream, AVISTREAMINFOW*,psi) \
720     ICOM_METHOD3(HRESULT,WriteData,    DWORD,fcc, LPVOID,lpBuffer, LONG,cbBuffer) \
721     ICOM_METHOD3(HRESULT,ReadData,     DWORD,fcc, LPVOID,lpBuffer, LONG*,lpcbBuffer) \
722         ICOM_METHOD (HRESULT,EndRecord)                                 \
723     ICOM_METHOD2(HRESULT,DeleteStream, DWORD,fccType, LONG,lParam)
724 #define IAVIFile_IMETHODS       \
725         IUnknown_IMETHODS       \
726         IAVIFile_METHODS
727 ICOM_DEFINE(IAVIFile,IUnknown)
728 #undef ICOM_INTERFACE
729
730 #ifdef ICOM_CINTERFACE
731 /*** IUnknown methods ***/
732 #define IAVIFile_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
733 #define IAVIFile_AddRef(p)             ICOM_CALL (AddRef,p)
734 #define IAVIFile_Release(p)            ICOM_CALL (Release,p)
735 /*** IAVIFile methods ***/
736 #define IAVIFile_Info(p,a,b)         ICOM_CALL2(Info,p,a,b)
737 #define IAVIFile_GetStream(p,a,b,c)  ICOM_CALL3(GetStream,p,a,b,c)
738 #define IAVIFile_CreateStream(p,a,b) ICOM_CALL2(CreateStream,p,a,b)
739 #define IAVIFile_WriteData(p,a,b,c)  ICOM_CALL3(WriteData,p,a,b,c)
740 #define IAVIFile_ReadData(p,a,b,c)   ICOM_CALL3(ReadData,p,a,b,c)
741 #define IAVIFile_EndRecord(p)        ICOM_CALL (EndRecord,p)
742 #define IAVIFile_DeleteStream(p,a,b) ICOM_CALL2(DeleteStream,p,a,b)
743 #endif
744
745 HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE pfile,PAVISTREAM* ppavi,AVISTREAMINFOA* psi);
746 HRESULT WINAPI AVIFileCreateStreamW(PAVIFILE pfile,PAVISTREAM* ppavi,AVISTREAMINFOW* psi);
747 #define AVIFileCreateStream WINELIB_NAME_AW(AVIFileCreateStream)
748 void WINAPI AVIFileExit(void);
749 HRESULT WINAPI AVIFileGetStream(PAVIFILE pfile,PAVISTREAM* avis,DWORD fccType,LONG lParam);
750 HRESULT WINAPI AVIFileInfoA(PAVIFILE pfile,PAVIFILEINFOA pfi,LONG lSize);
751 HRESULT WINAPI AVIFileInfoW(PAVIFILE pfile,PAVIFILEINFOW pfi,LONG lSize);
752 #define AVIFileInfo WINELIB_NAME_AW(AVIFileInfo)
753 void WINAPI AVIFileInit(void);
754 HRESULT WINAPI AVIFileOpenA(PAVIFILE* ppfile,LPCSTR szFile,UINT uMode,LPCLSID lpHandler);
755 HRESULT WINAPI AVIFileOpenW(PAVIFILE* ppfile,LPCWSTR szFile,UINT uMode,LPCLSID lpHandler);
756 #define AVIFileOpen WINELIB_NAME_AW(AVIFileOpen)
757 ULONG WINAPI AVIFileRelease(PAVIFILE iface);
758
759
760 /*****************************************************************************
761  * IGetFrame interface
762  */
763 #define ICOM_INTERFACE IGetFrame
764 #define IGetFrame_METHODS                                       \
765     ICOM_METHOD1(LPVOID, GetFrame,  LONG,lPos) \
766     ICOM_METHOD3(HRESULT,Begin,     LONG,lStart, LONG,lEnd, LONG,lRate) \
767         ICOM_METHOD (HRESULT,End)                               \
768     ICOM_METHOD6(HRESULT,SetFormat, LPBITMAPINFOHEADER,lpbi, LPVOID,lpBits, INT,x, INT,y, INT,dx, INT,dy)
769 #define IGetFrame_IMETHODS      \
770         IUnknown_IMETHODS       \
771         IGetFrame_METHODS
772 ICOM_DEFINE(IGetFrame,IUnknown)
773 #undef ICOM_INTERFACE
774
775 #ifdef ICOM_CINTERFACE
776 /*** IUnknown methods ***/
777 #define IGetFrame_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
778 #define IGetFrame_AddRef(p)             ICOM_CALL (AddRef,p)
779 #define IGetFrame_Release(p)            ICOM_CALL (Release,p)
780 /*** IGetFrame methods ***/
781 #define IGetFrame_GetFrame(p,a)            ICOM_CALL1(GetFrame,p,a)
782 #define IGetFrame_Begin(p,a,b,c)           ICOM_CALL3(Begin,p,a,b,c)
783 #define IGetFrame_End(p)                   ICOM_CALL (End,p)
784 #define IGetFrame_SetFormat(p,a,b,c,d,e,f) ICOM_CALL6(SetFormat,p,a,b,c,d,e,f)
785 #endif
786
787 #define AVIERR_OK               0
788 #define MAKE_AVIERR(error)      MAKE_SCODE(SEVERITY_ERROR,FACILITY_ITF,0x4000+error)
789
790 #define AVIERR_UNSUPPORTED      MAKE_AVIERR(101)
791 #define AVIERR_BADFORMAT        MAKE_AVIERR(102)
792 #define AVIERR_MEMORY           MAKE_AVIERR(103)
793 #define AVIERR_INTERNAL         MAKE_AVIERR(104)
794 #define AVIERR_BADFLAGS         MAKE_AVIERR(105)
795 #define AVIERR_BADPARAM         MAKE_AVIERR(106)
796 #define AVIERR_BADSIZE          MAKE_AVIERR(107)
797 #define AVIERR_BADHANDLE        MAKE_AVIERR(108)
798 #define AVIERR_FILEREAD         MAKE_AVIERR(109)
799 #define AVIERR_FILEWRITE        MAKE_AVIERR(110)
800 #define AVIERR_FILEOPEN         MAKE_AVIERR(111)
801 #define AVIERR_COMPRESSOR       MAKE_AVIERR(112)
802 #define AVIERR_NOCOMPRESSOR     MAKE_AVIERR(113)
803 #define AVIERR_READONLY         MAKE_AVIERR(114)
804 #define AVIERR_NODATA           MAKE_AVIERR(115)
805 #define AVIERR_BUFFERTOOSMALL   MAKE_AVIERR(116)
806 #define AVIERR_CANTCOMPRESS     MAKE_AVIERR(117)
807 #define AVIERR_USERABORT        MAKE_AVIERR(198)
808 #define AVIERR_ERROR            MAKE_AVIERR(199)
809
810
811 #endif /* __WINE_VFW_H */