Use emergency TEB selector to avoid debugger crashes when stepping
[wine] / include / vfw.h
1 #ifndef __WINE_VFW_H
2 #define __WINE_VFW_H
3
4 #include <wintypes.h>
5 #include <driver.h>
6
7 #define VFWAPI  WINAPI
8 #define VFWAPIV WINAPIV
9
10 DWORD VFWAPI VideoForWindowsVersion(void);
11
12 #ifndef aviTWOCC
13 #define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
14 #endif
15
16 #define ICTYPE_VIDEO    mmioFOURCC('v', 'i', 'd', 'c')
17 #define ICTYPE_AUDIO    mmioFOURCC('a', 'u', 'd', 'c')
18
19
20 /* Installable Compressor M? */
21
22 /* HIC32 struct (same layout as Win95 one) */
23 typedef struct tagWINE_HIC {
24         DWORD           magic;          /* 00: 'Smag' */
25         HANDLE32        curthread;      /* 04: */
26         DWORD           type;           /* 08: */
27         DWORD           handler;        /* 0C: */
28         HDRVR32         hdrv;           /* 10: */
29         DWORD           private;        /* 14: private data passed to drv */
30         FARPROC32       driverproc;     /* 18: */
31         DWORD           x1;             /* 1c: name? */
32         WORD            x2;             /* 20: */
33         DWORD           x3;             /* 22: */
34                                         /* 26: */
35 } WINE_HIC;
36
37 /* error return codes */
38 #define ICERR_OK                0
39 #define ICERR_DONTDRAW          1
40 #define ICERR_NEWPALETTE        2
41 #define ICERR_GOTOKEYFRAME      3
42 #define ICERR_STOPDRAWING       4
43
44 #define ICERR_UNSUPPORTED       -1
45 #define ICERR_BADFORMAT         -2
46 #define ICERR_MEMORY            -3
47 #define ICERR_INTERNAL          -4
48 #define ICERR_BADFLAGS          -5
49 #define ICERR_BADPARAM          -6
50 #define ICERR_BADSIZE           -7
51 #define ICERR_BADHANDLE         -8
52 #define ICERR_CANTUPDATE        -9
53 #define ICERR_ABORT             -10
54 #define ICERR_ERROR             -100
55 #define ICERR_BADBITDEPTH       -200
56 #define ICERR_BADIMAGESIZE      -201
57
58 #define ICERR_CUSTOM            -400
59
60 /* ICM Messages */
61 #define ICM_USER                (DRV_USER+0x0000)
62
63 /* ICM driver message range */
64 #define ICM_RESERVED_LOW        (DRV_USER+0x1000)
65 #define ICM_RESERVED_HIGH       (DRV_USER+0x2000)
66 #define ICM_RESERVED            ICM_RESERVED_LOW
67
68 #define ICM_GETSTATE            (ICM_RESERVED+0)
69 #define ICM_SETSTATE            (ICM_RESERVED+1)
70 #define ICM_GETINFO             (ICM_RESERVED+2)
71
72 #define ICM_CONFIGURE           (ICM_RESERVED+10)
73 #define ICM_ABOUT               (ICM_RESERVED+11)
74 /* */
75
76 #define ICM_GETDEFAULTQUALITY   (ICM_RESERVED+30)
77 #define ICM_GETQUALITY          (ICM_RESERVED+31)
78 #define ICM_SETQUALITY          (ICM_RESERVED+32)
79
80 #define ICM_SET                 (ICM_RESERVED+40)
81 #define ICM_GET                 (ICM_RESERVED+41)
82
83 /* 2 constant FOURCC codes */
84 #define ICM_FRAMERATE           mmioFOURCC('F','r','m','R')
85 #define ICM_KEYFRAMERATE        mmioFOURCC('K','e','y','R')
86
87 #define ICM_COMPRESS_GET_FORMAT         (ICM_USER+4)
88 #define ICM_COMPRESS_GET_SIZE           (ICM_USER+5)
89 #define ICM_COMPRESS_QUERY              (ICM_USER+6)
90 #define ICM_COMPRESS_BEGIN              (ICM_USER+7)
91 #define ICM_COMPRESS                    (ICM_USER+8)
92 #define ICM_COMPRESS_END                (ICM_USER+9)
93
94 #define ICM_DECOMPRESS_GET_FORMAT       (ICM_USER+10)
95 #define ICM_DECOMPRESS_QUERY            (ICM_USER+11)
96 #define ICM_DECOMPRESS_BEGIN            (ICM_USER+12)
97 #define ICM_DECOMPRESS                  (ICM_USER+13)
98 #define ICM_DECOMPRESS_END              (ICM_USER+14)
99 #define ICM_DECOMPRESS_SET_PALETTE      (ICM_USER+29)
100 #define ICM_DECOMPRESS_GET_PALETTE      (ICM_USER+30)
101
102 #define ICM_DRAW_QUERY                  (ICM_USER+31)
103 #define ICM_DRAW_BEGIN                  (ICM_USER+15)
104 #define ICM_DRAW_GET_PALETTE            (ICM_USER+16)
105 #define ICM_DRAW_START                  (ICM_USER+18)
106 #define ICM_DRAW_STOP                   (ICM_USER+19)
107 #define ICM_DRAW_END                    (ICM_USER+21)
108 #define ICM_DRAW_GETTIME                (ICM_USER+32)
109 #define ICM_DRAW                        (ICM_USER+33)
110 #define ICM_DRAW_WINDOW                 (ICM_USER+34)
111 #define ICM_DRAW_SETTIME                (ICM_USER+35)
112 #define ICM_DRAW_REALIZE                (ICM_USER+36)
113 #define ICM_DRAW_FLUSH                  (ICM_USER+37)
114 #define ICM_DRAW_RENDERBUFFER           (ICM_USER+38)
115
116 #define ICM_DRAW_START_PLAY             (ICM_USER+39)
117 #define ICM_DRAW_STOP_PLAY              (ICM_USER+40)
118
119 #define ICM_DRAW_SUGGESTFORMAT          (ICM_USER+50)
120 #define ICM_DRAW_CHANGEPALETTE          (ICM_USER+51)
121
122 #define ICM_GETBUFFERSWANTED            (ICM_USER+41)
123
124 #define ICM_GETDEFAULTKEYFRAMERATE      (ICM_USER+42)
125
126 #define ICM_DECOMPRESSEX_BEGIN          (ICM_USER+60)
127 #define ICM_DECOMPRESSEX_QUERY          (ICM_USER+61)
128 #define ICM_DECOMPRESSEX                (ICM_USER+62)
129 #define ICM_DECOMPRESSEX_END            (ICM_USER+63)
130
131 #define ICM_COMPRESS_FRAMES_INFO        (ICM_USER+70)
132 #define ICM_SET_STATUS_PROC             (ICM_USER+72)
133
134 /* structs */
135
136 typedef struct {
137         DWORD   dwSize;         /* 00: size */
138         DWORD   fccType;        /* 04: type 'vidc' usually */
139         DWORD   fccHandler;     /* 08: */
140         DWORD   dwVersion;      /* 0c: version of compman opening you */
141         DWORD   dwFlags;        /* 10: LOWORD is type specific */
142         LRESULT dwError;        /* 14: */
143         LPVOID  pV1Reserved;    /* 18: */
144         LPVOID  pV2Reserved;    /* 1c: */
145         DWORD   dnDevNode;      /* 20: */
146                                 /* 24: */
147 } ICOPEN,*LPICOPEN;
148
149 /* Values for dwFlags of ICOpen() */
150 #define ICMODE_COMPRESS         1
151 #define ICMODE_DECOMPRESS       2
152 #define ICMODE_FASTDECOMPRESS   3
153 #define ICMODE_QUERY            4
154 #define ICMODE_FASTCOMPRESS     5
155 #define ICMODE_DRAW             8
156
157 /* quality flags */
158 #define ICQUALITY_LOW       0
159 #define ICQUALITY_HIGH      10000
160 #define ICQUALITY_DEFAULT   -1
161
162 typedef struct {
163         DWORD   dwSize;         /* 00: */
164         DWORD   fccType;        /* 04:compressor type     'vidc' 'audc' */
165         DWORD   fccHandler;     /* 08:compressor sub-type 'rle ' 'jpeg' 'pcm '*/
166         DWORD   dwFlags;        /* 0c:flags LOWORD is type specific */
167         DWORD   dwVersion;      /* 10:version of the driver */
168         DWORD   dwVersionICM;   /* 14:version of the ICM used */
169         /*
170          * under Win32, the driver always returns UNICODE strings.
171          */
172         WCHAR   szName[16];             /* 18:short name */
173         WCHAR   szDescription[128];     /* 38:long name */
174         WCHAR   szDriver[128];          /* 138:driver that contains compressor*/
175                                         /* 238: */
176 } ICINFO32;
177
178
179 /* Flags for the <dwFlags> field of the <ICINFO> structure. */
180 #define VIDCF_QUALITY           0x0001  /* supports quality */
181 #define VIDCF_CRUNCH            0x0002  /* supports crunching to a frame size */
182 #define VIDCF_TEMPORAL          0x0004  /* supports inter-frame compress */
183 #define VIDCF_COMPRESSFRAMES    0x0008  /* wants the compress all frames message */
184 #define VIDCF_DRAW              0x0010  /* supports drawing */
185 #define VIDCF_FASTTEMPORALC     0x0020  /* does not need prev frame on compress */
186 #define VIDCF_FASTTEMPORALD     0x0080  /* does not need prev frame on decompress */
187 #define VIDCF_QUALITYTIME       0x0040  /* supports temporal quality */
188
189 #define VIDCF_FASTTEMPORAL      (VIDCF_FASTTEMPORALC|VIDCF_FASTTEMPORALD)
190
191
192 /* function shortcuts */
193 /* ICM_ABOUT */
194 #define ICMF_ABOUT_QUERY         0x00000001
195
196 #define ICQueryAbout(hic) \
197         (ICSendMessage(hic,ICM_ABOUT,(DWORD)-1,ICMF_ABOUT_QUERY)==ICERR_OK)
198
199 #define ICAbout(hic, hwnd) \
200         ICSendMessage(hic,ICM_ABOUT,(DWORD)(UINT)(hwnd),0)
201
202 /* ICM_CONFIGURE */
203 #define ICMF_CONFIGURE_QUERY    0x00000001
204 #define ICQueryConfigure(hic) \
205         (ICSendMessage(hic,ICM_CONFIGURE,(DWORD)-1,ICMF_CONFIGURE_QUERY)==ICERR_OK)
206
207 #define ICConfigure(hic,hwnd) \
208         ICSendMessage(hic,ICM_CONFIGURE,(DWORD)(UINT)(hwnd),0)
209
210 /* Decompression stuff */
211 #define ICDECOMPRESS_HURRYUP            0x80000000      /* don't draw just buffer (hurry up!) */
212 #define ICDECOMPRESS_UPDATE             0x40000000      /* don't draw just update screen */
213 #define ICDECOMPRESS_PREROL             0x20000000      /* this frame is before real start */
214 #define ICDECOMPRESS_NULLFRAME          0x10000000      /* repeat last frame */
215 #define ICDECOMPRESS_NOTKEYFRAME        0x08000000      /* this frame is not a key frame */
216
217 typedef struct {
218     DWORD               dwFlags;        /* flags (from AVI index...) */
219     LPBITMAPINFOHEADER  lpbiInput;      /* BITMAPINFO of compressed data */
220     LPVOID              lpInput;        /* compressed data */
221     LPBITMAPINFOHEADER  lpbiOutput;     /* DIB to decompress to */
222     LPVOID              lpOutput;
223     DWORD               ckid;           /* ckid from AVI file */
224 } ICDECOMPRESS;
225
226 typedef struct {
227     DWORD               dwFlags;
228     LPBITMAPINFOHEADER  lpbiSrc;
229     LPVOID              lpSrc;
230     LPBITMAPINFOHEADER  lpbiDst;
231     LPVOID              lpDst;
232
233     /* changed for ICM_DECOMPRESSEX */
234     INT32               xDst;       /* destination rectangle */
235     INT32               yDst;
236     INT32               dxDst;
237     INT32               dyDst;
238
239     INT32               xSrc;       /* source rectangle */
240     INT32               ySrc;
241     INT32               dxSrc;
242     INT32               dySrc;
243 } ICDECOMPRESSEX;
244
245 #define ICDRAW_QUERY        0x00000001L   // test for support
246 #define ICDRAW_FULLSCREEN   0x00000002L   // draw to full screen
247 #define ICDRAW_HDC          0x00000004L   // draw to a HDC/HWND
248
249
250 BOOL32  VFWAPI  ICInfo32(DWORD fccType, DWORD fccHandler, ICINFO32 * lpicinfo);
251 LRESULT VFWAPI  ICGetInfo32(HIC32 hic,ICINFO32 *picinfo, DWORD cb);
252 HIC32   VFWAPI  ICOpen32(DWORD fccType, DWORD fccHandler, UINT32 wMode);
253 LRESULT VFWAPI  ICSendMessage32(HIC32 hic, UINT32 msg, DWORD dw1, DWORD dw2);
254 DWORD   VFWAPIV ICDrawBegin32(
255         HIC32                   hic,
256         DWORD                   dwFlags,/* flags */
257         HPALETTE32              hpal,   /* palette to draw with */
258         HWND32                  hwnd,   /* window to draw to */
259         HDC32                   hdc,    /* HDC to draw to */
260         INT32                   xDst,   /* destination rectangle */
261         INT32                   yDst,
262         INT32                   dxDst,
263         INT32                   dyDst,
264         LPBITMAPINFOHEADER      lpbi,   /* format of frame to draw */
265         INT32                   xSrc,   /* source rectangle */
266         INT32                   ySrc,
267         INT32                   dxSrc,
268         INT32                   dySrc,
269         DWORD                   dwRate, /* frames/second = (dwRate/dwScale) */
270         DWORD                   dwScale);
271
272 #endif