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.

3786 lines
136 KiB

  1. /****************************************************************************
  2. *
  3. * VfW.H - Video for windows include file for WIN32
  4. *
  5. * Copyright (c) 1991-1995, Microsoft Corp. All rights reserved.
  6. *
  7. * This include files defines interfaces to the following
  8. * video components
  9. *
  10. * COMPMAN - Installable Compression Manager.
  11. * DRAWDIB - Routines for drawing to the display.
  12. * VIDEO - Video Capture Driver Interface
  13. *
  14. * AVIFMT - AVI File Format structure definitions.
  15. * MMREG - FOURCC and other things
  16. *
  17. * AVIFile - Interface for reading AVI Files and AVI Streams
  18. * MCIWND - MCI/AVI window class
  19. * AVICAP - AVI Capture Window class
  20. *
  21. * MSACM - Audio compression manager.
  22. *
  23. * The following symbols control inclusion of various parts of this file:
  24. *
  25. * NOCOMPMAN - dont include COMPMAN
  26. * NODRAWDIB - dont include DRAWDIB
  27. * NOVIDEO - dont include video capture interface
  28. *
  29. * NOAVIFMT - dont include AVI file format structs
  30. * NOMMREG - dont include MMREG
  31. *
  32. * NOAVIFILE - dont include AVIFile interface
  33. * NOMCIWND - dont include AVIWnd class.
  34. * NOAVICAP - dont include AVICap class.
  35. *
  36. * NOMSACM - dont include ACM stuff.
  37. *
  38. ****************************************************************************/
  39. #ifndef _INC_VFW
  40. #define _INC_VFW
  41. #ifdef __cplusplus
  42. extern "C" { /* Assume C declarations for C++ */
  43. #endif /* __cplusplus */
  44. /****************************************************************************
  45. *
  46. * types
  47. *
  48. ***************************************************************************/
  49. #define VFWAPI WINAPI
  50. #define VFWAPIV WINAPIV
  51. /****************************************************************************
  52. *
  53. * VideoForWindowsVersion() - returns version of VfW
  54. *
  55. ***************************************************************************/
  56. DWORD FAR PASCAL VideoForWindowsVersion(void);
  57. /****************************************************************************
  58. *
  59. * call these to start stop using VfW from your app.
  60. *
  61. ***************************************************************************/
  62. LONG VFWAPI InitVFW(void);
  63. LONG VFWAPI TermVFW(void);
  64. #ifdef __cplusplus
  65. } // extern "C"
  66. #endif /* __cplusplus */
  67. /****************************************************************************
  68. *
  69. * do we need MMSYSTEM?
  70. *
  71. ****************************************************************************/
  72. #if !defined(_INC_MMSYSTEM) && (!defined(NOVIDEO) || !defined(NOAVICAP))
  73. #include <mmsystem.h>
  74. #endif
  75. #ifdef __cplusplus
  76. extern "C" { /* Assume C declarations for C++ */
  77. #endif /* __cplusplus */
  78. /****************************************************************************/
  79. /* */
  80. /* Macros */
  81. /* */
  82. /* should we define this?? */
  83. /* */
  84. /****************************************************************************/
  85. #ifndef MKFOURCC
  86. #define MKFOURCC( ch0, ch1, ch2, ch3 ) \
  87. ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
  88. ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
  89. #endif
  90. #if !defined(_INC_MMSYSTEM)
  91. #define mmioFOURCC MKFOURCC
  92. #endif
  93. /****************************************************************************
  94. *
  95. * COMPMAN - Installable Compression Manager.
  96. *
  97. ****************************************************************************/
  98. #ifndef NOCOMPMAN
  99. #define ICVERSION 0x0104
  100. DECLARE_HANDLE(HIC); /* Handle to a Installable Compressor */
  101. //
  102. // this code in biCompression means the DIB must be accesed via
  103. // 48 bit pointers! using *ONLY* the selector given.
  104. //
  105. #define BI_1632 0x32333631 // '1632'
  106. #ifndef mmioFOURCC
  107. #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
  108. ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
  109. ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
  110. #endif
  111. #ifndef aviTWOCC
  112. #define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
  113. #endif
  114. #ifndef ICTYPE_VIDEO
  115. #define ICTYPE_VIDEO mmioFOURCC('v', 'i', 'd', 'c')
  116. #define ICTYPE_AUDIO mmioFOURCC('a', 'u', 'd', 'c')
  117. #endif
  118. #ifndef ICERR_OK
  119. #define ICERR_OK 0L
  120. #define ICERR_DONTDRAW 1L
  121. #define ICERR_NEWPALETTE 2L
  122. #define ICERR_GOTOKEYFRAME 3L
  123. #define ICERR_STOPDRAWING 4L
  124. #define ICERR_UNSUPPORTED -1L
  125. #define ICERR_BADFORMAT -2L
  126. #define ICERR_MEMORY -3L
  127. #define ICERR_INTERNAL -4L
  128. #define ICERR_BADFLAGS -5L
  129. #define ICERR_BADPARAM -6L
  130. #define ICERR_BADSIZE -7L
  131. #define ICERR_BADHANDLE -8L
  132. #define ICERR_CANTUPDATE -9L
  133. #define ICERR_ABORT -10L
  134. #define ICERR_ERROR -100L
  135. #define ICERR_BADBITDEPTH -200L
  136. #define ICERR_BADIMAGESIZE -201L
  137. #define ICERR_CUSTOM -400L // errors less than ICERR_CUSTOM...
  138. #endif
  139. /* Values for dwFlags of ICOpen() */
  140. #ifndef ICMODE_COMPRESS
  141. #define ICMODE_COMPRESS 1
  142. #define ICMODE_DECOMPRESS 2
  143. #define ICMODE_FASTDECOMPRESS 3
  144. #define ICMODE_QUERY 4
  145. #define ICMODE_FASTCOMPRESS 5
  146. #define ICMODE_DRAW 8
  147. #endif
  148. #ifndef _WIN32 // ;Internal
  149. #define ICMODE_INTERNALF_FUNCTION32 0x8000 // ;Internal
  150. #define ICMODE_INTERNALF_MASK 0x8000 // ;Internal
  151. #endif // ;Internal
  152. /* Flags for AVI file index */
  153. #define AVIIF_LIST 0x00000001L
  154. #define AVIIF_TWOCC 0x00000002L
  155. #define AVIIF_KEYFRAME 0x00000010L
  156. /* quality flags */
  157. #define ICQUALITY_LOW 0
  158. #define ICQUALITY_HIGH 10000
  159. #define ICQUALITY_DEFAULT -1
  160. /************************************************************************
  161. ************************************************************************/
  162. #define ICM_USER (DRV_USER+0x0000)
  163. #define ICM_RESERVED ICM_RESERVED_LOW
  164. #define ICM_RESERVED_LOW (DRV_USER+0x1000)
  165. #define ICM_RESERVED_HIGH (DRV_USER+0x2000)
  166. /************************************************************************
  167. messages.
  168. ************************************************************************/
  169. #define ICM_GETSTATE (ICM_RESERVED+0) // Get compressor state
  170. #define ICM_SETSTATE (ICM_RESERVED+1) // Set compressor state
  171. #define ICM_GETINFO (ICM_RESERVED+2) // Query info about the compressor
  172. #define ICM_CONFIGURE (ICM_RESERVED+10) // show the configure dialog
  173. #define ICM_ABOUT (ICM_RESERVED+11) // show the about box
  174. #define ICM_GETERRORTEXT (ICM_RESERVED+12) // get error text TBD ;Internal
  175. #define ICM_GETFORMATNAME (ICM_RESERVED+20) // get a name for a format ;Internal
  176. #define ICM_ENUMFORMATS (ICM_RESERVED+21) // cycle through formats ;Internal
  177. #define ICM_GETDEFAULTQUALITY (ICM_RESERVED+30) // get the default value for quality
  178. #define ICM_GETQUALITY (ICM_RESERVED+31) // get the current value for quality
  179. #define ICM_SETQUALITY (ICM_RESERVED+32) // set the default value for quality
  180. #define ICM_SET (ICM_RESERVED+40) // Tell the driver something
  181. #define ICM_GET (ICM_RESERVED+41) // Ask the driver something
  182. // Constants for ICM_SET:
  183. #define ICM_FRAMERATE mmioFOURCC('F','r','m','R')
  184. #define ICM_KEYFRAMERATE mmioFOURCC('K','e','y','R')
  185. /************************************************************************
  186. ICM specific messages.
  187. ************************************************************************/
  188. #define ICM_COMPRESS_GET_FORMAT (ICM_USER+4) // get compress format or size
  189. #define ICM_COMPRESS_GET_SIZE (ICM_USER+5) // get output size
  190. #define ICM_COMPRESS_QUERY (ICM_USER+6) // query support for compress
  191. #define ICM_COMPRESS_BEGIN (ICM_USER+7) // begin a series of compress calls.
  192. #define ICM_COMPRESS (ICM_USER+8) // compress a frame
  193. #define ICM_COMPRESS_END (ICM_USER+9) // end of a series of compress calls.
  194. #define ICM_DECOMPRESS_GET_FORMAT (ICM_USER+10) // get decompress format or size
  195. #define ICM_DECOMPRESS_QUERY (ICM_USER+11) // query support for dempress
  196. #define ICM_DECOMPRESS_BEGIN (ICM_USER+12) // start a series of decompress calls
  197. #define ICM_DECOMPRESS (ICM_USER+13) // decompress a frame
  198. #define ICM_DECOMPRESS_END (ICM_USER+14) // end a series of decompress calls
  199. #define ICM_DECOMPRESS_SET_PALETTE (ICM_USER+29) // fill in the DIB color table
  200. #define ICM_DECOMPRESS_GET_PALETTE (ICM_USER+30) // fill in the DIB color table
  201. #define ICM_DRAW_QUERY (ICM_USER+31) // query support for dempress
  202. #define ICM_DRAW_BEGIN (ICM_USER+15) // start a series of draw calls
  203. #define ICM_DRAW_GET_PALETTE (ICM_USER+16) // get the palette needed for drawing
  204. #define ICM_DRAW_UPDATE (ICM_USER+17) // update screen with current frame ;Internal
  205. #define ICM_DRAW_START (ICM_USER+18) // start decompress clock
  206. #define ICM_DRAW_STOP (ICM_USER+19) // stop decompress clock
  207. #define ICM_DRAW_BITS (ICM_USER+20) // decompress a frame to screen ;Internal
  208. #define ICM_DRAW_END (ICM_USER+21) // end a series of draw calls
  209. #define ICM_DRAW_GETTIME (ICM_USER+32) // get value of decompress clock
  210. #define ICM_DRAW (ICM_USER+33) // generalized "render" message
  211. #define ICM_DRAW_WINDOW (ICM_USER+34) // drawing window has moved or hidden
  212. #define ICM_DRAW_SETTIME (ICM_USER+35) // set correct value for decompress clock
  213. #define ICM_DRAW_REALIZE (ICM_USER+36) // realize palette for drawing
  214. #define ICM_DRAW_FLUSH (ICM_USER+37) // clear out buffered frames
  215. #define ICM_DRAW_RENDERBUFFER (ICM_USER+38) // draw undrawn things in queue
  216. #define ICM_DRAW_START_PLAY (ICM_USER+39) // start of a play
  217. #define ICM_DRAW_STOP_PLAY (ICM_USER+40) // end of a play
  218. #define ICM_DRAW_SUGGESTFORMAT (ICM_USER+50) // Like ICGetDisplayFormat
  219. #define ICM_DRAW_CHANGEPALETTE (ICM_USER+51) // for animating palette
  220. #define ICM_DRAW_IDLE (ICM_USER+52) // send each frame time ;Internal
  221. #define ICM_GETBUFFERSWANTED (ICM_USER+41) // ask about prebuffering
  222. #define ICM_GETDEFAULTKEYFRAMERATE (ICM_USER+42) // get the default value for key frames
  223. #define ICM_DECOMPRESSEX_BEGIN (ICM_USER+60) // start a series of decompress calls
  224. #define ICM_DECOMPRESSEX_QUERY (ICM_USER+61) // start a series of decompress calls
  225. #define ICM_DECOMPRESSEX (ICM_USER+62) // decompress a frame
  226. #define ICM_DECOMPRESSEX_END (ICM_USER+63) // end a series of decompress calls
  227. #define ICM_COMPRESS_FRAMES_INFO (ICM_USER+70) // tell about compress to come
  228. #define ICM_COMPRESS_FRAMES (ICM_USER+71) // compress a bunch of frames ;Internal
  229. #define ICM_SET_STATUS_PROC (ICM_USER+72) // set status callback
  230. /************************************************************************
  231. ************************************************************************/
  232. typedef struct {
  233. DWORD dwSize; // sizeof(ICOPEN)
  234. DWORD fccType; // 'vidc'
  235. DWORD fccHandler; //
  236. DWORD dwVersion; // version of compman opening you
  237. DWORD dwFlags; // LOWORD is type specific
  238. LRESULT dwError; // error return.
  239. LPVOID pV1Reserved; // Reserved
  240. LPVOID pV2Reserved; // Reserved
  241. DWORD dnDevNode; // Devnode for PnP devices
  242. } ICOPEN;
  243. /************************************************************************
  244. ************************************************************************/
  245. typedef struct {
  246. DWORD dwSize; // sizeof(ICINFO)
  247. DWORD fccType; // compressor type 'vidc' 'audc'
  248. DWORD fccHandler; // compressor sub-type 'rle ' 'jpeg' 'pcm '
  249. DWORD dwFlags; // flags LOWORD is type specific
  250. DWORD dwVersion; // version of the driver
  251. DWORD dwVersionICM; // version of the ICM used
  252. //
  253. // under Win32, the driver always returns UNICODE strings.
  254. //
  255. WCHAR szName[16]; // short name
  256. WCHAR szDescription[128]; // long name
  257. WCHAR szDriver[128]; // driver that contains compressor
  258. } ICINFO;
  259. /* Flags for the <dwFlags> field of the <ICINFO> structure. */
  260. #define VIDCF_QUALITY 0x0001 // supports quality
  261. #define VIDCF_CRUNCH 0x0002 // supports crunching to a frame size
  262. #define VIDCF_TEMPORAL 0x0004 // supports inter-frame compress
  263. #define VIDCF_COMPRESSFRAMES 0x0008 // wants the compress all frames message
  264. #define VIDCF_DRAW 0x0010 // supports drawing
  265. #define VIDCF_FASTTEMPORALC 0x0020 // does not need prev frame on compress
  266. #define VIDCF_FASTTEMPORALD 0x0080 // does not need prev frame on decompress
  267. //#define VIDCF_QUALITYTIME 0x0040 // supports temporal quality
  268. //#define VIDCF_FASTTEMPORAL (VIDCF_FASTTEMPORALC|VIDCF_FASTTEMPORALD)
  269. /************************************************************************
  270. ************************************************************************/
  271. #define ICCOMPRESS_KEYFRAME 0x00000001L
  272. typedef struct {
  273. DWORD dwFlags; // flags
  274. LPBITMAPINFOHEADER lpbiOutput; // output format
  275. LPVOID lpOutput; // output data
  276. LPBITMAPINFOHEADER lpbiInput; // format of frame to compress
  277. LPVOID lpInput; // frame data to compress
  278. LPDWORD lpckid; // ckid for data in AVI file
  279. LPDWORD lpdwFlags; // flags in the AVI index.
  280. LONG lFrameNum; // frame number of seq.
  281. DWORD dwFrameSize; // reqested size in bytes. (if non zero)
  282. DWORD dwQuality; // quality
  283. // these are new fields
  284. LPBITMAPINFOHEADER lpbiPrev; // format of previous frame
  285. LPVOID lpPrev; // previous frame
  286. } ICCOMPRESS;
  287. /************************************************************************
  288. ************************************************************************/
  289. #define ICCOMPRESSFRAMES_PADDING 0x00000001
  290. typedef struct {
  291. DWORD dwFlags; // flags
  292. LPBITMAPINFOHEADER lpbiOutput; // output format
  293. LPARAM lOutput; // output identifier
  294. LPBITMAPINFOHEADER lpbiInput; // format of frame to compress
  295. LPARAM lInput; // input identifier
  296. LONG lStartFrame; // start frame
  297. LONG lFrameCount; // # of frames
  298. LONG lQuality; // quality
  299. LONG lDataRate; // data rate
  300. LONG lKeyRate; // key frame rate
  301. DWORD dwRate; // frame rate, as always
  302. DWORD dwScale;
  303. DWORD dwOverheadPerFrame;
  304. DWORD dwReserved2;
  305. LONG (CALLBACK *GetData)(LPARAM lInput, LONG lFrame, LPVOID lpBits, LONG len);
  306. LONG (CALLBACK *PutData)(LPARAM lOutput, LONG lFrame, LPVOID lpBits, LONG len);
  307. } ICCOMPRESSFRAMES;
  308. typedef struct {
  309. DWORD dwFlags;
  310. LPARAM lParam;
  311. // messages for Status callback
  312. #define ICSTATUS_START 0
  313. #define ICSTATUS_STATUS 1 // l == % done
  314. #define ICSTATUS_END 2
  315. #define ICSTATUS_ERROR 3 // l == error string (LPSTR)
  316. #define ICSTATUS_YIELD 4
  317. // return nonzero means abort operation in progress
  318. LONG (CALLBACK *Status) (LPARAM lParam, UINT message, LONG l);
  319. } ICSETSTATUSPROC;
  320. /************************************************************************
  321. ************************************************************************/
  322. #define ICDECOMPRESS_HURRYUP 0x80000000L // don't draw just buffer (hurry up!)
  323. #define ICDECOMPRESS_UPDATE 0x40000000L // don't draw just update screen
  324. #define ICDECOMPRESS_PREROLL 0x20000000L // this frame is before real start
  325. #define ICDECOMPRESS_NULLFRAME 0x10000000L // repeat last frame
  326. #define ICDECOMPRESS_NOTKEYFRAME 0x08000000L // this frame is not a key frame
  327. typedef struct {
  328. DWORD dwFlags; // flags (from AVI index...)
  329. LPBITMAPINFOHEADER lpbiInput; // BITMAPINFO of compressed data
  330. // biSizeImage has the chunk size
  331. LPVOID lpInput; // compressed data
  332. LPBITMAPINFOHEADER lpbiOutput; // DIB to decompress to
  333. LPVOID lpOutput;
  334. DWORD ckid; // ckid from AVI file
  335. } ICDECOMPRESS;
  336. typedef struct {
  337. //
  338. // same as ICM_DECOMPRESS
  339. //
  340. DWORD dwFlags;
  341. LPBITMAPINFOHEADER lpbiSrc; // BITMAPINFO of compressed data
  342. LPVOID lpSrc; // compressed data
  343. LPBITMAPINFOHEADER lpbiDst; // DIB to decompress to
  344. LPVOID lpDst; // output data
  345. //
  346. // new for ICM_DECOMPRESSEX
  347. //
  348. int xDst; // destination rectangle
  349. int yDst;
  350. int dxDst;
  351. int dyDst;
  352. int xSrc; // source rectangle
  353. int ySrc;
  354. int dxSrc;
  355. int dySrc;
  356. } ICDECOMPRESSEX;
  357. /************************************************************************
  358. ************************************************************************/
  359. #define ICDRAW_QUERY 0x00000001L // test for support
  360. #define ICDRAW_FULLSCREEN 0x00000002L // draw to full screen
  361. #define ICDRAW_HDC 0x00000004L // draw to a HDC/HWND
  362. #define ICDRAW_ANIMATE 0x00000008L // expect palette animation
  363. #define ICDRAW_CONTINUE 0x00000010L // draw is a continuation of previous draw
  364. #define ICDRAW_MEMORYDC 0x00000020L // DC is offscreen, by the way
  365. #define ICDRAW_UPDATING 0x00000040L // We're updating, as opposed to playing
  366. #define ICDRAW_RENDER 0x00000080L // used to render data not draw it
  367. #define ICDRAW_BUFFER 0x00000100L // please buffer this data offscreen, we will need to update it
  368. typedef struct {
  369. DWORD dwFlags; // flags
  370. HPALETTE hpal; // palette to draw with
  371. HWND hwnd; // window to draw to
  372. HDC hdc; // HDC to draw to
  373. int xDst; // destination rectangle
  374. int yDst;
  375. int dxDst;
  376. int dyDst;
  377. LPBITMAPINFOHEADER lpbi; // format of frame to draw
  378. int xSrc; // source rectangle
  379. int ySrc;
  380. int dxSrc;
  381. int dySrc;
  382. DWORD dwRate; // frames/second = (dwRate/dwScale)
  383. DWORD dwScale;
  384. } ICDRAWBEGIN;
  385. /************************************************************************
  386. ************************************************************************/
  387. #define ICDRAW_HURRYUP 0x80000000L // don't draw just buffer (hurry up!)
  388. #define ICDRAW_UPDATE 0x40000000L // don't draw just update screen
  389. #define ICDRAW_PREROLL 0x20000000L // this frame is before real start
  390. #define ICDRAW_NULLFRAME 0x10000000L // repeat last frame
  391. #define ICDRAW_NOTKEYFRAME 0x08000000L // this frame is not a key frame
  392. typedef struct {
  393. DWORD dwFlags; // flags
  394. LPVOID lpFormat; // format of frame to decompress
  395. LPVOID lpData; // frame data to decompress
  396. DWORD cbData;
  397. LONG lTime; // time in drawbegin units (see dwRate and dwScale)
  398. } ICDRAW;
  399. typedef struct {
  400. LPBITMAPINFOHEADER lpbiIn; // format to be drawn
  401. LPBITMAPINFOHEADER lpbiSuggest; // location for suggested format (or NULL to get size)
  402. int dxSrc; // source extent or 0
  403. int dySrc;
  404. int dxDst; // dest extent or 0
  405. int dyDst;
  406. HIC hicDecompressor;// decompressor you can talk to
  407. } ICDRAWSUGGEST;
  408. /************************************************************************
  409. ************************************************************************/
  410. typedef struct {
  411. DWORD dwFlags; // flags (from AVI index...)
  412. int iStart; // first palette to change
  413. int iLen; // count of entries to change.
  414. LPPALETTEENTRY lppe; // palette
  415. } ICPALETTE;
  416. /************************************************************************
  417. ICM function declarations
  418. ************************************************************************/
  419. BOOL
  420. VFWAPI
  421. ICInfo(
  422. IN DWORD fccType,
  423. IN DWORD fccHandler,
  424. OUT ICINFO FAR * lpicinfo
  425. );
  426. BOOL
  427. VFWAPI
  428. ICInstall(
  429. IN DWORD fccType,
  430. IN DWORD fccHandler,
  431. IN LPARAM lParam,
  432. IN LPSTR szDesc,
  433. IN UINT wFlags
  434. );
  435. BOOL
  436. VFWAPI
  437. ICRemove(
  438. IN DWORD fccType,
  439. IN DWORD fccHandler,
  440. IN UINT wFlags
  441. );
  442. LRESULT
  443. VFWAPI
  444. ICGetInfo(
  445. IN HIC hic,
  446. OUT ICINFO FAR *picinfo,
  447. IN DWORD cb
  448. );
  449. HIC
  450. VFWAPI
  451. ICOpen(
  452. IN DWORD fccType,
  453. IN DWORD fccHandler,
  454. IN UINT wMode
  455. );
  456. HIC
  457. VFWAPI
  458. ICOpenFunction(
  459. IN DWORD fccType,
  460. IN DWORD fccHandler,
  461. IN UINT wMode,
  462. IN FARPROC lpfnHandler
  463. );
  464. LRESULT
  465. VFWAPI
  466. ICClose(
  467. IN HIC hic
  468. );
  469. LRESULT
  470. VFWAPI
  471. ICSendMessage(
  472. IN HIC hic,
  473. IN UINT msg,
  474. IN DWORD_PTR dw1,
  475. IN DWORD_PTR dw2
  476. );
  477. #ifndef _WIN32
  478. //this function is unsupported on Win32 as it is non-portable.
  479. LRESULT VFWAPIV ICMessage(HIC hic, UINT msg, UINT cb, ...);
  480. #endif
  481. /* Values for wFlags of ICInstall() */
  482. #define ICINSTALL_UNICODE 0x8000
  483. #define ICINSTALL_FUNCTION 0x0001 // lParam is a DriverProc (function ptr)
  484. #define ICINSTALL_DRIVER 0x0002 // lParam is a driver name (string)
  485. #define ICINSTALL_HDRV 0x0004 // lParam is a HDRVR (driver handle)
  486. #define ICINSTALL_DRIVERW 0x8002 // lParam is a unicode driver name
  487. /************************************************************************
  488. query macros
  489. ************************************************************************/
  490. #define ICMF_CONFIGURE_QUERY 0x00000001
  491. #define ICMF_ABOUT_QUERY 0x00000001
  492. #define ICQueryAbout(hic) \
  493. (ICSendMessage(hic, ICM_ABOUT, (DWORD_PTR) -1, ICMF_ABOUT_QUERY) == ICERR_OK)
  494. #define ICAbout(hic, hwnd) \
  495. ICSendMessage(hic, ICM_ABOUT, (DWORD_PTR)(UINT_PTR)(hwnd), 0)
  496. #define ICQueryConfigure(hic) \
  497. (ICSendMessage(hic, ICM_CONFIGURE, (DWORD_PTR) -1, ICMF_CONFIGURE_QUERY) == ICERR_OK)
  498. #define ICConfigure(hic, hwnd) \
  499. ICSendMessage(hic, ICM_CONFIGURE, (DWORD_PTR)(UINT_PTR)(hwnd), 0)
  500. /************************************************************************
  501. get/set state macros
  502. ************************************************************************/
  503. #define ICGetState(hic, pv, cb) \
  504. ICSendMessage(hic, ICM_GETSTATE, (DWORD_PTR)(LPVOID)(pv), (DWORD_PTR)(cb))
  505. #define ICSetState(hic, pv, cb) \
  506. ICSendMessage(hic, ICM_SETSTATE, (DWORD_PTR)(LPVOID)(pv), (DWORD_PTR)(cb))
  507. #define ICGetStateSize(hic) \
  508. (DWORD) ICGetState(hic, NULL, 0)
  509. /************************************************************************
  510. get value macros
  511. ************************************************************************/
  512. static DWORD dwICValue;
  513. #define ICGetDefaultQuality(hic) \
  514. (ICSendMessage(hic, ICM_GETDEFAULTQUALITY, (DWORD_PTR)(LPVOID)&dwICValue, sizeof(DWORD)), dwICValue)
  515. #define ICGetDefaultKeyFrameRate(hic) \
  516. (ICSendMessage(hic, ICM_GETDEFAULTKEYFRAMERATE, (DWORD_PTR)(LPVOID)&dwICValue, sizeof(DWORD)), dwICValue)
  517. /************************************************************************
  518. draw window macro
  519. ************************************************************************/
  520. #define ICDrawWindow(hic, prc) \
  521. ICSendMessage(hic, ICM_DRAW_WINDOW, (DWORD_PTR)(LPVOID)(prc), sizeof(RECT))
  522. /************************************************************************
  523. compression functions
  524. ************************************************************************/
  525. /*
  526. * ICCompress()
  527. *
  528. * compress a single frame
  529. *
  530. */
  531. DWORD
  532. VFWAPIV
  533. ICCompress(
  534. IN HIC hic,
  535. IN DWORD dwFlags, // flags
  536. IN LPBITMAPINFOHEADER lpbiOutput, // output format
  537. OUT LPVOID lpData, // output data
  538. IN LPBITMAPINFOHEADER lpbiInput, // format of frame to compress
  539. IN LPVOID lpBits, // frame data to compress
  540. OUT LPDWORD lpckid, // ckid for data in AVI file
  541. OUT LPDWORD lpdwFlags, // flags in the AVI index.
  542. IN LONG lFrameNum, // frame number of seq.
  543. IN DWORD dwFrameSize, // reqested size in bytes. (if non zero)
  544. IN DWORD dwQuality, // quality within one frame
  545. IN LPBITMAPINFOHEADER lpbiPrev, // format of previous frame
  546. IN LPVOID lpPrev // previous frame
  547. );
  548. /*
  549. * ICCompressBegin()
  550. *
  551. * start compression from a source format (lpbiInput) to a dest
  552. * format (lpbiOuput) is supported.
  553. *
  554. */
  555. #define ICCompressBegin(hic, lpbiInput, lpbiOutput) \
  556. ICSendMessage(hic, ICM_COMPRESS_BEGIN, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput))
  557. /*
  558. * ICCompressQuery()
  559. *
  560. * determines if compression from a source format (lpbiInput) to a dest
  561. * format (lpbiOuput) is supported.
  562. *
  563. */
  564. #define ICCompressQuery(hic, lpbiInput, lpbiOutput) \
  565. ICSendMessage(hic, ICM_COMPRESS_QUERY, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput))
  566. /*
  567. * ICCompressGetFormat()
  568. *
  569. * get the output format, (format of compressed data)
  570. * if lpbiOutput is NULL return the size in bytes needed for format.
  571. *
  572. */
  573. #define ICCompressGetFormat(hic, lpbiInput, lpbiOutput) \
  574. ICSendMessage(hic, ICM_COMPRESS_GET_FORMAT, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput))
  575. #define ICCompressGetFormatSize(hic, lpbi) \
  576. (DWORD) ICCompressGetFormat(hic, lpbi, NULL)
  577. /*
  578. * ICCompressSize()
  579. *
  580. * return the maximal size of a compressed frame
  581. *
  582. */
  583. #define ICCompressGetSize(hic, lpbiInput, lpbiOutput) \
  584. (DWORD) ICSendMessage(hic, ICM_COMPRESS_GET_SIZE, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput))
  585. #define ICCompressEnd(hic) \
  586. ICSendMessage(hic, ICM_COMPRESS_END, 0, 0)
  587. /************************************************************************
  588. decompression functions
  589. ************************************************************************/
  590. /*
  591. * ICDecompress()
  592. *
  593. * decompress a single frame
  594. *
  595. */
  596. #define ICDECOMPRESS_HURRYUP 0x80000000L // don't draw just buffer (hurry up!)
  597. DWORD
  598. VFWAPIV
  599. ICDecompress(
  600. IN HIC hic,
  601. IN DWORD dwFlags, // flags (from AVI index...)
  602. IN LPBITMAPINFOHEADER lpbiFormat, // BITMAPINFO of compressed data
  603. // biSizeImage has the chunk size
  604. IN LPVOID lpData, // data
  605. IN LPBITMAPINFOHEADER lpbi, // DIB to decompress to
  606. OUT LPVOID lpBits
  607. );
  608. /*
  609. * ICDecompressBegin()
  610. *
  611. * start compression from a source format (lpbiInput) to a dest
  612. * format (lpbiOutput) is supported.
  613. *
  614. */
  615. #define ICDecompressBegin(hic, lpbiInput, lpbiOutput) \
  616. ICSendMessage(hic, ICM_DECOMPRESS_BEGIN, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput))
  617. /*
  618. * ICDecompressQuery()
  619. *
  620. * determines if compression from a source format (lpbiInput) to a dest
  621. * format (lpbiOutput) is supported.
  622. *
  623. */
  624. #define ICDecompressQuery(hic, lpbiInput, lpbiOutput) \
  625. ICSendMessage(hic, ICM_DECOMPRESS_QUERY, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput))
  626. /*
  627. * ICDecompressGetFormat()
  628. *
  629. * get the output format, (format of un-compressed data)
  630. * if lpbiOutput is NULL return the size in bytes needed for format.
  631. *
  632. */
  633. #define ICDecompressGetFormat(hic, lpbiInput, lpbiOutput) \
  634. ((LONG) ICSendMessage(hic, ICM_DECOMPRESS_GET_FORMAT, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput)))
  635. #define ICDecompressGetFormatSize(hic, lpbi) \
  636. ICDecompressGetFormat(hic, lpbi, NULL)
  637. /*
  638. * ICDecompressGetPalette()
  639. *
  640. * get the output palette
  641. *
  642. */
  643. #define ICDecompressGetPalette(hic, lpbiInput, lpbiOutput) \
  644. ICSendMessage(hic, ICM_DECOMPRESS_GET_PALETTE, (DWORD_PTR)(LPVOID)(lpbiInput), (DWORD_PTR)(LPVOID)(lpbiOutput))
  645. #define ICDecompressSetPalette(hic, lpbiPalette) \
  646. ICSendMessage(hic, ICM_DECOMPRESS_SET_PALETTE, (DWORD_PTR)(LPVOID)(lpbiPalette), 0)
  647. #define ICDecompressEnd(hic) \
  648. ICSendMessage(hic, ICM_DECOMPRESS_END, 0, 0)
  649. /************************************************************************
  650. decompression (ex) functions
  651. ************************************************************************/
  652. //
  653. // on Win16 these functions are macros that call ICMessage. ICMessage will
  654. // not work on NT. rather than add new entrypoints we have given
  655. // them as static inline functions
  656. //
  657. /*
  658. * ICDecompressEx()
  659. *
  660. * decompress a single frame
  661. *
  662. */
  663. static __inline LRESULT VFWAPI
  664. ICDecompressEx(
  665. HIC hic,
  666. DWORD dwFlags,
  667. LPBITMAPINFOHEADER lpbiSrc,
  668. LPVOID lpSrc,
  669. int xSrc,
  670. int ySrc,
  671. int dxSrc,
  672. int dySrc,
  673. LPBITMAPINFOHEADER lpbiDst,
  674. LPVOID lpDst,
  675. int xDst,
  676. int yDst,
  677. int dxDst,
  678. int dyDst)
  679. {
  680. ICDECOMPRESSEX ic;
  681. ic.dwFlags = dwFlags;
  682. ic.lpbiSrc = lpbiSrc;
  683. ic.lpSrc = lpSrc;
  684. ic.xSrc = xSrc;
  685. ic.ySrc = ySrc;
  686. ic.dxSrc = dxSrc;
  687. ic.dySrc = dySrc;
  688. ic.lpbiDst = lpbiDst;
  689. ic.lpDst = lpDst;
  690. ic.xDst = xDst;
  691. ic.yDst = yDst;
  692. ic.dxDst = dxDst;
  693. ic.dyDst = dyDst;
  694. // note that ICM swaps round the length and pointer
  695. // length in lparam2, pointer in lparam1
  696. return ICSendMessage(hic, ICM_DECOMPRESSEX, (DWORD_PTR)&ic, sizeof(ic));
  697. }
  698. /*
  699. * ICDecompressExBegin()
  700. *
  701. * start compression from a source format (lpbiInput) to a dest
  702. * format (lpbiOutput) is supported.
  703. *
  704. */
  705. static __inline LRESULT VFWAPI
  706. ICDecompressExBegin(
  707. HIC hic,
  708. DWORD dwFlags,
  709. LPBITMAPINFOHEADER lpbiSrc,
  710. LPVOID lpSrc,
  711. int xSrc,
  712. int ySrc,
  713. int dxSrc,
  714. int dySrc,
  715. LPBITMAPINFOHEADER lpbiDst,
  716. LPVOID lpDst,
  717. int xDst,
  718. int yDst,
  719. int dxDst,
  720. int dyDst)
  721. {
  722. ICDECOMPRESSEX ic;
  723. ic.dwFlags = dwFlags;
  724. ic.lpbiSrc = lpbiSrc;
  725. ic.lpSrc = lpSrc;
  726. ic.xSrc = xSrc;
  727. ic.ySrc = ySrc;
  728. ic.dxSrc = dxSrc;
  729. ic.dySrc = dySrc;
  730. ic.lpbiDst = lpbiDst;
  731. ic.lpDst = lpDst;
  732. ic.xDst = xDst;
  733. ic.yDst = yDst;
  734. ic.dxDst = dxDst;
  735. ic.dyDst = dyDst;
  736. // note that ICM swaps round the length and pointer
  737. // length in lparam2, pointer in lparam1
  738. return ICSendMessage(hic, ICM_DECOMPRESSEX_BEGIN, (DWORD_PTR)&ic, sizeof(ic));
  739. }
  740. /*
  741. * ICDecompressExQuery()
  742. *
  743. */
  744. static __inline LRESULT VFWAPI
  745. ICDecompressExQuery(
  746. HIC hic,
  747. DWORD dwFlags,
  748. LPBITMAPINFOHEADER lpbiSrc,
  749. LPVOID lpSrc,
  750. int xSrc,
  751. int ySrc,
  752. int dxSrc,
  753. int dySrc,
  754. LPBITMAPINFOHEADER lpbiDst,
  755. LPVOID lpDst,
  756. int xDst,
  757. int yDst,
  758. int dxDst,
  759. int dyDst)
  760. {
  761. ICDECOMPRESSEX ic;
  762. ic.dwFlags = dwFlags;
  763. ic.lpbiSrc = lpbiSrc;
  764. ic.lpSrc = lpSrc;
  765. ic.xSrc = xSrc;
  766. ic.ySrc = ySrc;
  767. ic.dxSrc = dxSrc;
  768. ic.dySrc = dySrc;
  769. ic.lpbiDst = lpbiDst;
  770. ic.lpDst = lpDst;
  771. ic.xDst = xDst;
  772. ic.yDst = yDst;
  773. ic.dxDst = dxDst;
  774. ic.dyDst = dyDst;
  775. // note that ICM swaps round the length and pointer
  776. // length in lparam2, pointer in lparam1
  777. return ICSendMessage(hic, ICM_DECOMPRESSEX_QUERY, (DWORD_PTR)&ic, sizeof(ic));
  778. }
  779. #define ICDecompressExEnd(hic) \
  780. ICSendMessage(hic, ICM_DECOMPRESSEX_END, 0, 0)
  781. /************************************************************************
  782. drawing functions
  783. ************************************************************************/
  784. /*
  785. * ICDrawBegin()
  786. *
  787. * start decompressing data with format (lpbiInput) directly to the screen
  788. *
  789. * return zero if the decompressor supports drawing.
  790. *
  791. */
  792. #define ICDRAW_QUERY 0x00000001L // test for support
  793. #define ICDRAW_FULLSCREEN 0x00000002L // draw to full screen
  794. #define ICDRAW_HDC 0x00000004L // draw to a HDC/HWND
  795. DWORD
  796. VFWAPIV
  797. ICDrawBegin(
  798. IN HIC hic,
  799. IN DWORD dwFlags, // flags
  800. IN HPALETTE hpal, // palette to draw with
  801. IN HWND hwnd, // window to draw to
  802. IN HDC hdc, // HDC to draw to
  803. IN int xDst, // destination rectangle
  804. IN int yDst,
  805. IN int dxDst,
  806. IN int dyDst,
  807. IN LPBITMAPINFOHEADER lpbi, // format of frame to draw
  808. IN int xSrc, // source rectangle
  809. IN int ySrc,
  810. IN int dxSrc,
  811. IN int dySrc,
  812. IN DWORD dwRate, // frames/second = (dwRate/dwScale)
  813. IN DWORD dwScale
  814. );
  815. /*
  816. * ICDraw()
  817. *
  818. * decompress data directly to the screen
  819. *
  820. */
  821. #define ICDRAW_HURRYUP 0x80000000L // don't draw just buffer (hurry up!)
  822. #define ICDRAW_UPDATE 0x40000000L // don't draw just update screen
  823. DWORD
  824. VFWAPIV
  825. ICDraw(
  826. IN HIC hic,
  827. IN DWORD dwFlags, // flags
  828. IN LPVOID lpFormat, // format of frame to decompress
  829. IN LPVOID lpData, // frame data to decompress
  830. IN DWORD cbData, // size of data
  831. IN LONG lTime // time to draw this frame
  832. );
  833. // ICMessage is not supported on Win32, so provide a static inline function
  834. // to do the same job
  835. static __inline LRESULT VFWAPI
  836. ICDrawSuggestFormat(
  837. HIC hic,
  838. LPBITMAPINFOHEADER lpbiIn,
  839. LPBITMAPINFOHEADER lpbiOut,
  840. int dxSrc,
  841. int dySrc,
  842. int dxDst,
  843. int dyDst,
  844. HIC hicDecomp)
  845. {
  846. ICDRAWSUGGEST ic;
  847. ic.lpbiIn = lpbiIn;
  848. ic.lpbiSuggest = lpbiOut;
  849. ic.dxSrc = dxSrc;
  850. ic.dySrc = dySrc;
  851. ic.dxDst = dxDst;
  852. ic.dyDst = dyDst;
  853. ic.hicDecompressor = hicDecomp;
  854. // note that ICM swaps round the length and pointer
  855. // length in lparam2, pointer in lparam1
  856. return ICSendMessage(hic, ICM_DRAW_SUGGESTFORMAT, (DWORD_PTR)&ic, sizeof(ic));
  857. }
  858. /*
  859. * ICDrawQuery()
  860. *
  861. * determines if the compressor is willing to render the specified format.
  862. *
  863. */
  864. #define ICDrawQuery(hic, lpbiInput) \
  865. ICSendMessage(hic, ICM_DRAW_QUERY, (DWORD_PTR)(LPVOID)(lpbiInput), 0L)
  866. #define ICDrawChangePalette(hic, lpbiInput) \
  867. ICSendMessage(hic, ICM_DRAW_CHANGEPALETTE, (DWORD_PTR)(LPVOID)(lpbiInput), 0L)
  868. #define ICGetBuffersWanted(hic, lpdwBuffers) \
  869. ICSendMessage(hic, ICM_GETBUFFERSWANTED, (DWORD_PTR)(LPVOID)(lpdwBuffers), 0)
  870. #define ICDrawEnd(hic) \
  871. ICSendMessage(hic, ICM_DRAW_END, 0, 0)
  872. #define ICDrawStart(hic) \
  873. ICSendMessage(hic, ICM_DRAW_START, 0, 0)
  874. #define ICDrawStartPlay(hic, lFrom, lTo) \
  875. ICSendMessage(hic, ICM_DRAW_START_PLAY, (DWORD_PTR)(lFrom), (DWORD_PTR)(lTo))
  876. #define ICDrawStop(hic) \
  877. ICSendMessage(hic, ICM_DRAW_STOP, 0, 0)
  878. #define ICDrawStopPlay(hic) \
  879. ICSendMessage(hic, ICM_DRAW_STOP_PLAY, 0, 0)
  880. #define ICDrawGetTime(hic, lplTime) \
  881. ICSendMessage(hic, ICM_DRAW_GETTIME, (DWORD_PTR)(LPVOID)(lplTime), 0)
  882. #define ICDrawSetTime(hic, lTime) \
  883. ICSendMessage(hic, ICM_DRAW_SETTIME, (DWORD_PTR)lTime, 0)
  884. #define ICDrawRealize(hic, hdc, fBackground) \
  885. ICSendMessage(hic, ICM_DRAW_REALIZE, (DWORD_PTR)(UINT_PTR)(HDC)(hdc), (DWORD_PTR)(BOOL)(fBackground))
  886. #define ICDrawFlush(hic) \
  887. ICSendMessage(hic, ICM_DRAW_FLUSH, 0, 0)
  888. #define ICDrawRenderBuffer(hic) \
  889. ICSendMessage(hic, ICM_DRAW_RENDERBUFFER, 0, 0)
  890. /************************************************************************
  891. Status callback functions
  892. ************************************************************************/
  893. /*
  894. * ICSetStatusProc()
  895. *
  896. * Set the status callback function
  897. *
  898. */
  899. // ICMessage is not supported on NT
  900. static __inline LRESULT VFWAPI
  901. ICSetStatusProc(
  902. HIC hic,
  903. DWORD dwFlags,
  904. LRESULT lParam,
  905. LONG (CALLBACK *fpfnStatus)(LPARAM, UINT, LONG) )
  906. {
  907. ICSETSTATUSPROC ic;
  908. ic.dwFlags = dwFlags;
  909. ic.lParam = lParam;
  910. ic.Status = fpfnStatus;
  911. // note that ICM swaps round the length and pointer
  912. // length in lparam2, pointer in lparam1
  913. return ICSendMessage(hic, ICM_SET_STATUS_PROC, (DWORD_PTR)&ic, sizeof(ic));
  914. }
  915. /************************************************************************
  916. helper routines for DrawDib and MCIAVI...
  917. ************************************************************************/
  918. #define ICDecompressOpen(fccType, fccHandler, lpbiIn, lpbiOut) \
  919. ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, ICMODE_DECOMPRESS)
  920. #define ICDrawOpen(fccType, fccHandler, lpbiIn) \
  921. ICLocate(fccType, fccHandler, lpbiIn, NULL, ICMODE_DRAW)
  922. HIC
  923. VFWAPI
  924. ICLocate(
  925. IN DWORD fccType,
  926. IN DWORD fccHandler,
  927. IN LPBITMAPINFOHEADER lpbiIn,
  928. IN LPBITMAPINFOHEADER lpbiOut,
  929. IN WORD wFlags
  930. );
  931. HIC
  932. VFWAPI
  933. ICGetDisplayFormat(
  934. IN HIC hic,
  935. IN LPBITMAPINFOHEADER lpbiIn,
  936. OUT LPBITMAPINFOHEADER lpbiOut,
  937. IN int BitDepth,
  938. IN int dx,
  939. IN int dy
  940. );
  941. /************************************************************************
  942. Higher level functions
  943. ************************************************************************/
  944. HANDLE
  945. VFWAPI
  946. ICImageCompress(
  947. IN HIC hic, // compressor to use
  948. IN UINT uiFlags, // flags (none yet)
  949. IN LPBITMAPINFO lpbiIn, // format to compress from
  950. IN LPVOID lpBits, // data to compress
  951. IN LPBITMAPINFO lpbiOut, // compress to this (NULL ==> default)
  952. IN LONG lQuality, // quality to use
  953. IN OUT LONG FAR * plSize // compress to this size (0=whatever)
  954. );
  955. HANDLE
  956. VFWAPI
  957. ICImageDecompress(
  958. IN HIC hic, // compressor to use
  959. IN UINT uiFlags, // flags (none yet)
  960. IN LPBITMAPINFO lpbiIn, // format to decompress from
  961. IN LPVOID lpBits, // data to decompress
  962. IN LPBITMAPINFO lpbiOut // decompress to this (NULL ==> default)
  963. );
  964. //
  965. // Structure used by ICSeqCompressFrame and ICCompressorChoose routines
  966. // Make sure this matches the autodoc in icm.c!
  967. //
  968. typedef struct {
  969. LONG cbSize; // set to sizeof(COMPVARS) before
  970. // calling ICCompressorChoose
  971. DWORD dwFlags; // see below...
  972. HIC hic; // HIC of chosen compressor
  973. DWORD fccType; // basically ICTYPE_VIDEO
  974. DWORD fccHandler; // handler of chosen compressor or
  975. // "" or "DIB "
  976. LPBITMAPINFO lpbiIn; // input format
  977. LPBITMAPINFO lpbiOut; // output format - will compress to this
  978. LPVOID lpBitsOut;
  979. LPVOID lpBitsPrev;
  980. LONG lFrame;
  981. LONG lKey; // key frames how often?
  982. LONG lDataRate; // desired data rate KB/Sec
  983. LONG lQ; // desired quality
  984. LONG lKeyCount;
  985. LPVOID lpState; // state of compressor
  986. LONG cbState; // size of the state
  987. } COMPVARS, FAR *PCOMPVARS;
  988. // FLAGS for dwFlags element of COMPVARS structure:
  989. // set this flag if you initialize COMPVARS before calling ICCompressorChoose
  990. #define ICMF_COMPVARS_VALID 0x00000001 // COMPVARS contains valid data
  991. //
  992. // allows user to choose compressor, quality etc...
  993. //
  994. BOOL
  995. VFWAPI
  996. ICCompressorChoose(
  997. IN HWND hwnd, // parent window for dialog
  998. IN UINT uiFlags, // flags
  999. IN LPVOID pvIn, // input format (optional)
  1000. IN LPVOID lpData, // input data (optional)
  1001. IN OUT PCOMPVARS pc, // data about the compressor/dlg
  1002. IN LPSTR lpszTitle // dialog title (optional)
  1003. );
  1004. // defines for uiFlags
  1005. #define ICMF_CHOOSE_KEYFRAME 0x0001 // show KeyFrame Every box
  1006. #define ICMF_CHOOSE_DATARATE 0x0002 // show DataRate box
  1007. #define ICMF_CHOOSE_PREVIEW 0x0004 // allow expanded preview dialog
  1008. #define ICMF_CHOOSE_ALLCOMPRESSORS 0x0008 // don't only show those that
  1009. // can handle the input format
  1010. // or input data
  1011. BOOL
  1012. VFWAPI
  1013. ICSeqCompressFrameStart(
  1014. IN PCOMPVARS pc,
  1015. IN LPBITMAPINFO lpbiIn
  1016. );
  1017. void
  1018. VFWAPI
  1019. ICSeqCompressFrameEnd(
  1020. IN PCOMPVARS pc
  1021. );
  1022. LPVOID
  1023. VFWAPI
  1024. ICSeqCompressFrame(
  1025. IN PCOMPVARS pc, // set by ICCompressorChoose
  1026. IN UINT uiFlags, // flags
  1027. IN LPVOID lpBits, // input DIB bits
  1028. OUT BOOL FAR *pfKey, // did it end up being a key frame?
  1029. IN OUT LONG FAR *plSize // size to compress to/of returned image
  1030. );
  1031. void
  1032. VFWAPI
  1033. ICCompressorFree(
  1034. IN PCOMPVARS pc
  1035. );
  1036. #endif /* NOCOMPMAN */
  1037. /**************************************************************************
  1038. *
  1039. * DRAWDIB - Routines for drawing to the display.
  1040. *
  1041. *************************************************************************/
  1042. #ifndef NODRAWDIB
  1043. typedef HANDLE HDRAWDIB; /* hdd */
  1044. /*********************************************************************
  1045. DrawDib Flags
  1046. **********************************************************************/
  1047. #define DDF_0001 0x0001 /* ;Internal */
  1048. #define DDF_UPDATE 0x0002 /* re-draw the last DIB */
  1049. #define DDF_SAME_HDC 0x0004 /* HDC same as last call (all setup) */
  1050. #define DDF_SAME_DRAW 0x0008 /* draw params are the same */
  1051. #define DDF_DONTDRAW 0x0010 /* dont draw frame, just decompress */
  1052. #define DDF_ANIMATE 0x0020 /* allow palette animation */
  1053. #define DDF_BUFFER 0x0040 /* always buffer image */
  1054. #define DDF_JUSTDRAWIT 0x0080 /* just draw it with GDI */
  1055. #define DDF_FULLSCREEN 0x0100 /* use DisplayDib */
  1056. #define DDF_BACKGROUNDPAL 0x0200 /* Realize palette in background */
  1057. #define DDF_NOTKEYFRAME 0x0400 /* this is a partial frame update, hint */
  1058. #define DDF_HURRYUP 0x0800 /* hurry up please! */
  1059. #define DDF_HALFTONE 0x1000 /* always halftone */
  1060. #define DDF_2000 0x2000 /* ;Internal */
  1061. #define DDF_PREROLL DDF_DONTDRAW /* Builing up a non-keyframe */
  1062. #define DDF_SAME_DIB DDF_SAME_DRAW
  1063. #define DDF_SAME_SIZE DDF_SAME_DRAW
  1064. /*********************************************************************
  1065. DrawDib functions
  1066. *********************************************************************/
  1067. /* // ;Internal
  1068. ** DrawDibInit() // ;Internal
  1069. ** // ;Internal
  1070. */ // ;Internal
  1071. extern BOOL VFWAPI DrawDibInit(void); // ;Internal
  1072. // ;Internal
  1073. /*
  1074. ** DrawDibOpen()
  1075. **
  1076. */
  1077. extern HDRAWDIB VFWAPI DrawDibOpen(void);
  1078. /*
  1079. ** DrawDibClose()
  1080. **
  1081. */
  1082. extern
  1083. BOOL
  1084. VFWAPI
  1085. DrawDibClose(
  1086. IN HDRAWDIB hdd
  1087. );
  1088. /*
  1089. ** DrawDibGetBuffer()
  1090. **
  1091. */
  1092. extern
  1093. LPVOID
  1094. VFWAPI
  1095. DrawDibGetBuffer(
  1096. IN HDRAWDIB hdd,
  1097. OUT LPBITMAPINFOHEADER lpbi,
  1098. IN DWORD dwSize,
  1099. IN DWORD dwFlags
  1100. );
  1101. /* // ;Internal
  1102. ** DrawDibError() // ;Internal
  1103. */ // ;Internal
  1104. extern UINT VFWAPI DrawDibError(HDRAWDIB hdd); // ;Internal
  1105. // ;Internal
  1106. /*
  1107. ** DrawDibGetPalette()
  1108. **
  1109. ** get the palette used for drawing DIBs
  1110. **
  1111. */
  1112. extern
  1113. HPALETTE
  1114. VFWAPI
  1115. DrawDibGetPalette(
  1116. IN HDRAWDIB hdd
  1117. );
  1118. /*
  1119. ** DrawDibSetPalette()
  1120. **
  1121. ** get the palette used for drawing DIBs
  1122. **
  1123. */
  1124. extern
  1125. BOOL
  1126. VFWAPI
  1127. DrawDibSetPalette(
  1128. IN HDRAWDIB hdd,
  1129. IN HPALETTE hpal
  1130. );
  1131. /*
  1132. ** DrawDibChangePalette()
  1133. */
  1134. extern
  1135. BOOL
  1136. VFWAPI
  1137. DrawDibChangePalette(
  1138. IN HDRAWDIB hdd,
  1139. IN int iStart,
  1140. IN int iLen,
  1141. IN LPPALETTEENTRY lppe
  1142. );
  1143. /*
  1144. ** DrawDibRealize()
  1145. **
  1146. ** realize the palette in a HDD
  1147. **
  1148. */
  1149. extern
  1150. UINT
  1151. VFWAPI
  1152. DrawDibRealize(
  1153. IN HDRAWDIB hdd,
  1154. IN HDC hdc,
  1155. IN BOOL fBackground
  1156. );
  1157. /*
  1158. ** DrawDibStart()
  1159. **
  1160. ** start of streaming playback
  1161. **
  1162. */
  1163. extern
  1164. BOOL
  1165. VFWAPI
  1166. DrawDibStart(
  1167. IN HDRAWDIB hdd,
  1168. IN DWORD rate
  1169. );
  1170. /*
  1171. ** DrawDibStop()
  1172. **
  1173. ** start of streaming playback
  1174. **
  1175. */
  1176. extern
  1177. BOOL
  1178. VFWAPI
  1179. DrawDibStop(
  1180. IN HDRAWDIB hdd
  1181. );
  1182. /*
  1183. ** DrawDibBegin()
  1184. **
  1185. ** prepare to draw
  1186. **
  1187. */
  1188. extern
  1189. BOOL
  1190. VFWAPI
  1191. DrawDibBegin(
  1192. IN HDRAWDIB hdd,
  1193. IN HDC hdc,
  1194. IN int dxDst,
  1195. IN int dyDst,
  1196. IN LPBITMAPINFOHEADER lpbi,
  1197. IN int dxSrc,
  1198. IN int dySrc,
  1199. IN UINT wFlags
  1200. );
  1201. /*
  1202. ** DrawDibDraw()
  1203. **
  1204. ** actualy draw a DIB to the screen.
  1205. **
  1206. */
  1207. extern
  1208. BOOL
  1209. VFWAPI
  1210. DrawDibDraw(
  1211. IN HDRAWDIB hdd,
  1212. IN HDC hdc,
  1213. IN int xDst,
  1214. IN int yDst,
  1215. IN int dxDst,
  1216. IN int dyDst,
  1217. IN LPBITMAPINFOHEADER lpbi,
  1218. IN LPVOID lpBits,
  1219. IN int xSrc,
  1220. IN int ySrc,
  1221. IN int dxSrc,
  1222. IN int dySrc,
  1223. IN UINT wFlags
  1224. );
  1225. /*
  1226. ** DrawDibUpdate()
  1227. **
  1228. ** redraw the last image (may only be valid with DDF_BUFFER)
  1229. */
  1230. #define DrawDibUpdate(hdd, hdc, x, y) \
  1231. DrawDibDraw(hdd, hdc, x, y, 0, 0, NULL, NULL, 0, 0, 0, 0, DDF_UPDATE)
  1232. /*
  1233. ** DrawDibEnd()
  1234. */
  1235. extern
  1236. BOOL
  1237. VFWAPI
  1238. DrawDibEnd(
  1239. IN HDRAWDIB hdd
  1240. );
  1241. /*
  1242. ** DrawDibTime() [for debugging purposes only]
  1243. */
  1244. typedef struct {
  1245. LONG timeCount;
  1246. LONG timeDraw;
  1247. LONG timeDecompress;
  1248. LONG timeDither;
  1249. LONG timeStretch;
  1250. LONG timeBlt;
  1251. LONG timeSetDIBits;
  1252. } DRAWDIBTIME, FAR *LPDRAWDIBTIME;
  1253. BOOL
  1254. VFWAPI
  1255. DrawDibTime(
  1256. IN HDRAWDIB hdd,
  1257. OUT LPDRAWDIBTIME lpddtime
  1258. );
  1259. /* display profiling */
  1260. #define PD_CAN_DRAW_DIB 0x0001 /* if you can draw at all */
  1261. #define PD_CAN_STRETCHDIB 0x0002 /* basicly RC_STRETCHDIB */
  1262. #define PD_STRETCHDIB_1_1_OK 0x0004 /* is it fast? */
  1263. #define PD_STRETCHDIB_1_2_OK 0x0008 /* ... */
  1264. #define PD_STRETCHDIB_1_N_OK 0x0010 /* ... */
  1265. LRESULT
  1266. VFWAPI
  1267. DrawDibProfileDisplay(
  1268. IN LPBITMAPINFOHEADER lpbi
  1269. );
  1270. #endif /* NODRAWDIB */
  1271. /****************************************************************************
  1272. *
  1273. * AVIFMT - AVI file format definitions
  1274. *
  1275. ****************************************************************************/
  1276. #ifndef NOAVIFMT
  1277. #ifndef _INC_MMSYSTEM
  1278. typedef DWORD FOURCC;
  1279. #endif
  1280. #ifdef _MSC_VER
  1281. #pragma warning(disable:4200)
  1282. #endif
  1283. /* The following is a short description of the AVI file format. Please
  1284. * see the accompanying documentation for a full explanation.
  1285. *
  1286. * An AVI file is the following RIFF form:
  1287. *
  1288. * RIFF('AVI'
  1289. * LIST('hdrl'
  1290. * avih(<MainAVIHeader>)
  1291. * LIST ('strl'
  1292. * strh(<Stream header>)
  1293. * strf(<Stream format>)
  1294. * ... additional header data
  1295. * LIST('movi'
  1296. * { LIST('rec'
  1297. * SubChunk...
  1298. * )
  1299. * | SubChunk } ....
  1300. * )
  1301. * [ <AVIIndex> ]
  1302. * )
  1303. *
  1304. * The main file header specifies how many streams are present. For
  1305. * each one, there must be a stream header chunk and a stream format
  1306. * chunk, enlosed in a 'strl' LIST chunk. The 'strf' chunk contains
  1307. * type-specific format information; for a video stream, this should
  1308. * be a BITMAPINFO structure, including palette. For an audio stream,
  1309. * this should be a WAVEFORMAT (or PCMWAVEFORMAT) structure.
  1310. *
  1311. * The actual data is contained in subchunks within the 'movi' LIST
  1312. * chunk. The first two characters of each data chunk are the
  1313. * stream number with which that data is associated.
  1314. *
  1315. * Some defined chunk types:
  1316. * Video Streams:
  1317. * ##db: RGB DIB bits
  1318. * ##dc: RLE8 compressed DIB bits
  1319. * ##pc: Palette Change
  1320. *
  1321. * Audio Streams:
  1322. * ##wb: waveform audio bytes
  1323. *
  1324. * The grouping into LIST 'rec' chunks implies only that the contents of
  1325. * the chunk should be read into memory at the same time. This
  1326. * grouping is used for files specifically intended to be played from
  1327. * CD-ROM.
  1328. *
  1329. * The index chunk at the end of the file should contain one entry for
  1330. * each data chunk in the file.
  1331. *
  1332. * Limitations for the current software:
  1333. * Only one video stream and one audio stream are allowed.
  1334. * The streams must start at the beginning of the file.
  1335. *
  1336. *
  1337. * To register codec types please obtain a copy of the Multimedia
  1338. * Developer Registration Kit from:
  1339. *
  1340. * Microsoft Corporation
  1341. * Multimedia Systems Group
  1342. * Product Marketing
  1343. * One Microsoft Way
  1344. * Redmond, WA 98052-6399
  1345. *
  1346. */
  1347. #ifndef mmioFOURCC
  1348. #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
  1349. ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
  1350. ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
  1351. #endif
  1352. /* Macro to make a TWOCC out of two characters */
  1353. #ifndef aviTWOCC
  1354. #define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
  1355. #endif
  1356. typedef WORD TWOCC;
  1357. /* form types, list types, and chunk types */
  1358. #define formtypeAVI mmioFOURCC('A', 'V', 'I', ' ')
  1359. #define listtypeAVIHEADER mmioFOURCC('h', 'd', 'r', 'l')
  1360. #define ckidAVIMAINHDR mmioFOURCC('a', 'v', 'i', 'h')
  1361. #define listtypeSTREAMHEADER mmioFOURCC('s', 't', 'r', 'l')
  1362. #define ckidSTREAMHEADER mmioFOURCC('s', 't', 'r', 'h')
  1363. #define ckidSTREAMFORMAT mmioFOURCC('s', 't', 'r', 'f')
  1364. #define ckidSTREAMHANDLERDATA mmioFOURCC('s', 't', 'r', 'd')
  1365. #define ckidSTREAMNAME mmioFOURCC('s', 't', 'r', 'n')
  1366. #define listtypeAVIMOVIE mmioFOURCC('m', 'o', 'v', 'i')
  1367. #define listtypeAVIRECORD mmioFOURCC('r', 'e', 'c', ' ')
  1368. #define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1')
  1369. /*
  1370. ** Stream types for the <fccType> field of the stream header.
  1371. */
  1372. #define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
  1373. #define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
  1374. #define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's')
  1375. #define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's')
  1376. /* Basic chunk types */
  1377. #define cktypeDIBbits aviTWOCC('d', 'b')
  1378. #define cktypeDIBcompressed aviTWOCC('d', 'c')
  1379. #define cktypePALchange aviTWOCC('p', 'c')
  1380. #define cktypeWAVEbytes aviTWOCC('w', 'b')
  1381. /* Chunk id to use for extra chunks for padding. */
  1382. #define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K')
  1383. /*
  1384. ** Useful macros
  1385. **
  1386. ** Warning: These are nasty macro, and MS C 6.0 compiles some of them
  1387. ** incorrectly if optimizations are on. Ack.
  1388. */
  1389. /* Macro to get stream number out of a FOURCC ckid */
  1390. #define FromHex(n) (((n) >= 'A') ? ((n) + 10 - 'A') : ((n) - '0'))
  1391. #define StreamFromFOURCC(fcc) ((WORD) ((FromHex(LOBYTE(LOWORD(fcc))) << 4) + \
  1392. (FromHex(HIBYTE(LOWORD(fcc))))))
  1393. /* Macro to get TWOCC chunk type out of a FOURCC ckid */
  1394. #define TWOCCFromFOURCC(fcc) HIWORD(fcc)
  1395. /* Macro to make a ckid for a chunk out of a TWOCC and a stream number
  1396. ** from 0-255.
  1397. */
  1398. #define ToHex(n) ((BYTE) (((n) > 9) ? ((n) - 10 + 'A') : ((n) + '0')))
  1399. #define MAKEAVICKID(tcc, stream) \
  1400. MAKELONG((ToHex((stream) & 0x0f) << 8) | \
  1401. (ToHex(((stream) & 0xf0) >> 4)), tcc)
  1402. /*
  1403. ** Main AVI File Header
  1404. */
  1405. /* flags for use in <dwFlags> in AVIFileHdr */
  1406. #define AVIF_HASINDEX 0x00000010 // Index at end of file?
  1407. #define AVIF_MUSTUSEINDEX 0x00000020
  1408. #define AVIF_ISINTERLEAVED 0x00000100
  1409. #define AVIF_WASCAPTUREFILE 0x00010000
  1410. #define AVIF_COPYRIGHTED 0x00020000
  1411. /* The AVI File Header LIST chunk should be padded to this size */
  1412. #define AVI_HEADERSIZE 2048 // size of AVI header list
  1413. typedef struct
  1414. {
  1415. DWORD dwMicroSecPerFrame; // frame display rate (or 0L)
  1416. DWORD dwMaxBytesPerSec; // max. transfer rate
  1417. DWORD dwPaddingGranularity; // pad to multiples of this
  1418. // size; normally 2K.
  1419. DWORD dwFlags; // the ever-present flags
  1420. DWORD dwTotalFrames; // # frames in file
  1421. DWORD dwInitialFrames;
  1422. DWORD dwStreams;
  1423. DWORD dwSuggestedBufferSize;
  1424. DWORD dwWidth;
  1425. DWORD dwHeight;
  1426. DWORD dwReserved[4];
  1427. } MainAVIHeader;
  1428. /*
  1429. ** Stream header
  1430. */
  1431. #define AVISF_DISABLED 0x00000001
  1432. #define AVISF_VIDEO_PALCHANGES 0x00010000
  1433. typedef struct {
  1434. FOURCC fccType;
  1435. FOURCC fccHandler;
  1436. DWORD dwFlags; /* Contains AVITF_* flags */
  1437. WORD wPriority;
  1438. WORD wLanguage;
  1439. DWORD dwInitialFrames;
  1440. DWORD dwScale;
  1441. DWORD dwRate; /* dwRate / dwScale == samples/second */
  1442. DWORD dwStart;
  1443. DWORD dwLength; /* In units above... */
  1444. DWORD dwSuggestedBufferSize;
  1445. DWORD dwQuality;
  1446. DWORD dwSampleSize;
  1447. RECT rcFrame;
  1448. } AVIStreamHeader;
  1449. /* Flags for index */
  1450. #define AVIIF_LIST 0x00000001L // chunk is a 'LIST'
  1451. #define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame.
  1452. #define AVIIF_FIRSTPART 0x00000020L // this frame is the start of a partial frame.
  1453. #define AVIIF_LASTPART 0x00000040L // this frame is the end of a partial frame.
  1454. #define AVIIF_MIDPART (AVIIF_LASTPART|AVIIF_FIRSTPART)
  1455. #define AVIIF_NOTIME 0x00000100L // this frame doesn't take any time
  1456. #define AVIIF_COMPUSE 0x0FFF0000L // these bits are for compressor use
  1457. typedef struct
  1458. {
  1459. DWORD ckid;
  1460. DWORD dwFlags;
  1461. DWORD dwChunkOffset; // Position of chunk
  1462. DWORD dwChunkLength; // Length of chunk
  1463. } AVIINDEXENTRY;
  1464. /*
  1465. ** Palette change chunk
  1466. **
  1467. ** Used in video streams.
  1468. */
  1469. typedef struct
  1470. {
  1471. BYTE bFirstEntry; /* first entry to change */
  1472. BYTE bNumEntries; /* # entries to change (0 if 256) */
  1473. WORD wFlags; /* Mostly to preserve alignment... */
  1474. PALETTEENTRY peNew[]; /* New color specifications */
  1475. } AVIPALCHANGE;
  1476. #endif /* NOAVIFMT */
  1477. #ifdef __cplusplus
  1478. } // extern "C"
  1479. #endif /* __cplusplus */
  1480. /****************************************************************************
  1481. *
  1482. * MMREG.H (standard include file for MM defines, like FOURCC and things)
  1483. *
  1484. ***************************************************************************/
  1485. #ifndef RC_INVOKED
  1486. #include "pshpack8.h"
  1487. #endif
  1488. #ifndef NOMMREG
  1489. #include <mmreg.h>
  1490. #endif
  1491. #ifdef __cplusplus
  1492. extern "C" { /* Assume C declarations for C++ */
  1493. #endif /* __cplusplus */
  1494. /****************************************************************************
  1495. *
  1496. * AVIFile - routines for reading/writing standard AVI files
  1497. *
  1498. ***************************************************************************/
  1499. #ifndef NOAVIFILE
  1500. /*
  1501. * Ansi - Unicode thunking.
  1502. *
  1503. * Unicode or Ansi-only apps can call the avifile APIs.
  1504. * any Win32 app who wants to use
  1505. * any of the AVI COM interfaces must be UNICODE - the AVISTREAMINFO and
  1506. * AVIFILEINFO structures used in the Info methods of these interfaces are
  1507. * the unicode variants, and no thunking to or from ansi takes place
  1508. * except in the AVIFILE api entrypoints.
  1509. *
  1510. * For Ansi/Unicode thunking: for each entrypoint or structure that
  1511. * uses chars or strings, two versions are declared in the Win32 version,
  1512. * ApiNameW and ApiNameA. The default name ApiName is #defined to one or
  1513. * other of these depending on whether UNICODE is defined (during
  1514. * compilation of the app that is including this header). The source will
  1515. * contain ApiName and ApiNameA (with ApiName being the Win16 implementation,
  1516. * and also #defined to ApiNameW, and ApiNameA being the thunk entrypoint).
  1517. *
  1518. */
  1519. #ifndef mmioFOURCC
  1520. #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
  1521. ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
  1522. ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
  1523. #endif
  1524. #ifndef streamtypeVIDEO
  1525. #define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
  1526. #define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
  1527. #define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's')
  1528. #define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's')
  1529. #endif
  1530. #ifndef AVIIF_KEYFRAME
  1531. #define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame.
  1532. #endif
  1533. // For GetFrame::SetFormat - use the best format for the display
  1534. #define AVIGETFRAMEF_BESTDISPLAYFMT 1
  1535. //
  1536. // Structures used by AVIStreamInfo & AVIFileInfo.
  1537. //
  1538. // These are related to, but not identical to, the header chunks
  1539. // in an AVI file.
  1540. //
  1541. /*
  1542. *
  1543. * --- AVISTREAMINFO ------------------------------------------------
  1544. *
  1545. * for Unicode/Ansi thunking we need to declare three versions of this!
  1546. */
  1547. typedef struct _AVISTREAMINFOW {
  1548. DWORD fccType;
  1549. DWORD fccHandler;
  1550. DWORD dwFlags; /* Contains AVITF_* flags */
  1551. DWORD dwCaps;
  1552. WORD wPriority;
  1553. WORD wLanguage;
  1554. DWORD dwScale;
  1555. DWORD dwRate; /* dwRate / dwScale == samples/second */
  1556. DWORD dwStart;
  1557. DWORD dwLength; /* In units above... */
  1558. DWORD dwInitialFrames;
  1559. DWORD dwSuggestedBufferSize;
  1560. DWORD dwQuality;
  1561. DWORD dwSampleSize;
  1562. RECT rcFrame;
  1563. DWORD dwEditCount;
  1564. DWORD dwFormatChangeCount;
  1565. WCHAR szName[64];
  1566. } AVISTREAMINFOW, FAR * LPAVISTREAMINFOW;
  1567. typedef struct _AVISTREAMINFOA {
  1568. DWORD fccType;
  1569. DWORD fccHandler;
  1570. DWORD dwFlags; /* Contains AVITF_* flags */
  1571. DWORD dwCaps;
  1572. WORD wPriority;
  1573. WORD wLanguage;
  1574. DWORD dwScale;
  1575. DWORD dwRate; /* dwRate / dwScale == samples/second */
  1576. DWORD dwStart;
  1577. DWORD dwLength; /* In units above... */
  1578. DWORD dwInitialFrames;
  1579. DWORD dwSuggestedBufferSize;
  1580. DWORD dwQuality;
  1581. DWORD dwSampleSize;
  1582. RECT rcFrame;
  1583. DWORD dwEditCount;
  1584. DWORD dwFormatChangeCount;
  1585. char szName[64];
  1586. } AVISTREAMINFOA, FAR * LPAVISTREAMINFOA;
  1587. #ifdef UNICODE
  1588. #define AVISTREAMINFO AVISTREAMINFOW
  1589. #define LPAVISTREAMINFO LPAVISTREAMINFOW
  1590. #else
  1591. #define AVISTREAMINFO AVISTREAMINFOA
  1592. #define LPAVISTREAMINFO LPAVISTREAMINFOA
  1593. #endif
  1594. #define AVISTREAMINFO_DISABLED 0x00000001
  1595. #define AVISTREAMINFO_FORMATCHANGES 0x00010000
  1596. /*
  1597. * --- AVIFILEINFO ----------------------------------------------------
  1598. *
  1599. */
  1600. typedef struct _AVIFILEINFOW {
  1601. DWORD dwMaxBytesPerSec; // max. transfer rate
  1602. DWORD dwFlags; // the ever-present flags
  1603. DWORD dwCaps;
  1604. DWORD dwStreams;
  1605. DWORD dwSuggestedBufferSize;
  1606. DWORD dwWidth;
  1607. DWORD dwHeight;
  1608. DWORD dwScale;
  1609. DWORD dwRate; /* dwRate / dwScale == samples/second */
  1610. DWORD dwLength;
  1611. DWORD dwEditCount;
  1612. WCHAR szFileType[64]; // descriptive string for file type?
  1613. } AVIFILEINFOW, FAR * LPAVIFILEINFOW;
  1614. typedef struct _AVIFILEINFOA {
  1615. DWORD dwMaxBytesPerSec; // max. transfer rate
  1616. DWORD dwFlags; // the ever-present flags
  1617. DWORD dwCaps;
  1618. DWORD dwStreams;
  1619. DWORD dwSuggestedBufferSize;
  1620. DWORD dwWidth;
  1621. DWORD dwHeight;
  1622. DWORD dwScale;
  1623. DWORD dwRate; /* dwRate / dwScale == samples/second */
  1624. DWORD dwLength;
  1625. DWORD dwEditCount;
  1626. char szFileType[64]; // descriptive string for file type?
  1627. } AVIFILEINFOA, FAR * LPAVIFILEINFOA;
  1628. #ifdef UNICODE
  1629. #define AVIFILEINFO AVIFILEINFOW
  1630. #define LPAVIFILEINFO LPAVIFILEINFOW
  1631. #else
  1632. #define AVIFILEINFO AVIFILEINFOA
  1633. #define LPAVIFILEINFO LPAVIFILEINFOA
  1634. #endif
  1635. // Flags for dwFlags
  1636. #define AVIFILEINFO_HASINDEX 0x00000010
  1637. #define AVIFILEINFO_MUSTUSEINDEX 0x00000020
  1638. #define AVIFILEINFO_ISINTERLEAVED 0x00000100
  1639. #define AVIFILEINFO_WASCAPTUREFILE 0x00010000
  1640. #define AVIFILEINFO_COPYRIGHTED 0x00020000
  1641. // Flags for dwCaps
  1642. #define AVIFILECAPS_CANREAD 0x00000001
  1643. #define AVIFILECAPS_CANWRITE 0x00000002
  1644. #define AVIFILECAPS_ALLKEYFRAMES 0x00000010
  1645. #define AVIFILECAPS_NOCOMPRESSION 0x00000020
  1646. typedef BOOL (FAR PASCAL * AVISAVECALLBACK)(int);
  1647. /************************************************************************/
  1648. /* Declaration for the AVICOMPRESSOPTIONS structure. Make sure it */
  1649. /* matches the AutoDoc in avisave.c !!! */
  1650. /************************************************************************/
  1651. typedef struct {
  1652. DWORD fccType; /* stream type, for consistency */
  1653. DWORD fccHandler; /* compressor */
  1654. DWORD dwKeyFrameEvery; /* keyframe rate */
  1655. DWORD dwQuality; /* compress quality 0-10,000 */
  1656. DWORD dwBytesPerSecond; /* bytes per second */
  1657. DWORD dwFlags; /* flags... see below */
  1658. LPVOID lpFormat; /* save format */
  1659. DWORD cbFormat;
  1660. LPVOID lpParms; /* compressor options */
  1661. DWORD cbParms;
  1662. DWORD dwInterleaveEvery; /* for non-video streams only */
  1663. } AVICOMPRESSOPTIONS, FAR *LPAVICOMPRESSOPTIONS;
  1664. //
  1665. // Defines for the dwFlags field of the AVICOMPRESSOPTIONS struct
  1666. // Each of these flags determines if the appropriate field in the structure
  1667. // (dwInterleaveEvery, dwBytesPerSecond, and dwKeyFrameEvery) is payed
  1668. // attention to. See the autodoc in avisave.c for details.
  1669. //
  1670. #define AVICOMPRESSF_INTERLEAVE 0x00000001 // interleave
  1671. #define AVICOMPRESSF_DATARATE 0x00000002 // use a data rate
  1672. #define AVICOMPRESSF_KEYFRAMES 0x00000004 // use keyframes
  1673. #define AVICOMPRESSF_VALID 0x00000008 // has valid data?
  1674. #ifdef __cplusplus
  1675. } // extern "C"
  1676. #endif /* __cplusplus */
  1677. #include <ole2.h>
  1678. #ifdef __cplusplus
  1679. extern "C" { /* Assume C declarations for C++ */
  1680. #endif /* __cplusplus */
  1681. /* - - - - - - - - */
  1682. /****** AVI Stream Interface *******************************************/
  1683. #undef INTERFACE
  1684. #define INTERFACE IAVIStream
  1685. DECLARE_INTERFACE_(IAVIStream, IUnknown)
  1686. {
  1687. // *** IUnknown methods ***
  1688. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  1689. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1690. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1691. // *** IAVIStream methods ***
  1692. STDMETHOD(Create) (THIS_ LPARAM lParam1, LPARAM lParam2) PURE ;
  1693. STDMETHOD(Info) (THIS_ AVISTREAMINFOW FAR * psi, LONG lSize) PURE ;
  1694. STDMETHOD_(LONG, FindSample)(THIS_ LONG lPos, LONG lFlags) PURE ;
  1695. STDMETHOD(ReadFormat) (THIS_ LONG lPos,
  1696. LPVOID lpFormat, LONG FAR *lpcbFormat) PURE ;
  1697. STDMETHOD(SetFormat) (THIS_ LONG lPos,
  1698. LPVOID lpFormat, LONG cbFormat) PURE ;
  1699. STDMETHOD(Read) (THIS_ LONG lStart, LONG lSamples,
  1700. LPVOID lpBuffer, LONG cbBuffer,
  1701. LONG FAR * plBytes, LONG FAR * plSamples) PURE ;
  1702. STDMETHOD(Write) (THIS_ LONG lStart, LONG lSamples,
  1703. LPVOID lpBuffer, LONG cbBuffer,
  1704. DWORD dwFlags,
  1705. LONG FAR *plSampWritten,
  1706. LONG FAR *plBytesWritten) PURE ;
  1707. STDMETHOD(Delete) (THIS_ LONG lStart, LONG lSamples) PURE;
  1708. STDMETHOD(ReadData) (THIS_ DWORD fcc, LPVOID lp, LONG FAR *lpcb) PURE ;
  1709. STDMETHOD(WriteData) (THIS_ DWORD fcc, LPVOID lp, LONG cb) PURE ;
  1710. #ifdef _WIN32
  1711. STDMETHOD(SetInfo) (THIS_ AVISTREAMINFOW FAR * lpInfo,
  1712. LONG cbInfo) PURE;
  1713. #else
  1714. STDMETHOD(Reserved1) (THIS) PURE;
  1715. STDMETHOD(Reserved2) (THIS) PURE;
  1716. STDMETHOD(Reserved3) (THIS) PURE;
  1717. STDMETHOD(Reserved4) (THIS) PURE;
  1718. STDMETHOD(Reserved5) (THIS) PURE;
  1719. #endif
  1720. };
  1721. typedef IAVIStream FAR* PAVISTREAM;
  1722. #undef INTERFACE
  1723. #define INTERFACE IAVIStreaming
  1724. DECLARE_INTERFACE_(IAVIStreaming, IUnknown)
  1725. {
  1726. // *** IUnknown methods ***
  1727. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  1728. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1729. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1730. // *** IAVIStreaming methods ***
  1731. STDMETHOD(Begin) (THIS_
  1732. LONG lStart, // start of what we expect
  1733. // to play
  1734. LONG lEnd, // expected end, or -1
  1735. LONG lRate) PURE; // Should this be a float?
  1736. STDMETHOD(End) (THIS) PURE;
  1737. };
  1738. typedef IAVIStreaming FAR* PAVISTREAMING;
  1739. #undef INTERFACE
  1740. #define INTERFACE IAVIEditStream
  1741. DECLARE_INTERFACE_(IAVIEditStream, IUnknown)
  1742. {
  1743. // *** IUnknown methods ***
  1744. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  1745. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1746. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1747. // *** IAVIEditStream methods ***
  1748. STDMETHOD(Cut) (THIS_ LONG FAR *plStart,
  1749. LONG FAR *plLength,
  1750. PAVISTREAM FAR * ppResult) PURE;
  1751. STDMETHOD(Copy) (THIS_ LONG FAR *plStart,
  1752. LONG FAR *plLength,
  1753. PAVISTREAM FAR * ppResult) PURE;
  1754. STDMETHOD(Paste) (THIS_ LONG FAR *plPos,
  1755. LONG FAR *plLength,
  1756. PAVISTREAM pstream,
  1757. LONG lStart,
  1758. LONG lEnd) PURE;
  1759. STDMETHOD(Clone) (THIS_ PAVISTREAM FAR *ppResult) PURE;
  1760. STDMETHOD(SetInfo) (THIS_ AVISTREAMINFOW FAR * lpInfo,
  1761. LONG cbInfo) PURE;
  1762. };
  1763. typedef IAVIEditStream FAR* PAVIEDITSTREAM;
  1764. /****** AVI File Interface *******************************************/
  1765. #undef INTERFACE
  1766. #define INTERFACE IAVIFile
  1767. #define PAVIFILE IAVIFile FAR*
  1768. DECLARE_INTERFACE_(IAVIFile, IUnknown)
  1769. {
  1770. // *** IUnknown methods ***
  1771. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  1772. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1773. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1774. // *** IAVIFile methods ***
  1775. STDMETHOD(Info) (THIS_
  1776. AVIFILEINFOW FAR * pfi,
  1777. LONG lSize) PURE;
  1778. STDMETHOD(GetStream) (THIS_
  1779. PAVISTREAM FAR * ppStream,
  1780. DWORD fccType,
  1781. LONG lParam) PURE;
  1782. STDMETHOD(CreateStream) (THIS_
  1783. PAVISTREAM FAR * ppStream,
  1784. AVISTREAMINFOW FAR * psi) PURE;
  1785. STDMETHOD(WriteData) (THIS_
  1786. DWORD ckid,
  1787. LPVOID lpData,
  1788. LONG cbData) PURE;
  1789. STDMETHOD(ReadData) (THIS_
  1790. DWORD ckid,
  1791. LPVOID lpData,
  1792. LONG FAR *lpcbData) PURE;
  1793. STDMETHOD(EndRecord) (THIS) PURE;
  1794. STDMETHOD(DeleteStream) (THIS_
  1795. DWORD fccType,
  1796. LONG lParam) PURE;
  1797. };
  1798. #undef PAVIFILE
  1799. typedef IAVIFile FAR* PAVIFILE;
  1800. /****** GetFrame Interface *******************************************/
  1801. #undef INTERFACE
  1802. #define INTERFACE IGetFrame
  1803. #define PGETFRAME IGetFrame FAR*
  1804. DECLARE_INTERFACE_(IGetFrame, IUnknown)
  1805. {
  1806. // *** IUnknown methods ***
  1807. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  1808. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1809. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1810. // *** IGetFrame methods ***
  1811. STDMETHOD_(LPVOID,GetFrame) (THIS_ LONG lPos) PURE;
  1812. // STDMETHOD_(LPVOID,GetFrameData) (THIS_ LONG lPos) PURE;
  1813. STDMETHOD(Begin) (THIS_ LONG lStart, LONG lEnd, LONG lRate) PURE;
  1814. STDMETHOD(End) (THIS) PURE;
  1815. STDMETHOD(SetFormat) (THIS_ LPBITMAPINFOHEADER lpbi, LPVOID lpBits, int x, int y, int dx, int dy) PURE;
  1816. // STDMETHOD(DrawFrameStart) (THIS) PURE;
  1817. // STDMETHOD(DrawFrame) (THIS_ LONG lPos, HDC hdc, int x, int y, int dx, int dy) PURE;
  1818. // STDMETHOD(DrawFrameEnd) (THIS) PURE;
  1819. };
  1820. #undef PGETFRAME
  1821. typedef IGetFrame FAR* PGETFRAME;
  1822. /****** GUIDs *******************************************/
  1823. #define DEFINE_AVIGUID(name, l, w1, w2) \
  1824. DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
  1825. DEFINE_AVIGUID(IID_IAVIFile, 0x00020020, 0, 0);
  1826. DEFINE_AVIGUID(IID_IAVIStream, 0x00020021, 0, 0);
  1827. DEFINE_AVIGUID(IID_IAVIStreaming, 0x00020022, 0, 0);
  1828. DEFINE_AVIGUID(IID_IGetFrame, 0x00020023, 0, 0);
  1829. DEFINE_AVIGUID(IID_IAVIEditStream, 0x00020024, 0, 0);
  1830. #ifndef UNICODE
  1831. DEFINE_AVIGUID(CLSID_AVISimpleUnMarshal, 0x00020009, 0, 0);
  1832. #endif
  1833. DEFINE_AVIGUID(CLSID_AVIFile, 0x00020000, 0, 0);
  1834. #define AVIFILEHANDLER_CANREAD 0x0001
  1835. #define AVIFILEHANDLER_CANWRITE 0x0002
  1836. #define AVIFILEHANDLER_CANACCEPTNONRGB 0x0004
  1837. //
  1838. // functions
  1839. //
  1840. STDAPI_(void) AVIFileInit(void); // Call this first!
  1841. STDAPI_(void) AVIFileExit(void);
  1842. STDAPI_(ULONG) AVIFileAddRef (PAVIFILE pfile);
  1843. STDAPI_(ULONG) AVIFileRelease (PAVIFILE pfile);
  1844. #ifdef _WIN32
  1845. STDAPI AVIFileOpenA (PAVIFILE FAR * ppfile, LPCSTR szFile,
  1846. UINT uMode, LPCLSID lpHandler);
  1847. STDAPI AVIFileOpenW (PAVIFILE FAR * ppfile, LPCWSTR szFile,
  1848. UINT uMode, LPCLSID lpHandler);
  1849. #ifdef UNICODE
  1850. #define AVIFileOpen AVIFileOpenW
  1851. #else
  1852. #define AVIFileOpen AVIFileOpenA
  1853. #endif
  1854. #else // win16
  1855. STDAPI AVIFileOpen (PAVIFILE FAR * ppfile, LPCSTR szFile,
  1856. UINT uMode, LPCLSID lpHandler);
  1857. #define AVIFileOpenW AVIFileOpen /* ;Internal */
  1858. #endif
  1859. #ifdef _WIN32
  1860. STDAPI AVIFileInfoW (PAVIFILE pfile, LPAVIFILEINFOW pfi, LONG lSize);
  1861. STDAPI AVIFileInfoA (PAVIFILE pfile, LPAVIFILEINFOA pfi, LONG lSize);
  1862. #ifdef UNICODE
  1863. #define AVIFileInfo AVIFileInfoW
  1864. #else
  1865. #define AVIFileInfo AVIFileInfoA
  1866. #endif
  1867. #else //win16 version
  1868. STDAPI AVIFileInfo (PAVIFILE pfile, LPAVIFILEINFO pfi, LONG lSize);
  1869. #define AVIFileInfoW AVIFileInfo /* ;Internal */
  1870. #endif
  1871. STDAPI AVIFileGetStream (PAVIFILE pfile, PAVISTREAM FAR * ppavi, DWORD fccType, LONG lParam);
  1872. #ifdef _WIN32
  1873. STDAPI AVIFileCreateStreamW (PAVIFILE pfile, PAVISTREAM FAR *ppavi, AVISTREAMINFOW FAR * psi);
  1874. STDAPI AVIFileCreateStreamA (PAVIFILE pfile, PAVISTREAM FAR *ppavi, AVISTREAMINFOA FAR * psi);
  1875. #ifdef UNICODE
  1876. #define AVIFileCreateStream AVIFileCreateStreamW
  1877. #else
  1878. #define AVIFileCreateStream AVIFileCreateStreamA
  1879. #endif
  1880. #else //win16 version
  1881. STDAPI AVIFileCreateStream(PAVIFILE pfile, PAVISTREAM FAR *ppavi, AVISTREAMINFO FAR * psi);
  1882. #define AVIFileCreateStreamW AVIFileCreateStream /* ;Internal */
  1883. #endif
  1884. STDAPI AVIFileWriteData (PAVIFILE pfile,
  1885. DWORD ckid,
  1886. LPVOID lpData,
  1887. LONG cbData);
  1888. STDAPI AVIFileReadData (PAVIFILE pfile,
  1889. DWORD ckid,
  1890. LPVOID lpData,
  1891. LONG FAR *lpcbData);
  1892. STDAPI AVIFileEndRecord (PAVIFILE pfile);
  1893. STDAPI_(ULONG) AVIStreamAddRef (PAVISTREAM pavi);
  1894. STDAPI_(ULONG) AVIStreamRelease (PAVISTREAM pavi);
  1895. STDAPI AVIStreamInfoW (PAVISTREAM pavi, LPAVISTREAMINFOW psi, LONG lSize);
  1896. STDAPI AVIStreamInfoA (PAVISTREAM pavi, LPAVISTREAMINFOA psi, LONG lSize);
  1897. #ifdef UNICODE
  1898. #define AVIStreamInfo AVIStreamInfoW
  1899. #else
  1900. #define AVIStreamInfo AVIStreamInfoA
  1901. #endif
  1902. STDAPI_(LONG) AVIStreamFindSample(PAVISTREAM pavi, LONG lPos, LONG lFlags);
  1903. STDAPI AVIStreamReadFormat (PAVISTREAM pavi, LONG lPos,LPVOID lpFormat,LONG FAR *lpcbFormat);
  1904. STDAPI AVIStreamSetFormat (PAVISTREAM pavi, LONG lPos,LPVOID lpFormat,LONG cbFormat);
  1905. STDAPI AVIStreamReadData (PAVISTREAM pavi, DWORD fcc, LPVOID lp, LONG FAR *lpcb);
  1906. STDAPI AVIStreamWriteData (PAVISTREAM pavi, DWORD fcc, LPVOID lp, LONG cb);
  1907. STDAPI AVIStreamRead (PAVISTREAM pavi,
  1908. LONG lStart,
  1909. LONG lSamples,
  1910. LPVOID lpBuffer,
  1911. LONG cbBuffer,
  1912. LONG FAR * plBytes,
  1913. LONG FAR * plSamples);
  1914. #define AVISTREAMREAD_CONVENIENT (-1L)
  1915. STDAPI AVIStreamWrite (PAVISTREAM pavi,
  1916. LONG lStart, LONG lSamples,
  1917. LPVOID lpBuffer, LONG cbBuffer, DWORD dwFlags,
  1918. LONG FAR *plSampWritten,
  1919. LONG FAR *plBytesWritten);
  1920. // Right now, these just use AVIStreamInfo() to get information, then
  1921. // return some of it. Can they be more efficient?
  1922. STDAPI_(LONG) AVIStreamStart (PAVISTREAM pavi);
  1923. STDAPI_(LONG) AVIStreamLength (PAVISTREAM pavi);
  1924. STDAPI_(LONG) AVIStreamTimeToSample (PAVISTREAM pavi, LONG lTime);
  1925. STDAPI_(LONG) AVIStreamSampleToTime (PAVISTREAM pavi, LONG lSample);
  1926. STDAPI AVIStreamBeginStreaming(PAVISTREAM pavi, LONG lStart, LONG lEnd, LONG lRate);
  1927. STDAPI AVIStreamEndStreaming(PAVISTREAM pavi);
  1928. //
  1929. // helper functions for using IGetFrame
  1930. //
  1931. STDAPI_(PGETFRAME) AVIStreamGetFrameOpen(PAVISTREAM pavi,
  1932. LPBITMAPINFOHEADER lpbiWanted);
  1933. STDAPI_(LPVOID) AVIStreamGetFrame(PGETFRAME pg, LONG lPos);
  1934. STDAPI AVIStreamGetFrameClose(PGETFRAME pg);
  1935. // !!! We need some way to place an advise on a stream....
  1936. // STDAPI AVIStreamHasChanged (PAVISTREAM pavi);
  1937. // Shortcut function
  1938. STDAPI AVIStreamOpenFromFileA(PAVISTREAM FAR *ppavi, LPCSTR szFile,
  1939. DWORD fccType, LONG lParam,
  1940. UINT mode, CLSID FAR *pclsidHandler);
  1941. STDAPI AVIStreamOpenFromFileW(PAVISTREAM FAR *ppavi, LPCWSTR szFile,
  1942. DWORD fccType, LONG lParam,
  1943. UINT mode, CLSID FAR *pclsidHandler);
  1944. #ifdef UNICODE
  1945. #define AVIStreamOpenFromFile AVIStreamOpenFromFileW
  1946. #else
  1947. #define AVIStreamOpenFromFile AVIStreamOpenFromFileA
  1948. #endif
  1949. // Use to create disembodied streams
  1950. STDAPI AVIStreamCreate(PAVISTREAM FAR *ppavi, LONG lParam1, LONG lParam2,
  1951. CLSID FAR *pclsidHandler);
  1952. // PHANDLER AVIAPI AVIGetHandler (PAVISTREAM pavi, PAVISTREAMHANDLER psh);
  1953. // PAVISTREAM AVIAPI AVIGetStream (PHANDLER p);
  1954. //
  1955. // flags for AVIStreamFindSample
  1956. //
  1957. #define FIND_DIR 0x0000000FL // direction
  1958. #define FIND_NEXT 0x00000001L // go forward
  1959. #define FIND_PREV 0x00000004L // go backward
  1960. #define FIND_FROM_START 0x00000008L // start at the logical beginning
  1961. #define FIND_TYPE 0x000000F0L // type mask
  1962. #define FIND_KEY 0x00000010L // find key frame.
  1963. #define FIND_ANY 0x00000020L // find any (non-empty) sample
  1964. #define FIND_FORMAT 0x00000040L // find format change
  1965. #define FIND_RET 0x0000F000L // return mask
  1966. #define FIND_POS 0x00000000L // return logical position
  1967. #define FIND_LENGTH 0x00001000L // return logical size
  1968. #define FIND_OFFSET 0x00002000L // return physical position
  1969. #define FIND_SIZE 0x00003000L // return physical size
  1970. #define FIND_INDEX 0x00004000L // return physical index position
  1971. //
  1972. // stuff to support backward compat.
  1973. //
  1974. #define AVIStreamFindKeyFrame AVIStreamFindSample
  1975. #define FindKeyFrame FindSample
  1976. #define AVIStreamClose AVIStreamRelease
  1977. #define AVIFileClose AVIFileRelease
  1978. #define AVIStreamInit AVIFileInit
  1979. #define AVIStreamExit AVIFileExit
  1980. #define SEARCH_NEAREST FIND_PREV
  1981. #define SEARCH_BACKWARD FIND_PREV
  1982. #define SEARCH_FORWARD FIND_NEXT
  1983. #define SEARCH_KEY FIND_KEY
  1984. #define SEARCH_ANY FIND_ANY
  1985. //
  1986. // helper macros.
  1987. //
  1988. #define AVIStreamSampleToSample(pavi1, pavi2, l) \
  1989. AVIStreamTimeToSample(pavi1,AVIStreamSampleToTime(pavi2, l))
  1990. #define AVIStreamNextSample(pavi, l) \
  1991. AVIStreamFindSample(pavi,l+1,FIND_NEXT|FIND_ANY)
  1992. #define AVIStreamPrevSample(pavi, l) \
  1993. AVIStreamFindSample(pavi,l-1,FIND_PREV|FIND_ANY)
  1994. #define AVIStreamNearestSample(pavi, l) \
  1995. AVIStreamFindSample(pavi,l,FIND_PREV|FIND_ANY)
  1996. #define AVIStreamNextKeyFrame(pavi,l) \
  1997. AVIStreamFindSample(pavi,l+1,FIND_NEXT|FIND_KEY)
  1998. #define AVIStreamPrevKeyFrame(pavi, l) \
  1999. AVIStreamFindSample(pavi,l-1,FIND_PREV|FIND_KEY)
  2000. #define AVIStreamNearestKeyFrame(pavi, l) \
  2001. AVIStreamFindSample(pavi,l,FIND_PREV|FIND_KEY)
  2002. #define AVIStreamIsKeyFrame(pavi, l) \
  2003. (AVIStreamNearestKeyFrame(pavi,l) == l)
  2004. #define AVIStreamPrevSampleTime(pavi, t) \
  2005. AVIStreamSampleToTime(pavi, AVIStreamPrevSample(pavi,AVIStreamTimeToSample(pavi,t)))
  2006. #define AVIStreamNextSampleTime(pavi, t) \
  2007. AVIStreamSampleToTime(pavi, AVIStreamNextSample(pavi,AVIStreamTimeToSample(pavi,t)))
  2008. #define AVIStreamNearestSampleTime(pavi, t) \
  2009. AVIStreamSampleToTime(pavi, AVIStreamNearestSample(pavi,AVIStreamTimeToSample(pavi,t)))
  2010. #define AVIStreamNextKeyFrameTime(pavi, t) \
  2011. AVIStreamSampleToTime(pavi, AVIStreamNextKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)))
  2012. #define AVIStreamPrevKeyFrameTime(pavi, t) \
  2013. AVIStreamSampleToTime(pavi, AVIStreamPrevKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)))
  2014. #define AVIStreamNearestKeyFrameTime(pavi, t) \
  2015. AVIStreamSampleToTime(pavi, AVIStreamNearestKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)))
  2016. #define AVIStreamStartTime(pavi) \
  2017. AVIStreamSampleToTime(pavi, AVIStreamStart(pavi))
  2018. #define AVIStreamLengthTime(pavi) \
  2019. AVIStreamSampleToTime(pavi, AVIStreamLength(pavi))
  2020. #define AVIStreamEnd(pavi) \
  2021. (AVIStreamStart(pavi) + AVIStreamLength(pavi))
  2022. #define AVIStreamEndTime(pavi) \
  2023. AVIStreamSampleToTime(pavi, AVIStreamEnd(pavi))
  2024. #define AVIStreamSampleSize(pavi, lPos, plSize) \
  2025. AVIStreamRead(pavi,lPos,1,NULL,0,plSize,NULL)
  2026. #define AVIStreamFormatSize(pavi, lPos, plSize) \
  2027. AVIStreamReadFormat(pavi,lPos,NULL,plSize)
  2028. #define AVIStreamDataSize(pavi, fcc, plSize) \
  2029. AVIStreamReadData(pavi,fcc,NULL,plSize)
  2030. /****************************************************************************
  2031. *
  2032. * AVISave routines and structures
  2033. *
  2034. ***************************************************************************/
  2035. #ifndef comptypeDIB
  2036. #define comptypeDIB mmioFOURCC('D', 'I', 'B', ' ')
  2037. #endif
  2038. STDAPI AVIMakeCompressedStream(
  2039. PAVISTREAM FAR * ppsCompressed,
  2040. PAVISTREAM ppsSource,
  2041. AVICOMPRESSOPTIONS FAR * lpOptions,
  2042. CLSID FAR *pclsidHandler);
  2043. EXTERN_C HRESULT CDECL AVISaveA (LPCSTR szFile,
  2044. CLSID FAR *pclsidHandler,
  2045. AVISAVECALLBACK lpfnCallback,
  2046. int nStreams,
  2047. PAVISTREAM pfile,
  2048. LPAVICOMPRESSOPTIONS lpOptions,
  2049. ...);
  2050. STDAPI AVISaveVA(LPCSTR szFile,
  2051. CLSID FAR *pclsidHandler,
  2052. AVISAVECALLBACK lpfnCallback,
  2053. int nStreams,
  2054. PAVISTREAM FAR * ppavi,
  2055. LPAVICOMPRESSOPTIONS FAR *plpOptions);
  2056. EXTERN_C HRESULT CDECL AVISaveW (LPCWSTR szFile,
  2057. CLSID FAR *pclsidHandler,
  2058. AVISAVECALLBACK lpfnCallback,
  2059. int nStreams,
  2060. PAVISTREAM pfile,
  2061. LPAVICOMPRESSOPTIONS lpOptions,
  2062. ...);
  2063. STDAPI AVISaveVW(LPCWSTR szFile,
  2064. CLSID FAR *pclsidHandler,
  2065. AVISAVECALLBACK lpfnCallback,
  2066. int nStreams,
  2067. PAVISTREAM FAR * ppavi,
  2068. LPAVICOMPRESSOPTIONS FAR *plpOptions);
  2069. #ifdef UNICODE
  2070. #define AVISave AVISaveW
  2071. #define AVISaveV AVISaveVW
  2072. #else
  2073. #define AVISave AVISaveA
  2074. #define AVISaveV AVISaveVA
  2075. #endif
  2076. STDAPI_(INT_PTR) AVISaveOptions(HWND hwnd,
  2077. UINT uiFlags,
  2078. int nStreams,
  2079. PAVISTREAM FAR *ppavi,
  2080. LPAVICOMPRESSOPTIONS FAR *plpOptions);
  2081. STDAPI AVISaveOptionsFree(int nStreams,
  2082. LPAVICOMPRESSOPTIONS FAR *plpOptions);
  2083. // FLAGS FOR uiFlags:
  2084. //
  2085. // Same as the flags for ICCompressorChoose (see compman.h)
  2086. // These determine what the compression options dialog for video streams
  2087. // will look like.
  2088. STDAPI AVIBuildFilterW(LPWSTR lpszFilter, LONG cbFilter, BOOL fSaving);
  2089. STDAPI AVIBuildFilterA(LPSTR lpszFilter, LONG cbFilter, BOOL fSaving);
  2090. #ifdef UNICODE
  2091. #define AVIBuildFilter AVIBuildFilterW
  2092. #else
  2093. #define AVIBuildFilter AVIBuildFilterA
  2094. #endif
  2095. STDAPI AVIMakeFileFromStreams(PAVIFILE FAR * ppfile,
  2096. int nStreams,
  2097. PAVISTREAM FAR * papStreams);
  2098. STDAPI AVIMakeStreamFromClipboard(UINT cfFormat, HANDLE hGlobal, PAVISTREAM FAR *ppstream);
  2099. /****************************************************************************
  2100. *
  2101. * Clipboard routines
  2102. *
  2103. ***************************************************************************/
  2104. STDAPI AVIPutFileOnClipboard(PAVIFILE pf);
  2105. STDAPI AVIGetFromClipboard(PAVIFILE FAR * lppf);
  2106. STDAPI AVIClearClipboard(void);
  2107. /****************************************************************************
  2108. *
  2109. * Editing routines
  2110. *
  2111. ***************************************************************************/
  2112. STDAPI CreateEditableStream(
  2113. PAVISTREAM FAR * ppsEditable,
  2114. PAVISTREAM psSource);
  2115. STDAPI EditStreamCut(PAVISTREAM pavi, LONG FAR *plStart, LONG FAR *plLength, PAVISTREAM FAR * ppResult);
  2116. STDAPI EditStreamCopy(PAVISTREAM pavi, LONG FAR *plStart, LONG FAR *plLength, PAVISTREAM FAR * ppResult);
  2117. STDAPI EditStreamPaste(PAVISTREAM pavi, LONG FAR *plPos, LONG FAR *plLength, PAVISTREAM pstream, LONG lStart, LONG lEnd);
  2118. STDAPI EditStreamClone(PAVISTREAM pavi, PAVISTREAM FAR *ppResult);
  2119. STDAPI EditStreamSetNameA(PAVISTREAM pavi, LPCSTR lpszName);
  2120. STDAPI EditStreamSetNameW(PAVISTREAM pavi, LPCWSTR lpszName);
  2121. STDAPI EditStreamSetInfoW(PAVISTREAM pavi, LPAVISTREAMINFOW lpInfo, LONG cbInfo);
  2122. STDAPI EditStreamSetInfoA(PAVISTREAM pavi, LPAVISTREAMINFOA lpInfo, LONG cbInfo);
  2123. #ifdef UNICODE
  2124. #define EditStreamSetInfo EditStreamSetInfoW
  2125. #define EditStreamSetName EditStreamSetNameW
  2126. #else
  2127. #define EditStreamSetInfo EditStreamSetInfoA
  2128. #define EditStreamSetName EditStreamSetNameA
  2129. #endif
  2130. /* - - - - - - - - */
  2131. #ifndef AVIERR_OK
  2132. #define AVIERR_OK 0L
  2133. #define MAKE_AVIERR(error) MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x4000 + error)
  2134. // !!! Questions to be answered:
  2135. // How can you get a string form of these errors?
  2136. // Which of these errors should be replaced by errors in SCODE.H?
  2137. #define AVIERR_UNSUPPORTED MAKE_AVIERR(101)
  2138. #define AVIERR_BADFORMAT MAKE_AVIERR(102)
  2139. #define AVIERR_MEMORY MAKE_AVIERR(103)
  2140. #define AVIERR_INTERNAL MAKE_AVIERR(104)
  2141. #define AVIERR_BADFLAGS MAKE_AVIERR(105)
  2142. #define AVIERR_BADPARAM MAKE_AVIERR(106)
  2143. #define AVIERR_BADSIZE MAKE_AVIERR(107)
  2144. #define AVIERR_BADHANDLE MAKE_AVIERR(108)
  2145. #define AVIERR_FILEREAD MAKE_AVIERR(109)
  2146. #define AVIERR_FILEWRITE MAKE_AVIERR(110)
  2147. #define AVIERR_FILEOPEN MAKE_AVIERR(111)
  2148. #define AVIERR_COMPRESSOR MAKE_AVIERR(112)
  2149. #define AVIERR_NOCOMPRESSOR MAKE_AVIERR(113)
  2150. #define AVIERR_READONLY MAKE_AVIERR(114)
  2151. #define AVIERR_NODATA MAKE_AVIERR(115)
  2152. #define AVIERR_BUFFERTOOSMALL MAKE_AVIERR(116)
  2153. #define AVIERR_CANTCOMPRESS MAKE_AVIERR(117)
  2154. #define AVIERR_USERABORT MAKE_AVIERR(198)
  2155. #define AVIERR_ERROR MAKE_AVIERR(199)
  2156. #endif
  2157. #endif /* NOAVIFILE */
  2158. /****************************************************************************
  2159. *
  2160. * MCIWnd - Window class for MCI objects
  2161. *
  2162. ***************************************************************************/
  2163. #ifndef NOMCIWND
  2164. /*----------------------------------------------------------------------------*\
  2165. *
  2166. * MCIWnd
  2167. *
  2168. * MCIWnd window class header file.
  2169. *
  2170. * the MCIWnd window class is a window class for controling MCI devices
  2171. * MCI devices include, wave files, midi files, AVI Video, cd audio,
  2172. * vcr, video disc, and others..
  2173. *
  2174. * to learn more about MCI and mci command sets see the
  2175. * "Microsoft Multimedia Programmers's guide" in the Win31 SDK
  2176. *
  2177. * the easiest use of the MCIWnd class is like so:
  2178. *
  2179. * hwnd = MCIWndCreate(hwndParent, hInstance, 0, "chimes.wav");
  2180. * ...
  2181. * MCIWndPlay(hwnd);
  2182. * MCIWndStop(hwnd);
  2183. * MCIWndPause(hwnd);
  2184. * ....
  2185. * MCIWndDestroy(hwnd);
  2186. *
  2187. * this will create a window with a play/pause, stop and a playbar
  2188. * and start the wave file playing.
  2189. *
  2190. * mciwnd.h defines macros for all the most common MCI commands, but
  2191. * any string command can be used if needed.
  2192. *
  2193. * Note: unlike the mciSendString() API, no alias or file name needs
  2194. * to be specifed, since the device to use is implied by the window handle.
  2195. *
  2196. * MCIWndSendString(hwnd, "setaudio stream to 2");
  2197. *
  2198. * (C) Copyright Microsoft Corp. 1991-1995. All rights reserved.
  2199. *
  2200. * You have a royalty-free right to use, modify, reproduce and
  2201. * distribute the Sample Files (and/or any modified version) in
  2202. * any way you find useful, provided that you agree that
  2203. * Microsoft has no warranty obligations or liability for any
  2204. * Sample Application Files.
  2205. *
  2206. * If you did not get this from Microsoft Sources, then it may not be the
  2207. * most current version. This sample code in particular will be updated
  2208. * and include more documentation.
  2209. *
  2210. * Sources are:
  2211. * CompuServe: WINSDK forum, MDK section.
  2212. * Anonymous FTP from ftp.uu.net vendor\microsoft\multimedia
  2213. *
  2214. * WIN32:
  2215. *
  2216. * MCIWnd supports both ansi and unicode interfaces. For any message that
  2217. * takes or returns a text string, two versions of the message are defined,
  2218. * appended with A or W for Ansi or Wide Char. The message or api itself
  2219. * is defined to be one or other of these depending on whether you have
  2220. * UNICODE defined in your application.
  2221. * Thus for the api MCIWndCreate, there are in fact two apis,
  2222. * MCIWndCreateA and MCIWndCreateW. If you call MCIWndCreate, this will be
  2223. * re-routed to MCIWndCreateA unless UNICODE is defined when building your
  2224. * application. In any one application, you can mix calls to the
  2225. * Ansi and Unicode entrypoints.
  2226. *
  2227. * If you use SendMessage instead of the macros below such as MCIWndOpen(),
  2228. * you will see that the messages have changed for WIN32, to support Ansi
  2229. * and Unicode entrypoints. In particular, MCI_OPEN has been replaced by
  2230. * MCWNDM_OPENA, or MCIWNDM_OPENW (MCIWNDM_OPEN is defined to be one or
  2231. * other of these).
  2232. *
  2233. * Also, note that the WIN32 implementation of MCIWnd uses UNICODE
  2234. * so all apis and messages supporting ANSI strings do so by mapping them
  2235. * UNICODE strings and then calling the corresponding UNICODE entrypoint.
  2236. *
  2237. *----------------------------------------------------------------------------*/
  2238. #ifdef __cplusplus
  2239. // MFC Redefines SendMessage, so make sure we get the global one....
  2240. #define MCIWndSM ::SendMessage /* SendMessage in C++*/
  2241. #else
  2242. #define MCIWndSM SendMessage /* SendMessage in C */
  2243. #endif /* __cplusplus */
  2244. #define MCIWND_WINDOW_CLASS TEXT("MCIWndClass")
  2245. HWND
  2246. VFWAPIV
  2247. MCIWndCreateA(
  2248. IN HWND hwndParent,
  2249. IN HINSTANCE hInstance,
  2250. IN DWORD dwStyle,
  2251. IN LPCSTR szFile
  2252. );
  2253. HWND
  2254. VFWAPIV
  2255. MCIWndCreateW(
  2256. IN HWND hwndParent,
  2257. IN HINSTANCE hInstance,
  2258. IN DWORD dwStyle,
  2259. IN LPCWSTR szFile
  2260. );
  2261. #ifdef UNICODE
  2262. #define MCIWndCreate MCIWndCreateW
  2263. #else
  2264. #define MCIWndCreate MCIWndCreateA
  2265. #endif
  2266. BOOL VFWAPIV MCIWndRegisterClass(void);
  2267. // Flags for the MCIWndOpen command
  2268. #define MCIWNDOPENF_NEW 0x0001 // open a new file
  2269. // window styles
  2270. #define MCIWNDF_NOAUTOSIZEWINDOW 0x0001 // when movie size changes
  2271. #define MCIWNDF_NOPLAYBAR 0x0002 // no toolbar
  2272. #define MCIWNDF_NOAUTOSIZEMOVIE 0x0004 // when window size changes
  2273. #define MCIWNDF_NOMENU 0x0008 // no popup menu from RBUTTONDOWN
  2274. #define MCIWNDF_SHOWNAME 0x0010 // show name in caption
  2275. #define MCIWNDF_SHOWPOS 0x0020 // show position in caption
  2276. #define MCIWNDF_SHOWMODE 0x0040 // show mode in caption
  2277. #define MCIWNDF_SHOWALL 0x0070 // show all
  2278. #define MCIWNDF_NOTIFYMODE 0x0100 // tell parent of mode change
  2279. #define MCIWNDF_NOTIFYPOS 0x0200 // tell parent of pos change
  2280. #define MCIWNDF_NOTIFYSIZE 0x0400 // tell parent of size change
  2281. #define MCIWNDF_NOTIFYERROR 0x1000 // tell parent of an error
  2282. #define MCIWNDF_NOTIFYALL 0x1F00 // tell all
  2283. #define MCIWNDF_NOTIFYANSI 0x0080
  2284. // The MEDIA notification includes a text string.
  2285. // To receive notifications in ANSI instead of unicode set the
  2286. // MCIWNDF_NOTIFYANSI style bit. The macro below includes this bit
  2287. // by default unless you define UNICODE in your application.
  2288. #define MCIWNDF_NOTIFYMEDIAA 0x0880 // tell parent of media change
  2289. #define MCIWNDF_NOTIFYMEDIAW 0x0800 // tell parent of media change
  2290. #ifdef UNICODE
  2291. #define MCIWNDF_NOTIFYMEDIA MCIWNDF_NOTIFYMEDIAW
  2292. #else
  2293. #define MCIWNDF_NOTIFYMEDIA MCIWNDF_NOTIFYMEDIAA
  2294. #endif
  2295. #define MCIWNDF_RECORD 0x2000 // Give a record button
  2296. #define MCIWNDF_NOERRORDLG 0x4000 // Show Error Dlgs for MCI cmds?
  2297. #define MCIWNDF_NOOPEN 0x8000 // Don't allow user to open things
  2298. // can macros
  2299. #define MCIWndCanPlay(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_PLAY,0,0)
  2300. #define MCIWndCanRecord(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_RECORD,0,0)
  2301. #define MCIWndCanSave(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_SAVE,0,0)
  2302. #define MCIWndCanWindow(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_WINDOW,0,0)
  2303. #define MCIWndCanEject(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_EJECT,0,0)
  2304. #define MCIWndCanConfig(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_CONFIG,0,0)
  2305. #define MCIWndPaletteKick(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_PALETTEKICK,0,0)
  2306. #define MCIWndSave(hwnd, szFile) (LONG)MCIWndSM(hwnd, MCI_SAVE, 0, (LPARAM)(LPVOID)(szFile))
  2307. #define MCIWndSaveDialog(hwnd) MCIWndSave(hwnd, -1)
  2308. // if you dont give a device it will use the current device....
  2309. #define MCIWndNew(hwnd, lp) (LONG)MCIWndSM(hwnd, MCIWNDM_NEW, 0, (LPARAM)(LPVOID)(lp))
  2310. #define MCIWndRecord(hwnd) (LONG)MCIWndSM(hwnd, MCI_RECORD, 0, 0)
  2311. #define MCIWndOpen(hwnd, sz, f) (LONG)MCIWndSM(hwnd, MCIWNDM_OPEN, (WPARAM)(UINT)(f),(LPARAM)(LPVOID)(sz))
  2312. #define MCIWndOpenDialog(hwnd) MCIWndOpen(hwnd, -1, 0)
  2313. #define MCIWndClose(hwnd) (LONG)MCIWndSM(hwnd, MCI_CLOSE, 0, 0)
  2314. #define MCIWndPlay(hwnd) (LONG)MCIWndSM(hwnd, MCI_PLAY, 0, 0)
  2315. #define MCIWndStop(hwnd) (LONG)MCIWndSM(hwnd, MCI_STOP, 0, 0)
  2316. #define MCIWndPause(hwnd) (LONG)MCIWndSM(hwnd, MCI_PAUSE, 0, 0)
  2317. #define MCIWndResume(hwnd) (LONG)MCIWndSM(hwnd, MCI_RESUME, 0, 0)
  2318. #define MCIWndSeek(hwnd, lPos) (LONG)MCIWndSM(hwnd, MCI_SEEK, 0, (LPARAM)(LONG)(lPos))
  2319. #define MCIWndEject(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_EJECT, 0, 0)
  2320. #define MCIWndHome(hwnd) MCIWndSeek(hwnd, MCIWND_START)
  2321. #define MCIWndEnd(hwnd) MCIWndSeek(hwnd, MCIWND_END)
  2322. #define MCIWndGetSource(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_GET_SOURCE, 0, (LPARAM)(LPRECT)(prc))
  2323. #define MCIWndPutSource(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_PUT_SOURCE, 0, (LPARAM)(LPRECT)(prc))
  2324. #define MCIWndGetDest(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_GET_DEST, 0, (LPARAM)(LPRECT)(prc))
  2325. #define MCIWndPutDest(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_PUT_DEST, 0, (LPARAM)(LPRECT)(prc))
  2326. #define MCIWndPlayReverse(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_PLAYREVERSE, 0, 0)
  2327. #define MCIWndPlayFrom(hwnd, lPos) (LONG)MCIWndSM(hwnd, MCIWNDM_PLAYFROM, 0, (LPARAM)(LONG)(lPos))
  2328. #define MCIWndPlayTo(hwnd, lPos) (LONG)MCIWndSM(hwnd, MCIWNDM_PLAYTO, 0, (LPARAM)(LONG)(lPos))
  2329. #define MCIWndPlayFromTo(hwnd, lStart, lEnd) (MCIWndSeek(hwnd, lStart), MCIWndPlayTo(hwnd, lEnd))
  2330. #define MCIWndGetDeviceID(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETDEVICEID, 0, 0)
  2331. #define MCIWndGetAlias(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETALIAS, 0, 0)
  2332. #define MCIWndGetMode(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETMODE, (WPARAM)(UINT)(len), (LPARAM)(LPTSTR)(lp))
  2333. #define MCIWndGetPosition(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETPOSITION, 0, 0)
  2334. #define MCIWndGetPositionString(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETPOSITION, (WPARAM)(UINT)(len), (LPARAM)(LPTSTR)(lp))
  2335. #define MCIWndGetStart(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETSTART, 0, 0)
  2336. #define MCIWndGetLength(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETLENGTH, 0, 0)
  2337. #define MCIWndGetEnd(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETEND, 0, 0)
  2338. #define MCIWndStep(hwnd, n) (LONG)MCIWndSM(hwnd, MCI_STEP, 0,(LPARAM)(long)(n))
  2339. #define MCIWndDestroy(hwnd) (VOID)MCIWndSM(hwnd, WM_CLOSE, 0, 0)
  2340. #define MCIWndSetZoom(hwnd,iZoom) (VOID)MCIWndSM(hwnd, MCIWNDM_SETZOOM, 0, (LPARAM)(UINT)(iZoom))
  2341. #define MCIWndGetZoom(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETZOOM, 0, 0)
  2342. #define MCIWndSetVolume(hwnd,iVol) (LONG)MCIWndSM(hwnd, MCIWNDM_SETVOLUME, 0, (LPARAM)(UINT)(iVol))
  2343. #define MCIWndGetVolume(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETVOLUME, 0, 0)
  2344. #define MCIWndSetSpeed(hwnd,iSpeed) (LONG)MCIWndSM(hwnd, MCIWNDM_SETSPEED, 0, (LPARAM)(UINT)(iSpeed))
  2345. #define MCIWndGetSpeed(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETSPEED, 0, 0)
  2346. #define MCIWndSetTimeFormat(hwnd, lp) (LONG)MCIWndSM(hwnd, MCIWNDM_SETTIMEFORMAT, 0, (LPARAM)(LPTSTR)(lp))
  2347. #define MCIWndGetTimeFormat(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETTIMEFORMAT, (WPARAM)(UINT)(len), (LPARAM)(LPTSTR)(lp))
  2348. #define MCIWndValidateMedia(hwnd) (VOID)MCIWndSM(hwnd, MCIWNDM_VALIDATEMEDIA, 0, 0)
  2349. #define MCIWndSetRepeat(hwnd,f) (void)MCIWndSM(hwnd, MCIWNDM_SETREPEAT, 0, (LPARAM)(BOOL)(f))
  2350. #define MCIWndGetRepeat(hwnd) (BOOL)MCIWndSM(hwnd, MCIWNDM_GETREPEAT, 0, 0)
  2351. #define MCIWndUseFrames(hwnd) MCIWndSetTimeFormat(hwnd, TEXT("frames"))
  2352. #define MCIWndUseTime(hwnd) MCIWndSetTimeFormat(hwnd, TEXT("ms"))
  2353. #define MCIWndSetActiveTimer(hwnd, active) \
  2354. (VOID)MCIWndSM(hwnd, MCIWNDM_SETACTIVETIMER, \
  2355. (WPARAM)(UINT)(active), 0L)
  2356. #define MCIWndSetInactiveTimer(hwnd, inactive) \
  2357. (VOID)MCIWndSM(hwnd, MCIWNDM_SETINACTIVETIMER, \
  2358. (WPARAM)(UINT)(inactive), 0L)
  2359. #define MCIWndSetTimers(hwnd, active, inactive) \
  2360. (VOID)MCIWndSM(hwnd, MCIWNDM_SETTIMERS,(WPARAM)(UINT)(active), \
  2361. (LPARAM)(UINT)(inactive))
  2362. #define MCIWndGetActiveTimer(hwnd) \
  2363. (UINT)MCIWndSM(hwnd, MCIWNDM_GETACTIVETIMER, 0, 0L);
  2364. #define MCIWndGetInactiveTimer(hwnd) \
  2365. (UINT)MCIWndSM(hwnd, MCIWNDM_GETINACTIVETIMER, 0, 0L);
  2366. #define MCIWndRealize(hwnd, fBkgnd) (LONG)MCIWndSM(hwnd, MCIWNDM_REALIZE,(WPARAM)(BOOL)(fBkgnd),0)
  2367. #define MCIWndSendString(hwnd, sz) (LONG)MCIWndSM(hwnd, MCIWNDM_SENDSTRING, 0, (LPARAM)(LPTSTR)(sz))
  2368. #define MCIWndReturnString(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_RETURNSTRING, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
  2369. #define MCIWndGetError(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETERROR, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
  2370. //#define MCIWndActivate(hwnd, f) (void)MCIWndSM(hwnd, WM_ACTIVATE, (WPARAM)(BOOL)(f), 0)
  2371. #define MCIWndGetPalette(hwnd) (HPALETTE)MCIWndSM(hwnd, MCIWNDM_GETPALETTE, 0, 0)
  2372. #define MCIWndSetPalette(hwnd, hpal) (LONG)MCIWndSM(hwnd, MCIWNDM_SETPALETTE, (WPARAM)(HPALETTE)(hpal), 0)
  2373. #define MCIWndGetFileName(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETFILENAME, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
  2374. #define MCIWndGetDevice(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETDEVICE, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
  2375. #define MCIWndGetStyles(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETSTYLES, 0, 0L)
  2376. #define MCIWndChangeStyles(hwnd, mask, value) (LONG)MCIWndSM(hwnd, MCIWNDM_CHANGESTYLES, (WPARAM)(UINT)(mask), (LPARAM)(LONG)(value))
  2377. #define MCIWndOpenInterface(hwnd, pUnk) (LONG)MCIWndSM(hwnd, MCIWNDM_OPENINTERFACE, 0, (LPARAM)(LPUNKNOWN)(pUnk))
  2378. #define MCIWndSetOwner(hwnd, hwndP) (LONG)MCIWndSM(hwnd, MCIWNDM_SETOWNER, (WPARAM)(hwndP), 0)
  2379. // Messages an app will send to MCIWND
  2380. // all the text-related messages are defined out of order above (they need
  2381. // to be defined before the MCIWndOpen() macros
  2382. #define MCIWNDM_GETDEVICEID (WM_USER + 100)
  2383. #define MCIWNDM_GETSTART (WM_USER + 103)
  2384. #define MCIWNDM_GETLENGTH (WM_USER + 104)
  2385. #define MCIWNDM_GETEND (WM_USER + 105)
  2386. #define MCIWNDM_EJECT (WM_USER + 107)
  2387. #define MCIWNDM_SETZOOM (WM_USER + 108)
  2388. #define MCIWNDM_GETZOOM (WM_USER + 109)
  2389. #define MCIWNDM_SETVOLUME (WM_USER + 110)
  2390. #define MCIWNDM_GETVOLUME (WM_USER + 111)
  2391. #define MCIWNDM_SETSPEED (WM_USER + 112)
  2392. #define MCIWNDM_GETSPEED (WM_USER + 113)
  2393. #define MCIWNDM_SETREPEAT (WM_USER + 114)
  2394. #define MCIWNDM_GETREPEAT (WM_USER + 115)
  2395. #define MCIWNDM_REALIZE (WM_USER + 118)
  2396. #define MCIWNDM_VALIDATEMEDIA (WM_USER + 121)
  2397. #define MCIWNDM_PLAYFROM (WM_USER + 122)
  2398. #define MCIWNDM_PLAYTO (WM_USER + 123)
  2399. #define MCIWNDM_GETPALETTE (WM_USER + 126)
  2400. #define MCIWNDM_SETPALETTE (WM_USER + 127)
  2401. #define MCIWNDM_SETTIMERS (WM_USER + 129)
  2402. #define MCIWNDM_SETACTIVETIMER (WM_USER + 130)
  2403. #define MCIWNDM_SETINACTIVETIMER (WM_USER + 131)
  2404. #define MCIWNDM_GETACTIVETIMER (WM_USER + 132)
  2405. #define MCIWNDM_GETINACTIVETIMER (WM_USER + 133)
  2406. #define MCIWNDM_CHANGESTYLES (WM_USER + 135)
  2407. #define MCIWNDM_GETSTYLES (WM_USER + 136)
  2408. #define MCIWNDM_GETALIAS (WM_USER + 137)
  2409. #define MCIWNDM_PLAYREVERSE (WM_USER + 139)
  2410. #define MCIWNDM_GET_SOURCE (WM_USER + 140)
  2411. #define MCIWNDM_PUT_SOURCE (WM_USER + 141)
  2412. #define MCIWNDM_GET_DEST (WM_USER + 142)
  2413. #define MCIWNDM_PUT_DEST (WM_USER + 143)
  2414. #define MCIWNDM_CAN_PLAY (WM_USER + 144)
  2415. #define MCIWNDM_CAN_WINDOW (WM_USER + 145)
  2416. #define MCIWNDM_CAN_RECORD (WM_USER + 146)
  2417. #define MCIWNDM_CAN_SAVE (WM_USER + 147)
  2418. #define MCIWNDM_CAN_EJECT (WM_USER + 148)
  2419. #define MCIWNDM_CAN_CONFIG (WM_USER + 149)
  2420. #define MCIWNDM_PALETTEKICK (WM_USER + 150)
  2421. #define MCIWNDM_OPENINTERFACE (WM_USER + 151)
  2422. #define MCIWNDM_SETOWNER (WM_USER + 152)
  2423. //define both A and W messages
  2424. #define MCIWNDM_SENDSTRINGA (WM_USER + 101)
  2425. #define MCIWNDM_GETPOSITIONA (WM_USER + 102)
  2426. #define MCIWNDM_GETMODEA (WM_USER + 106)
  2427. #define MCIWNDM_SETTIMEFORMATA (WM_USER + 119)
  2428. #define MCIWNDM_GETTIMEFORMATA (WM_USER + 120)
  2429. #define MCIWNDM_GETFILENAMEA (WM_USER + 124)
  2430. #define MCIWNDM_GETDEVICEA (WM_USER + 125)
  2431. #define MCIWNDM_GETERRORA (WM_USER + 128)
  2432. #define MCIWNDM_NEWA (WM_USER + 134)
  2433. #define MCIWNDM_RETURNSTRINGA (WM_USER + 138)
  2434. #define MCIWNDM_OPENA (WM_USER + 153)
  2435. #define MCIWNDM_SENDSTRINGW (WM_USER + 201)
  2436. #define MCIWNDM_GETPOSITIONW (WM_USER + 202)
  2437. #define MCIWNDM_GETMODEW (WM_USER + 206)
  2438. #define MCIWNDM_SETTIMEFORMATW (WM_USER + 219)
  2439. #define MCIWNDM_GETTIMEFORMATW (WM_USER + 220)
  2440. #define MCIWNDM_GETFILENAMEW (WM_USER + 224)
  2441. #define MCIWNDM_GETDEVICEW (WM_USER + 225)
  2442. #define MCIWNDM_GETERRORW (WM_USER + 228)
  2443. #define MCIWNDM_NEWW (WM_USER + 234)
  2444. #define MCIWNDM_RETURNSTRINGW (WM_USER + 238)
  2445. #define MCIWNDM_OPENW (WM_USER + 252)
  2446. // map defaults to A or W depending on app's UNICODE setting
  2447. #ifdef UNICODE
  2448. #define MCIWNDM_SENDSTRING MCIWNDM_SENDSTRINGW
  2449. #define MCIWNDM_GETPOSITION MCIWNDM_GETPOSITIONW
  2450. #define MCIWNDM_GETMODE MCIWNDM_GETMODEW
  2451. #define MCIWNDM_SETTIMEFORMAT MCIWNDM_SETTIMEFORMATW
  2452. #define MCIWNDM_GETTIMEFORMAT MCIWNDM_GETTIMEFORMATW
  2453. #define MCIWNDM_GETFILENAME MCIWNDM_GETFILENAMEW
  2454. #define MCIWNDM_GETDEVICE MCIWNDM_GETDEVICEW
  2455. #define MCIWNDM_GETERROR MCIWNDM_GETERRORW
  2456. #define MCIWNDM_NEW MCIWNDM_NEWW
  2457. #define MCIWNDM_RETURNSTRING MCIWNDM_RETURNSTRINGW
  2458. #define MCIWNDM_OPEN MCIWNDM_OPENW
  2459. #else
  2460. #define MCIWNDM_SENDSTRING MCIWNDM_SENDSTRINGA
  2461. #define MCIWNDM_GETPOSITION MCIWNDM_GETPOSITIONA
  2462. #define MCIWNDM_GETMODE MCIWNDM_GETMODEA
  2463. #define MCIWNDM_SETTIMEFORMAT MCIWNDM_SETTIMEFORMATA
  2464. #define MCIWNDM_GETTIMEFORMAT MCIWNDM_GETTIMEFORMATA
  2465. #define MCIWNDM_GETFILENAME MCIWNDM_GETFILENAMEA
  2466. #define MCIWNDM_GETDEVICE MCIWNDM_GETDEVICEA
  2467. #define MCIWNDM_GETERROR MCIWNDM_GETERRORA
  2468. #define MCIWNDM_NEW MCIWNDM_NEWA
  2469. #define MCIWNDM_RETURNSTRING MCIWNDM_RETURNSTRINGA
  2470. #define MCIWNDM_OPEN MCIWNDM_OPENA
  2471. #endif
  2472. // note that the source text for MCIWND will thus contain
  2473. // support for eg MCIWNDM_SENDSTRING (both the 16-bit entrypoint and
  2474. // in win32 mapped to MCIWNDM_SENDSTRINGW), and MCIWNDM_SENDSTRINGA (the
  2475. // win32 ansi thunk).
  2476. // Messages MCIWND will send to an app
  2477. // !!! Use less messages and use a code instead to indicate the type of notify? /* ;Internal */
  2478. #define MCIWNDM_NOTIFYMODE (WM_USER + 200) // wp = hwnd, lp = mode
  2479. #define MCIWNDM_NOTIFYPOS (WM_USER + 201) // wp = hwnd, lp = pos
  2480. #define MCIWNDM_NOTIFYSIZE (WM_USER + 202) // wp = hwnd
  2481. #define MCIWNDM_NOTIFYMEDIA (WM_USER + 203) // wp = hwnd, lp = fn
  2482. #define MCIWNDM_NOTIFYERROR (WM_USER + 205) // wp = hwnd, lp = error
  2483. // special seek values for START and END
  2484. #define MCIWND_START -1
  2485. #define MCIWND_END -2
  2486. #ifndef MCI_PLAY
  2487. /* MCI command message identifiers */
  2488. #ifndef _WIN32
  2489. // win32 apps send MCIWNDM_OPEN
  2490. #define MCI_OPEN 0x0803
  2491. #endif
  2492. #define MCI_CLOSE 0x0804
  2493. #define MCI_PLAY 0x0806
  2494. #define MCI_SEEK 0x0807
  2495. #define MCI_STOP 0x0808
  2496. #define MCI_PAUSE 0x0809
  2497. #define MCI_STEP 0x080E
  2498. #define MCI_RECORD 0x080F
  2499. #define MCI_SAVE 0x0813
  2500. #define MCI_CUT 0x0851
  2501. #define MCI_COPY 0x0852
  2502. #define MCI_PASTE 0x0853
  2503. #define MCI_RESUME 0x0855
  2504. #define MCI_DELETE 0x0856
  2505. #endif
  2506. #ifndef MCI_MODE_NOT_READY
  2507. /* return values for 'status mode' command */
  2508. #define MCI_MODE_NOT_READY (524)
  2509. #define MCI_MODE_STOP (525)
  2510. #define MCI_MODE_PLAY (526)
  2511. #define MCI_MODE_RECORD (527)
  2512. #define MCI_MODE_SEEK (528)
  2513. #define MCI_MODE_PAUSE (529)
  2514. #define MCI_MODE_OPEN (530)
  2515. #endif
  2516. #endif /* NOAVIFILE */
  2517. /****************************************************************************
  2518. *
  2519. * VIDEO - Video Capture Driver Interface
  2520. *
  2521. ****************************************************************************/
  2522. #if !defined(NOAVICAP) || !defined(NOVIDEO)
  2523. #ifndef _RCINVOKED
  2524. /* video data types */
  2525. DECLARE_HANDLE(HVIDEO); // generic handle
  2526. typedef HVIDEO FAR * LPHVIDEO;
  2527. #endif // ifndef RCINVOKED
  2528. /****************************************************************************
  2529. version api
  2530. ****************************************************************************/
  2531. DWORD FAR PASCAL VideoForWindowsVersion(void);
  2532. /****************************************************************************
  2533. Error Return Values
  2534. ****************************************************************************/
  2535. #define DV_ERR_OK (0) /* No error */
  2536. #define DV_ERR_BASE (1) /* Error Base */
  2537. #define DV_ERR_NONSPECIFIC (DV_ERR_BASE)
  2538. #define DV_ERR_BADFORMAT (DV_ERR_BASE + 1)
  2539. /* unsupported video format */
  2540. #define DV_ERR_STILLPLAYING (DV_ERR_BASE + 2)
  2541. /* still something playing */
  2542. #define DV_ERR_UNPREPARED (DV_ERR_BASE + 3)
  2543. /* header not prepared */
  2544. #define DV_ERR_SYNC (DV_ERR_BASE + 4)
  2545. /* device is synchronous */
  2546. #define DV_ERR_TOOMANYCHANNELS (DV_ERR_BASE + 5)
  2547. /* number of channels exceeded */
  2548. #define DV_ERR_NOTDETECTED (DV_ERR_BASE + 6) /* HW not detected */
  2549. #define DV_ERR_BADINSTALL (DV_ERR_BASE + 7) /* Can not get Profile */
  2550. #define DV_ERR_CREATEPALETTE (DV_ERR_BASE + 8)
  2551. #define DV_ERR_SIZEFIELD (DV_ERR_BASE + 9)
  2552. #define DV_ERR_PARAM1 (DV_ERR_BASE + 10)
  2553. #define DV_ERR_PARAM2 (DV_ERR_BASE + 11)
  2554. #define DV_ERR_CONFIG1 (DV_ERR_BASE + 12)
  2555. #define DV_ERR_CONFIG2 (DV_ERR_BASE + 13)
  2556. #define DV_ERR_FLAGS (DV_ERR_BASE + 14)
  2557. #define DV_ERR_13 (DV_ERR_BASE + 15)
  2558. #define DV_ERR_NOTSUPPORTED (DV_ERR_BASE + 16) /* function not suported */
  2559. #define DV_ERR_NOMEM (DV_ERR_BASE + 17) /* out of memory */
  2560. #define DV_ERR_ALLOCATED (DV_ERR_BASE + 18) /* device is allocated */
  2561. #define DV_ERR_BADDEVICEID (DV_ERR_BASE + 19)
  2562. #define DV_ERR_INVALHANDLE (DV_ERR_BASE + 20)
  2563. #define DV_ERR_BADERRNUM (DV_ERR_BASE + 21)
  2564. #define DV_ERR_NO_BUFFERS (DV_ERR_BASE + 22) /* out of buffers */
  2565. #define DV_ERR_MEM_CONFLICT (DV_ERR_BASE + 23) /* Mem conflict detected */
  2566. #define DV_ERR_IO_CONFLICT (DV_ERR_BASE + 24) /* I/O conflict detected */
  2567. #define DV_ERR_DMA_CONFLICT (DV_ERR_BASE + 25) /* DMA conflict detected */
  2568. #define DV_ERR_INT_CONFLICT (DV_ERR_BASE + 26) /* Interrupt conflict detected */
  2569. #define DV_ERR_PROTECT_ONLY (DV_ERR_BASE + 27) /* Can not run in standard mode */
  2570. #define DV_ERR_LASTERROR (DV_ERR_BASE + 27)
  2571. //#define DV_IDS_PROFILING (DV_ERR_BASE + 900)
  2572. //#define DV_IDS_LISTBOX (DV_ERR_BASE + 901)
  2573. #define DV_ERR_USER_MSG (DV_ERR_BASE + 1000) /* Hardware specific errors */
  2574. /****************************************************************************
  2575. Callback Messages
  2576. Note that the values for all installable driver callback messages are
  2577. identical, (ie. MM_DRVM_DATA has the same value for capture drivers,
  2578. installable video codecs, and the audio compression manager).
  2579. ****************************************************************************/
  2580. #ifndef _RCINVOKED
  2581. #ifndef MM_DRVM_OPEN
  2582. #define MM_DRVM_OPEN 0x3D0
  2583. #define MM_DRVM_CLOSE 0x3D1
  2584. #define MM_DRVM_DATA 0x3D2
  2585. #define MM_DRVM_ERROR 0x3D3
  2586. #endif
  2587. #define DV_VM_OPEN MM_DRVM_OPEN // Obsolete messages
  2588. #define DV_VM_CLOSE MM_DRVM_CLOSE
  2589. #define DV_VM_DATA MM_DRVM_DATA
  2590. #define DV_VM_ERROR MM_DRVM_ERROR
  2591. /****************************************************************************
  2592. Structures
  2593. ****************************************************************************/
  2594. /* video data block header */
  2595. typedef struct videohdr_tag {
  2596. LPBYTE lpData; /* pointer to locked data buffer */
  2597. DWORD dwBufferLength; /* Length of data buffer */
  2598. DWORD dwBytesUsed; /* Bytes actually used */
  2599. DWORD dwTimeCaptured; /* Milliseconds from start of stream */
  2600. DWORD_PTR dwUser; /* for client's use */
  2601. DWORD dwFlags; /* assorted flags (see defines) */
  2602. DWORD_PTR dwReserved[4]; /* reserved for driver */
  2603. } VIDEOHDR, NEAR *PVIDEOHDR, FAR * LPVIDEOHDR;
  2604. /* dwFlags field of VIDEOHDR */
  2605. #define VHDR_DONE 0x00000001 /* Done bit */
  2606. #define VHDR_PREPARED 0x00000002 /* Set if this header has been prepared */
  2607. #define VHDR_INQUEUE 0x00000004 /* Reserved for driver */
  2608. #define VHDR_KEYFRAME 0x00000008 /* Key Frame */
  2609. #define VHDR_VALID 0x0000000F /* valid flags */ /* ;Internal */
  2610. /* Channel capabilities structure */
  2611. typedef struct channel_caps_tag {
  2612. DWORD dwFlags; /* Capability flags*/
  2613. DWORD dwSrcRectXMod; /* Granularity of src rect in x */
  2614. DWORD dwSrcRectYMod; /* Granularity of src rect in y */
  2615. DWORD dwSrcRectWidthMod; /* Granularity of src rect width */
  2616. DWORD dwSrcRectHeightMod; /* Granularity of src rect height */
  2617. DWORD dwDstRectXMod; /* Granularity of dst rect in x */
  2618. DWORD dwDstRectYMod; /* Granularity of dst rect in y */
  2619. DWORD dwDstRectWidthMod; /* Granularity of dst rect width */
  2620. DWORD dwDstRectHeightMod; /* Granularity of dst rect height */
  2621. } CHANNEL_CAPS, NEAR *PCHANNEL_CAPS, FAR * LPCHANNEL_CAPS;
  2622. /* dwFlags of CHANNEL_CAPS */
  2623. #define VCAPS_OVERLAY 0x00000001 /* overlay channel */
  2624. #define VCAPS_SRC_CAN_CLIP 0x00000002 /* src rect can clip */
  2625. #define VCAPS_DST_CAN_CLIP 0x00000004 /* dst rect can clip */
  2626. #define VCAPS_CAN_SCALE 0x00000008 /* allows src != dst */
  2627. /****************************************************************************
  2628. API Flags
  2629. ****************************************************************************/
  2630. // Types of channels to open with the videoOpen function
  2631. #define VIDEO_EXTERNALIN 0x0001
  2632. #define VIDEO_EXTERNALOUT 0x0002
  2633. #define VIDEO_IN 0x0004
  2634. #define VIDEO_OUT 0x0008
  2635. // Is a driver dialog available for this channel?
  2636. #define VIDEO_DLG_QUERY 0x0010
  2637. // videoConfigure (both GET and SET)
  2638. #define VIDEO_CONFIGURE_QUERY 0x8000
  2639. // videoConfigure (SET only)
  2640. #define VIDEO_CONFIGURE_SET 0x1000
  2641. // videoConfigure (GET only)
  2642. #define VIDEO_CONFIGURE_GET 0x2000
  2643. #define VIDEO_CONFIGURE_QUERYSIZE 0x0001
  2644. #define VIDEO_CONFIGURE_CURRENT 0x0010
  2645. #define VIDEO_CONFIGURE_NOMINAL 0x0020
  2646. #define VIDEO_CONFIGURE_MIN 0x0040
  2647. #define VIDEO_CONFIGURE_MAX 0x0080
  2648. /****************************************************************************
  2649. CONFIGURE MESSAGES
  2650. ****************************************************************************/
  2651. #define DVM_USER 0X4000
  2652. #define DVM_CONFIGURE_START 0x1000
  2653. #define DVM_CONFIGURE_END 0x1FFF
  2654. #define DVM_PALETTE (DVM_CONFIGURE_START + 1)
  2655. #define DVM_FORMAT (DVM_CONFIGURE_START + 2)
  2656. #define DVM_PALETTERGB555 (DVM_CONFIGURE_START + 3)
  2657. #define DVM_SRC_RECT (DVM_CONFIGURE_START + 4)
  2658. #define DVM_DST_RECT (DVM_CONFIGURE_START + 5)
  2659. #endif /* ifndef _RCINVOKED */
  2660. #endif /* NOVIDEO */
  2661. /****************************************************************************
  2662. *
  2663. * AVICAP - Window class for AVI capture
  2664. *
  2665. ***************************************************************************/
  2666. #ifndef NOAVICAP
  2667. #ifdef __cplusplus
  2668. /* SendMessage in C++*/
  2669. #define AVICapSM(hwnd,m,w,l) ( (::IsWindow(hwnd)) ? ::SendMessage(hwnd,m,w,l) : 0)
  2670. #else
  2671. /* SendMessage in C */
  2672. #define AVICapSM(hwnd,m,w,l) ( (IsWindow(hwnd)) ? SendMessage(hwnd,m,w,l) : 0)
  2673. #endif /* __cplusplus */
  2674. #ifndef RC_INVOKED
  2675. // ------------------------------------------------------------------
  2676. // Window Messages WM_CAP... which can be sent to an AVICAP window
  2677. // ------------------------------------------------------------------
  2678. // UNICODE
  2679. //
  2680. // The Win32 version of AVICAP on NT supports UNICODE applications:
  2681. // for each API or message that takes a char or string parameter, there are
  2682. // two versions, ApiNameA and ApiNameW. The default name ApiName is #defined
  2683. // to one or other depending on whether UNICODE is defined. Apps can call
  2684. // the A and W apis directly, and mix them.
  2685. //
  2686. // The 32-bit AVICAP on NT uses unicode exclusively internally.
  2687. // ApiNameA() will be implemented as a call to ApiNameW() together with
  2688. // translation of strings.
  2689. // Defines start of the message range
  2690. #define WM_CAP_START WM_USER
  2691. // start of unicode messages
  2692. #define WM_CAP_UNICODE_START WM_USER+100
  2693. #define WM_CAP_GET_CAPSTREAMPTR (WM_CAP_START+ 1)
  2694. #define WM_CAP_SET_CALLBACK_ERRORW (WM_CAP_UNICODE_START+ 2)
  2695. #define WM_CAP_SET_CALLBACK_STATUSW (WM_CAP_UNICODE_START+ 3)
  2696. #define WM_CAP_SET_CALLBACK_ERRORA (WM_CAP_START+ 2)
  2697. #define WM_CAP_SET_CALLBACK_STATUSA (WM_CAP_START+ 3)
  2698. #ifdef UNICODE
  2699. #define WM_CAP_SET_CALLBACK_ERROR WM_CAP_SET_CALLBACK_ERRORW
  2700. #define WM_CAP_SET_CALLBACK_STATUS WM_CAP_SET_CALLBACK_STATUSW
  2701. #else
  2702. #define WM_CAP_SET_CALLBACK_ERROR WM_CAP_SET_CALLBACK_ERRORA
  2703. #define WM_CAP_SET_CALLBACK_STATUS WM_CAP_SET_CALLBACK_STATUSA
  2704. #endif
  2705. #define WM_CAP_SET_CALLBACK_YIELD (WM_CAP_START+ 4)
  2706. #define WM_CAP_SET_CALLBACK_FRAME (WM_CAP_START+ 5)
  2707. #define WM_CAP_SET_CALLBACK_VIDEOSTREAM (WM_CAP_START+ 6)
  2708. #define WM_CAP_SET_CALLBACK_WAVESTREAM (WM_CAP_START+ 7)
  2709. #define WM_CAP_GET_USER_DATA (WM_CAP_START+ 8)
  2710. #define WM_CAP_SET_USER_DATA (WM_CAP_START+ 9)
  2711. #define WM_CAP_DRIVER_CONNECT (WM_CAP_START+ 10)
  2712. #define WM_CAP_DRIVER_DISCONNECT (WM_CAP_START+ 11)
  2713. #define WM_CAP_DRIVER_GET_NAMEA (WM_CAP_START+ 12)
  2714. #define WM_CAP_DRIVER_GET_VERSIONA (WM_CAP_START+ 13)
  2715. #define WM_CAP_DRIVER_GET_NAMEW (WM_CAP_UNICODE_START+ 12)
  2716. #define WM_CAP_DRIVER_GET_VERSIONW (WM_CAP_UNICODE_START+ 13)
  2717. #ifdef UNICODE
  2718. #define WM_CAP_DRIVER_GET_NAME WM_CAP_DRIVER_GET_NAMEW
  2719. #define WM_CAP_DRIVER_GET_VERSION WM_CAP_DRIVER_GET_VERSIONW
  2720. #else
  2721. #define WM_CAP_DRIVER_GET_NAME WM_CAP_DRIVER_GET_NAMEA
  2722. #define WM_CAP_DRIVER_GET_VERSION WM_CAP_DRIVER_GET_VERSIONA
  2723. #endif
  2724. #define WM_CAP_DRIVER_GET_CAPS (WM_CAP_START+ 14)
  2725. #define WM_CAP_FILE_SET_CAPTURE_FILEA (WM_CAP_START+ 20)
  2726. #define WM_CAP_FILE_GET_CAPTURE_FILEA (WM_CAP_START+ 21)
  2727. #define WM_CAP_FILE_SAVEASA (WM_CAP_START+ 23)
  2728. #define WM_CAP_FILE_SAVEDIBA (WM_CAP_START+ 25)
  2729. #define WM_CAP_FILE_SET_CAPTURE_FILEW (WM_CAP_UNICODE_START+ 20)
  2730. #define WM_CAP_FILE_GET_CAPTURE_FILEW (WM_CAP_UNICODE_START+ 21)
  2731. #define WM_CAP_FILE_SAVEASW (WM_CAP_UNICODE_START+ 23)
  2732. #define WM_CAP_FILE_SAVEDIBW (WM_CAP_UNICODE_START+ 25)
  2733. #ifdef UNICODE
  2734. #define WM_CAP_FILE_SET_CAPTURE_FILE WM_CAP_FILE_SET_CAPTURE_FILEW
  2735. #define WM_CAP_FILE_GET_CAPTURE_FILE WM_CAP_FILE_GET_CAPTURE_FILEW
  2736. #define WM_CAP_FILE_SAVEAS WM_CAP_FILE_SAVEASW
  2737. #define WM_CAP_FILE_SAVEDIB WM_CAP_FILE_SAVEDIBW
  2738. #else
  2739. #define WM_CAP_FILE_SET_CAPTURE_FILE WM_CAP_FILE_SET_CAPTURE_FILEA
  2740. #define WM_CAP_FILE_GET_CAPTURE_FILE WM_CAP_FILE_GET_CAPTURE_FILEA
  2741. #define WM_CAP_FILE_SAVEAS WM_CAP_FILE_SAVEASA
  2742. #define WM_CAP_FILE_SAVEDIB WM_CAP_FILE_SAVEDIBA
  2743. #endif
  2744. // out of order to save on ifdefs
  2745. #define WM_CAP_FILE_ALLOCATE (WM_CAP_START+ 22)
  2746. #define WM_CAP_FILE_SET_INFOCHUNK (WM_CAP_START+ 24)
  2747. #define WM_CAP_EDIT_COPY (WM_CAP_START+ 30)
  2748. #define WM_CAP_SET_AUDIOFORMAT (WM_CAP_START+ 35)
  2749. #define WM_CAP_GET_AUDIOFORMAT (WM_CAP_START+ 36)
  2750. #define WM_CAP_DLG_VIDEOFORMAT (WM_CAP_START+ 41)
  2751. #define WM_CAP_DLG_VIDEOSOURCE (WM_CAP_START+ 42)
  2752. #define WM_CAP_DLG_VIDEODISPLAY (WM_CAP_START+ 43)
  2753. #define WM_CAP_GET_VIDEOFORMAT (WM_CAP_START+ 44)
  2754. #define WM_CAP_SET_VIDEOFORMAT (WM_CAP_START+ 45)
  2755. #define WM_CAP_DLG_VIDEOCOMPRESSION (WM_CAP_START+ 46)
  2756. #define WM_CAP_SET_PREVIEW (WM_CAP_START+ 50)
  2757. #define WM_CAP_SET_OVERLAY (WM_CAP_START+ 51)
  2758. #define WM_CAP_SET_PREVIEWRATE (WM_CAP_START+ 52)
  2759. #define WM_CAP_SET_SCALE (WM_CAP_START+ 53)
  2760. #define WM_CAP_GET_STATUS (WM_CAP_START+ 54)
  2761. #define WM_CAP_SET_SCROLL (WM_CAP_START+ 55)
  2762. #define WM_CAP_GRAB_FRAME (WM_CAP_START+ 60)
  2763. #define WM_CAP_GRAB_FRAME_NOSTOP (WM_CAP_START+ 61)
  2764. #define WM_CAP_SEQUENCE (WM_CAP_START+ 62)
  2765. #define WM_CAP_SEQUENCE_NOFILE (WM_CAP_START+ 63)
  2766. #define WM_CAP_SET_SEQUENCE_SETUP (WM_CAP_START+ 64)
  2767. #define WM_CAP_GET_SEQUENCE_SETUP (WM_CAP_START+ 65)
  2768. #define WM_CAP_SET_MCI_DEVICEA (WM_CAP_START+ 66)
  2769. #define WM_CAP_GET_MCI_DEVICEA (WM_CAP_START+ 67)
  2770. #define WM_CAP_SET_MCI_DEVICEW (WM_CAP_UNICODE_START+ 66)
  2771. #define WM_CAP_GET_MCI_DEVICEW (WM_CAP_UNICODE_START+ 67)
  2772. #ifdef UNICODE
  2773. #define WM_CAP_SET_MCI_DEVICE WM_CAP_SET_MCI_DEVICEW
  2774. #define WM_CAP_GET_MCI_DEVICE WM_CAP_GET_MCI_DEVICEW
  2775. #else
  2776. #define WM_CAP_SET_MCI_DEVICE WM_CAP_SET_MCI_DEVICEA
  2777. #define WM_CAP_GET_MCI_DEVICE WM_CAP_GET_MCI_DEVICEA
  2778. #endif
  2779. #define WM_CAP_STOP (WM_CAP_START+ 68)
  2780. #define WM_CAP_ABORT (WM_CAP_START+ 69)
  2781. #define WM_CAP_SINGLE_FRAME_OPEN (WM_CAP_START+ 70)
  2782. #define WM_CAP_SINGLE_FRAME_CLOSE (WM_CAP_START+ 71)
  2783. #define WM_CAP_SINGLE_FRAME (WM_CAP_START+ 72)
  2784. #define WM_CAP_PAL_OPENA (WM_CAP_START+ 80)
  2785. #define WM_CAP_PAL_SAVEA (WM_CAP_START+ 81)
  2786. #define WM_CAP_PAL_OPENW (WM_CAP_UNICODE_START+ 80)
  2787. #define WM_CAP_PAL_SAVEW (WM_CAP_UNICODE_START+ 81)
  2788. #ifdef UNICODE
  2789. #define WM_CAP_PAL_OPEN WM_CAP_PAL_OPENW
  2790. #define WM_CAP_PAL_SAVE WM_CAP_PAL_SAVEW
  2791. #else
  2792. #define WM_CAP_PAL_OPEN WM_CAP_PAL_OPENA
  2793. #define WM_CAP_PAL_SAVE WM_CAP_PAL_SAVEA
  2794. #endif
  2795. #define WM_CAP_PAL_PASTE (WM_CAP_START+ 82)
  2796. #define WM_CAP_PAL_AUTOCREATE (WM_CAP_START+ 83)
  2797. #define WM_CAP_PAL_MANUALCREATE (WM_CAP_START+ 84)
  2798. // Following added post VFW 1.1
  2799. #define WM_CAP_SET_CALLBACK_CAPCONTROL (WM_CAP_START+ 85)
  2800. // Defines end of the message range
  2801. #define WM_CAP_UNICODE_END WM_CAP_PAL_SAVEW
  2802. #define WM_CAP_END WM_CAP_UNICODE_END
  2803. // ------------------------------------------------------------------
  2804. // Message crackers for above
  2805. // ------------------------------------------------------------------
  2806. // message wrapper macros are defined for the default messages only. Apps
  2807. // that wish to mix Ansi and UNICODE message sending will have to
  2808. // reference the _A and _W messages directly
  2809. #define capSetCallbackOnError(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_ERROR, 0, (LPARAM)(LPVOID)(fpProc)))
  2810. #define capSetCallbackOnStatus(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_STATUS, 0, (LPARAM)(LPVOID)(fpProc)))
  2811. #define capSetCallbackOnYield(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_YIELD, 0, (LPARAM)(LPVOID)(fpProc)))
  2812. #define capSetCallbackOnFrame(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_FRAME, 0, (LPARAM)(LPVOID)(fpProc)))
  2813. #define capSetCallbackOnVideoStream(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, (LPARAM)(LPVOID)(fpProc)))
  2814. #define capSetCallbackOnWaveStream(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_WAVESTREAM, 0, (LPARAM)(LPVOID)(fpProc)))
  2815. #define capSetCallbackOnCapControl(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_CAPCONTROL, 0, (LPARAM)(LPVOID)(fpProc)))
  2816. #define capSetUserData(hwnd, lUser) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_USER_DATA, 0, (LPARAM)lUser))
  2817. #define capGetUserData(hwnd) (AVICapSM(hwnd, WM_CAP_GET_USER_DATA, 0, 0))
  2818. #define capDriverConnect(hwnd, i) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_CONNECT, (WPARAM)(i), 0L))
  2819. #define capDriverDisconnect(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_DISCONNECT, (WPARAM)0, 0L))
  2820. #define capDriverGetName(hwnd, szName, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_NAME, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2821. #define capDriverGetVersion(hwnd, szVer, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_VERSION, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szVer)))
  2822. #define capDriverGetCaps(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_CAPS, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPDRIVERCAPS)(s)))
  2823. #define capFileSetCaptureFile(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SET_CAPTURE_FILE, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2824. #define capFileGetCaptureFile(hwnd, szName, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_GET_CAPTURE_FILE, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2825. #define capFileAlloc(hwnd, dwSize) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_ALLOCATE, 0, (LPARAM)(DWORD)(dwSize)))
  2826. #define capFileSaveAs(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SAVEAS, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2827. #define capFileSetInfoChunk(hwnd, lpInfoChunk) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SET_INFOCHUNK, (WPARAM)0, (LPARAM)(LPCAPINFOCHUNK)(lpInfoChunk)))
  2828. #define capFileSaveDIB(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SAVEDIB, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2829. #define capEditCopy(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_EDIT_COPY, 0, 0L))
  2830. #define capSetAudioFormat(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_AUDIOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPWAVEFORMATEX)(s)))
  2831. #define capGetAudioFormat(hwnd, s, wSize) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_AUDIOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPWAVEFORMATEX)(s)))
  2832. #define capGetAudioFormatSize(hwnd) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_AUDIOFORMAT, (WPARAM)0, (LPARAM)0L))
  2833. #define capDlgVideoFormat(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEOFORMAT, 0, 0L))
  2834. #define capDlgVideoSource(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEOSOURCE, 0, 0L))
  2835. #define capDlgVideoDisplay(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEODISPLAY, 0, 0L))
  2836. #define capDlgVideoCompression(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEOCOMPRESSION, 0, 0L))
  2837. #define capGetVideoFormat(hwnd, s, wSize) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_VIDEOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(s)))
  2838. #define capGetVideoFormatSize(hwnd) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_VIDEOFORMAT, 0, 0L))
  2839. #define capSetVideoFormat(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_VIDEOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(s)))
  2840. #define capPreview(hwnd, f) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_PREVIEW, (WPARAM)(BOOL)(f), 0L))
  2841. #define capPreviewRate(hwnd, wMS) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_PREVIEWRATE, (WPARAM)(wMS), 0))
  2842. #define capOverlay(hwnd, f) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_OVERLAY, (WPARAM)(BOOL)(f), 0L))
  2843. #define capPreviewScale(hwnd, f) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SCALE, (WPARAM)(BOOL)f, 0L))
  2844. #define capGetStatus(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_GET_STATUS, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPSTATUS)(s)))
  2845. #define capSetScrollPos(hwnd, lpP) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SCROLL, (WPARAM)0, (LPARAM)(LPPOINT)(lpP)))
  2846. #define capGrabFrame(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_GRAB_FRAME, (WPARAM)0, (LPARAM)0L))
  2847. #define capGrabFrameNoStop(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_GRAB_FRAME_NOSTOP, (WPARAM)0, (LPARAM)0L))
  2848. #define capCaptureSequence(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SEQUENCE, (WPARAM)0, (LPARAM)0L))
  2849. #define capCaptureSequenceNoFile(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SEQUENCE_NOFILE, (WPARAM)0, (LPARAM)0L))
  2850. #define capCaptureStop(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_STOP, (WPARAM)0, (LPARAM)0L))
  2851. #define capCaptureAbort(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_ABORT, (WPARAM)0, (LPARAM)0L))
  2852. #define capCaptureSingleFrameOpen(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SINGLE_FRAME_OPEN, (WPARAM)0, (LPARAM)0L))
  2853. #define capCaptureSingleFrameClose(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SINGLE_FRAME_CLOSE, (WPARAM)0, (LPARAM)0L))
  2854. #define capCaptureSingleFrame(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SINGLE_FRAME, (WPARAM)0, (LPARAM)0L))
  2855. #define capCaptureGetSetup(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_GET_SEQUENCE_SETUP, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPTUREPARMS)(s)))
  2856. #define capCaptureSetSetup(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SEQUENCE_SETUP, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPTUREPARMS)(s)))
  2857. #define capSetMCIDeviceName(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_MCI_DEVICE, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2858. #define capGetMCIDeviceName(hwnd, szName, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_GET_MCI_DEVICE, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2859. #define capPaletteOpen(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_OPEN, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2860. #define capPaletteSave(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_SAVE, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2861. #define capPalettePaste(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_PASTE, (WPARAM) 0, (LPARAM)0L))
  2862. #define capPaletteAuto(hwnd, iFrames, iColors) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_AUTOCREATE, (WPARAM)(iFrames), (LPARAM)(DWORD)(iColors)))
  2863. #define capPaletteManual(hwnd, fGrab, iColors) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_MANUALCREATE, (WPARAM)(fGrab), (LPARAM)(DWORD)(iColors)))
  2864. // ------------------------------------------------------------------
  2865. // Structures
  2866. // ------------------------------------------------------------------
  2867. typedef struct tagCapDriverCaps {
  2868. UINT wDeviceIndex; // Driver index in system.ini
  2869. BOOL fHasOverlay; // Can device overlay?
  2870. BOOL fHasDlgVideoSource; // Has Video source dlg?
  2871. BOOL fHasDlgVideoFormat; // Has Format dlg?
  2872. BOOL fHasDlgVideoDisplay; // Has External out dlg?
  2873. BOOL fCaptureInitialized; // Driver ready to capture?
  2874. BOOL fDriverSuppliesPalettes; // Can driver make palettes?
  2875. // following always NULL on Win32.
  2876. HANDLE hVideoIn; // Driver In channel
  2877. HANDLE hVideoOut; // Driver Out channel
  2878. HANDLE hVideoExtIn; // Driver Ext In channel
  2879. HANDLE hVideoExtOut; // Driver Ext Out channel
  2880. } CAPDRIVERCAPS, *PCAPDRIVERCAPS, FAR *LPCAPDRIVERCAPS;
  2881. typedef struct tagCapStatus {
  2882. UINT uiImageWidth; // Width of the image
  2883. UINT uiImageHeight; // Height of the image
  2884. BOOL fLiveWindow; // Now Previewing video?
  2885. BOOL fOverlayWindow; // Now Overlaying video?
  2886. BOOL fScale; // Scale image to client?
  2887. POINT ptScroll; // Scroll position
  2888. BOOL fUsingDefaultPalette; // Using default driver palette?
  2889. BOOL fAudioHardware; // Audio hardware present?
  2890. BOOL fCapFileExists; // Does capture file exist?
  2891. DWORD dwCurrentVideoFrame; // # of video frames cap'td
  2892. DWORD dwCurrentVideoFramesDropped;// # of video frames dropped
  2893. DWORD dwCurrentWaveSamples; // # of wave samples cap'td
  2894. DWORD dwCurrentTimeElapsedMS; // Elapsed capture duration
  2895. HPALETTE hPalCurrent; // Current palette in use
  2896. BOOL fCapturingNow; // Capture in progress?
  2897. DWORD dwReturn; // Error value after any operation
  2898. UINT wNumVideoAllocated; // Actual number of video buffers
  2899. UINT wNumAudioAllocated; // Actual number of audio buffers
  2900. } CAPSTATUS, *PCAPSTATUS, FAR *LPCAPSTATUS;
  2901. // Default values in parenthesis
  2902. typedef struct tagCaptureParms {
  2903. DWORD dwRequestMicroSecPerFrame; // Requested capture rate
  2904. BOOL fMakeUserHitOKToCapture; // Show "Hit OK to cap" dlg?
  2905. UINT wPercentDropForError; // Give error msg if > (10%)
  2906. BOOL fYield; // Capture via background task?
  2907. DWORD dwIndexSize; // Max index size in frames (32K)
  2908. UINT wChunkGranularity; // Junk chunk granularity (2K)
  2909. BOOL fUsingDOSMemory; // Use DOS buffers?
  2910. UINT wNumVideoRequested; // # video buffers, If 0, autocalc
  2911. BOOL fCaptureAudio; // Capture audio?
  2912. UINT wNumAudioRequested; // # audio buffers, If 0, autocalc
  2913. UINT vKeyAbort; // Virtual key causing abort
  2914. BOOL fAbortLeftMouse; // Abort on left mouse?
  2915. BOOL fAbortRightMouse; // Abort on right mouse?
  2916. BOOL fLimitEnabled; // Use wTimeLimit?
  2917. UINT wTimeLimit; // Seconds to capture
  2918. BOOL fMCIControl; // Use MCI video source?
  2919. BOOL fStepMCIDevice; // Step MCI device?
  2920. DWORD dwMCIStartTime; // Time to start in MS
  2921. DWORD dwMCIStopTime; // Time to stop in MS
  2922. BOOL fStepCaptureAt2x; // Perform spatial averaging 2x
  2923. UINT wStepCaptureAverageFrames; // Temporal average n Frames
  2924. DWORD dwAudioBufferSize; // Size of audio bufs (0 = default)
  2925. BOOL fDisableWriteCache; // Attempt to disable write cache
  2926. UINT AVStreamMaster; // Which stream controls length?
  2927. } CAPTUREPARMS, *PCAPTUREPARMS, FAR *LPCAPTUREPARMS;
  2928. // ------------------------------------------------------------------
  2929. // AVStreamMaster
  2930. // Since Audio and Video streams generally use non-synchronized capture
  2931. // clocks, this flag determines whether the audio stream is to be considered
  2932. // the master or controlling clock when writing the AVI file:
  2933. //
  2934. // AVSTREAMMASTER_AUDIO - Audio is master, video frame duration is forced
  2935. // to match audio duration (VFW 1.0, 1.1 default)
  2936. // AVSTREAMMASTER_NONE - No master, audio and video streams may be of
  2937. // different lengths
  2938. // ------------------------------------------------------------------
  2939. #define AVSTREAMMASTER_AUDIO 0 /* Audio master (VFW 1.0, 1.1) */
  2940. #define AVSTREAMMASTER_NONE 1 /* No master */
  2941. typedef struct tagCapInfoChunk {
  2942. FOURCC fccInfoID; // Chunk ID, "ICOP" for copyright
  2943. LPVOID lpData; // pointer to data
  2944. LONG cbData; // size of lpData
  2945. } CAPINFOCHUNK, *PCAPINFOCHUNK, FAR *LPCAPINFOCHUNK;
  2946. // ------------------------------------------------------------------
  2947. // Callback Definitions
  2948. // ------------------------------------------------------------------
  2949. typedef LRESULT (CALLBACK* CAPYIELDCALLBACK) (HWND hWnd);
  2950. typedef LRESULT (CALLBACK* CAPSTATUSCALLBACKW) (HWND hWnd, int nID, LPCWSTR lpsz);
  2951. typedef LRESULT (CALLBACK* CAPERRORCALLBACKW) (HWND hWnd, int nID, LPCWSTR lpsz);
  2952. typedef LRESULT (CALLBACK* CAPSTATUSCALLBACKA) (HWND hWnd, int nID, LPCSTR lpsz);
  2953. typedef LRESULT (CALLBACK* CAPERRORCALLBACKA) (HWND hWnd, int nID, LPCSTR lpsz);
  2954. #ifdef UNICODE
  2955. #define CAPSTATUSCALLBACK CAPSTATUSCALLBACKW
  2956. #define CAPERRORCALLBACK CAPERRORCALLBACKW
  2957. #else
  2958. #define CAPSTATUSCALLBACK CAPSTATUSCALLBACKA
  2959. #define CAPERRORCALLBACK CAPERRORCALLBACKA
  2960. #endif
  2961. typedef LRESULT (CALLBACK* CAPVIDEOCALLBACK) (HWND hWnd, LPVIDEOHDR lpVHdr);
  2962. typedef LRESULT (CALLBACK* CAPWAVECALLBACK) (HWND hWnd, LPWAVEHDR lpWHdr);
  2963. typedef LRESULT (CALLBACK* CAPCONTROLCALLBACK)(HWND hWnd, int nState);
  2964. // ------------------------------------------------------------------
  2965. // CapControlCallback states
  2966. // ------------------------------------------------------------------
  2967. #define CONTROLCALLBACK_PREROLL 1 /* Waiting to start capture */
  2968. #define CONTROLCALLBACK_CAPTURING 2 /* Now capturing */
  2969. // ------------------------------------------------------------------
  2970. // The only exported functions from AVICAP.DLL
  2971. // ------------------------------------------------------------------
  2972. HWND VFWAPI capCreateCaptureWindowA (
  2973. LPCSTR lpszWindowName,
  2974. DWORD dwStyle,
  2975. int x, int y, int nWidth, int nHeight,
  2976. HWND hwndParent, int nID);
  2977. BOOL VFWAPI capGetDriverDescriptionA (UINT wDriverIndex,
  2978. LPSTR lpszName, int cbName,
  2979. LPSTR lpszVer, int cbVer);
  2980. HWND VFWAPI capCreateCaptureWindowW (
  2981. LPCWSTR lpszWindowName,
  2982. DWORD dwStyle,
  2983. int x, int y, int nWidth, int nHeight,
  2984. HWND hwndParent, int nID);
  2985. BOOL VFWAPI capGetDriverDescriptionW (UINT wDriverIndex,
  2986. LPWSTR lpszName, int cbName,
  2987. LPWSTR lpszVer, int cbVer);
  2988. #ifdef UNICODE
  2989. #define capCreateCaptureWindow capCreateCaptureWindowW
  2990. #define capGetDriverDescription capGetDriverDescriptionW
  2991. #else
  2992. #define capCreateCaptureWindow capCreateCaptureWindowA
  2993. #define capGetDriverDescription capGetDriverDescriptionA
  2994. #endif
  2995. #endif /* RC_INVOKED */
  2996. // ------------------------------------------------------------------
  2997. // New Information chunk IDs
  2998. // ------------------------------------------------------------------
  2999. #define infotypeDIGITIZATION_TIME mmioFOURCC ('I','D','I','T')
  3000. #define infotypeSMPTE_TIME mmioFOURCC ('I','S','M','P')
  3001. // ------------------------------------------------------------------
  3002. // String IDs from status and error callbacks
  3003. // ------------------------------------------------------------------
  3004. #define IDS_CAP_BEGIN 300 /* "Capture Start" */
  3005. #define IDS_CAP_END 301 /* "Capture End" */
  3006. #define IDS_CAP_INFO 401 /* "%s" */
  3007. #define IDS_CAP_OUTOFMEM 402 /* "Out of memory" */
  3008. #define IDS_CAP_FILEEXISTS 403 /* "File '%s' exists -- overwrite it?" */
  3009. #define IDS_CAP_ERRORPALOPEN 404 /* "Error opening palette '%s'" */
  3010. #define IDS_CAP_ERRORPALSAVE 405 /* "Error saving palette '%s'" */
  3011. #define IDS_CAP_ERRORDIBSAVE 406 /* "Error saving frame '%s'" */
  3012. #define IDS_CAP_DEFAVIEXT 407 /* "avi" */
  3013. #define IDS_CAP_DEFPALEXT 408 /* "pal" */
  3014. #define IDS_CAP_CANTOPEN 409 /* "Cannot open '%s'" */
  3015. #define IDS_CAP_SEQ_MSGSTART 410 /* "Select OK to start capture\nof video sequence\nto %s." */
  3016. #define IDS_CAP_SEQ_MSGSTOP 411 /* "Hit ESCAPE or click to end capture" */
  3017. #define IDS_CAP_VIDEDITERR 412 /* "An error occurred while trying to run VidEdit." */
  3018. #define IDS_CAP_READONLYFILE 413 /* "The file '%s' is a read-only file." */
  3019. #define IDS_CAP_WRITEERROR 414 /* "Unable to write to file '%s'.\nDisk may be full." */
  3020. #define IDS_CAP_NODISKSPACE 415 /* "There is no space to create a capture file on the specified device." */
  3021. #define IDS_CAP_SETFILESIZE 416 /* "Set File Size" */
  3022. #define IDS_CAP_SAVEASPERCENT 417 /* "SaveAs: %2ld%% Hit Escape to abort." */
  3023. #define IDS_CAP_DRIVER_ERROR 418 /* Driver specific error message */
  3024. #define IDS_CAP_WAVE_OPEN_ERROR 419 /* "Error: Cannot open the wave input device.\nCheck sample size, frequency, and channels." */
  3025. #define IDS_CAP_WAVE_ALLOC_ERROR 420 /* "Error: Out of memory for wave buffers." */
  3026. #define IDS_CAP_WAVE_PREPARE_ERROR 421 /* "Error: Cannot prepare wave buffers." */
  3027. #define IDS_CAP_WAVE_ADD_ERROR 422 /* "Error: Cannot add wave buffers." */
  3028. #define IDS_CAP_WAVE_SIZE_ERROR 423 /* "Error: Bad wave size." */
  3029. #define IDS_CAP_VIDEO_OPEN_ERROR 424 /* "Error: Cannot open the video input device." */
  3030. #define IDS_CAP_VIDEO_ALLOC_ERROR 425 /* "Error: Out of memory for video buffers." */
  3031. #define IDS_CAP_VIDEO_PREPARE_ERROR 426 /* "Error: Cannot prepare video buffers." */
  3032. #define IDS_CAP_VIDEO_ADD_ERROR 427 /* "Error: Cannot add video buffers." */
  3033. #define IDS_CAP_VIDEO_SIZE_ERROR 428 /* "Error: Bad video size." */
  3034. #define IDS_CAP_FILE_OPEN_ERROR 429 /* "Error: Cannot open capture file." */
  3035. #define IDS_CAP_FILE_WRITE_ERROR 430 /* "Error: Cannot write to capture file. Disk may be full." */
  3036. #define IDS_CAP_RECORDING_ERROR 431 /* "Error: Cannot write to capture file. Data rate too high or disk full." */
  3037. #define IDS_CAP_RECORDING_ERROR2 432 /* "Error while recording" */
  3038. #define IDS_CAP_AVI_INIT_ERROR 433 /* "Error: Unable to initialize for capture." */
  3039. #define IDS_CAP_NO_FRAME_CAP_ERROR 434 /* "Warning: No frames captured.\nConfirm that vertical sync interrupts\nare configured and enabled." */
  3040. #define IDS_CAP_NO_PALETTE_WARN 435 /* "Warning: Using default palette." */
  3041. #define IDS_CAP_MCI_CONTROL_ERROR 436 /* "Error: Unable to access MCI device." */
  3042. #define IDS_CAP_MCI_CANT_STEP_ERROR 437 /* "Error: Unable to step MCI device." */
  3043. #define IDS_CAP_NO_AUDIO_CAP_ERROR 438 /* "Error: No audio data captured.\nCheck audio card settings." */
  3044. #define IDS_CAP_AVI_DRAWDIB_ERROR 439 /* "Error: Unable to draw this data format." */
  3045. #define IDS_CAP_COMPRESSOR_ERROR 440 /* "Error: Unable to initialize compressor." */
  3046. #define IDS_CAP_AUDIO_DROP_ERROR 441 /* "Error: Audio data was lost during capture, reduce capture rate." */
  3047. #define IDS_CAP_AUDIO_DROP_COMPERROR 442 /* "Error: Audio data was lost during capture. Try capturing without compressing." */
  3048. /* status string IDs */
  3049. #define IDS_CAP_STAT_LIVE_MODE 500 /* "Live window" */
  3050. #define IDS_CAP_STAT_OVERLAY_MODE 501 /* "Overlay window" */
  3051. #define IDS_CAP_STAT_CAP_INIT 502 /* "Setting up for capture - Please wait" */
  3052. #define IDS_CAP_STAT_CAP_FINI 503 /* "Finished capture, now writing frame %ld" */
  3053. #define IDS_CAP_STAT_PALETTE_BUILD 504 /* "Building palette map" */
  3054. #define IDS_CAP_STAT_OPTPAL_BUILD 505 /* "Computing optimal palette" */
  3055. #define IDS_CAP_STAT_I_FRAMES 506 /* "%d frames" */
  3056. #define IDS_CAP_STAT_L_FRAMES 507 /* "%ld frames" */
  3057. #define IDS_CAP_STAT_CAP_L_FRAMES 508 /* "Captured %ld frames" */
  3058. #define IDS_CAP_STAT_CAP_AUDIO 509 /* "Capturing audio" */
  3059. #define IDS_CAP_STAT_VIDEOCURRENT 510 /* "Captured %ld frames (%ld dropped) %d.%03d sec." */
  3060. #define IDS_CAP_STAT_VIDEOAUDIO 511 /* "Captured %d.%03d sec. %ld frames (%ld dropped) (%d.%03d fps). %ld audio bytes (%d,%03d sps)" */
  3061. #define IDS_CAP_STAT_VIDEOONLY 512 /* "Captured %d.%03d sec. %ld frames (%ld dropped) (%d.%03d fps)" */
  3062. #define IDS_CAP_STAT_FRAMESDROPPED 513 /* "Dropped %ld of %ld frames (%d.%02d%%) during capture." */
  3063. #endif /* NOAVIFILE */
  3064. #ifdef __cplusplus
  3065. } // extern "C"
  3066. #endif /* __cplusplus */
  3067. /****************************************************************************
  3068. *
  3069. * ACM (Audio compression manager)
  3070. *
  3071. ***************************************************************************/
  3072. #ifndef NOMSACM
  3073. #include <msacm.h>
  3074. #endif
  3075. #ifdef __cplusplus
  3076. extern "C" { /* Assume C declarations for C++ */
  3077. #endif /* __cplusplus */
  3078. /****************************************************************************
  3079. *
  3080. * FilePreview dialog.
  3081. *
  3082. ***************************************************************************/
  3083. #ifdef OFN_READONLY
  3084. BOOL
  3085. VFWAPI
  3086. GetOpenFileNamePreviewA(
  3087. IN OUT LPOPENFILENAMEA lpofn
  3088. );
  3089. BOOL
  3090. VFWAPI
  3091. GetSaveFileNamePreviewA(
  3092. IN OUT LPOPENFILENAMEA lpofn
  3093. );
  3094. BOOL
  3095. VFWAPI
  3096. GetOpenFileNamePreviewW(
  3097. IN OUT LPOPENFILENAMEW lpofn
  3098. );
  3099. BOOL
  3100. VFWAPI
  3101. GetSaveFileNamePreviewW(
  3102. IN OUT LPOPENFILENAMEW lpofn
  3103. );
  3104. #ifdef UNICODE
  3105. #define GetOpenFileNamePreview GetOpenFileNamePreviewW
  3106. #define GetSaveFileNamePreview GetSaveFileNamePreviewW
  3107. #else
  3108. #define GetOpenFileNamePreview GetOpenFileNamePreviewA
  3109. #define GetSaveFileNamePreview GetSaveFileNamePreviewA
  3110. #endif
  3111. #endif // OFN_READONLY
  3112. #ifndef RC_INVOKED
  3113. #include "poppack.h"
  3114. #endif
  3115. #ifdef __cplusplus
  3116. } /* End of extern "C" { */
  3117. #endif /* __cplusplus */
  3118. #endif /* _INC_VFW */
  3119.