Source code of Windows XP (NT5)
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.

906 lines
25 KiB

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