Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

791 lines
24 KiB

  1. /*
  2. * Header file for comunication with AVI installable compressors/decompressors
  3. *
  4. * Copyright (c) 1990-1994, Microsoft Corp. All rights reserved.
  5. *
  6. * Win16:
  7. *
  8. * Installable compressors should be listed in SYSTEM.INI as
  9. * follows:
  10. *
  11. * [Drivers]
  12. * VIDC.MSSQ = mssqcomp.drv
  13. * VIDC.XXXX = foodrv.drv
  14. *
  15. * Win32: (NT)
  16. *
  17. * Installable compressors should be listed in the registration database
  18. * under the key
  19. * HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32
  20. * VIDC.MSSQ = mssqcomp.dll
  21. * VIDC.XXXX = foodrv.dll
  22. *
  23. *
  24. * That is, an identifying FOURCC should be the key, and the value
  25. * should be the driver filename
  26. *
  27. */
  28. #ifndef _INC_COMPMAN
  29. #define _INC_COMPMAN
  30. #ifndef RC_INVOKED
  31. #ifndef VFWAPI
  32. #ifdef WIN32
  33. #define VFWAPI WINAPI
  34. #ifdef WINAPIV
  35. #define VFWAPIV WINAPIV
  36. #else
  37. #define VFWAPIV FAR CDECL
  38. #endif
  39. #else
  40. #define VFWAPI FAR PASCAL
  41. #define VFWAPIV FAR CDECL
  42. #endif
  43. #endif
  44. #endif
  45. #ifdef __cplusplus
  46. extern "C" { /* Assume C declarations for C++ */
  47. #endif /* __cplusplus */
  48. /************************************************************************
  49. messages and structures.
  50. ************************************************************************/
  51. #if !defined HTASK
  52. #define HTASK HANDLE
  53. #endif
  54. #include "compddk.h" // include this file for the messages.
  55. // begin_vfw32
  56. /************************************************************************
  57. ICM function declarations
  58. ************************************************************************/
  59. BOOL VFWAPI ICInfo(DWORD fccType, DWORD fccHandler, ICINFO FAR * lpicinfo);
  60. BOOL VFWAPI ICInstall(DWORD fccType, DWORD fccHandler, LPARAM lParam, LPSTR szDesc, UINT wFlags);
  61. BOOL VFWAPI ICRemove(DWORD fccType, DWORD fccHandler, UINT wFlags);
  62. LRESULT VFWAPI ICGetInfo(HIC hic, ICINFO FAR *picinfo, DWORD cb);
  63. HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode);
  64. HIC VFWAPI ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, FARPROC lpfnHandler);
  65. LRESULT VFWAPI ICClose(HIC hic);
  66. LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD dw1, DWORD dw2);
  67. #ifndef WIN32
  68. //this function is unsupported on Win32 as it is non-portable.
  69. LRESULT VFWAPIV ICMessage(HIC hic, UINT msg, UINT cb, ...);
  70. #endif
  71. /* Values for wFlags of ICInstall() */
  72. #define ICINSTALL_FUNCTION 0x0001 // lParam is a DriverProc (function ptr)
  73. #define ICINSTALL_DRIVER 0x0002 // lParam is a driver name (string)
  74. #define ICINSTALL_HDRV 0x0004 // lParam is a HDRVR (driver handle)
  75. /************************************************************************
  76. query macros
  77. ************************************************************************/
  78. #define ICMF_CONFIGURE_QUERY 0x00000001
  79. #define ICMF_ABOUT_QUERY 0x00000001
  80. #define ICQueryAbout(hic) \
  81. (ICSendMessage(hic, ICM_ABOUT, (DWORD) -1, ICMF_ABOUT_QUERY) == ICERR_OK)
  82. #define ICAbout(hic, hwnd) \
  83. ICSendMessage(hic, ICM_ABOUT, (DWORD)(UINT)(hwnd), 0)
  84. #define ICQueryConfigure(hic) \
  85. (ICSendMessage(hic, ICM_CONFIGURE, (DWORD) -1, ICMF_CONFIGURE_QUERY) == ICERR_OK)
  86. #define ICConfigure(hic, hwnd) \
  87. ICSendMessage(hic, ICM_CONFIGURE, (DWORD)(UINT)(hwnd), 0)
  88. /************************************************************************
  89. get/set state macros
  90. ************************************************************************/
  91. #define ICGetState(hic, pv, cb) \
  92. ICSendMessage(hic, ICM_GETSTATE, (DWORD)(LPVOID)(pv), (DWORD)(cb))
  93. #define ICSetState(hic, pv, cb) \
  94. ICSendMessage(hic, ICM_SETSTATE, (DWORD)(LPVOID)(pv), (DWORD)(cb))
  95. #define ICGetStateSize(hic) \
  96. ICGetState(hic, NULL, 0)
  97. /************************************************************************
  98. get value macros
  99. ************************************************************************/
  100. static DWORD dwICValue;
  101. #define ICGetDefaultQuality(hic) \
  102. (ICSendMessage(hic, ICM_GETDEFAULTQUALITY, (DWORD)(LPVOID)&dwICValue, sizeof(DWORD)), dwICValue)
  103. #define ICGetDefaultKeyFrameRate(hic) \
  104. (ICSendMessage(hic, ICM_GETDEFAULTKEYFRAMERATE, (DWORD)(LPVOID)&dwICValue, sizeof(DWORD)), dwICValue)
  105. /************************************************************************
  106. draw window macro
  107. ************************************************************************/
  108. #define ICDrawWindow(hic, prc) \
  109. ICSendMessage(hic, ICM_DRAW_WINDOW, (DWORD)(LPVOID)(prc), sizeof(RECT))
  110. /************************************************************************
  111. compression functions
  112. ************************************************************************/
  113. /*
  114. * ICCompress()
  115. *
  116. * compress a single frame
  117. *
  118. */
  119. DWORD VFWAPIV ICCompress(
  120. HIC hic,
  121. DWORD dwFlags, // flags
  122. LPBITMAPINFOHEADER lpbiOutput, // output format
  123. LPVOID lpData, // output data
  124. LPBITMAPINFOHEADER lpbiInput, // format of frame to compress
  125. LPVOID lpBits, // frame data to compress
  126. LPDWORD lpckid, // ckid for data in AVI file
  127. LPDWORD lpdwFlags, // flags in the AVI index.
  128. LONG lFrameNum, // frame number of seq.
  129. DWORD dwFrameSize, // reqested size in bytes. (if non zero)
  130. DWORD dwQuality, // quality within one frame
  131. LPBITMAPINFOHEADER lpbiPrev, // format of previous frame
  132. LPVOID lpPrev); // previous frame
  133. /*
  134. * ICCompressBegin()
  135. *
  136. * start compression from a source format (lpbiInput) to a dest
  137. * format (lpbiOuput) is supported.
  138. *
  139. */
  140. #define ICCompressBegin(hic, lpbiInput, lpbiOutput) \
  141. ICSendMessage(hic, ICM_COMPRESS_BEGIN, (DWORD)(LPVOID)(lpbiInput), (DWORD)(LPVOID)(lpbiOutput))
  142. /*
  143. * ICCompressQuery()
  144. *
  145. * determines if compression from a source format (lpbiInput) to a dest
  146. * format (lpbiOuput) is supported.
  147. *
  148. */
  149. #define ICCompressQuery(hic, lpbiInput, lpbiOutput) \
  150. ICSendMessage(hic, ICM_COMPRESS_QUERY, (DWORD)(LPVOID)(lpbiInput), (DWORD)(LPVOID)(lpbiOutput))
  151. /*
  152. * ICCompressGetFormat()
  153. *
  154. * get the output format, (format of compressed data)
  155. * if lpbiOutput is NULL return the size in bytes needed for format.
  156. *
  157. */
  158. #define ICCompressGetFormat(hic, lpbiInput, lpbiOutput) \
  159. ICSendMessage(hic, ICM_COMPRESS_GET_FORMAT, (DWORD)(LPVOID)(lpbiInput), (DWORD)(LPVOID)(lpbiOutput))
  160. #define ICCompressGetFormatSize(hic, lpbi) \
  161. ICCompressGetFormat(hic, lpbi, NULL)
  162. /*
  163. * ICCompressSize()
  164. *
  165. * return the maximal size of a compressed frame
  166. *
  167. */
  168. #define ICCompressGetSize(hic, lpbiInput, lpbiOutput) \
  169. ICSendMessage(hic, ICM_COMPRESS_GET_SIZE, (DWORD)(LPVOID)(lpbiInput), (DWORD)(LPVOID)(lpbiOutput))
  170. #define ICCompressEnd(hic) \
  171. ICSendMessage(hic, ICM_COMPRESS_END, 0, 0)
  172. /************************************************************************
  173. decompression functions
  174. ************************************************************************/
  175. /*
  176. * ICDecompress()
  177. *
  178. * decompress a single frame
  179. *
  180. */
  181. #define ICDECOMPRESS_HURRYUP 0x80000000L // don't draw just buffer (hurry up!)
  182. DWORD VFWAPIV ICDecompress(
  183. HIC hic,
  184. DWORD dwFlags, // flags (from AVI index...)
  185. LPBITMAPINFOHEADER lpbiFormat, // BITMAPINFO of compressed data
  186. // biSizeImage has the chunk size
  187. LPVOID lpData, // data
  188. LPBITMAPINFOHEADER lpbi, // DIB to decompress to
  189. LPVOID lpBits);
  190. /*
  191. * ICDecompressBegin()
  192. *
  193. * start compression from a source format (lpbiInput) to a dest
  194. * format (lpbiOutput) is supported.
  195. *
  196. */
  197. #define ICDecompressBegin(hic, lpbiInput, lpbiOutput) \
  198. ICSendMessage(hic, ICM_DECOMPRESS_BEGIN, (DWORD)(LPVOID)(lpbiInput), (DWORD)(LPVOID)(lpbiOutput))
  199. /*
  200. * ICDecompressQuery()
  201. *
  202. * determines if compression from a source format (lpbiInput) to a dest
  203. * format (lpbiOutput) is supported.
  204. *
  205. */
  206. #define ICDecompressQuery(hic, lpbiInput, lpbiOutput) \
  207. ICSendMessage(hic, ICM_DECOMPRESS_QUERY, (DWORD)(LPVOID)(lpbiInput), (DWORD)(LPVOID)(lpbiOutput))
  208. /*
  209. * ICDecompressGetFormat()
  210. *
  211. * get the output format, (format of un-compressed data)
  212. * if lpbiOutput is NULL return the size in bytes needed for format.
  213. *
  214. */
  215. #define ICDecompressGetFormat(hic, lpbiInput, lpbiOutput) \
  216. ((LONG) ICSendMessage(hic, ICM_DECOMPRESS_GET_FORMAT, (DWORD)(LPVOID)(lpbiInput), (DWORD)(LPVOID)(lpbiOutput)))
  217. #define ICDecompressGetFormatSize(hic, lpbi) \
  218. ICDecompressGetFormat(hic, lpbi, NULL)
  219. /*
  220. * ICDecompressGetPalette()
  221. *
  222. * get the output palette
  223. *
  224. */
  225. #define ICDecompressGetPalette(hic, lpbiInput, lpbiOutput) \
  226. ICSendMessage(hic, ICM_DECOMPRESS_GET_PALETTE, (DWORD)(LPVOID)(lpbiInput), (DWORD)(LPVOID)(lpbiOutput))
  227. #define ICDecompressSetPalette(hic, lpbiPalette) \
  228. ICSendMessage(hic, ICM_DECOMPRESS_SET_PALETTE, (DWORD)(LPVOID)(lpbiPalette), 0)
  229. #define ICDecompressEnd(hic) \
  230. ICSendMessage(hic, ICM_DECOMPRESS_END, 0, 0)
  231. /************************************************************************
  232. decompression (ex) functions
  233. ************************************************************************/
  234. // end_vfw32
  235. #ifdef WIN32
  236. // begin_vfw32
  237. //
  238. // on Win16 these functions are macros that call ICMessage. ICMessage will
  239. // not work on NT. rather than add new entrypoints we have given
  240. // them as static inline functions
  241. //
  242. /*
  243. * ICDecompressEx()
  244. *
  245. * decompress a single frame
  246. *
  247. */
  248. static __inline LRESULT VFWAPI
  249. ICDecompressEx(
  250. HIC hic,
  251. DWORD dwFlags,
  252. LPBITMAPINFOHEADER lpbiSrc,
  253. LPVOID lpSrc,
  254. int xSrc,
  255. int ySrc,
  256. int dxSrc,
  257. int dySrc,
  258. LPBITMAPINFOHEADER lpbiDst,
  259. LPVOID lpDst,
  260. int xDst,
  261. int yDst,
  262. int dxDst,
  263. int dyDst)
  264. {
  265. ICDECOMPRESSEX ic;
  266. ic.dwFlags = dwFlags;
  267. ic.lpbiSrc = lpbiSrc;
  268. ic.lpSrc = lpSrc;
  269. ic.xSrc = xSrc;
  270. ic.ySrc = ySrc;
  271. ic.dxSrc = dxSrc;
  272. ic.dySrc = dySrc;
  273. ic.lpbiDst = lpbiDst;
  274. ic.lpDst = lpDst;
  275. ic.xDst = xDst;
  276. ic.yDst = yDst;
  277. ic.dxDst = dxDst;
  278. ic.dyDst = dyDst;
  279. // note that ICM swaps round the length and pointer
  280. // length in lparam2, pointer in lparam1
  281. return ICSendMessage(hic, ICM_DECOMPRESSEX, (DWORD)&ic, sizeof(ic));
  282. }
  283. /*
  284. * ICDecompressExBegin()
  285. *
  286. * start compression from a source format (lpbiInput) to a dest
  287. * format (lpbiOutput) is supported.
  288. *
  289. */
  290. static __inline LRESULT VFWAPI
  291. ICDecompressExBegin(
  292. HIC hic,
  293. DWORD dwFlags,
  294. LPBITMAPINFOHEADER lpbiSrc,
  295. LPVOID lpSrc,
  296. int xSrc,
  297. int ySrc,
  298. int dxSrc,
  299. int dySrc,
  300. LPBITMAPINFOHEADER lpbiDst,
  301. LPVOID lpDst,
  302. int xDst,
  303. int yDst,
  304. int dxDst,
  305. int dyDst)
  306. {
  307. ICDECOMPRESSEX ic;
  308. ic.dwFlags = dwFlags;
  309. ic.lpbiSrc = lpbiSrc;
  310. ic.lpSrc = lpSrc;
  311. ic.xSrc = xSrc;
  312. ic.ySrc = ySrc;
  313. ic.dxSrc = dxSrc;
  314. ic.dySrc = dySrc;
  315. ic.lpbiDst = lpbiDst;
  316. ic.lpDst = lpDst;
  317. ic.xDst = xDst;
  318. ic.yDst = yDst;
  319. ic.dxDst = dxDst;
  320. ic.dyDst = dyDst;
  321. // note that ICM swaps round the length and pointer
  322. // length in lparam2, pointer in lparam1
  323. return ICSendMessage(hic, ICM_DECOMPRESSEX_BEGIN, (DWORD)&ic, sizeof(ic));
  324. }
  325. /*
  326. * ICDecompressExQuery()
  327. *
  328. */
  329. static __inline LRESULT VFWAPI
  330. ICDecompressExQuery(
  331. HIC hic,
  332. DWORD dwFlags,
  333. LPBITMAPINFOHEADER lpbiSrc,
  334. LPVOID lpSrc,
  335. int xSrc,
  336. int ySrc,
  337. int dxSrc,
  338. int dySrc,
  339. LPBITMAPINFOHEADER lpbiDst,
  340. LPVOID lpDst,
  341. int xDst,
  342. int yDst,
  343. int dxDst,
  344. int dyDst)
  345. {
  346. ICDECOMPRESSEX ic;
  347. ic.dwFlags = dwFlags;
  348. ic.lpbiSrc = lpbiSrc;
  349. ic.lpSrc = lpSrc;
  350. ic.xSrc = xSrc;
  351. ic.ySrc = ySrc;
  352. ic.dxSrc = dxSrc;
  353. ic.dySrc = dySrc;
  354. ic.lpbiDst = lpbiDst;
  355. ic.lpDst = lpDst;
  356. ic.xDst = xDst;
  357. ic.yDst = yDst;
  358. ic.dxDst = dxDst;
  359. ic.dyDst = dyDst;
  360. // note that ICM swaps round the length and pointer
  361. // length in lparam2, pointer in lparam1
  362. return ICSendMessage(hic, ICM_DECOMPRESSEX_QUERY, (DWORD)&ic, sizeof(ic));
  363. }
  364. // end_vfw32
  365. #else
  366. // these macros need to be functions for WIN32 because ICMessage is
  367. // essentially unsupportable on NT
  368. /*
  369. * ICDecompressEx()
  370. *
  371. * decompress a single frame
  372. *
  373. */
  374. #define ICDecompressEx(hic, dwFlags, lpbiSrc, lpSrc, xSrc, ySrc, dxSrc, dySrc, lpbiDst, lpDst, xDst, yDst, dxDst, dyDst) \
  375. ICMessage(hic, ICM_DECOMPRESSEX, sizeof(ICDECOMPRESSEX), \
  376. (DWORD)(dwFlags), \
  377. (LPBITMAPINFOHEADER)(lpbiSrc), (LPVOID)(lpSrc), \
  378. (LPBITMAPINFOHEADER)(lpbiDst), (LPVOID)(lpDst), \
  379. (int)(xDst), (int)(yDst), (int)(dxDst), (int)(dyDst), \
  380. (int)(xSrc), (int)(ySrc), (int)(dxSrc), (int)(dySrc))
  381. /*
  382. * ICDecompressBegin()
  383. *
  384. * start compression from a source format (lpbiInput) to a dest
  385. * format (lpbiOutput) is supported.
  386. *
  387. */
  388. #define ICDecompressExBegin(hic, dwFlags, lpbiSrc, lpSrc, xSrc, ySrc, dxSrc, dySrc, lpbiDst, lpDst, xDst, yDst, dxDst, dyDst) \
  389. ICMessage(hic, ICM_DECOMPRESSEX_BEGIN, sizeof(ICDECOMPRESSEX), \
  390. (DWORD)(dwFlags), \
  391. (LPBITMAPINFOHEADER)(lpbiSrc), (LPVOID)(lpSrc), \
  392. (LPBITMAPINFOHEADER)(lpbiDst), (LPVOID)(lpDst), \
  393. (int)(xDst), (int)(yDst), (int)(dxDst), (int)(dyDst), \
  394. (int)(xSrc), (int)(ySrc), (int)(dxSrc), (int)(dySrc))
  395. /*
  396. * ICDecompressExQuery()
  397. *
  398. */
  399. #define ICDecompressExQuery(hic, dwFlags, lpbiSrc, lpSrc, xSrc, ySrc, dxSrc, dySrc, lpbiDst, lpDst, xDst, yDst, dxDst, dyDst) \
  400. ICMessage(hic, ICM_DECOMPRESSEX_QUERY, sizeof(ICDECOMPRESSEX), \
  401. (DWORD)(dwFlags), \
  402. (LPBITMAPINFOHEADER)(lpbiSrc), (LPVOID)(lpSrc), \
  403. (LPBITMAPINFOHEADER)(lpbiDst), (LPVOID)(lpDst), \
  404. (int)(xDst), (int)(yDst), (int)(dxDst), (int)(dyDst), \
  405. (int)(xSrc), (int)(ySrc), (int)(dxSrc), (int)(dySrc))
  406. #endif
  407. // begin_vfw32
  408. #define ICDecompressExEnd(hic) \
  409. ICSendMessage(hic, ICM_DECOMPRESSEX_END, 0, 0)
  410. /************************************************************************
  411. drawing functions
  412. ************************************************************************/
  413. /*
  414. * ICDrawBegin()
  415. *
  416. * start decompressing data with format (lpbiInput) directly to the screen
  417. *
  418. * return zero if the decompressor supports drawing.
  419. *
  420. */
  421. #define ICDRAW_QUERY 0x00000001L // test for support
  422. #define ICDRAW_FULLSCREEN 0x00000002L // draw to full screen
  423. #define ICDRAW_HDC 0x00000004L // draw to a HDC/HWND
  424. DWORD VFWAPIV ICDrawBegin(
  425. HIC hic,
  426. DWORD dwFlags, // flags
  427. HPALETTE hpal, // palette to draw with
  428. HWND hwnd, // window to draw to
  429. HDC hdc, // HDC to draw to
  430. int xDst, // destination rectangle
  431. int yDst,
  432. int dxDst,
  433. int dyDst,
  434. LPBITMAPINFOHEADER lpbi, // format of frame to draw
  435. int xSrc, // source rectangle
  436. int ySrc,
  437. int dxSrc,
  438. int dySrc,
  439. DWORD dwRate, // frames/second = (dwRate/dwScale)
  440. DWORD dwScale);
  441. /*
  442. * ICDraw()
  443. *
  444. * decompress data directly to the screen
  445. *
  446. */
  447. #define ICDRAW_HURRYUP 0x80000000L // don't draw just buffer (hurry up!)
  448. #define ICDRAW_UPDATE 0x40000000L // don't draw just update screen
  449. DWORD VFWAPIV ICDraw(
  450. HIC hic,
  451. DWORD dwFlags, // flags
  452. LPVOID lpFormat, // format of frame to decompress
  453. LPVOID lpData, // frame data to decompress
  454. DWORD cbData, // size of data
  455. LONG lTime); // time to draw this frame
  456. // end_vfw32
  457. #ifdef WIN32
  458. // begin_vfw32
  459. // ICMessage is not supported on Win32, so provide a static inline function
  460. // to do the same job
  461. static __inline LRESULT VFWAPI
  462. ICDrawSuggestFormat(
  463. HIC hic,
  464. LPBITMAPINFOHEADER lpbiIn,
  465. LPBITMAPINFOHEADER lpbiOut,
  466. int dxSrc,
  467. int dySrc,
  468. int dxDst,
  469. int dyDst,
  470. HIC hicDecomp)
  471. {
  472. ICDRAWSUGGEST ic;
  473. ic.lpbiIn = lpbiIn;
  474. ic.lpbiSuggest = lpbiOut;
  475. ic.dxSrc = dxSrc;
  476. ic.dySrc = dySrc;
  477. ic.dxDst = dxDst;
  478. ic.dyDst = dyDst;
  479. ic.hicDecompressor = hicDecomp;
  480. // note that ICM swaps round the length and pointer
  481. // length in lparam2, pointer in lparam1
  482. return ICSendMessage(hic, ICM_DRAW_SUGGESTFORMAT, (DWORD)&ic, sizeof(ic));
  483. }
  484. // end_vfw32
  485. #else
  486. #define ICDrawSuggestFormat(hic,lpbiIn,lpbiOut,dxSrc,dySrc,dxDst,dyDst,hicDecomp) \
  487. ICMessage(hic, ICM_DRAW_SUGGESTFORMAT, sizeof(ICDRAWSUGGEST), \
  488. (LPBITMAPINFOHEADER)(lpbiIn),(LPBITMAPINFOHEADER)(lpbiOut), \
  489. (int)(dxSrc),(int)(dySrc),(int)(dxDst),(int)(dyDst), (HIC)(hicDecomp))
  490. #endif
  491. // begin_vfw32
  492. /*
  493. * ICDrawQuery()
  494. *
  495. * determines if the compressor is willing to render the specified format.
  496. *
  497. */
  498. #define ICDrawQuery(hic, lpbiInput) \
  499. ICSendMessage(hic, ICM_DRAW_QUERY, (DWORD)(LPVOID)(lpbiInput), 0L)
  500. #define ICDrawChangePalette(hic, lpbiInput) \
  501. ICSendMessage(hic, ICM_DRAW_CHANGEPALETTE, (DWORD)(LPVOID)(lpbiInput), 0L)
  502. #define ICGetBuffersWanted(hic, lpdwBuffers) \
  503. ICSendMessage(hic, ICM_GETBUFFERSWANTED, (DWORD)(LPVOID)(lpdwBuffers), 0)
  504. #define ICDrawEnd(hic) \
  505. ICSendMessage(hic, ICM_DRAW_END, 0, 0)
  506. #define ICDrawStart(hic) \
  507. ICSendMessage(hic, ICM_DRAW_START, 0, 0)
  508. #define ICDrawStartPlay(hic, lFrom, lTo) \
  509. ICSendMessage(hic, ICM_DRAW_START_PLAY, (DWORD)(lFrom), (DWORD)(lTo))
  510. #define ICDrawStop(hic) \
  511. ICSendMessage(hic, ICM_DRAW_STOP, 0, 0)
  512. #define ICDrawStopPlay(hic) \
  513. ICSendMessage(hic, ICM_DRAW_STOP_PLAY, 0, 0)
  514. #define ICDrawGetTime(hic, lplTime) \
  515. ICSendMessage(hic, ICM_DRAW_GETTIME, (DWORD)(LPVOID)(lplTime), 0)
  516. #define ICDrawSetTime(hic, lTime) \
  517. ICSendMessage(hic, ICM_DRAW_SETTIME, (DWORD)lTime, 0)
  518. #define ICDrawRealize(hic, hdc, fBackground) \
  519. ICSendMessage(hic, ICM_DRAW_REALIZE, (DWORD)(UINT)(HDC)(hdc), (DWORD)(BOOL)(fBackground))
  520. #define ICDrawFlush(hic) \
  521. ICSendMessage(hic, ICM_DRAW_FLUSH, 0, 0)
  522. #define ICDrawRenderBuffer(hic) \
  523. ICSendMessage(hic, ICM_DRAW_RENDERBUFFER, 0, 0)
  524. /************************************************************************
  525. Status callback functions
  526. ************************************************************************/
  527. /*
  528. * ICSetStatusProc()
  529. *
  530. * Set the status callback function
  531. *
  532. */
  533. // end_vfw32
  534. #ifdef WIN32
  535. // begin_vfw32
  536. // ICMessage is not supported on NT
  537. static __inline LRESULT VFWAPI
  538. ICSetStatusProc(
  539. HIC hic,
  540. DWORD dwFlags,
  541. LRESULT lParam,
  542. LONG (CALLBACK *fpfnStatus)(LPARAM, UINT, LONG) )
  543. {
  544. ICSETSTATUSPROC ic;
  545. ic.dwFlags = dwFlags;
  546. ic.lParam = lParam;
  547. ic.Status = fpfnStatus;
  548. // note that ICM swaps round the length and pointer
  549. // length in lparam2, pointer in lparam1
  550. return ICSendMessage(hic, ICM_SET_STATUS_PROC, (DWORD)&ic, sizeof(ic));
  551. }
  552. // end_vfw32
  553. #else
  554. #define ICSetStatusProc(hic, dwFlags, lParam, fpfnStatus) \
  555. ICMessage(hic, ICM_SET_STATUS_PROC, sizeof(ICSETSTATUSPROC), \
  556. (DWORD)(dwFlags), \
  557. (LRESULT)(lParam), \
  558. (LONG ((CALLBACK *) ()))(fpfnStatus))
  559. #endif
  560. // begin_vfw32
  561. /************************************************************************
  562. helper routines for DrawDib and MCIAVI...
  563. ************************************************************************/
  564. #define ICDecompressOpen(fccType, fccHandler, lpbiIn, lpbiOut) \
  565. ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, ICMODE_DECOMPRESS)
  566. #define ICDrawOpen(fccType, fccHandler, lpbiIn) \
  567. ICLocate(fccType, fccHandler, lpbiIn, NULL, ICMODE_DRAW)
  568. HIC VFWAPI ICLocate(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wFlags);
  569. HIC VFWAPI ICGetDisplayFormat(HIC hic, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, int BitDepth, int dx, int dy);
  570. /************************************************************************
  571. Higher level functions
  572. ************************************************************************/
  573. HANDLE VFWAPI ICImageCompress(
  574. HIC hic, // compressor to use
  575. UINT uiFlags, // flags (none yet)
  576. LPBITMAPINFO lpbiIn, // format to compress from
  577. LPVOID lpBits, // data to compress
  578. LPBITMAPINFO lpbiOut, // compress to this (NULL ==> default)
  579. LONG lQuality, // quality to use
  580. LONG FAR * plSize); // compress to this size (0=whatever)
  581. HANDLE VFWAPI ICImageDecompress(
  582. HIC hic, // compressor to use
  583. UINT uiFlags, // flags (none yet)
  584. LPBITMAPINFO lpbiIn, // format to decompress from
  585. LPVOID lpBits, // data to decompress
  586. LPBITMAPINFO lpbiOut); // decompress to this (NULL ==> default)
  587. //
  588. // Structure used by ICSeqCompressFrame and ICCompressorChoose routines
  589. // Make sure this matches the autodoc in icm.c!
  590. //
  591. typedef struct {
  592. LONG cbSize; // set to sizeof(COMPVARS) before
  593. // calling ICCompressorChoose
  594. DWORD dwFlags; // see below...
  595. HIC hic; // HIC of chosen compressor
  596. DWORD fccType; // basically ICTYPE_VIDEO
  597. DWORD fccHandler; // handler of chosen compressor or
  598. // "" or "DIB "
  599. LPBITMAPINFO lpbiIn; // input format
  600. LPBITMAPINFO lpbiOut; // output format - will compress to this
  601. LPVOID lpBitsOut;
  602. LPVOID lpBitsPrev;
  603. LONG lFrame;
  604. LONG lKey; // key frames how often?
  605. LONG lDataRate; // desired data rate KB/Sec
  606. LONG lQ; // desired quality
  607. LONG lKeyCount;
  608. LPVOID lpState; // state of compressor
  609. LONG cbState; // size of the state
  610. } COMPVARS, FAR *PCOMPVARS;
  611. // FLAGS for dwFlags element of COMPVARS structure:
  612. // set this flag if you initialize COMPVARS before calling ICCompressorChoose
  613. #define ICMF_COMPVARS_VALID 0x00000001 // COMPVARS contains valid data
  614. //
  615. // allows user to choose compressor, quality etc...
  616. //
  617. BOOL VFWAPI ICCompressorChoose(
  618. HWND hwnd, // parent window for dialog
  619. UINT uiFlags, // flags
  620. LPVOID pvIn, // input format (optional)
  621. LPVOID lpData, // input data (optional)
  622. PCOMPVARS pc, // data about the compressor/dlg
  623. LPSTR lpszTitle); // dialog title (optional)
  624. // defines for uiFlags
  625. #define ICMF_CHOOSE_KEYFRAME 0x0001 // show KeyFrame Every box
  626. #define ICMF_CHOOSE_DATARATE 0x0002 // show DataRate box
  627. #define ICMF_CHOOSE_PREVIEW 0x0004 // allow expanded preview dialog
  628. #define ICMF_CHOOSE_ALLCOMPRESSORS 0x0008 // don't only show those that
  629. // can handle the input format
  630. // or input data
  631. BOOL VFWAPI ICSeqCompressFrameStart(PCOMPVARS pc, LPBITMAPINFO lpbiIn);
  632. void VFWAPI ICSeqCompressFrameEnd(PCOMPVARS pc);
  633. LPVOID VFWAPI ICSeqCompressFrame(
  634. PCOMPVARS pc, // set by ICCompressorChoose
  635. UINT uiFlags, // flags
  636. LPVOID lpBits, // input DIB bits
  637. BOOL FAR *pfKey, // did it end up being a key frame?
  638. LONG FAR *plSize); // size to compress to/of returned image
  639. void VFWAPI ICCompressorFree(PCOMPVARS pc);
  640. // end_vfw32
  641. #ifdef __cplusplus
  642. } /* End of extern "C" { */
  643. #endif /* __cplusplus */
  644. #endif /* _INC_COMPMAN */