2 * Modified for use with MPlayer, detailed CVS changelog at
3 * http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
9 //#include "pshpack1.h"
13 #ifndef __WINE_WINGDI_H
15 typedef struct __attribute__((__packed__))
24 #ifndef _BITMAPINFOHEADER_
25 #define _BITMAPINFOHEADER_
26 typedef struct __attribute__((__packed__))
39 } BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
41 BITMAPINFOHEADER bmiHeader;
43 } BITMAPINFO, *LPBITMAPINFO;
49 #ifndef __WINE_WINDEF_H
50 typedef long (__stdcall__ *DRIVERPROC)(long,HDRVR,unsigned int,long,long);
56 #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
57 ( (long)(unsigned char)(ch0) | ( (long)(unsigned char)(ch1) << 8 ) | \
58 ( (long)(unsigned char)(ch2) << 16 ) | ( (long)(unsigned char)(ch3) << 24 ) )
62 #define aviTWOCC(ch0, ch1) ((short)(unsigned char)(ch0) | ((short)(unsigned char)(ch1) << 8))
65 #define ICTYPE_VIDEO mmioFOURCC('v', 'i', 'd', 'c')
66 #define ICTYPE_AUDIO mmioFOURCC('a', 'u', 'd', 'c')
69 /* Installable Compressor M? */
71 /* HIC struct (same layout as Win95 one) */
72 typedef struct tagWINE_HIC {
73 long magic; /* 00: 'Smag' */
74 HANDLE curthread; /* 04: */
76 long handler; /* 0C: */
78 long driverid; /* 14:(handled by SendDriverMessage)*/
79 DRIVERPROC driverproc; /* 18:(handled by SendDriverMessage)*/
80 long x1; /* 1c: name? */
86 /* error return codes */
88 #define ICERR_DONTDRAW 1
89 #define ICERR_NEWPALETTE 2
90 #define ICERR_GOTOKEYFRAME 3
91 #define ICERR_STOPDRAWING 4
93 #define ICERR_UNSUPPORTED -1
94 #define ICERR_BADFORMAT -2
95 #define ICERR_MEMORY -3
96 #define ICERR_INTERNAL -4
97 #define ICERR_BADFLAGS -5
98 #define ICERR_BADPARAM -6
99 #define ICERR_BADSIZE -7
100 #define ICERR_BADHANDLE -8
101 #define ICERR_CANTUPDATE -9
102 #define ICERR_ABORT -10
103 #define ICERR_ERROR -100
104 #define ICERR_BADBITDEPTH -200
105 #define ICERR_BADIMAGESIZE -201
107 #define ICERR_CUSTOM -400
110 #define ICM_USER (DRV_USER+0x0000)
112 /* ICM driver message range */
113 #define ICM_RESERVED_LOW (DRV_USER+0x1000)
114 #define ICM_RESERVED_HIGH (DRV_USER+0x2000)
115 #define ICM_RESERVED ICM_RESERVED_LOW
117 #define ICM_GETSTATE (ICM_RESERVED+0)
118 #define ICM_SETSTATE (ICM_RESERVED+1)
119 #define ICM_GETINFO (ICM_RESERVED+2)
121 #define ICM_CONFIGURE (ICM_RESERVED+10)
122 #define ICM_ABOUT (ICM_RESERVED+11)
125 #define ICM_GETDEFAULTQUALITY (ICM_RESERVED+30)
126 #define ICM_GETQUALITY (ICM_RESERVED+31)
127 #define ICM_SETQUALITY (ICM_RESERVED+32)
129 #define ICM_SET (ICM_RESERVED+40)
130 #define ICM_GET (ICM_RESERVED+41)
132 /* 2 constant FOURCC codes */
133 #define ICM_FRAMERATE mmioFOURCC('F','r','m','R')
134 #define ICM_KEYFRAMERATE mmioFOURCC('K','e','y','R')
136 #define ICM_COMPRESS_GET_FORMAT (ICM_USER+4)
137 #define ICM_COMPRESS_GET_SIZE (ICM_USER+5)
138 #define ICM_COMPRESS_QUERY (ICM_USER+6)
139 #define ICM_COMPRESS_BEGIN (ICM_USER+7)
140 #define ICM_COMPRESS (ICM_USER+8)
141 #define ICM_COMPRESS_END (ICM_USER+9)
143 #define ICM_DECOMPRESS_GET_FORMAT (ICM_USER+10)
144 #define ICM_DECOMPRESS_QUERY (ICM_USER+11)
145 #define ICM_DECOMPRESS_BEGIN (ICM_USER+12)
146 #define ICM_DECOMPRESS (ICM_USER+13)
147 #define ICM_DECOMPRESS_END (ICM_USER+14)
148 #define ICM_DECOMPRESS_SET_PALETTE (ICM_USER+29)
149 #define ICM_DECOMPRESS_GET_PALETTE (ICM_USER+30)
151 #define ICM_DRAW_QUERY (ICM_USER+31)
152 #define ICM_DRAW_BEGIN (ICM_USER+15)
153 #define ICM_DRAW_GET_PALETTE (ICM_USER+16)
154 #define ICM_DRAW_START (ICM_USER+18)
155 #define ICM_DRAW_STOP (ICM_USER+19)
156 #define ICM_DRAW_END (ICM_USER+21)
157 #define ICM_DRAW_GETTIME (ICM_USER+32)
158 #define ICM_DRAW (ICM_USER+33)
159 #define ICM_DRAW_WINDOW (ICM_USER+34)
160 #define ICM_DRAW_SETTIME (ICM_USER+35)
161 #define ICM_DRAW_REALIZE (ICM_USER+36)
162 #define ICM_DRAW_FLUSH (ICM_USER+37)
163 #define ICM_DRAW_RENDERBUFFER (ICM_USER+38)
165 #define ICM_DRAW_START_PLAY (ICM_USER+39)
166 #define ICM_DRAW_STOP_PLAY (ICM_USER+40)
168 #define ICM_DRAW_SUGGESTFORMAT (ICM_USER+50)
169 #define ICM_DRAW_CHANGEPALETTE (ICM_USER+51)
171 #define ICM_GETBUFFERSWANTED (ICM_USER+41)
173 #define ICM_GETDEFAULTKEYFRAMERATE (ICM_USER+42)
175 #define ICM_DECOMPRESSEX_BEGIN (ICM_USER+60)
176 #define ICM_DECOMPRESSEX_QUERY (ICM_USER+61)
177 #define ICM_DECOMPRESSEX (ICM_USER+62)
178 #define ICM_DECOMPRESSEX_END (ICM_USER+63)
180 #define ICM_COMPRESS_FRAMES_INFO (ICM_USER+70)
181 #define ICM_SET_STATUS_PROC (ICM_USER+72)
186 long dwSize; /* 00: size */
187 long fccType; /* 04: type 'vidc' usually */
188 long fccHandler; /* 08: */
189 long dwVersion; /* 0c: version of compman opening you */
190 long dwFlags; /* 10: LOshort is type specific */
191 LRESULT dwError; /* 14: */
192 void* pV1Reserved; /* 18: */
193 void* pV2Reserved; /* 1c: */
194 long dnDevNode; /* 20: */
198 #define ICCOMPRESS_KEYFRAME 0x00000001L
202 LPBITMAPINFOHEADER lpbiOutput;
204 LPBITMAPINFOHEADER lpbiInput;
211 LPBITMAPINFOHEADER lpbiPrev;
215 long VFWAPIV ICCompress(
216 HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiOutput,void* lpData,
217 LPBITMAPINFOHEADER lpbiInput,void* lpBits,long* lpckid,
218 long* lpdwFlags,long lFrameNum,long dwFrameSize,long dwQuality,
219 LPBITMAPINFOHEADER lpbiPrev,void* lpPrev
223 #define ICCompressGetFormat(hic, lpbiInput, lpbiOutput) \
225 hic,ICM_COMPRESS_GET_FORMAT,(long)(void*)(lpbiInput), \
226 (long)(void*)(lpbiOutput) \
229 #define ICCompressGetFormatSize(hic,lpbi) ICCompressGetFormat(hic,lpbi,NULL)
231 #define ICGetDefaultKeyFrameRate(hic,lpint) \
233 hic, ICM_GETDEFAULTKEYFRAMERATE, \
234 (long)(void*)(lpint), \
237 #define ICGetDefaultQuality(hic,lpint) \
239 hic, ICM_GETDEFAULTQUALITY, \
240 (long)(void*)(lpint), \
244 #define ICCompressBegin(hic, lpbiInput, lpbiOutput) \
246 hic, ICM_COMPRESS_BEGIN, (long)(void*)(lpbiInput), \
247 (long)(void*)(lpbiOutput) \
250 #define ICCompressGetSize(hic, lpbiInput, lpbiOutput) \
252 hic, ICM_COMPRESS_GET_SIZE, (long)(void*)(lpbiInput), \
253 (long)(void*)(lpbiOutput) \
256 #define ICCompressQuery(hic, lpbiInput, lpbiOutput) \
258 hic, ICM_COMPRESS_QUERY, (long)(void*)(lpbiInput), \
259 (long)(void*)(lpbiOutput) \
263 #define ICCompressEnd(hic) ICSendMessage(hic, ICM_COMPRESS_END, 0, 0)
265 /* ICCOMPRESSFRAMES.dwFlags */
266 #define ICCOMPRESSFRAMES_PADDING 0x00000001
269 LPBITMAPINFOHEADER lpbiOutput;
271 LPBITMAPINFOHEADER lpbiInput;
280 long dwOverheadPerFrame;
282 long CALLBACK (*GetData)(LPARAM lInput,long lFrame,void* lpBits,long len);
283 long CALLBACK (*PutData)(LPARAM lOutput,long lFrame,void* lpBits,long len);
286 /* Values for wMode of ICOpen() */
287 #define ICMODE_COMPRESS 1
288 #define ICMODE_DECOMPRESS 2
289 #define ICMODE_FASTDECOMPRESS 3
290 #define ICMODE_QUERY 4
291 #define ICMODE_FASTCOMPRESS 5
292 #define ICMODE_DRAW 8
295 #define ICQUALITY_LOW 0
296 #define ICQUALITY_HIGH 10000
297 #define ICQUALITY_DEFAULT -1
300 long dwSize; /* 00: */
301 long fccType; /* 04:compressor type 'vidc' 'audc' */
302 long fccHandler; /* 08:compressor sub-type 'rle ' 'jpeg' 'pcm '*/
303 long dwFlags; /* 0c:flags LOshort is type specific */
304 long dwVersion; /* 10:version of the driver */
305 long dwVersionICM; /* 14:version of the ICM used */
307 * under Win32, the driver always returns UNICODE strings.
309 WCHAR szName[16]; /* 18:short name */
310 WCHAR szDescription[128]; /* 38:long name */
311 WCHAR szDriver[128]; /* 138:driver that contains compressor*/
316 #define VIDCF_QUALITY 0x0001 /* supports quality */
317 #define VIDCF_CRUNCH 0x0002 /* supports crunching to a frame size */
318 #define VIDCF_TEMPORAL 0x0004 /* supports inter-frame compress */
319 #define VIDCF_COMPRESSFRAMES 0x0008 /* wants the compress all frames message */
320 #define VIDCF_DRAW 0x0010 /* supports drawing */
321 #define VIDCF_FASTTEMPORALC 0x0020 /* does not need prev frame on compress */
322 #define VIDCF_FASTTEMPORALD 0x0080 /* does not need prev frame on decompress */
323 #define VIDCF_QUALITYTIME 0x0040 /* supports temporal quality */
325 #define VIDCF_FASTTEMPORAL (VIDCF_FASTTEMPORALC|VIDCF_FASTTEMPORALD)
328 /* function shortcuts */
330 #define ICMF_ABOUT_QUERY 0x00000001
332 #define ICQueryAbout(hic) \
333 (ICSendMessage(hic,ICM_ABOUT,(long)-1,ICMF_ABOUT_QUERY)==ICERR_OK)
335 #define ICAbout(hic, hwnd) ICSendMessage(hic,ICM_ABOUT,(long)(unsigned int)(hwnd),0)
338 #define ICMF_CONFIGURE_QUERY 0x00000001
339 #define ICQueryConfigure(hic) \
340 (ICSendMessage(hic,ICM_CONFIGURE,(long)-1,ICMF_CONFIGURE_QUERY)==ICERR_OK)
342 #define ICConfigure(hic,hwnd) \
343 ICSendMessage(hic,ICM_CONFIGURE,(long)(unsigned int)(hwnd),0)
345 /* Decompression stuff */
346 #define ICDECOMPRESS_HURRYUP 0x80000000 /* don't draw just buffer (hurry up!) */
347 #define ICDECOMPRESS_UPDATE 0x40000000 /* don't draw just update screen */
348 #define ICDECOMPRESS_PREROL 0x20000000 /* this frame is before real start */
349 #define ICDECOMPRESS_NULLFRAME 0x10000000 /* repeat last frame */
350 #define ICDECOMPRESS_NOTKEYFRAME 0x08000000 /* this frame is not a key frame */
353 long dwFlags; /* flags (from AVI index...) */
354 LPBITMAPINFOHEADER lpbiInput; /* BITMAPINFO of compressed data */
355 const void* lpInput; /* compressed data */
356 LPBITMAPINFOHEADER lpbiOutput; /* DIB to decompress to */
358 long ckid; /* ckid from AVI file */
363 LPBITMAPINFOHEADER lpbiSrc;
365 LPBITMAPINFOHEADER lpbiDst;
368 /* changed for ICM_DECOMPRESSEX */
369 INT xDst; /* destination rectangle */
374 INT xSrc; /* source rectangle */
381 long VFWAPIV ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits);
382 long VFWAPIV ICDecompressEx(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits);
383 long VFWAPIV ICUniversalEx(HIC hic,int command,LPBITMAPINFOHEADER lpbiFormat,LPBITMAPINFOHEADER lpbi);
386 #define ICDecompressBegin(hic, lpbiInput, lpbiOutput) \
388 hic, ICM_DECOMPRESS_BEGIN, (long)(void*)(lpbiInput), \
389 (long)(void*)(lpbiOutput) \
392 #define ICDecompressBeginEx(hic, lpbiInput, lpbiOutput) \
394 hic, ICM_DECOMPRESSEX_BEGIN, (lpbiInput), \
398 #define ICDecompressQuery(hic, lpbiInput, lpbiOutput) \
400 hic,ICM_DECOMPRESS_QUERY, (long)(void*)(lpbiInput), \
401 (long) (void*)(lpbiOutput) \
404 #define ICDecompressQueryEx(hic, lpbiInput, lpbiOutput) \
406 hic,ICM_DECOMPRESSEX_QUERY, (lpbiInput), \
410 #define ICDecompressGetFormat(hic, lpbiInput, lpbiOutput) \
411 ((long)ICSendMessage( \
412 hic,ICM_DECOMPRESS_GET_FORMAT, (long)(void*)(lpbiInput), \
413 (long)(void*)(lpbiOutput) \
416 #define ICDecompressGetFormatSize(hic, lpbi) \
417 ICDecompressGetFormat(hic, lpbi, NULL)
419 #define ICDecompressGetPalette(hic, lpbiInput, lpbiOutput) \
421 hic, ICM_DECOMPRESS_GET_PALETTE, (long)(void*)(lpbiInput), \
422 (long)(void*)(lpbiOutput) \
425 #define ICDecompressSetPalette(hic,lpbiPalette) \
427 hic,ICM_DECOMPRESS_SET_PALETTE, \
428 (long)(void*)(lpbiPalette),0 \
431 #define ICDecompressEnd(hic) ICSendMessage(hic, ICM_DECOMPRESS_END, 0, 0)
432 #define ICDecompressEndEx(hic) ICSendMessage(hic,ICM_DECOMPRESSEX_END, 0, 0)
434 #define ICDRAW_QUERY 0x00000001L /* test for support */
435 #define ICDRAW_FULLSCREEN 0x00000002L /* draw to full screen */
436 #define ICDRAW_HDC 0x00000004L /* draw to a HDC/HWND */
439 WIN_BOOL VFWAPI ICInfo(long fccType, long fccHandler, ICINFO * lpicinfo);
440 LRESULT VFWAPI ICGetInfo(HIC hic,ICINFO *picinfo, long cb);
441 HIC VFWAPI ICOpen(long fccType, long fccHandler, UINT wMode);
442 //HIC VFWAPI ICOpenFunction(long fccType, long fccHandler, unsigned int wMode, void* lpfnHandler);
444 LRESULT VFWAPI ICClose(HIC hic);
445 LRESULT VFWAPI ICSendMessage(HIC hic, unsigned int msg, long dw1, long dw2);
446 //HIC VFWAPI ICLocate(long fccType, long fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, short wFlags);
448 int VFWAPI ICDoSomething(void);
450 long VFWAPIV ICDrawBegin(
452 long dwFlags,/* flags */
453 HPALETTE hpal, /* palette to draw with */
454 HWND hwnd, /* window to draw to */
455 HDC hdc, /* HDC to draw to */
456 INT xDst, /* destination rectangle */
460 LPBITMAPINFOHEADER lpbi, /* format of frame to draw */
461 INT xSrc, /* source rectangle */
465 long dwRate, /* frames/second = (dwRate/dwScale) */
469 /* as passed to ICM_DRAW_BEGIN (FIXME: correct only for Win32?) */
479 LPBITMAPINFOHEADER lpbi;
488 #define ICDRAW_HURRYUP 0x80000000L /* don't draw just buffer (hurry up!) */
489 #define ICDRAW_UPDATE 0x40000000L /* don't draw just update screen */
490 #define ICDRAW_PREROLL 0x20000000L /* this frame is before real start */
491 #define ICDRAW_NULLFRAME 0x10000000L /* repeat last frame */
492 #define ICDRAW_NOTKEYFRAME 0x08000000L /* this frame is not a key frame */
502 long VFWAPIV ICDraw(HIC hic,long dwFlags,void* lpFormat,void* lpData,long cbData,long lTime);
505 #define AVIGETFRAMEF_BESTDISPLAYFMT 1
507 typedef struct _AVISTREAMINFOA {
510 long dwFlags; /* AVIIF_* */
515 long dwRate; /* dwRate / dwScale == samples/second */
517 long dwLength; /* In units above... */
518 long dwInitialFrames;
519 long dwSuggestedBufferSize;
524 long dwFormatChangeCount;
526 } AVISTREAMINFOA, * LPAVISTREAMINFOA, *PAVISTREAMINFOA;
528 typedef struct _AVISTREAMINFOW {
536 long dwRate; /* dwRate / dwScale == samples/second */
538 long dwLength; /* In units above... */
539 long dwInitialFrames;
540 long dwSuggestedBufferSize;
545 long dwFormatChangeCount;
547 } AVISTREAMINFOW, * LPAVISTREAMINFOW, *PAVISTREAMINFOW;
548 DECL_WINELIB_TYPE_AW(AVISTREAMINFO)
549 DECL_WINELIB_TYPE_AW(LPAVISTREAMINFO)
550 DECL_WINELIB_TYPE_AW(PAVISTREAMINFO)
552 #define AVISTREAMINFO_DISABLED 0x00000001
553 #define AVISTREAMINFO_FORMATCHANGES 0x00010000
555 /* AVIFILEINFO.dwFlags */
556 #define AVIFILEINFO_HASINDEX 0x00000010
557 #define AVIFILEINFO_MUSTUSEINDEX 0x00000020
558 #define AVIFILEINFO_ISINTERLEAVED 0x00000100
559 #define AVIFILEINFO_WASCAPTUREFILE 0x00010000
560 #define AVIFILEINFO_COPYRIGHTED 0x00020000
562 /* AVIFILEINFO.dwCaps */
563 #define AVIFILECAPS_CANREAD 0x00000001
564 #define AVIFILECAPS_CANWRITE 0x00000002
565 #define AVIFILECAPS_ALLKEYFRAMES 0x00000010
566 #define AVIFILECAPS_NOCOMPRESSION 0x00000020
568 typedef struct _AVIFILEINFOW {
569 long dwMaxBytesPerSec;
573 long dwSuggestedBufferSize;
580 short szFileType[64];
581 } AVIFILEINFOW, * LPAVIFILEINFOW, *PAVIFILEINFOW;
583 typedef struct _AVIFILEINFOA {
584 long dwMaxBytesPerSec;
588 long dwSuggestedBufferSize;
596 } AVIFILEINFOA, * LPAVIFILEINFOA, *PAVIFILEINFOA;
598 DECL_WINELIB_TYPE_AW(AVIFILEINFO)
599 DECL_WINELIB_TYPE_AW(PAVIFILEINFO)
600 DECL_WINELIB_TYPE_AW(LPAVIFILEINFO)
602 /* AVICOMPRESSOPTIONS.dwFlags. determines presence of fields in below struct */
603 #define AVICOMPRESSF_INTERLEAVE 0x00000001
604 #define AVICOMPRESSF_DATARATE 0x00000002
605 #define AVICOMPRESSF_KEYFRAMES 0x00000004
606 #define AVICOMPRESSF_VALID 0x00000008
609 long fccType; /* stream type, for consistency */
610 long fccHandler; /* compressor */
611 long dwKeyFrameEvery; /* keyframe rate */
612 long dwQuality; /* compress quality 0-10,000 */
613 long dwBytesPerSecond; /* unsigned chars per second */
614 long dwFlags; /* flags... see below */
615 void* lpFormat; /* save format */
617 void* lpParms; /* compressor options */
619 long dwInterleaveEvery; /* for non-video streams only */
620 } AVICOMPRESSOPTIONS, *LPAVICOMPRESSOPTIONS,*PAVICOMPRESSOPTIONS;
625 long cbSize; // set to sizeof(COMPVARS) before
626 // calling ICCompressorChoose
627 long dwFlags; // see below...
628 HIC hic; // HIC of chosen compressor
629 long fccType; // basically ICTYPE_VIDEO
630 long fccHandler; // handler of chosen compressor or
632 LPBITMAPINFO lpbiIn; // input format
633 LPBITMAPINFO lpbiOut; // output format - will compress to this
637 long lKey; // key frames how often?
638 long lDataRate; // desired data rate KB/Sec
639 long lQ; // desired quality
641 void* lpState; // state of compressor
642 long cbState; // size of the state
643 } COMPVARS, *PCOMPVARS;
645 // FLAGS for dwFlags element of COMPVARS structure:
649 #define MAKE_AVIERR(error) MAKE_SCODE(SEVERITY_ERROR,FACILITY_ITF,0x4000+error)
651 #define AVIERR_UNSUPPORTED MAKE_AVIERR(101)
652 #define AVIERR_BADFORMAT MAKE_AVIERR(102)
653 #define AVIERR_MEMORY MAKE_AVIERR(103)
654 #define AVIERR_INTERNAL MAKE_AVIERR(104)
655 #define AVIERR_BADFLAGS MAKE_AVIERR(105)
656 #define AVIERR_BADPARAM MAKE_AVIERR(106)
657 #define AVIERR_BADSIZE MAKE_AVIERR(107)
658 #define AVIERR_BADHANDLE MAKE_AVIERR(108)
659 #define AVIERR_FILEREAD MAKE_AVIERR(109)
660 #define AVIERR_FILEWRITE MAKE_AVIERR(110)
661 #define AVIERR_FILEOPEN MAKE_AVIERR(111)
662 #define AVIERR_COMPRESSOR MAKE_AVIERR(112)
663 #define AVIERR_NOCOMPRESSOR MAKE_AVIERR(113)
664 #define AVIERR_READONLY MAKE_AVIERR(114)
665 #define AVIERR_NODATA MAKE_AVIERR(115)
666 #define AVIERR_BUFFERTOOSMALL MAKE_AVIERR(116)
667 #define AVIERR_CANTCOMPRESS MAKE_AVIERR(117)
668 #define AVIERR_USERABORT MAKE_AVIERR(198)
669 #define AVIERR_ERROR MAKE_AVIERR(199)
674 #endif /* __WINE_VFW_H */