2 * msvideo 16-bit functions
4 * Copyright 1998 Marcus Meissner
5 * Copyright 2000 Bradley Baetz
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "stackframe.h"
27 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(msvideo);
31 /* handle16 --> handle conversions */
32 #define HDRAWDIB_32(h16) ((HDRAWDIB)(ULONG_PTR)(h16))
33 #define HIC_32(h16) ((HIC)(ULONG_PTR)(h16))
35 /* handle --> handle16 conversions */
36 #define HDRAWDIB_16(h32) (LOWORD(h32))
37 #define HIC_16(h32) (LOWORD(h32))
40 /***********************************************************************
41 * DrawDibOpen [MSVIDEO.102]
43 HDRAWDIB16 VFWAPI DrawDibOpen16(void)
45 return HDRAWDIB_16(DrawDibOpen());
48 /***********************************************************************
49 * DrawDibClose [MSVIDEO.103]
51 BOOL16 VFWAPI DrawDibClose16(HDRAWDIB16 hdd)
53 return DrawDibClose(HDRAWDIB_32(hdd));
56 /************************************************************************
57 * DrawDibBegin [MSVIDEO.104]
59 BOOL16 VFWAPI DrawDibBegin16(HDRAWDIB16 hdd, HDC16 hdc, INT16 dxDst,
60 INT16 dyDst, LPBITMAPINFOHEADER lpbi, INT16 dxSrc,
61 INT16 dySrc, UINT16 wFlags)
63 return DrawDibBegin(HDRAWDIB_32(hdd), HDC_32(hdc), dxDst, dyDst, lpbi,
64 dxSrc, dySrc, wFlags);
67 /***********************************************************************
68 * DrawDibEnd [MSVIDEO.105]
70 BOOL16 VFWAPI DrawDibEnd16(HDRAWDIB16 hdd)
72 return DrawDibEnd(HDRAWDIB_32(hdd));
75 /**********************************************************************
76 * DrawDibDraw [MSVIDEO.106]
78 BOOL16 VFWAPI DrawDibDraw16(HDRAWDIB16 hdd, HDC16 hdc, INT16 xDst, INT16 yDst,
79 INT16 dxDst, INT16 dyDst, LPBITMAPINFOHEADER lpbi,
80 LPVOID lpBits, INT16 xSrc, INT16 ySrc, INT16 dxSrc,
81 INT16 dySrc, UINT16 wFlags)
83 return DrawDibDraw(HDRAWDIB_32(hdd), HDC_32(hdc), xDst, yDst, dxDst,
84 dyDst, lpbi, lpBits, xSrc, ySrc, dxSrc, dySrc, wFlags);
87 /***********************************************************************
88 * DrawDibGetPalette [MSVIDEO.108]
90 HPALETTE16 VFWAPI DrawDibGetPalette16(HDRAWDIB16 hdd)
92 return HPALETTE_16(DrawDibGetPalette(HDRAWDIB_32(hdd)));
95 /***********************************************************************
96 * DrawDibSetPalette [MSVIDEO.110]
98 BOOL16 VFWAPI DrawDibSetPalette16(HDRAWDIB16 hdd, HPALETTE16 hpal)
100 return DrawDibSetPalette(HDRAWDIB_32(hdd), HPALETTE_32(hpal));
103 /***********************************************************************
104 * DrawDibRealize [MSVIDEO.112]
106 UINT16 VFWAPI DrawDibRealize16(HDRAWDIB16 hdd, HDC16 hdc,
109 return (UINT16) DrawDibRealize(HDRAWDIB_32(hdd), HDC_32(hdc), fBackground);
112 /*************************************************************************
113 * DrawDibStart [MSVIDEO.118]
115 BOOL16 VFWAPI DrawDibStart16(HDRAWDIB16 hdd, DWORD rate)
117 return DrawDibStart(HDRAWDIB_32(hdd), rate);
120 /*************************************************************************
121 * DrawDibStop [MSVIDEO.119]
123 BOOL16 DrawDibStop16(HDRAWDIB16 hdd)
125 return DrawDibStop(HDRAWDIB_32(hdd));
128 /***********************************************************************
129 * ICOpen [MSVIDEO.203]
131 HIC16 VFWAPI ICOpen16(DWORD fccType, DWORD fccHandler, UINT16 wMode)
133 return HIC_16(ICOpen(fccType, fccHandler, wMode));
136 /***********************************************************************
137 * ICClose [MSVIDEO.204]
139 LRESULT WINAPI ICClose16(HIC16 hic)
141 return ICClose(HIC_32(hic));
144 /***********************************************************************
145 * _ICMessage [MSVIDEO.207]
147 LRESULT VFWAPIV ICMessage16(void)
160 hic = VA_ARG16(valist, HIC16);
161 msg = VA_ARG16(valist, UINT16);
162 cb = VA_ARG16(valist, UINT16);
164 lpData = HeapAlloc(GetProcessHeap(), 0, cb);
166 TRACE("0x%08lx, %u, %u, ...)\n", (DWORD) hic, msg, cb);
168 for (i = 0; i < cb / sizeof(WORD); i++) {
169 lpData[i] = VA_ARG16(valist, WORD);
173 segData = MapLS(lpData);
174 ret = ICSendMessage16(hic, msg, segData, (DWORD) cb);
176 HeapFree(GetProcessHeap(), 0, lpData);
180 /***********************************************************************
181 * ICGetInfo [MSVIDEO.212]
183 LRESULT VFWAPI ICGetInfo16(HIC16 hic, ICINFO16 * picinfo, DWORD cb)
187 TRACE("(0x%08lx,%p,%ld)\n", (DWORD) hic, picinfo, cb);
188 ret = ICSendMessage16(hic, ICM_GETINFO, (DWORD) picinfo, cb);
189 TRACE(" -> 0x%08lx\n", ret);
193 /***********************************************************************
194 * ICLocate [MSVIDEO.213]
196 HIC16 VFWAPI ICLocate16(DWORD fccType, DWORD fccHandler,
197 LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut,
200 return HIC_16(ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, wFlags));
203 /***********************************************************************
204 * _ICCompress [MSVIDEO.224]
206 DWORD VFWAPIV ICCompress16(HIC16 hic, DWORD dwFlags,
207 LPBITMAPINFOHEADER lpbiOutput, LPVOID lpData,
208 LPBITMAPINFOHEADER lpbiInput, LPVOID lpBits,
209 LPDWORD lpckid, LPDWORD lpdwFlags,
210 LONG lFrameNum, DWORD dwFrameSize,
211 DWORD dwQuality, LPBITMAPINFOHEADER lpbiPrev,
219 TRACE("(0x%08lx,%ld,%p,%p,%p,%p,...)\n", (DWORD) hic, dwFlags,
220 lpbiOutput, lpData, lpbiInput, lpBits);
222 iccmp.dwFlags = dwFlags;
224 iccmp.lpbiOutput = lpbiOutput;
225 iccmp.lpOutput = lpData;
226 iccmp.lpbiInput = lpbiInput;
227 iccmp.lpInput = lpBits;
229 iccmp.lpckid = lpckid;
230 iccmp.lpdwFlags = lpdwFlags;
231 iccmp.lFrameNum = lFrameNum;
232 iccmp.dwFrameSize = dwFrameSize;
233 iccmp.dwQuality = dwQuality;
234 iccmp.lpbiPrev = lpbiPrev;
235 iccmp.lpPrev = lpPrev;
236 seg_iccmp = MapLS(&iccmp);
237 ret = ICSendMessage16(hic, ICM_COMPRESS, seg_iccmp, sizeof(ICCOMPRESS));
242 /***********************************************************************
243 * _ICDecompress [MSVIDEO.230]
245 DWORD VFWAPIV ICDecompress16(HIC16 hic, DWORD dwFlags,
246 LPBITMAPINFOHEADER lpbiFormat, LPVOID lpData,
247 LPBITMAPINFOHEADER lpbi, LPVOID lpBits)
253 TRACE("(0x%08lx,%ld,%p,%p,%p,%p)\n", (DWORD) hic, dwFlags, lpbiFormat,
254 lpData, lpbi, lpBits);
256 icd.dwFlags = dwFlags;
257 icd.lpbiInput = lpbiFormat;
258 icd.lpInput = lpData;
259 icd.lpbiOutput = lpbi;
260 icd.lpOutput = lpBits;
262 segptr = MapLS(&icd);
263 ret = ICSendMessage16(hic, ICM_DECOMPRESS, segptr, sizeof(ICDECOMPRESS));
268 /***********************************************************************
269 * _ICDrawBegin [MSVIDEO.232]
271 DWORD VFWAPIV ICDrawBegin16(HIC16 hic, /* [in] */
272 DWORD dwFlags, /* [in] flags */
273 HPALETTE16 hpal, /* [in] palette to draw with */
274 HWND16 hwnd, /* [in] window to draw to */
275 HDC16 hdc, /* [in] HDC to draw to */
276 INT16 xDst, /* [in] destination rectangle */
277 INT16 yDst, /* [in] */
278 INT16 dxDst, /* [in] */
279 INT16 dyDst, /* [in] */
280 LPBITMAPINFOHEADER lpbi, /* [in] format of frame to draw NOTE: SEGPTR */
281 INT16 xSrc, /* [in] source rectangle */
282 INT16 ySrc, /* [in] */
283 INT16 dxSrc, /* [in] */
284 INT16 dySrc, /* [in] */
285 DWORD dwRate, /* [in] frames/second = (dwRate/dwScale) */
286 DWORD dwScale) /* [in] */
292 TRACE ("(0x%08lx,%ld,0x%08lx,0x%08lx,0x%08lx,%u,%u,%u,%u,%p,%u,%u,%u,%u,%ld,%ld)\n",
293 (DWORD) hic, dwFlags, (DWORD) hpal, (DWORD) hwnd, (DWORD) hdc,
294 xDst, yDst, dxDst, dyDst, lpbi, xSrc, ySrc, dxSrc, dySrc, dwRate,
297 icdb.dwFlags = dwFlags;
305 icdb.lpbi = lpbi; /* Keep this as SEGPTR for the mapping code to deal with */
310 icdb.dwRate = dwRate;
311 icdb.dwScale = dwScale;
312 seg_icdb = MapLS(&icdb);
313 ret = (DWORD) ICSendMessage16(hic, ICM_DRAW_BEGIN, seg_icdb,
314 sizeof(ICDRAWBEGIN16));
319 /***********************************************************************
320 * _ICDraw [MSVIDEO.234]
322 DWORD VFWAPIV ICDraw16(HIC16 hic, DWORD dwFlags,
323 LPVOID lpFormat, /* [???] NOTE: SEGPTR */
324 LPVOID lpData, /* [???] NOTE: SEGPTR */
325 DWORD cbData, LONG lTime)
331 TRACE("(0x%08lx,0x%08lx,%p,%p,%ld,%ld)\n", (DWORD) hic, dwFlags,
332 lpFormat, lpData, cbData, lTime);
333 icd.dwFlags = dwFlags;
334 icd.lpFormat = lpFormat;
338 seg_icd = MapLS(&icd);
339 ret = ICSendMessage16(hic, ICM_DRAW, seg_icd, sizeof(ICDRAW));
344 /***********************************************************************
345 * ICGetDisplayFormat [MSVIDEO.239]
347 HIC16 VFWAPI ICGetDisplayFormat16(HIC16 hic, LPBITMAPINFOHEADER lpbiIn,
348 LPBITMAPINFOHEADER lpbiOut, INT16 depth,
351 return HIC_16(ICGetDisplayFormat(HIC_32(hic), lpbiIn, lpbiOut, depth,