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

3803 lines
140 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. #ifdef DRAWDIB_INCLUDE_STRETCHDIB
  1271. void WINAPI StretchDIB(
  1272. LPBITMAPINFOHEADER biDst,
  1273. LPVOID lpDst,
  1274. int DstX,
  1275. int DstY,
  1276. int DstXE,
  1277. int DstYE,
  1278. LPBITMAPINFOHEADER biSrc,
  1279. LPVOID lpSrc,
  1280. int SrcX,
  1281. int SrcY,
  1282. int SrcXE,
  1283. int SrcYE);
  1284. #endif
  1285. #endif /* NODRAWDIB */
  1286. /****************************************************************************
  1287. *
  1288. * AVIFMT - AVI file format definitions
  1289. *
  1290. ****************************************************************************/
  1291. #ifndef NOAVIFMT
  1292. #ifndef _INC_MMSYSTEM
  1293. typedef DWORD FOURCC;
  1294. #endif
  1295. #ifdef _MSC_VER
  1296. #pragma warning(disable:4200)
  1297. #endif
  1298. /* The following is a short description of the AVI file format. Please
  1299. * see the accompanying documentation for a full explanation.
  1300. *
  1301. * An AVI file is the following RIFF form:
  1302. *
  1303. * RIFF('AVI'
  1304. * LIST('hdrl'
  1305. * avih(<MainAVIHeader>)
  1306. * LIST ('strl'
  1307. * strh(<Stream header>)
  1308. * strf(<Stream format>)
  1309. * ... additional header data
  1310. * LIST('movi'
  1311. * { LIST('rec'
  1312. * SubChunk...
  1313. * )
  1314. * | SubChunk } ....
  1315. * )
  1316. * [ <AVIIndex> ]
  1317. * )
  1318. *
  1319. * The main file header specifies how many streams are present. For
  1320. * each one, there must be a stream header chunk and a stream format
  1321. * chunk, enlosed in a 'strl' LIST chunk. The 'strf' chunk contains
  1322. * type-specific format information; for a video stream, this should
  1323. * be a BITMAPINFO structure, including palette. For an audio stream,
  1324. * this should be a WAVEFORMAT (or PCMWAVEFORMAT) structure.
  1325. *
  1326. * The actual data is contained in subchunks within the 'movi' LIST
  1327. * chunk. The first two characters of each data chunk are the
  1328. * stream number with which that data is associated.
  1329. *
  1330. * Some defined chunk types:
  1331. * Video Streams:
  1332. * ##db: RGB DIB bits
  1333. * ##dc: RLE8 compressed DIB bits
  1334. * ##pc: Palette Change
  1335. *
  1336. * Audio Streams:
  1337. * ##wb: waveform audio bytes
  1338. *
  1339. * The grouping into LIST 'rec' chunks implies only that the contents of
  1340. * the chunk should be read into memory at the same time. This
  1341. * grouping is used for files specifically intended to be played from
  1342. * CD-ROM.
  1343. *
  1344. * The index chunk at the end of the file should contain one entry for
  1345. * each data chunk in the file.
  1346. *
  1347. * Limitations for the current software:
  1348. * Only one video stream and one audio stream are allowed.
  1349. * The streams must start at the beginning of the file.
  1350. *
  1351. *
  1352. * To register codec types please obtain a copy of the Multimedia
  1353. * Developer Registration Kit from:
  1354. *
  1355. * Microsoft Corporation
  1356. * Multimedia Systems Group
  1357. * Product Marketing
  1358. * One Microsoft Way
  1359. * Redmond, WA 98052-6399
  1360. *
  1361. */
  1362. #ifndef mmioFOURCC
  1363. #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
  1364. ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
  1365. ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
  1366. #endif
  1367. /* Macro to make a TWOCC out of two characters */
  1368. #ifndef aviTWOCC
  1369. #define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
  1370. #endif
  1371. typedef WORD TWOCC;
  1372. /* form types, list types, and chunk types */
  1373. #define formtypeAVI mmioFOURCC('A', 'V', 'I', ' ')
  1374. #define listtypeAVIHEADER mmioFOURCC('h', 'd', 'r', 'l')
  1375. #define ckidAVIMAINHDR mmioFOURCC('a', 'v', 'i', 'h')
  1376. #define listtypeSTREAMHEADER mmioFOURCC('s', 't', 'r', 'l')
  1377. #define ckidSTREAMHEADER mmioFOURCC('s', 't', 'r', 'h')
  1378. #define ckidSTREAMFORMAT mmioFOURCC('s', 't', 'r', 'f')
  1379. #define ckidSTREAMHANDLERDATA mmioFOURCC('s', 't', 'r', 'd')
  1380. #define ckidSTREAMNAME mmioFOURCC('s', 't', 'r', 'n')
  1381. #define listtypeAVIMOVIE mmioFOURCC('m', 'o', 'v', 'i')
  1382. #define listtypeAVIRECORD mmioFOURCC('r', 'e', 'c', ' ')
  1383. #define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1')
  1384. /*
  1385. ** Stream types for the <fccType> field of the stream header.
  1386. */
  1387. #define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
  1388. #define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
  1389. #define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's')
  1390. #define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's')
  1391. /* Basic chunk types */
  1392. #define cktypeDIBbits aviTWOCC('d', 'b')
  1393. #define cktypeDIBcompressed aviTWOCC('d', 'c')
  1394. #define cktypePALchange aviTWOCC('p', 'c')
  1395. #define cktypeWAVEbytes aviTWOCC('w', 'b')
  1396. /* Chunk id to use for extra chunks for padding. */
  1397. #define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K')
  1398. /*
  1399. ** Useful macros
  1400. **
  1401. ** Warning: These are nasty macro, and MS C 6.0 compiles some of them
  1402. ** incorrectly if optimizations are on. Ack.
  1403. */
  1404. /* Macro to get stream number out of a FOURCC ckid */
  1405. #define FromHex(n) (((n) >= 'A') ? ((n) + 10 - 'A') : ((n) - '0'))
  1406. #define StreamFromFOURCC(fcc) ((WORD) ((FromHex(LOBYTE(LOWORD(fcc))) << 4) + \
  1407. (FromHex(HIBYTE(LOWORD(fcc))))))
  1408. /* Macro to get TWOCC chunk type out of a FOURCC ckid */
  1409. #define TWOCCFromFOURCC(fcc) HIWORD(fcc)
  1410. /* Macro to make a ckid for a chunk out of a TWOCC and a stream number
  1411. ** from 0-255.
  1412. */
  1413. #define ToHex(n) ((BYTE) (((n) > 9) ? ((n) - 10 + 'A') : ((n) + '0')))
  1414. #define MAKEAVICKID(tcc, stream) \
  1415. MAKELONG((ToHex((stream) & 0x0f) << 8) | \
  1416. (ToHex(((stream) & 0xf0) >> 4)), tcc)
  1417. /*
  1418. ** Main AVI File Header
  1419. */
  1420. /* flags for use in <dwFlags> in AVIFileHdr */
  1421. #define AVIF_HASINDEX 0x00000010 // Index at end of file?
  1422. #define AVIF_MUSTUSEINDEX 0x00000020
  1423. #define AVIF_ISINTERLEAVED 0x00000100
  1424. #define AVIF_WASCAPTUREFILE 0x00010000
  1425. #define AVIF_COPYRIGHTED 0x00020000
  1426. /* The AVI File Header LIST chunk should be padded to this size */
  1427. #define AVI_HEADERSIZE 2048 // size of AVI header list
  1428. typedef struct
  1429. {
  1430. DWORD dwMicroSecPerFrame; // frame display rate (or 0L)
  1431. DWORD dwMaxBytesPerSec; // max. transfer rate
  1432. DWORD dwPaddingGranularity; // pad to multiples of this
  1433. // size; normally 2K.
  1434. DWORD dwFlags; // the ever-present flags
  1435. DWORD dwTotalFrames; // # frames in file
  1436. DWORD dwInitialFrames;
  1437. DWORD dwStreams;
  1438. DWORD dwSuggestedBufferSize;
  1439. DWORD dwWidth;
  1440. DWORD dwHeight;
  1441. DWORD dwReserved[4];
  1442. } MainAVIHeader;
  1443. /*
  1444. ** Stream header
  1445. */
  1446. #define AVISF_DISABLED 0x00000001
  1447. #define AVISF_VIDEO_PALCHANGES 0x00010000
  1448. typedef struct {
  1449. FOURCC fccType;
  1450. FOURCC fccHandler;
  1451. DWORD dwFlags; /* Contains AVITF_* flags */
  1452. WORD wPriority;
  1453. WORD wLanguage;
  1454. DWORD dwInitialFrames;
  1455. DWORD dwScale;
  1456. DWORD dwRate; /* dwRate / dwScale == samples/second */
  1457. DWORD dwStart;
  1458. DWORD dwLength; /* In units above... */
  1459. DWORD dwSuggestedBufferSize;
  1460. DWORD dwQuality;
  1461. DWORD dwSampleSize;
  1462. RECT rcFrame;
  1463. } AVIStreamHeader;
  1464. /* Flags for index */
  1465. #define AVIIF_LIST 0x00000001L // chunk is a 'LIST'
  1466. #define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame.
  1467. #define AVIIF_FIRSTPART 0x00000020L // this frame is the start of a partial frame.
  1468. #define AVIIF_LASTPART 0x00000040L // this frame is the end of a partial frame.
  1469. #define AVIIF_MIDPART (AVIIF_LASTPART|AVIIF_FIRSTPART)
  1470. #define AVIIF_NOTIME 0x00000100L // this frame doesn't take any time
  1471. #define AVIIF_COMPUSE 0x0FFF0000L // these bits are for compressor use
  1472. typedef struct
  1473. {
  1474. DWORD ckid;
  1475. DWORD dwFlags;
  1476. DWORD dwChunkOffset; // Position of chunk
  1477. DWORD dwChunkLength; // Length of chunk
  1478. } AVIINDEXENTRY;
  1479. /*
  1480. ** Palette change chunk
  1481. **
  1482. ** Used in video streams.
  1483. */
  1484. typedef struct
  1485. {
  1486. BYTE bFirstEntry; /* first entry to change */
  1487. BYTE bNumEntries; /* # entries to change (0 if 256) */
  1488. WORD wFlags; /* Mostly to preserve alignment... */
  1489. PALETTEENTRY peNew[]; /* New color specifications */
  1490. } AVIPALCHANGE;
  1491. #endif /* NOAVIFMT */
  1492. #ifdef __cplusplus
  1493. } // extern "C"
  1494. #endif /* __cplusplus */
  1495. /****************************************************************************
  1496. *
  1497. * MMREG.H (standard include file for MM defines, like FOURCC and things)
  1498. *
  1499. ***************************************************************************/
  1500. #ifndef RC_INVOKED
  1501. #include "pshpack8.h"
  1502. #endif
  1503. #ifndef NOMMREG
  1504. #include <mmreg.h>
  1505. #endif
  1506. #ifdef __cplusplus
  1507. extern "C" { /* Assume C declarations for C++ */
  1508. #endif /* __cplusplus */
  1509. /****************************************************************************
  1510. *
  1511. * AVIFile - routines for reading/writing standard AVI files
  1512. *
  1513. ***************************************************************************/
  1514. #ifndef NOAVIFILE
  1515. /*
  1516. * Ansi - Unicode thunking.
  1517. *
  1518. * Unicode or Ansi-only apps can call the avifile APIs.
  1519. * any Win32 app who wants to use
  1520. * any of the AVI COM interfaces must be UNICODE - the AVISTREAMINFO and
  1521. * AVIFILEINFO structures used in the Info methods of these interfaces are
  1522. * the unicode variants, and no thunking to or from ansi takes place
  1523. * except in the AVIFILE api entrypoints.
  1524. *
  1525. * For Ansi/Unicode thunking: for each entrypoint or structure that
  1526. * uses chars or strings, two versions are declared in the Win32 version,
  1527. * ApiNameW and ApiNameA. The default name ApiName is #defined to one or
  1528. * other of these depending on whether UNICODE is defined (during
  1529. * compilation of the app that is including this header). The source will
  1530. * contain ApiName and ApiNameA (with ApiName being the Win16 implementation,
  1531. * and also #defined to ApiNameW, and ApiNameA being the thunk entrypoint).
  1532. *
  1533. */
  1534. #ifndef mmioFOURCC
  1535. #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
  1536. ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
  1537. ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
  1538. #endif
  1539. #ifndef streamtypeVIDEO
  1540. #define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
  1541. #define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
  1542. #define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's')
  1543. #define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's')
  1544. #endif
  1545. #ifndef AVIIF_KEYFRAME
  1546. #define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame.
  1547. #endif
  1548. // For GetFrame::SetFormat - use the best format for the display
  1549. #define AVIGETFRAMEF_BESTDISPLAYFMT 1
  1550. //
  1551. // Structures used by AVIStreamInfo & AVIFileInfo.
  1552. //
  1553. // These are related to, but not identical to, the header chunks
  1554. // in an AVI file.
  1555. //
  1556. /*
  1557. *
  1558. * --- AVISTREAMINFO ------------------------------------------------
  1559. *
  1560. * for Unicode/Ansi thunking we need to declare three versions of this!
  1561. */
  1562. typedef struct _AVISTREAMINFOW {
  1563. DWORD fccType;
  1564. DWORD fccHandler;
  1565. DWORD dwFlags; /* Contains AVITF_* flags */
  1566. DWORD dwCaps;
  1567. WORD wPriority;
  1568. WORD wLanguage;
  1569. DWORD dwScale;
  1570. DWORD dwRate; /* dwRate / dwScale == samples/second */
  1571. DWORD dwStart;
  1572. DWORD dwLength; /* In units above... */
  1573. DWORD dwInitialFrames;
  1574. DWORD dwSuggestedBufferSize;
  1575. DWORD dwQuality;
  1576. DWORD dwSampleSize;
  1577. RECT rcFrame;
  1578. DWORD dwEditCount;
  1579. DWORD dwFormatChangeCount;
  1580. WCHAR szName[64];
  1581. } AVISTREAMINFOW, FAR * LPAVISTREAMINFOW;
  1582. typedef struct _AVISTREAMINFOA {
  1583. DWORD fccType;
  1584. DWORD fccHandler;
  1585. DWORD dwFlags; /* Contains AVITF_* flags */
  1586. DWORD dwCaps;
  1587. WORD wPriority;
  1588. WORD wLanguage;
  1589. DWORD dwScale;
  1590. DWORD dwRate; /* dwRate / dwScale == samples/second */
  1591. DWORD dwStart;
  1592. DWORD dwLength; /* In units above... */
  1593. DWORD dwInitialFrames;
  1594. DWORD dwSuggestedBufferSize;
  1595. DWORD dwQuality;
  1596. DWORD dwSampleSize;
  1597. RECT rcFrame;
  1598. DWORD dwEditCount;
  1599. DWORD dwFormatChangeCount;
  1600. char szName[64];
  1601. } AVISTREAMINFOA, FAR * LPAVISTREAMINFOA;
  1602. #ifdef UNICODE
  1603. #define AVISTREAMINFO AVISTREAMINFOW
  1604. #define LPAVISTREAMINFO LPAVISTREAMINFOW
  1605. #else
  1606. #define AVISTREAMINFO AVISTREAMINFOA
  1607. #define LPAVISTREAMINFO LPAVISTREAMINFOA
  1608. #endif
  1609. #define AVISTREAMINFO_DISABLED 0x00000001
  1610. #define AVISTREAMINFO_FORMATCHANGES 0x00010000
  1611. /*
  1612. * --- AVIFILEINFO ----------------------------------------------------
  1613. *
  1614. */
  1615. typedef struct _AVIFILEINFOW {
  1616. DWORD dwMaxBytesPerSec; // max. transfer rate
  1617. DWORD dwFlags; // the ever-present flags
  1618. DWORD dwCaps;
  1619. DWORD dwStreams;
  1620. DWORD dwSuggestedBufferSize;
  1621. DWORD dwWidth;
  1622. DWORD dwHeight;
  1623. DWORD dwScale;
  1624. DWORD dwRate; /* dwRate / dwScale == samples/second */
  1625. DWORD dwLength;
  1626. DWORD dwEditCount;
  1627. WCHAR szFileType[64]; // descriptive string for file type?
  1628. } AVIFILEINFOW, FAR * LPAVIFILEINFOW;
  1629. typedef struct _AVIFILEINFOA {
  1630. DWORD dwMaxBytesPerSec; // max. transfer rate
  1631. DWORD dwFlags; // the ever-present flags
  1632. DWORD dwCaps;
  1633. DWORD dwStreams;
  1634. DWORD dwSuggestedBufferSize;
  1635. DWORD dwWidth;
  1636. DWORD dwHeight;
  1637. DWORD dwScale;
  1638. DWORD dwRate; /* dwRate / dwScale == samples/second */
  1639. DWORD dwLength;
  1640. DWORD dwEditCount;
  1641. char szFileType[64]; // descriptive string for file type?
  1642. } AVIFILEINFOA, FAR * LPAVIFILEINFOA;
  1643. #ifdef UNICODE
  1644. #define AVIFILEINFO AVIFILEINFOW
  1645. #define LPAVIFILEINFO LPAVIFILEINFOW
  1646. #else
  1647. #define AVIFILEINFO AVIFILEINFOA
  1648. #define LPAVIFILEINFO LPAVIFILEINFOA
  1649. #endif
  1650. // Flags for dwFlags
  1651. #define AVIFILEINFO_HASINDEX 0x00000010
  1652. #define AVIFILEINFO_MUSTUSEINDEX 0x00000020
  1653. #define AVIFILEINFO_ISINTERLEAVED 0x00000100
  1654. #define AVIFILEINFO_WASCAPTUREFILE 0x00010000
  1655. #define AVIFILEINFO_COPYRIGHTED 0x00020000
  1656. // Flags for dwCaps
  1657. #define AVIFILECAPS_CANREAD 0x00000001
  1658. #define AVIFILECAPS_CANWRITE 0x00000002
  1659. #define AVIFILECAPS_ALLKEYFRAMES 0x00000010
  1660. #define AVIFILECAPS_NOCOMPRESSION 0x00000020
  1661. typedef BOOL (FAR PASCAL * AVISAVECALLBACK)(int);
  1662. /************************************************************************/
  1663. /* Declaration for the AVICOMPRESSOPTIONS structure. Make sure it */
  1664. /* matches the AutoDoc in avisave.c !!! */
  1665. /************************************************************************/
  1666. typedef struct {
  1667. DWORD fccType; /* stream type, for consistency */
  1668. DWORD fccHandler; /* compressor */
  1669. DWORD dwKeyFrameEvery; /* keyframe rate */
  1670. DWORD dwQuality; /* compress quality 0-10,000 */
  1671. DWORD dwBytesPerSecond; /* bytes per second */
  1672. DWORD dwFlags; /* flags... see below */
  1673. LPVOID lpFormat; /* save format */
  1674. DWORD cbFormat;
  1675. LPVOID lpParms; /* compressor options */
  1676. DWORD cbParms;
  1677. DWORD dwInterleaveEvery; /* for non-video streams only */
  1678. } AVICOMPRESSOPTIONS, FAR *LPAVICOMPRESSOPTIONS;
  1679. //
  1680. // Defines for the dwFlags field of the AVICOMPRESSOPTIONS struct
  1681. // Each of these flags determines if the appropriate field in the structure
  1682. // (dwInterleaveEvery, dwBytesPerSecond, and dwKeyFrameEvery) is payed
  1683. // attention to. See the autodoc in avisave.c for details.
  1684. //
  1685. #define AVICOMPRESSF_INTERLEAVE 0x00000001 // interleave
  1686. #define AVICOMPRESSF_DATARATE 0x00000002 // use a data rate
  1687. #define AVICOMPRESSF_KEYFRAMES 0x00000004 // use keyframes
  1688. #define AVICOMPRESSF_VALID 0x00000008 // has valid data?
  1689. #ifdef __cplusplus
  1690. } // extern "C"
  1691. #endif /* __cplusplus */
  1692. #include <ole2.h>
  1693. #ifdef __cplusplus
  1694. extern "C" { /* Assume C declarations for C++ */
  1695. #endif /* __cplusplus */
  1696. /* - - - - - - - - */
  1697. /****** AVI Stream Interface *******************************************/
  1698. #undef INTERFACE
  1699. #define INTERFACE IAVIStream
  1700. DECLARE_INTERFACE_(IAVIStream, IUnknown)
  1701. {
  1702. // *** IUnknown methods ***
  1703. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  1704. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1705. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1706. // *** IAVIStream methods ***
  1707. STDMETHOD(Create) (THIS_ LPARAM lParam1, LPARAM lParam2) PURE ;
  1708. STDMETHOD(Info) (THIS_ AVISTREAMINFOW FAR * psi, LONG lSize) PURE ;
  1709. STDMETHOD_(LONG, FindSample)(THIS_ LONG lPos, LONG lFlags) PURE ;
  1710. STDMETHOD(ReadFormat) (THIS_ LONG lPos,
  1711. LPVOID lpFormat, LONG FAR *lpcbFormat) PURE ;
  1712. STDMETHOD(SetFormat) (THIS_ LONG lPos,
  1713. LPVOID lpFormat, LONG cbFormat) PURE ;
  1714. STDMETHOD(Read) (THIS_ LONG lStart, LONG lSamples,
  1715. LPVOID lpBuffer, LONG cbBuffer,
  1716. LONG FAR * plBytes, LONG FAR * plSamples) PURE ;
  1717. STDMETHOD(Write) (THIS_ LONG lStart, LONG lSamples,
  1718. LPVOID lpBuffer, LONG cbBuffer,
  1719. DWORD dwFlags,
  1720. LONG FAR *plSampWritten,
  1721. LONG FAR *plBytesWritten) PURE ;
  1722. STDMETHOD(Delete) (THIS_ LONG lStart, LONG lSamples) PURE;
  1723. STDMETHOD(ReadData) (THIS_ DWORD fcc, LPVOID lp, LONG FAR *lpcb) PURE ;
  1724. STDMETHOD(WriteData) (THIS_ DWORD fcc, LPVOID lp, LONG cb) PURE ;
  1725. #ifdef _WIN32
  1726. STDMETHOD(SetInfo) (THIS_ AVISTREAMINFOW FAR * lpInfo,
  1727. LONG cbInfo) PURE;
  1728. #else
  1729. STDMETHOD(Reserved1) (THIS) PURE;
  1730. STDMETHOD(Reserved2) (THIS) PURE;
  1731. STDMETHOD(Reserved3) (THIS) PURE;
  1732. STDMETHOD(Reserved4) (THIS) PURE;
  1733. STDMETHOD(Reserved5) (THIS) PURE;
  1734. #endif
  1735. };
  1736. typedef IAVIStream FAR* PAVISTREAM;
  1737. #undef INTERFACE
  1738. #define INTERFACE IAVIStreaming
  1739. DECLARE_INTERFACE_(IAVIStreaming, IUnknown)
  1740. {
  1741. // *** IUnknown methods ***
  1742. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  1743. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1744. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1745. // *** IAVIStreaming methods ***
  1746. STDMETHOD(Begin) (THIS_
  1747. LONG lStart, // start of what we expect
  1748. // to play
  1749. LONG lEnd, // expected end, or -1
  1750. LONG lRate) PURE; // Should this be a float?
  1751. STDMETHOD(End) (THIS) PURE;
  1752. };
  1753. typedef IAVIStreaming FAR* PAVISTREAMING;
  1754. #undef INTERFACE
  1755. #define INTERFACE IAVIEditStream
  1756. DECLARE_INTERFACE_(IAVIEditStream, IUnknown)
  1757. {
  1758. // *** IUnknown methods ***
  1759. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  1760. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1761. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1762. // *** IAVIEditStream methods ***
  1763. STDMETHOD(Cut) (THIS_ LONG FAR *plStart,
  1764. LONG FAR *plLength,
  1765. PAVISTREAM FAR * ppResult) PURE;
  1766. STDMETHOD(Copy) (THIS_ LONG FAR *plStart,
  1767. LONG FAR *plLength,
  1768. PAVISTREAM FAR * ppResult) PURE;
  1769. STDMETHOD(Paste) (THIS_ LONG FAR *plPos,
  1770. LONG FAR *plLength,
  1771. PAVISTREAM pstream,
  1772. LONG lStart,
  1773. LONG lEnd) PURE;
  1774. STDMETHOD(Clone) (THIS_ PAVISTREAM FAR *ppResult) PURE;
  1775. STDMETHOD(SetInfo) (THIS_ AVISTREAMINFOW FAR * lpInfo,
  1776. LONG cbInfo) PURE;
  1777. };
  1778. typedef IAVIEditStream FAR* PAVIEDITSTREAM;
  1779. /****** AVI File Interface *******************************************/
  1780. #undef INTERFACE
  1781. #define INTERFACE IAVIFile
  1782. #define PAVIFILE IAVIFile FAR*
  1783. DECLARE_INTERFACE_(IAVIFile, IUnknown)
  1784. {
  1785. // *** IUnknown methods ***
  1786. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  1787. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1788. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1789. // *** IAVIFile methods ***
  1790. STDMETHOD(Info) (THIS_
  1791. AVIFILEINFOW FAR * pfi,
  1792. LONG lSize) PURE;
  1793. STDMETHOD(GetStream) (THIS_
  1794. PAVISTREAM FAR * ppStream,
  1795. DWORD fccType,
  1796. LONG lParam) PURE;
  1797. STDMETHOD(CreateStream) (THIS_
  1798. PAVISTREAM FAR * ppStream,
  1799. AVISTREAMINFOW FAR * psi) PURE;
  1800. STDMETHOD(WriteData) (THIS_
  1801. DWORD ckid,
  1802. LPVOID lpData,
  1803. LONG cbData) PURE;
  1804. STDMETHOD(ReadData) (THIS_
  1805. DWORD ckid,
  1806. LPVOID lpData,
  1807. LONG FAR *lpcbData) PURE;
  1808. STDMETHOD(EndRecord) (THIS) PURE;
  1809. STDMETHOD(DeleteStream) (THIS_
  1810. DWORD fccType,
  1811. LONG lParam) PURE;
  1812. };
  1813. #undef PAVIFILE
  1814. typedef IAVIFile FAR* PAVIFILE;
  1815. /****** GetFrame Interface *******************************************/
  1816. #undef INTERFACE
  1817. #define INTERFACE IGetFrame
  1818. #define PGETFRAME IGetFrame FAR*
  1819. DECLARE_INTERFACE_(IGetFrame, IUnknown)
  1820. {
  1821. // *** IUnknown methods ***
  1822. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  1823. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1824. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1825. // *** IGetFrame methods ***
  1826. STDMETHOD_(LPVOID,GetFrame) (THIS_ LONG lPos) PURE;
  1827. // STDMETHOD_(LPVOID,GetFrameData) (THIS_ LONG lPos) PURE;
  1828. STDMETHOD(Begin) (THIS_ LONG lStart, LONG lEnd, LONG lRate) PURE;
  1829. STDMETHOD(End) (THIS) PURE;
  1830. STDMETHOD(SetFormat) (THIS_ LPBITMAPINFOHEADER lpbi, LPVOID lpBits, int x, int y, int dx, int dy) PURE;
  1831. // STDMETHOD(DrawFrameStart) (THIS) PURE;
  1832. // STDMETHOD(DrawFrame) (THIS_ LONG lPos, HDC hdc, int x, int y, int dx, int dy) PURE;
  1833. // STDMETHOD(DrawFrameEnd) (THIS) PURE;
  1834. };
  1835. #undef PGETFRAME
  1836. typedef IGetFrame FAR* PGETFRAME;
  1837. /****** GUIDs *******************************************/
  1838. #define DEFINE_AVIGUID(name, l, w1, w2) \
  1839. DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
  1840. DEFINE_AVIGUID(IID_IAVIFile, 0x00020020, 0, 0);
  1841. DEFINE_AVIGUID(IID_IAVIStream, 0x00020021, 0, 0);
  1842. DEFINE_AVIGUID(IID_IAVIStreaming, 0x00020022, 0, 0);
  1843. DEFINE_AVIGUID(IID_IGetFrame, 0x00020023, 0, 0);
  1844. DEFINE_AVIGUID(IID_IAVIEditStream, 0x00020024, 0, 0);
  1845. #ifndef UNICODE
  1846. DEFINE_AVIGUID(CLSID_AVISimpleUnMarshal, 0x00020009, 0, 0);
  1847. #endif
  1848. DEFINE_AVIGUID(CLSID_AVIFile, 0x00020000, 0, 0);
  1849. #define AVIFILEHANDLER_CANREAD 0x0001
  1850. #define AVIFILEHANDLER_CANWRITE 0x0002
  1851. #define AVIFILEHANDLER_CANACCEPTNONRGB 0x0004
  1852. //
  1853. // functions
  1854. //
  1855. STDAPI_(void) AVIFileInit(void); // Call this first!
  1856. STDAPI_(void) AVIFileExit(void);
  1857. STDAPI_(ULONG) AVIFileAddRef (PAVIFILE pfile);
  1858. STDAPI_(ULONG) AVIFileRelease (PAVIFILE pfile);
  1859. #ifdef _WIN32
  1860. STDAPI AVIFileOpenA (PAVIFILE FAR * ppfile, LPCSTR szFile,
  1861. UINT uMode, LPCLSID lpHandler);
  1862. STDAPI AVIFileOpenW (PAVIFILE FAR * ppfile, LPCWSTR szFile,
  1863. UINT uMode, LPCLSID lpHandler);
  1864. #ifdef UNICODE
  1865. #define AVIFileOpen AVIFileOpenW
  1866. #else
  1867. #define AVIFileOpen AVIFileOpenA
  1868. #endif
  1869. #else // win16
  1870. STDAPI AVIFileOpen (PAVIFILE FAR * ppfile, LPCSTR szFile,
  1871. UINT uMode, LPCLSID lpHandler);
  1872. #define AVIFileOpenW AVIFileOpen /* ;Internal */
  1873. #endif
  1874. #ifdef _WIN32
  1875. STDAPI AVIFileInfoW (PAVIFILE pfile, LPAVIFILEINFOW pfi, LONG lSize);
  1876. STDAPI AVIFileInfoA (PAVIFILE pfile, LPAVIFILEINFOA pfi, LONG lSize);
  1877. #ifdef UNICODE
  1878. #define AVIFileInfo AVIFileInfoW
  1879. #else
  1880. #define AVIFileInfo AVIFileInfoA
  1881. #endif
  1882. #else //win16 version
  1883. STDAPI AVIFileInfo (PAVIFILE pfile, LPAVIFILEINFO pfi, LONG lSize);
  1884. #define AVIFileInfoW AVIFileInfo /* ;Internal */
  1885. #endif
  1886. STDAPI AVIFileGetStream (PAVIFILE pfile, PAVISTREAM FAR * ppavi, DWORD fccType, LONG lParam);
  1887. #ifdef _WIN32
  1888. STDAPI AVIFileCreateStreamW (PAVIFILE pfile, PAVISTREAM FAR *ppavi, AVISTREAMINFOW FAR * psi);
  1889. STDAPI AVIFileCreateStreamA (PAVIFILE pfile, PAVISTREAM FAR *ppavi, AVISTREAMINFOA FAR * psi);
  1890. #ifdef UNICODE
  1891. #define AVIFileCreateStream AVIFileCreateStreamW
  1892. #else
  1893. #define AVIFileCreateStream AVIFileCreateStreamA
  1894. #endif
  1895. #else //win16 version
  1896. STDAPI AVIFileCreateStream(PAVIFILE pfile, PAVISTREAM FAR *ppavi, AVISTREAMINFO FAR * psi);
  1897. #define AVIFileCreateStreamW AVIFileCreateStream /* ;Internal */
  1898. #endif
  1899. STDAPI AVIFileWriteData (PAVIFILE pfile,
  1900. DWORD ckid,
  1901. LPVOID lpData,
  1902. LONG cbData);
  1903. STDAPI AVIFileReadData (PAVIFILE pfile,
  1904. DWORD ckid,
  1905. LPVOID lpData,
  1906. LONG FAR *lpcbData);
  1907. STDAPI AVIFileEndRecord (PAVIFILE pfile);
  1908. STDAPI_(ULONG) AVIStreamAddRef (PAVISTREAM pavi);
  1909. STDAPI_(ULONG) AVIStreamRelease (PAVISTREAM pavi);
  1910. STDAPI AVIStreamInfoW (PAVISTREAM pavi, LPAVISTREAMINFOW psi, LONG lSize);
  1911. STDAPI AVIStreamInfoA (PAVISTREAM pavi, LPAVISTREAMINFOA psi, LONG lSize);
  1912. #ifdef UNICODE
  1913. #define AVIStreamInfo AVIStreamInfoW
  1914. #else
  1915. #define AVIStreamInfo AVIStreamInfoA
  1916. #endif
  1917. STDAPI_(LONG) AVIStreamFindSample(PAVISTREAM pavi, LONG lPos, LONG lFlags);
  1918. STDAPI AVIStreamReadFormat (PAVISTREAM pavi, LONG lPos,LPVOID lpFormat,LONG FAR *lpcbFormat);
  1919. STDAPI AVIStreamSetFormat (PAVISTREAM pavi, LONG lPos,LPVOID lpFormat,LONG cbFormat);
  1920. STDAPI AVIStreamReadData (PAVISTREAM pavi, DWORD fcc, LPVOID lp, LONG FAR *lpcb);
  1921. STDAPI AVIStreamWriteData (PAVISTREAM pavi, DWORD fcc, LPVOID lp, LONG cb);
  1922. STDAPI AVIStreamRead (PAVISTREAM pavi,
  1923. LONG lStart,
  1924. LONG lSamples,
  1925. LPVOID lpBuffer,
  1926. LONG cbBuffer,
  1927. LONG FAR * plBytes,
  1928. LONG FAR * plSamples);
  1929. #define AVISTREAMREAD_CONVENIENT (-1L)
  1930. STDAPI AVIStreamWrite (PAVISTREAM pavi,
  1931. LONG lStart, LONG lSamples,
  1932. LPVOID lpBuffer, LONG cbBuffer, DWORD dwFlags,
  1933. LONG FAR *plSampWritten,
  1934. LONG FAR *plBytesWritten);
  1935. // Right now, these just use AVIStreamInfo() to get information, then
  1936. // return some of it. Can they be more efficient?
  1937. STDAPI_(LONG) AVIStreamStart (PAVISTREAM pavi);
  1938. STDAPI_(LONG) AVIStreamLength (PAVISTREAM pavi);
  1939. STDAPI_(LONG) AVIStreamTimeToSample (PAVISTREAM pavi, LONG lTime);
  1940. STDAPI_(LONG) AVIStreamSampleToTime (PAVISTREAM pavi, LONG lSample);
  1941. STDAPI AVIStreamBeginStreaming(PAVISTREAM pavi, LONG lStart, LONG lEnd, LONG lRate);
  1942. STDAPI AVIStreamEndStreaming(PAVISTREAM pavi);
  1943. //
  1944. // helper functions for using IGetFrame
  1945. //
  1946. STDAPI_(PGETFRAME) AVIStreamGetFrameOpen(PAVISTREAM pavi,
  1947. LPBITMAPINFOHEADER lpbiWanted);
  1948. STDAPI_(LPVOID) AVIStreamGetFrame(PGETFRAME pg, LONG lPos);
  1949. STDAPI AVIStreamGetFrameClose(PGETFRAME pg);
  1950. // !!! We need some way to place an advise on a stream....
  1951. // STDAPI AVIStreamHasChanged (PAVISTREAM pavi);
  1952. // Shortcut function
  1953. STDAPI AVIStreamOpenFromFileA(PAVISTREAM FAR *ppavi, LPCSTR szFile,
  1954. DWORD fccType, LONG lParam,
  1955. UINT mode, CLSID FAR *pclsidHandler);
  1956. STDAPI AVIStreamOpenFromFileW(PAVISTREAM FAR *ppavi, LPCWSTR szFile,
  1957. DWORD fccType, LONG lParam,
  1958. UINT mode, CLSID FAR *pclsidHandler);
  1959. #ifdef UNICODE
  1960. #define AVIStreamOpenFromFile AVIStreamOpenFromFileW
  1961. #else
  1962. #define AVIStreamOpenFromFile AVIStreamOpenFromFileA
  1963. #endif
  1964. // Use to create disembodied streams
  1965. STDAPI AVIStreamCreate(PAVISTREAM FAR *ppavi, LONG lParam1, LONG lParam2,
  1966. CLSID FAR *pclsidHandler);
  1967. // PHANDLER AVIAPI AVIGetHandler (PAVISTREAM pavi, PAVISTREAMHANDLER psh);
  1968. // PAVISTREAM AVIAPI AVIGetStream (PHANDLER p);
  1969. //
  1970. // flags for AVIStreamFindSample
  1971. //
  1972. #define FIND_DIR 0x0000000FL // direction
  1973. #define FIND_NEXT 0x00000001L // go forward
  1974. #define FIND_PREV 0x00000004L // go backward
  1975. #define FIND_FROM_START 0x00000008L // start at the logical beginning
  1976. #define FIND_TYPE 0x000000F0L // type mask
  1977. #define FIND_KEY 0x00000010L // find key frame.
  1978. #define FIND_ANY 0x00000020L // find any (non-empty) sample
  1979. #define FIND_FORMAT 0x00000040L // find format change
  1980. #define FIND_RET 0x0000F000L // return mask
  1981. #define FIND_POS 0x00000000L // return logical position
  1982. #define FIND_LENGTH 0x00001000L // return logical size
  1983. #define FIND_OFFSET 0x00002000L // return physical position
  1984. #define FIND_SIZE 0x00003000L // return physical size
  1985. #define FIND_INDEX 0x00004000L // return physical index position
  1986. //
  1987. // stuff to support backward compat.
  1988. //
  1989. #define AVIStreamFindKeyFrame AVIStreamFindSample
  1990. #define FindKeyFrame FindSample
  1991. #define AVIStreamClose AVIStreamRelease
  1992. #define AVIFileClose AVIFileRelease
  1993. #define AVIStreamInit AVIFileInit
  1994. #define AVIStreamExit AVIFileExit
  1995. #define SEARCH_NEAREST FIND_PREV
  1996. #define SEARCH_BACKWARD FIND_PREV
  1997. #define SEARCH_FORWARD FIND_NEXT
  1998. #define SEARCH_KEY FIND_KEY
  1999. #define SEARCH_ANY FIND_ANY
  2000. //
  2001. // helper macros.
  2002. //
  2003. #define AVIStreamSampleToSample(pavi1, pavi2, l) \
  2004. AVIStreamTimeToSample(pavi1,AVIStreamSampleToTime(pavi2, l))
  2005. #define AVIStreamNextSample(pavi, l) \
  2006. AVIStreamFindSample(pavi,l+1,FIND_NEXT|FIND_ANY)
  2007. #define AVIStreamPrevSample(pavi, l) \
  2008. AVIStreamFindSample(pavi,l-1,FIND_PREV|FIND_ANY)
  2009. #define AVIStreamNearestSample(pavi, l) \
  2010. AVIStreamFindSample(pavi,l,FIND_PREV|FIND_ANY)
  2011. #define AVIStreamNextKeyFrame(pavi,l) \
  2012. AVIStreamFindSample(pavi,l+1,FIND_NEXT|FIND_KEY)
  2013. #define AVIStreamPrevKeyFrame(pavi, l) \
  2014. AVIStreamFindSample(pavi,l-1,FIND_PREV|FIND_KEY)
  2015. #define AVIStreamNearestKeyFrame(pavi, l) \
  2016. AVIStreamFindSample(pavi,l,FIND_PREV|FIND_KEY)
  2017. #define AVIStreamIsKeyFrame(pavi, l) \
  2018. (AVIStreamNearestKeyFrame(pavi,l) == l)
  2019. #define AVIStreamPrevSampleTime(pavi, t) \
  2020. AVIStreamSampleToTime(pavi, AVIStreamPrevSample(pavi,AVIStreamTimeToSample(pavi,t)))
  2021. #define AVIStreamNextSampleTime(pavi, t) \
  2022. AVIStreamSampleToTime(pavi, AVIStreamNextSample(pavi,AVIStreamTimeToSample(pavi,t)))
  2023. #define AVIStreamNearestSampleTime(pavi, t) \
  2024. AVIStreamSampleToTime(pavi, AVIStreamNearestSample(pavi,AVIStreamTimeToSample(pavi,t)))
  2025. #define AVIStreamNextKeyFrameTime(pavi, t) \
  2026. AVIStreamSampleToTime(pavi, AVIStreamNextKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)))
  2027. #define AVIStreamPrevKeyFrameTime(pavi, t) \
  2028. AVIStreamSampleToTime(pavi, AVIStreamPrevKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)))
  2029. #define AVIStreamNearestKeyFrameTime(pavi, t) \
  2030. AVIStreamSampleToTime(pavi, AVIStreamNearestKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)))
  2031. #define AVIStreamStartTime(pavi) \
  2032. AVIStreamSampleToTime(pavi, AVIStreamStart(pavi))
  2033. #define AVIStreamLengthTime(pavi) \
  2034. AVIStreamSampleToTime(pavi, AVIStreamLength(pavi))
  2035. #define AVIStreamEnd(pavi) \
  2036. (AVIStreamStart(pavi) + AVIStreamLength(pavi))
  2037. #define AVIStreamEndTime(pavi) \
  2038. AVIStreamSampleToTime(pavi, AVIStreamEnd(pavi))
  2039. #define AVIStreamSampleSize(pavi, lPos, plSize) \
  2040. AVIStreamRead(pavi,lPos,1,NULL,0,plSize,NULL)
  2041. #define AVIStreamFormatSize(pavi, lPos, plSize) \
  2042. AVIStreamReadFormat(pavi,lPos,NULL,plSize)
  2043. #define AVIStreamDataSize(pavi, fcc, plSize) \
  2044. AVIStreamReadData(pavi,fcc,NULL,plSize)
  2045. /****************************************************************************
  2046. *
  2047. * AVISave routines and structures
  2048. *
  2049. ***************************************************************************/
  2050. #ifndef comptypeDIB
  2051. #define comptypeDIB mmioFOURCC('D', 'I', 'B', ' ')
  2052. #endif
  2053. STDAPI AVIMakeCompressedStream(
  2054. PAVISTREAM FAR * ppsCompressed,
  2055. PAVISTREAM ppsSource,
  2056. AVICOMPRESSOPTIONS FAR * lpOptions,
  2057. CLSID FAR *pclsidHandler);
  2058. EXTERN_C HRESULT CDECL AVISaveA (LPCSTR szFile,
  2059. CLSID FAR *pclsidHandler,
  2060. AVISAVECALLBACK lpfnCallback,
  2061. int nStreams,
  2062. PAVISTREAM pfile,
  2063. LPAVICOMPRESSOPTIONS lpOptions,
  2064. ...);
  2065. STDAPI AVISaveVA(LPCSTR szFile,
  2066. CLSID FAR *pclsidHandler,
  2067. AVISAVECALLBACK lpfnCallback,
  2068. int nStreams,
  2069. PAVISTREAM FAR * ppavi,
  2070. LPAVICOMPRESSOPTIONS FAR *plpOptions);
  2071. EXTERN_C HRESULT CDECL AVISaveW (LPCWSTR szFile,
  2072. CLSID FAR *pclsidHandler,
  2073. AVISAVECALLBACK lpfnCallback,
  2074. int nStreams,
  2075. PAVISTREAM pfile,
  2076. LPAVICOMPRESSOPTIONS lpOptions,
  2077. ...);
  2078. STDAPI AVISaveVW(LPCWSTR szFile,
  2079. CLSID FAR *pclsidHandler,
  2080. AVISAVECALLBACK lpfnCallback,
  2081. int nStreams,
  2082. PAVISTREAM FAR * ppavi,
  2083. LPAVICOMPRESSOPTIONS FAR *plpOptions);
  2084. #ifdef UNICODE
  2085. #define AVISave AVISaveW
  2086. #define AVISaveV AVISaveVW
  2087. #else
  2088. #define AVISave AVISaveA
  2089. #define AVISaveV AVISaveVA
  2090. #endif
  2091. STDAPI_(INT_PTR) AVISaveOptions(HWND hwnd,
  2092. UINT uiFlags,
  2093. int nStreams,
  2094. PAVISTREAM FAR *ppavi,
  2095. LPAVICOMPRESSOPTIONS FAR *plpOptions);
  2096. STDAPI AVISaveOptionsFree(int nStreams,
  2097. LPAVICOMPRESSOPTIONS FAR *plpOptions);
  2098. // FLAGS FOR uiFlags:
  2099. //
  2100. // Same as the flags for ICCompressorChoose (see compman.h)
  2101. // These determine what the compression options dialog for video streams
  2102. // will look like.
  2103. STDAPI AVIBuildFilterW(LPWSTR lpszFilter, LONG cbFilter, BOOL fSaving);
  2104. STDAPI AVIBuildFilterA(LPSTR lpszFilter, LONG cbFilter, BOOL fSaving);
  2105. #ifdef UNICODE
  2106. #define AVIBuildFilter AVIBuildFilterW
  2107. #else
  2108. #define AVIBuildFilter AVIBuildFilterA
  2109. #endif
  2110. STDAPI AVIMakeFileFromStreams(PAVIFILE FAR * ppfile,
  2111. int nStreams,
  2112. PAVISTREAM FAR * papStreams);
  2113. STDAPI AVIMakeStreamFromClipboard(UINT cfFormat, HANDLE hGlobal, PAVISTREAM FAR *ppstream);
  2114. /****************************************************************************
  2115. *
  2116. * Clipboard routines
  2117. *
  2118. ***************************************************************************/
  2119. STDAPI AVIPutFileOnClipboard(PAVIFILE pf);
  2120. STDAPI AVIGetFromClipboard(PAVIFILE FAR * lppf);
  2121. STDAPI AVIClearClipboard(void);
  2122. /****************************************************************************
  2123. *
  2124. * Editing routines
  2125. *
  2126. ***************************************************************************/
  2127. STDAPI CreateEditableStream(
  2128. PAVISTREAM FAR * ppsEditable,
  2129. PAVISTREAM psSource);
  2130. STDAPI EditStreamCut(PAVISTREAM pavi, LONG FAR *plStart, LONG FAR *plLength, PAVISTREAM FAR * ppResult);
  2131. STDAPI EditStreamCopy(PAVISTREAM pavi, LONG FAR *plStart, LONG FAR *plLength, PAVISTREAM FAR * ppResult);
  2132. STDAPI EditStreamPaste(PAVISTREAM pavi, LONG FAR *plPos, LONG FAR *plLength, PAVISTREAM pstream, LONG lStart, LONG lEnd);
  2133. STDAPI EditStreamClone(PAVISTREAM pavi, PAVISTREAM FAR *ppResult);
  2134. STDAPI EditStreamSetNameA(PAVISTREAM pavi, LPCSTR lpszName);
  2135. STDAPI EditStreamSetNameW(PAVISTREAM pavi, LPCWSTR lpszName);
  2136. STDAPI EditStreamSetInfoW(PAVISTREAM pavi, LPAVISTREAMINFOW lpInfo, LONG cbInfo);
  2137. STDAPI EditStreamSetInfoA(PAVISTREAM pavi, LPAVISTREAMINFOA lpInfo, LONG cbInfo);
  2138. #ifdef UNICODE
  2139. #define EditStreamSetInfo EditStreamSetInfoW
  2140. #define EditStreamSetName EditStreamSetNameW
  2141. #else
  2142. #define EditStreamSetInfo EditStreamSetInfoA
  2143. #define EditStreamSetName EditStreamSetNameA
  2144. #endif
  2145. /* - - - - - - - - */
  2146. #ifndef AVIERR_OK
  2147. #define AVIERR_OK 0L
  2148. #define MAKE_AVIERR(error) MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x4000 + error)
  2149. // !!! Questions to be answered:
  2150. // How can you get a string form of these errors?
  2151. // Which of these errors should be replaced by errors in SCODE.H?
  2152. #define AVIERR_UNSUPPORTED MAKE_AVIERR(101)
  2153. #define AVIERR_BADFORMAT MAKE_AVIERR(102)
  2154. #define AVIERR_MEMORY MAKE_AVIERR(103)
  2155. #define AVIERR_INTERNAL MAKE_AVIERR(104)
  2156. #define AVIERR_BADFLAGS MAKE_AVIERR(105)
  2157. #define AVIERR_BADPARAM MAKE_AVIERR(106)
  2158. #define AVIERR_BADSIZE MAKE_AVIERR(107)
  2159. #define AVIERR_BADHANDLE MAKE_AVIERR(108)
  2160. #define AVIERR_FILEREAD MAKE_AVIERR(109)
  2161. #define AVIERR_FILEWRITE MAKE_AVIERR(110)
  2162. #define AVIERR_FILEOPEN MAKE_AVIERR(111)
  2163. #define AVIERR_COMPRESSOR MAKE_AVIERR(112)
  2164. #define AVIERR_NOCOMPRESSOR MAKE_AVIERR(113)
  2165. #define AVIERR_READONLY MAKE_AVIERR(114)
  2166. #define AVIERR_NODATA MAKE_AVIERR(115)
  2167. #define AVIERR_BUFFERTOOSMALL MAKE_AVIERR(116)
  2168. #define AVIERR_CANTCOMPRESS MAKE_AVIERR(117)
  2169. #define AVIERR_USERABORT MAKE_AVIERR(198)
  2170. #define AVIERR_ERROR MAKE_AVIERR(199)
  2171. #endif
  2172. #endif /* NOAVIFILE */
  2173. /****************************************************************************
  2174. *
  2175. * MCIWnd - Window class for MCI objects
  2176. *
  2177. ***************************************************************************/
  2178. #ifndef NOMCIWND
  2179. /*----------------------------------------------------------------------------*\
  2180. *
  2181. * MCIWnd
  2182. *
  2183. * MCIWnd window class header file.
  2184. *
  2185. * the MCIWnd window class is a window class for controling MCI devices
  2186. * MCI devices include, wave files, midi files, AVI Video, cd audio,
  2187. * vcr, video disc, and others..
  2188. *
  2189. * to learn more about MCI and mci command sets see the
  2190. * "Microsoft Multimedia Programmers's guide" in the Win31 SDK
  2191. *
  2192. * the easiest use of the MCIWnd class is like so:
  2193. *
  2194. * hwnd = MCIWndCreate(hwndParent, hInstance, 0, "chimes.wav");
  2195. * ...
  2196. * MCIWndPlay(hwnd);
  2197. * MCIWndStop(hwnd);
  2198. * MCIWndPause(hwnd);
  2199. * ....
  2200. * MCIWndDestroy(hwnd);
  2201. *
  2202. * this will create a window with a play/pause, stop and a playbar
  2203. * and start the wave file playing.
  2204. *
  2205. * mciwnd.h defines macros for all the most common MCI commands, but
  2206. * any string command can be used if needed.
  2207. *
  2208. * Note: unlike the mciSendString() API, no alias or file name needs
  2209. * to be specifed, since the device to use is implied by the window handle.
  2210. *
  2211. * MCIWndSendString(hwnd, "setaudio stream to 2");
  2212. *
  2213. * (C) Copyright Microsoft Corp. 1991-1995. All rights reserved.
  2214. *
  2215. * You have a royalty-free right to use, modify, reproduce and
  2216. * distribute the Sample Files (and/or any modified version) in
  2217. * any way you find useful, provided that you agree that
  2218. * Microsoft has no warranty obligations or liability for any
  2219. * Sample Application Files.
  2220. *
  2221. * If you did not get this from Microsoft Sources, then it may not be the
  2222. * most current version. This sample code in particular will be updated
  2223. * and include more documentation.
  2224. *
  2225. * Sources are:
  2226. * CompuServe: WINSDK forum, MDK section.
  2227. * Anonymous FTP from ftp.uu.net vendor\microsoft\multimedia
  2228. *
  2229. * WIN32:
  2230. *
  2231. * MCIWnd supports both ansi and unicode interfaces. For any message that
  2232. * takes or returns a text string, two versions of the message are defined,
  2233. * appended with A or W for Ansi or Wide Char. The message or api itself
  2234. * is defined to be one or other of these depending on whether you have
  2235. * UNICODE defined in your application.
  2236. * Thus for the api MCIWndCreate, there are in fact two apis,
  2237. * MCIWndCreateA and MCIWndCreateW. If you call MCIWndCreate, this will be
  2238. * re-routed to MCIWndCreateA unless UNICODE is defined when building your
  2239. * application. In any one application, you can mix calls to the
  2240. * Ansi and Unicode entrypoints.
  2241. *
  2242. * If you use SendMessage instead of the macros below such as MCIWndOpen(),
  2243. * you will see that the messages have changed for WIN32, to support Ansi
  2244. * and Unicode entrypoints. In particular, MCI_OPEN has been replaced by
  2245. * MCWNDM_OPENA, or MCIWNDM_OPENW (MCIWNDM_OPEN is defined to be one or
  2246. * other of these).
  2247. *
  2248. * Also, note that the WIN32 implementation of MCIWnd uses UNICODE
  2249. * so all apis and messages supporting ANSI strings do so by mapping them
  2250. * UNICODE strings and then calling the corresponding UNICODE entrypoint.
  2251. *
  2252. *----------------------------------------------------------------------------*/
  2253. #ifdef __cplusplus
  2254. // MFC Redefines SendMessage, so make sure we get the global one....
  2255. #define MCIWndSM ::SendMessage /* SendMessage in C++*/
  2256. #else
  2257. #define MCIWndSM SendMessage /* SendMessage in C */
  2258. #endif /* __cplusplus */
  2259. #define MCIWND_WINDOW_CLASS TEXT("MCIWndClass")
  2260. HWND
  2261. VFWAPIV
  2262. MCIWndCreateA(
  2263. IN HWND hwndParent,
  2264. IN HINSTANCE hInstance,
  2265. IN DWORD dwStyle,
  2266. IN LPCSTR szFile
  2267. );
  2268. HWND
  2269. VFWAPIV
  2270. MCIWndCreateW(
  2271. IN HWND hwndParent,
  2272. IN HINSTANCE hInstance,
  2273. IN DWORD dwStyle,
  2274. IN LPCWSTR szFile
  2275. );
  2276. #ifdef UNICODE
  2277. #define MCIWndCreate MCIWndCreateW
  2278. #else
  2279. #define MCIWndCreate MCIWndCreateA
  2280. #endif
  2281. BOOL VFWAPIV MCIWndRegisterClass(void);
  2282. // Flags for the MCIWndOpen command
  2283. #define MCIWNDOPENF_NEW 0x0001 // open a new file
  2284. // window styles
  2285. #define MCIWNDF_NOAUTOSIZEWINDOW 0x0001 // when movie size changes
  2286. #define MCIWNDF_NOPLAYBAR 0x0002 // no toolbar
  2287. #define MCIWNDF_NOAUTOSIZEMOVIE 0x0004 // when window size changes
  2288. #define MCIWNDF_NOMENU 0x0008 // no popup menu from RBUTTONDOWN
  2289. #define MCIWNDF_SHOWNAME 0x0010 // show name in caption
  2290. #define MCIWNDF_SHOWPOS 0x0020 // show position in caption
  2291. #define MCIWNDF_SHOWMODE 0x0040 // show mode in caption
  2292. #define MCIWNDF_SHOWALL 0x0070 // show all
  2293. #define MCIWNDF_NOTIFYMODE 0x0100 // tell parent of mode change
  2294. #define MCIWNDF_NOTIFYPOS 0x0200 // tell parent of pos change
  2295. #define MCIWNDF_NOTIFYSIZE 0x0400 // tell parent of size change
  2296. #define MCIWNDF_NOTIFYERROR 0x1000 // tell parent of an error
  2297. #define MCIWNDF_NOTIFYALL 0x1F00 // tell all
  2298. #define MCIWNDF_NOTIFYANSI 0x0080
  2299. // The MEDIA notification includes a text string.
  2300. // To receive notifications in ANSI instead of unicode set the
  2301. // MCIWNDF_NOTIFYANSI style bit. The macro below includes this bit
  2302. // by default unless you define UNICODE in your application.
  2303. #define MCIWNDF_NOTIFYMEDIAA 0x0880 // tell parent of media change
  2304. #define MCIWNDF_NOTIFYMEDIAW 0x0800 // tell parent of media change
  2305. #ifdef UNICODE
  2306. #define MCIWNDF_NOTIFYMEDIA MCIWNDF_NOTIFYMEDIAW
  2307. #else
  2308. #define MCIWNDF_NOTIFYMEDIA MCIWNDF_NOTIFYMEDIAA
  2309. #endif
  2310. #define MCIWNDF_RECORD 0x2000 // Give a record button
  2311. #define MCIWNDF_NOERRORDLG 0x4000 // Show Error Dlgs for MCI cmds?
  2312. #define MCIWNDF_NOOPEN 0x8000 // Don't allow user to open things
  2313. // can macros
  2314. #define MCIWndCanPlay(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_PLAY,0,0)
  2315. #define MCIWndCanRecord(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_RECORD,0,0)
  2316. #define MCIWndCanSave(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_SAVE,0,0)
  2317. #define MCIWndCanWindow(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_WINDOW,0,0)
  2318. #define MCIWndCanEject(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_EJECT,0,0)
  2319. #define MCIWndCanConfig(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_CAN_CONFIG,0,0)
  2320. #define MCIWndPaletteKick(hwnd) (BOOL)MCIWndSM(hwnd,MCIWNDM_PALETTEKICK,0,0)
  2321. #define MCIWndSave(hwnd, szFile) (LONG)MCIWndSM(hwnd, MCI_SAVE, 0, (LPARAM)(LPVOID)(szFile))
  2322. #define MCIWndSaveDialog(hwnd) MCIWndSave(hwnd, -1)
  2323. // if you dont give a device it will use the current device....
  2324. #define MCIWndNew(hwnd, lp) (LONG)MCIWndSM(hwnd, MCIWNDM_NEW, 0, (LPARAM)(LPVOID)(lp))
  2325. #define MCIWndRecord(hwnd) (LONG)MCIWndSM(hwnd, MCI_RECORD, 0, 0)
  2326. #define MCIWndOpen(hwnd, sz, f) (LONG)MCIWndSM(hwnd, MCIWNDM_OPEN, (WPARAM)(UINT)(f),(LPARAM)(LPVOID)(sz))
  2327. #define MCIWndOpenDialog(hwnd) MCIWndOpen(hwnd, -1, 0)
  2328. #define MCIWndClose(hwnd) (LONG)MCIWndSM(hwnd, MCI_CLOSE, 0, 0)
  2329. #define MCIWndPlay(hwnd) (LONG)MCIWndSM(hwnd, MCI_PLAY, 0, 0)
  2330. #define MCIWndStop(hwnd) (LONG)MCIWndSM(hwnd, MCI_STOP, 0, 0)
  2331. #define MCIWndPause(hwnd) (LONG)MCIWndSM(hwnd, MCI_PAUSE, 0, 0)
  2332. #define MCIWndResume(hwnd) (LONG)MCIWndSM(hwnd, MCI_RESUME, 0, 0)
  2333. #define MCIWndSeek(hwnd, lPos) (LONG)MCIWndSM(hwnd, MCI_SEEK, 0, (LPARAM)(LONG)(lPos))
  2334. #define MCIWndEject(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_EJECT, 0, 0)
  2335. #define MCIWndHome(hwnd) MCIWndSeek(hwnd, MCIWND_START)
  2336. #define MCIWndEnd(hwnd) MCIWndSeek(hwnd, MCIWND_END)
  2337. #define MCIWndGetSource(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_GET_SOURCE, 0, (LPARAM)(LPRECT)(prc))
  2338. #define MCIWndPutSource(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_PUT_SOURCE, 0, (LPARAM)(LPRECT)(prc))
  2339. #define MCIWndGetDest(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_GET_DEST, 0, (LPARAM)(LPRECT)(prc))
  2340. #define MCIWndPutDest(hwnd, prc) (LONG)MCIWndSM(hwnd, MCIWNDM_PUT_DEST, 0, (LPARAM)(LPRECT)(prc))
  2341. #define MCIWndPlayReverse(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_PLAYREVERSE, 0, 0)
  2342. #define MCIWndPlayFrom(hwnd, lPos) (LONG)MCIWndSM(hwnd, MCIWNDM_PLAYFROM, 0, (LPARAM)(LONG)(lPos))
  2343. #define MCIWndPlayTo(hwnd, lPos) (LONG)MCIWndSM(hwnd, MCIWNDM_PLAYTO, 0, (LPARAM)(LONG)(lPos))
  2344. #define MCIWndPlayFromTo(hwnd, lStart, lEnd) (MCIWndSeek(hwnd, lStart), MCIWndPlayTo(hwnd, lEnd))
  2345. #define MCIWndGetDeviceID(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETDEVICEID, 0, 0)
  2346. #define MCIWndGetAlias(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETALIAS, 0, 0)
  2347. #define MCIWndGetMode(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETMODE, (WPARAM)(UINT)(len), (LPARAM)(LPTSTR)(lp))
  2348. #define MCIWndGetPosition(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETPOSITION, 0, 0)
  2349. #define MCIWndGetPositionString(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETPOSITION, (WPARAM)(UINT)(len), (LPARAM)(LPTSTR)(lp))
  2350. #define MCIWndGetStart(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETSTART, 0, 0)
  2351. #define MCIWndGetLength(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETLENGTH, 0, 0)
  2352. #define MCIWndGetEnd(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETEND, 0, 0)
  2353. #define MCIWndStep(hwnd, n) (LONG)MCIWndSM(hwnd, MCI_STEP, 0,(LPARAM)(long)(n))
  2354. #define MCIWndDestroy(hwnd) (VOID)MCIWndSM(hwnd, WM_CLOSE, 0, 0)
  2355. #define MCIWndSetZoom(hwnd,iZoom) (VOID)MCIWndSM(hwnd, MCIWNDM_SETZOOM, 0, (LPARAM)(UINT)(iZoom))
  2356. #define MCIWndGetZoom(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETZOOM, 0, 0)
  2357. #define MCIWndSetVolume(hwnd,iVol) (LONG)MCIWndSM(hwnd, MCIWNDM_SETVOLUME, 0, (LPARAM)(UINT)(iVol))
  2358. #define MCIWndGetVolume(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETVOLUME, 0, 0)
  2359. #define MCIWndSetSpeed(hwnd,iSpeed) (LONG)MCIWndSM(hwnd, MCIWNDM_SETSPEED, 0, (LPARAM)(UINT)(iSpeed))
  2360. #define MCIWndGetSpeed(hwnd) (LONG)MCIWndSM(hwnd, MCIWNDM_GETSPEED, 0, 0)
  2361. #define MCIWndSetTimeFormat(hwnd, lp) (LONG)MCIWndSM(hwnd, MCIWNDM_SETTIMEFORMAT, 0, (LPARAM)(LPTSTR)(lp))
  2362. #define MCIWndGetTimeFormat(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETTIMEFORMAT, (WPARAM)(UINT)(len), (LPARAM)(LPTSTR)(lp))
  2363. #define MCIWndValidateMedia(hwnd) (VOID)MCIWndSM(hwnd, MCIWNDM_VALIDATEMEDIA, 0, 0)
  2364. #define MCIWndSetRepeat(hwnd,f) (void)MCIWndSM(hwnd, MCIWNDM_SETREPEAT, 0, (LPARAM)(BOOL)(f))
  2365. #define MCIWndGetRepeat(hwnd) (BOOL)MCIWndSM(hwnd, MCIWNDM_GETREPEAT, 0, 0)
  2366. #define MCIWndUseFrames(hwnd) MCIWndSetTimeFormat(hwnd, TEXT("frames"))
  2367. #define MCIWndUseTime(hwnd) MCIWndSetTimeFormat(hwnd, TEXT("ms"))
  2368. #define MCIWndSetActiveTimer(hwnd, active) \
  2369. (VOID)MCIWndSM(hwnd, MCIWNDM_SETACTIVETIMER, \
  2370. (WPARAM)(UINT)(active), 0L)
  2371. #define MCIWndSetInactiveTimer(hwnd, inactive) \
  2372. (VOID)MCIWndSM(hwnd, MCIWNDM_SETINACTIVETIMER, \
  2373. (WPARAM)(UINT)(inactive), 0L)
  2374. #define MCIWndSetTimers(hwnd, active, inactive) \
  2375. (VOID)MCIWndSM(hwnd, MCIWNDM_SETTIMERS,(WPARAM)(UINT)(active), \
  2376. (LPARAM)(UINT)(inactive))
  2377. #define MCIWndGetActiveTimer(hwnd) \
  2378. (UINT)MCIWndSM(hwnd, MCIWNDM_GETACTIVETIMER, 0, 0L);
  2379. #define MCIWndGetInactiveTimer(hwnd) \
  2380. (UINT)MCIWndSM(hwnd, MCIWNDM_GETINACTIVETIMER, 0, 0L);
  2381. #define MCIWndRealize(hwnd, fBkgnd) (LONG)MCIWndSM(hwnd, MCIWNDM_REALIZE,(WPARAM)(BOOL)(fBkgnd),0)
  2382. #define MCIWndSendString(hwnd, sz) (LONG)MCIWndSM(hwnd, MCIWNDM_SENDSTRING, 0, (LPARAM)(LPTSTR)(sz))
  2383. #define MCIWndReturnString(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_RETURNSTRING, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
  2384. #define MCIWndGetError(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETERROR, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
  2385. //#define MCIWndActivate(hwnd, f) (void)MCIWndSM(hwnd, WM_ACTIVATE, (WPARAM)(BOOL)(f), 0)
  2386. #define MCIWndGetPalette(hwnd) (HPALETTE)MCIWndSM(hwnd, MCIWNDM_GETPALETTE, 0, 0)
  2387. #define MCIWndSetPalette(hwnd, hpal) (LONG)MCIWndSM(hwnd, MCIWNDM_SETPALETTE, (WPARAM)(HPALETTE)(hpal), 0)
  2388. #define MCIWndGetFileName(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETFILENAME, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
  2389. #define MCIWndGetDevice(hwnd, lp, len) (LONG)MCIWndSM(hwnd, MCIWNDM_GETDEVICE, (WPARAM)(UINT)(len), (LPARAM)(LPVOID)(lp))
  2390. #define MCIWndGetStyles(hwnd) (UINT)MCIWndSM(hwnd, MCIWNDM_GETSTYLES, 0, 0L)
  2391. #define MCIWndChangeStyles(hwnd, mask, value) (LONG)MCIWndSM(hwnd, MCIWNDM_CHANGESTYLES, (WPARAM)(UINT)(mask), (LPARAM)(LONG)(value))
  2392. #define MCIWndOpenInterface(hwnd, pUnk) (LONG)MCIWndSM(hwnd, MCIWNDM_OPENINTERFACE, 0, (LPARAM)(LPUNKNOWN)(pUnk))
  2393. #define MCIWndSetOwner(hwnd, hwndP) (LONG)MCIWndSM(hwnd, MCIWNDM_SETOWNER, (WPARAM)(hwndP), 0)
  2394. // Messages an app will send to MCIWND
  2395. // all the text-related messages are defined out of order above (they need
  2396. // to be defined before the MCIWndOpen() macros
  2397. #define MCIWNDM_GETDEVICEID (WM_USER + 100)
  2398. #define MCIWNDM_GETSTART (WM_USER + 103)
  2399. #define MCIWNDM_GETLENGTH (WM_USER + 104)
  2400. #define MCIWNDM_GETEND (WM_USER + 105)
  2401. #define MCIWNDM_EJECT (WM_USER + 107)
  2402. #define MCIWNDM_SETZOOM (WM_USER + 108)
  2403. #define MCIWNDM_GETZOOM (WM_USER + 109)
  2404. #define MCIWNDM_SETVOLUME (WM_USER + 110)
  2405. #define MCIWNDM_GETVOLUME (WM_USER + 111)
  2406. #define MCIWNDM_SETSPEED (WM_USER + 112)
  2407. #define MCIWNDM_GETSPEED (WM_USER + 113)
  2408. #define MCIWNDM_SETREPEAT (WM_USER + 114)
  2409. #define MCIWNDM_GETREPEAT (WM_USER + 115)
  2410. #define MCIWNDM_REALIZE (WM_USER + 118)
  2411. #define MCIWNDM_VALIDATEMEDIA (WM_USER + 121)
  2412. #define MCIWNDM_PLAYFROM (WM_USER + 122)
  2413. #define MCIWNDM_PLAYTO (WM_USER + 123)
  2414. #define MCIWNDM_GETPALETTE (WM_USER + 126)
  2415. #define MCIWNDM_SETPALETTE (WM_USER + 127)
  2416. #define MCIWNDM_SETTIMERS (WM_USER + 129)
  2417. #define MCIWNDM_SETACTIVETIMER (WM_USER + 130)
  2418. #define MCIWNDM_SETINACTIVETIMER (WM_USER + 131)
  2419. #define MCIWNDM_GETACTIVETIMER (WM_USER + 132)
  2420. #define MCIWNDM_GETINACTIVETIMER (WM_USER + 133)
  2421. #define MCIWNDM_CHANGESTYLES (WM_USER + 135)
  2422. #define MCIWNDM_GETSTYLES (WM_USER + 136)
  2423. #define MCIWNDM_GETALIAS (WM_USER + 137)
  2424. #define MCIWNDM_PLAYREVERSE (WM_USER + 139)
  2425. #define MCIWNDM_GET_SOURCE (WM_USER + 140)
  2426. #define MCIWNDM_PUT_SOURCE (WM_USER + 141)
  2427. #define MCIWNDM_GET_DEST (WM_USER + 142)
  2428. #define MCIWNDM_PUT_DEST (WM_USER + 143)
  2429. #define MCIWNDM_CAN_PLAY (WM_USER + 144)
  2430. #define MCIWNDM_CAN_WINDOW (WM_USER + 145)
  2431. #define MCIWNDM_CAN_RECORD (WM_USER + 146)
  2432. #define MCIWNDM_CAN_SAVE (WM_USER + 147)
  2433. #define MCIWNDM_CAN_EJECT (WM_USER + 148)
  2434. #define MCIWNDM_CAN_CONFIG (WM_USER + 149)
  2435. #define MCIWNDM_PALETTEKICK (WM_USER + 150)
  2436. #define MCIWNDM_OPENINTERFACE (WM_USER + 151)
  2437. #define MCIWNDM_SETOWNER (WM_USER + 152)
  2438. //define both A and W messages
  2439. #define MCIWNDM_SENDSTRINGA (WM_USER + 101)
  2440. #define MCIWNDM_GETPOSITIONA (WM_USER + 102)
  2441. #define MCIWNDM_GETMODEA (WM_USER + 106)
  2442. #define MCIWNDM_SETTIMEFORMATA (WM_USER + 119)
  2443. #define MCIWNDM_GETTIMEFORMATA (WM_USER + 120)
  2444. #define MCIWNDM_GETFILENAMEA (WM_USER + 124)
  2445. #define MCIWNDM_GETDEVICEA (WM_USER + 125)
  2446. #define MCIWNDM_GETERRORA (WM_USER + 128)
  2447. #define MCIWNDM_NEWA (WM_USER + 134)
  2448. #define MCIWNDM_RETURNSTRINGA (WM_USER + 138)
  2449. #define MCIWNDM_OPENA (WM_USER + 153)
  2450. #define MCIWNDM_SENDSTRINGW (WM_USER + 201)
  2451. #define MCIWNDM_GETPOSITIONW (WM_USER + 202)
  2452. #define MCIWNDM_GETMODEW (WM_USER + 206)
  2453. #define MCIWNDM_SETTIMEFORMATW (WM_USER + 219)
  2454. #define MCIWNDM_GETTIMEFORMATW (WM_USER + 220)
  2455. #define MCIWNDM_GETFILENAMEW (WM_USER + 224)
  2456. #define MCIWNDM_GETDEVICEW (WM_USER + 225)
  2457. #define MCIWNDM_GETERRORW (WM_USER + 228)
  2458. #define MCIWNDM_NEWW (WM_USER + 234)
  2459. #define MCIWNDM_RETURNSTRINGW (WM_USER + 238)
  2460. #define MCIWNDM_OPENW (WM_USER + 252)
  2461. // map defaults to A or W depending on app's UNICODE setting
  2462. #ifdef UNICODE
  2463. #define MCIWNDM_SENDSTRING MCIWNDM_SENDSTRINGW
  2464. #define MCIWNDM_GETPOSITION MCIWNDM_GETPOSITIONW
  2465. #define MCIWNDM_GETMODE MCIWNDM_GETMODEW
  2466. #define MCIWNDM_SETTIMEFORMAT MCIWNDM_SETTIMEFORMATW
  2467. #define MCIWNDM_GETTIMEFORMAT MCIWNDM_GETTIMEFORMATW
  2468. #define MCIWNDM_GETFILENAME MCIWNDM_GETFILENAMEW
  2469. #define MCIWNDM_GETDEVICE MCIWNDM_GETDEVICEW
  2470. #define MCIWNDM_GETERROR MCIWNDM_GETERRORW
  2471. #define MCIWNDM_NEW MCIWNDM_NEWW
  2472. #define MCIWNDM_RETURNSTRING MCIWNDM_RETURNSTRINGW
  2473. #define MCIWNDM_OPEN MCIWNDM_OPENW
  2474. #else
  2475. #define MCIWNDM_SENDSTRING MCIWNDM_SENDSTRINGA
  2476. #define MCIWNDM_GETPOSITION MCIWNDM_GETPOSITIONA
  2477. #define MCIWNDM_GETMODE MCIWNDM_GETMODEA
  2478. #define MCIWNDM_SETTIMEFORMAT MCIWNDM_SETTIMEFORMATA
  2479. #define MCIWNDM_GETTIMEFORMAT MCIWNDM_GETTIMEFORMATA
  2480. #define MCIWNDM_GETFILENAME MCIWNDM_GETFILENAMEA
  2481. #define MCIWNDM_GETDEVICE MCIWNDM_GETDEVICEA
  2482. #define MCIWNDM_GETERROR MCIWNDM_GETERRORA
  2483. #define MCIWNDM_NEW MCIWNDM_NEWA
  2484. #define MCIWNDM_RETURNSTRING MCIWNDM_RETURNSTRINGA
  2485. #define MCIWNDM_OPEN MCIWNDM_OPENA
  2486. #endif
  2487. // note that the source text for MCIWND will thus contain
  2488. // support for eg MCIWNDM_SENDSTRING (both the 16-bit entrypoint and
  2489. // in win32 mapped to MCIWNDM_SENDSTRINGW), and MCIWNDM_SENDSTRINGA (the
  2490. // win32 ansi thunk).
  2491. // Messages MCIWND will send to an app
  2492. // !!! Use less messages and use a code instead to indicate the type of notify? /* ;Internal */
  2493. #define MCIWNDM_NOTIFYMODE (WM_USER + 200) // wp = hwnd, lp = mode
  2494. #define MCIWNDM_NOTIFYPOS (WM_USER + 201) // wp = hwnd, lp = pos
  2495. #define MCIWNDM_NOTIFYSIZE (WM_USER + 202) // wp = hwnd
  2496. #define MCIWNDM_NOTIFYMEDIA (WM_USER + 203) // wp = hwnd, lp = fn
  2497. #define MCIWNDM_NOTIFYERROR (WM_USER + 205) // wp = hwnd, lp = error
  2498. // special seek values for START and END
  2499. #define MCIWND_START -1
  2500. #define MCIWND_END -2
  2501. #ifndef MCI_PLAY
  2502. /* MCI command message identifiers */
  2503. #ifndef _WIN32
  2504. // win32 apps send MCIWNDM_OPEN
  2505. #define MCI_OPEN 0x0803
  2506. #endif
  2507. #define MCI_CLOSE 0x0804
  2508. #define MCI_PLAY 0x0806
  2509. #define MCI_SEEK 0x0807
  2510. #define MCI_STOP 0x0808
  2511. #define MCI_PAUSE 0x0809
  2512. #define MCI_STEP 0x080E
  2513. #define MCI_RECORD 0x080F
  2514. #define MCI_SAVE 0x0813
  2515. #define MCI_CUT 0x0851
  2516. #define MCI_COPY 0x0852
  2517. #define MCI_PASTE 0x0853
  2518. #define MCI_RESUME 0x0855
  2519. #define MCI_DELETE 0x0856
  2520. #endif
  2521. #ifndef MCI_MODE_NOT_READY
  2522. /* return values for 'status mode' command */
  2523. #define MCI_MODE_NOT_READY (524)
  2524. #define MCI_MODE_STOP (525)
  2525. #define MCI_MODE_PLAY (526)
  2526. #define MCI_MODE_RECORD (527)
  2527. #define MCI_MODE_SEEK (528)
  2528. #define MCI_MODE_PAUSE (529)
  2529. #define MCI_MODE_OPEN (530)
  2530. #endif
  2531. #endif /* NOAVIFILE */
  2532. /****************************************************************************
  2533. *
  2534. * VIDEO - Video Capture Driver Interface
  2535. *
  2536. ****************************************************************************/
  2537. #if !defined(NOAVICAP) || !defined(NOVIDEO)
  2538. #ifndef _RCINVOKED
  2539. /* video data types */
  2540. DECLARE_HANDLE(HVIDEO); // generic handle
  2541. typedef HVIDEO FAR * LPHVIDEO;
  2542. #endif // ifndef RCINVOKED
  2543. /****************************************************************************
  2544. version api
  2545. ****************************************************************************/
  2546. DWORD FAR PASCAL VideoForWindowsVersion(void);
  2547. /****************************************************************************
  2548. Error Return Values
  2549. ****************************************************************************/
  2550. #define DV_ERR_OK (0) /* No error */
  2551. #define DV_ERR_BASE (1) /* Error Base */
  2552. #define DV_ERR_NONSPECIFIC (DV_ERR_BASE)
  2553. #define DV_ERR_BADFORMAT (DV_ERR_BASE + 1)
  2554. /* unsupported video format */
  2555. #define DV_ERR_STILLPLAYING (DV_ERR_BASE + 2)
  2556. /* still something playing */
  2557. #define DV_ERR_UNPREPARED (DV_ERR_BASE + 3)
  2558. /* header not prepared */
  2559. #define DV_ERR_SYNC (DV_ERR_BASE + 4)
  2560. /* device is synchronous */
  2561. #define DV_ERR_TOOMANYCHANNELS (DV_ERR_BASE + 5)
  2562. /* number of channels exceeded */
  2563. #define DV_ERR_NOTDETECTED (DV_ERR_BASE + 6) /* HW not detected */
  2564. #define DV_ERR_BADINSTALL (DV_ERR_BASE + 7) /* Can not get Profile */
  2565. #define DV_ERR_CREATEPALETTE (DV_ERR_BASE + 8)
  2566. #define DV_ERR_SIZEFIELD (DV_ERR_BASE + 9)
  2567. #define DV_ERR_PARAM1 (DV_ERR_BASE + 10)
  2568. #define DV_ERR_PARAM2 (DV_ERR_BASE + 11)
  2569. #define DV_ERR_CONFIG1 (DV_ERR_BASE + 12)
  2570. #define DV_ERR_CONFIG2 (DV_ERR_BASE + 13)
  2571. #define DV_ERR_FLAGS (DV_ERR_BASE + 14)
  2572. #define DV_ERR_13 (DV_ERR_BASE + 15)
  2573. #define DV_ERR_NOTSUPPORTED (DV_ERR_BASE + 16) /* function not suported */
  2574. #define DV_ERR_NOMEM (DV_ERR_BASE + 17) /* out of memory */
  2575. #define DV_ERR_ALLOCATED (DV_ERR_BASE + 18) /* device is allocated */
  2576. #define DV_ERR_BADDEVICEID (DV_ERR_BASE + 19)
  2577. #define DV_ERR_INVALHANDLE (DV_ERR_BASE + 20)
  2578. #define DV_ERR_BADERRNUM (DV_ERR_BASE + 21)
  2579. #define DV_ERR_NO_BUFFERS (DV_ERR_BASE + 22) /* out of buffers */
  2580. #define DV_ERR_MEM_CONFLICT (DV_ERR_BASE + 23) /* Mem conflict detected */
  2581. #define DV_ERR_IO_CONFLICT (DV_ERR_BASE + 24) /* I/O conflict detected */
  2582. #define DV_ERR_DMA_CONFLICT (DV_ERR_BASE + 25) /* DMA conflict detected */
  2583. #define DV_ERR_INT_CONFLICT (DV_ERR_BASE + 26) /* Interrupt conflict detected */
  2584. #define DV_ERR_PROTECT_ONLY (DV_ERR_BASE + 27) /* Can not run in standard mode */
  2585. #define DV_ERR_LASTERROR (DV_ERR_BASE + 27)
  2586. //#define DV_IDS_PROFILING (DV_ERR_BASE + 900)
  2587. //#define DV_IDS_LISTBOX (DV_ERR_BASE + 901)
  2588. #define DV_ERR_USER_MSG (DV_ERR_BASE + 1000) /* Hardware specific errors */
  2589. /****************************************************************************
  2590. Callback Messages
  2591. Note that the values for all installable driver callback messages are
  2592. identical, (ie. MM_DRVM_DATA has the same value for capture drivers,
  2593. installable video codecs, and the audio compression manager).
  2594. ****************************************************************************/
  2595. #ifndef _RCINVOKED
  2596. #ifndef MM_DRVM_OPEN
  2597. #define MM_DRVM_OPEN 0x3D0
  2598. #define MM_DRVM_CLOSE 0x3D1
  2599. #define MM_DRVM_DATA 0x3D2
  2600. #define MM_DRVM_ERROR 0x3D3
  2601. #endif
  2602. #define DV_VM_OPEN MM_DRVM_OPEN // Obsolete messages
  2603. #define DV_VM_CLOSE MM_DRVM_CLOSE
  2604. #define DV_VM_DATA MM_DRVM_DATA
  2605. #define DV_VM_ERROR MM_DRVM_ERROR
  2606. /****************************************************************************
  2607. Structures
  2608. ****************************************************************************/
  2609. /* video data block header */
  2610. typedef struct videohdr_tag {
  2611. LPBYTE lpData; /* pointer to locked data buffer */
  2612. DWORD dwBufferLength; /* Length of data buffer */
  2613. DWORD dwBytesUsed; /* Bytes actually used */
  2614. DWORD dwTimeCaptured; /* Milliseconds from start of stream */
  2615. DWORD_PTR dwUser; /* for client's use */
  2616. DWORD dwFlags; /* assorted flags (see defines) */
  2617. DWORD_PTR dwReserved[4]; /* reserved for driver */
  2618. } VIDEOHDR, NEAR *PVIDEOHDR, FAR * LPVIDEOHDR;
  2619. /* dwFlags field of VIDEOHDR */
  2620. #define VHDR_DONE 0x00000001 /* Done bit */
  2621. #define VHDR_PREPARED 0x00000002 /* Set if this header has been prepared */
  2622. #define VHDR_INQUEUE 0x00000004 /* Reserved for driver */
  2623. #define VHDR_KEYFRAME 0x00000008 /* Key Frame */
  2624. #define VHDR_VALID 0x0000000F /* valid flags */ /* ;Internal */
  2625. /* Channel capabilities structure */
  2626. typedef struct channel_caps_tag {
  2627. DWORD dwFlags; /* Capability flags*/
  2628. DWORD dwSrcRectXMod; /* Granularity of src rect in x */
  2629. DWORD dwSrcRectYMod; /* Granularity of src rect in y */
  2630. DWORD dwSrcRectWidthMod; /* Granularity of src rect width */
  2631. DWORD dwSrcRectHeightMod; /* Granularity of src rect height */
  2632. DWORD dwDstRectXMod; /* Granularity of dst rect in x */
  2633. DWORD dwDstRectYMod; /* Granularity of dst rect in y */
  2634. DWORD dwDstRectWidthMod; /* Granularity of dst rect width */
  2635. DWORD dwDstRectHeightMod; /* Granularity of dst rect height */
  2636. } CHANNEL_CAPS, NEAR *PCHANNEL_CAPS, FAR * LPCHANNEL_CAPS;
  2637. /* dwFlags of CHANNEL_CAPS */
  2638. #define VCAPS_OVERLAY 0x00000001 /* overlay channel */
  2639. #define VCAPS_SRC_CAN_CLIP 0x00000002 /* src rect can clip */
  2640. #define VCAPS_DST_CAN_CLIP 0x00000004 /* dst rect can clip */
  2641. #define VCAPS_CAN_SCALE 0x00000008 /* allows src != dst */
  2642. /****************************************************************************
  2643. API Flags
  2644. ****************************************************************************/
  2645. // Types of channels to open with the videoOpen function
  2646. #define VIDEO_EXTERNALIN 0x0001
  2647. #define VIDEO_EXTERNALOUT 0x0002
  2648. #define VIDEO_IN 0x0004
  2649. #define VIDEO_OUT 0x0008
  2650. // Is a driver dialog available for this channel?
  2651. #define VIDEO_DLG_QUERY 0x0010
  2652. // videoConfigure (both GET and SET)
  2653. #define VIDEO_CONFIGURE_QUERY 0x8000
  2654. // videoConfigure (SET only)
  2655. #define VIDEO_CONFIGURE_SET 0x1000
  2656. // videoConfigure (GET only)
  2657. #define VIDEO_CONFIGURE_GET 0x2000
  2658. #define VIDEO_CONFIGURE_QUERYSIZE 0x0001
  2659. #define VIDEO_CONFIGURE_CURRENT 0x0010
  2660. #define VIDEO_CONFIGURE_NOMINAL 0x0020
  2661. #define VIDEO_CONFIGURE_MIN 0x0040
  2662. #define VIDEO_CONFIGURE_MAX 0x0080
  2663. /****************************************************************************
  2664. CONFIGURE MESSAGES
  2665. ****************************************************************************/
  2666. #define DVM_USER 0X4000
  2667. #define DVM_CONFIGURE_START 0x1000
  2668. #define DVM_CONFIGURE_END 0x1FFF
  2669. #define DVM_PALETTE (DVM_CONFIGURE_START + 1)
  2670. #define DVM_FORMAT (DVM_CONFIGURE_START + 2)
  2671. #define DVM_PALETTERGB555 (DVM_CONFIGURE_START + 3)
  2672. #define DVM_SRC_RECT (DVM_CONFIGURE_START + 4)
  2673. #define DVM_DST_RECT (DVM_CONFIGURE_START + 5)
  2674. #endif /* ifndef _RCINVOKED */
  2675. #endif /* NOVIDEO */
  2676. /****************************************************************************
  2677. *
  2678. * AVICAP - Window class for AVI capture
  2679. *
  2680. ***************************************************************************/
  2681. #ifndef NOAVICAP
  2682. #ifdef __cplusplus
  2683. /* SendMessage in C++*/
  2684. #define AVICapSM(hwnd,m,w,l) ( (::IsWindow(hwnd)) ? ::SendMessage(hwnd,m,w,l) : 0)
  2685. #else
  2686. /* SendMessage in C */
  2687. #define AVICapSM(hwnd,m,w,l) ( (IsWindow(hwnd)) ? SendMessage(hwnd,m,w,l) : 0)
  2688. #endif /* __cplusplus */
  2689. #ifndef RC_INVOKED
  2690. // ------------------------------------------------------------------
  2691. // Window Messages WM_CAP... which can be sent to an AVICAP window
  2692. // ------------------------------------------------------------------
  2693. // UNICODE
  2694. //
  2695. // The Win32 version of AVICAP on NT supports UNICODE applications:
  2696. // for each API or message that takes a char or string parameter, there are
  2697. // two versions, ApiNameA and ApiNameW. The default name ApiName is #defined
  2698. // to one or other depending on whether UNICODE is defined. Apps can call
  2699. // the A and W apis directly, and mix them.
  2700. //
  2701. // The 32-bit AVICAP on NT uses unicode exclusively internally.
  2702. // ApiNameA() will be implemented as a call to ApiNameW() together with
  2703. // translation of strings.
  2704. // Defines start of the message range
  2705. #define WM_CAP_START WM_USER
  2706. // start of unicode messages
  2707. #define WM_CAP_UNICODE_START WM_USER+100
  2708. #define WM_CAP_GET_CAPSTREAMPTR (WM_CAP_START+ 1)
  2709. #define WM_CAP_SET_CALLBACK_ERRORW (WM_CAP_UNICODE_START+ 2)
  2710. #define WM_CAP_SET_CALLBACK_STATUSW (WM_CAP_UNICODE_START+ 3)
  2711. #define WM_CAP_SET_CALLBACK_ERRORA (WM_CAP_START+ 2)
  2712. #define WM_CAP_SET_CALLBACK_STATUSA (WM_CAP_START+ 3)
  2713. #ifdef UNICODE
  2714. #define WM_CAP_SET_CALLBACK_ERROR WM_CAP_SET_CALLBACK_ERRORW
  2715. #define WM_CAP_SET_CALLBACK_STATUS WM_CAP_SET_CALLBACK_STATUSW
  2716. #else
  2717. #define WM_CAP_SET_CALLBACK_ERROR WM_CAP_SET_CALLBACK_ERRORA
  2718. #define WM_CAP_SET_CALLBACK_STATUS WM_CAP_SET_CALLBACK_STATUSA
  2719. #endif
  2720. #define WM_CAP_SET_CALLBACK_YIELD (WM_CAP_START+ 4)
  2721. #define WM_CAP_SET_CALLBACK_FRAME (WM_CAP_START+ 5)
  2722. #define WM_CAP_SET_CALLBACK_VIDEOSTREAM (WM_CAP_START+ 6)
  2723. #define WM_CAP_SET_CALLBACK_WAVESTREAM (WM_CAP_START+ 7)
  2724. #define WM_CAP_GET_USER_DATA (WM_CAP_START+ 8)
  2725. #define WM_CAP_SET_USER_DATA (WM_CAP_START+ 9)
  2726. #define WM_CAP_DRIVER_CONNECT (WM_CAP_START+ 10)
  2727. #define WM_CAP_DRIVER_DISCONNECT (WM_CAP_START+ 11)
  2728. #define WM_CAP_DRIVER_GET_NAMEA (WM_CAP_START+ 12)
  2729. #define WM_CAP_DRIVER_GET_VERSIONA (WM_CAP_START+ 13)
  2730. #define WM_CAP_DRIVER_GET_NAMEW (WM_CAP_UNICODE_START+ 12)
  2731. #define WM_CAP_DRIVER_GET_VERSIONW (WM_CAP_UNICODE_START+ 13)
  2732. #ifdef UNICODE
  2733. #define WM_CAP_DRIVER_GET_NAME WM_CAP_DRIVER_GET_NAMEW
  2734. #define WM_CAP_DRIVER_GET_VERSION WM_CAP_DRIVER_GET_VERSIONW
  2735. #else
  2736. #define WM_CAP_DRIVER_GET_NAME WM_CAP_DRIVER_GET_NAMEA
  2737. #define WM_CAP_DRIVER_GET_VERSION WM_CAP_DRIVER_GET_VERSIONA
  2738. #endif
  2739. #define WM_CAP_DRIVER_GET_CAPS (WM_CAP_START+ 14)
  2740. #define WM_CAP_FILE_SET_CAPTURE_FILEA (WM_CAP_START+ 20)
  2741. #define WM_CAP_FILE_GET_CAPTURE_FILEA (WM_CAP_START+ 21)
  2742. #define WM_CAP_FILE_SAVEASA (WM_CAP_START+ 23)
  2743. #define WM_CAP_FILE_SAVEDIBA (WM_CAP_START+ 25)
  2744. #define WM_CAP_FILE_SET_CAPTURE_FILEW (WM_CAP_UNICODE_START+ 20)
  2745. #define WM_CAP_FILE_GET_CAPTURE_FILEW (WM_CAP_UNICODE_START+ 21)
  2746. #define WM_CAP_FILE_SAVEASW (WM_CAP_UNICODE_START+ 23)
  2747. #define WM_CAP_FILE_SAVEDIBW (WM_CAP_UNICODE_START+ 25)
  2748. #ifdef UNICODE
  2749. #define WM_CAP_FILE_SET_CAPTURE_FILE WM_CAP_FILE_SET_CAPTURE_FILEW
  2750. #define WM_CAP_FILE_GET_CAPTURE_FILE WM_CAP_FILE_GET_CAPTURE_FILEW
  2751. #define WM_CAP_FILE_SAVEAS WM_CAP_FILE_SAVEASW
  2752. #define WM_CAP_FILE_SAVEDIB WM_CAP_FILE_SAVEDIBW
  2753. #else
  2754. #define WM_CAP_FILE_SET_CAPTURE_FILE WM_CAP_FILE_SET_CAPTURE_FILEA
  2755. #define WM_CAP_FILE_GET_CAPTURE_FILE WM_CAP_FILE_GET_CAPTURE_FILEA
  2756. #define WM_CAP_FILE_SAVEAS WM_CAP_FILE_SAVEASA
  2757. #define WM_CAP_FILE_SAVEDIB WM_CAP_FILE_SAVEDIBA
  2758. #endif
  2759. // out of order to save on ifdefs
  2760. #define WM_CAP_FILE_ALLOCATE (WM_CAP_START+ 22)
  2761. #define WM_CAP_FILE_SET_INFOCHUNK (WM_CAP_START+ 24)
  2762. #define WM_CAP_EDIT_COPY (WM_CAP_START+ 30)
  2763. #define WM_CAP_SET_AUDIOFORMAT (WM_CAP_START+ 35)
  2764. #define WM_CAP_GET_AUDIOFORMAT (WM_CAP_START+ 36)
  2765. #define WM_CAP_DLG_VIDEOFORMAT (WM_CAP_START+ 41)
  2766. #define WM_CAP_DLG_VIDEOSOURCE (WM_CAP_START+ 42)
  2767. #define WM_CAP_DLG_VIDEODISPLAY (WM_CAP_START+ 43)
  2768. #define WM_CAP_GET_VIDEOFORMAT (WM_CAP_START+ 44)
  2769. #define WM_CAP_SET_VIDEOFORMAT (WM_CAP_START+ 45)
  2770. #define WM_CAP_DLG_VIDEOCOMPRESSION (WM_CAP_START+ 46)
  2771. #define WM_CAP_SET_PREVIEW (WM_CAP_START+ 50)
  2772. #define WM_CAP_SET_OVERLAY (WM_CAP_START+ 51)
  2773. #define WM_CAP_SET_PREVIEWRATE (WM_CAP_START+ 52)
  2774. #define WM_CAP_SET_SCALE (WM_CAP_START+ 53)
  2775. #define WM_CAP_GET_STATUS (WM_CAP_START+ 54)
  2776. #define WM_CAP_SET_SCROLL (WM_CAP_START+ 55)
  2777. #define WM_CAP_GRAB_FRAME (WM_CAP_START+ 60)
  2778. #define WM_CAP_GRAB_FRAME_NOSTOP (WM_CAP_START+ 61)
  2779. #define WM_CAP_SEQUENCE (WM_CAP_START+ 62)
  2780. #define WM_CAP_SEQUENCE_NOFILE (WM_CAP_START+ 63)
  2781. #define WM_CAP_SET_SEQUENCE_SETUP (WM_CAP_START+ 64)
  2782. #define WM_CAP_GET_SEQUENCE_SETUP (WM_CAP_START+ 65)
  2783. #define WM_CAP_SET_MCI_DEVICEA (WM_CAP_START+ 66)
  2784. #define WM_CAP_GET_MCI_DEVICEA (WM_CAP_START+ 67)
  2785. #define WM_CAP_SET_MCI_DEVICEW (WM_CAP_UNICODE_START+ 66)
  2786. #define WM_CAP_GET_MCI_DEVICEW (WM_CAP_UNICODE_START+ 67)
  2787. #ifdef UNICODE
  2788. #define WM_CAP_SET_MCI_DEVICE WM_CAP_SET_MCI_DEVICEW
  2789. #define WM_CAP_GET_MCI_DEVICE WM_CAP_GET_MCI_DEVICEW
  2790. #else
  2791. #define WM_CAP_SET_MCI_DEVICE WM_CAP_SET_MCI_DEVICEA
  2792. #define WM_CAP_GET_MCI_DEVICE WM_CAP_GET_MCI_DEVICEA
  2793. #endif
  2794. #define WM_CAP_STOP (WM_CAP_START+ 68)
  2795. #define WM_CAP_ABORT (WM_CAP_START+ 69)
  2796. #define WM_CAP_SINGLE_FRAME_OPEN (WM_CAP_START+ 70)
  2797. #define WM_CAP_SINGLE_FRAME_CLOSE (WM_CAP_START+ 71)
  2798. #define WM_CAP_SINGLE_FRAME (WM_CAP_START+ 72)
  2799. #define WM_CAP_PAL_OPENA (WM_CAP_START+ 80)
  2800. #define WM_CAP_PAL_SAVEA (WM_CAP_START+ 81)
  2801. #define WM_CAP_PAL_OPENW (WM_CAP_UNICODE_START+ 80)
  2802. #define WM_CAP_PAL_SAVEW (WM_CAP_UNICODE_START+ 81)
  2803. #ifdef UNICODE
  2804. #define WM_CAP_PAL_OPEN WM_CAP_PAL_OPENW
  2805. #define WM_CAP_PAL_SAVE WM_CAP_PAL_SAVEW
  2806. #else
  2807. #define WM_CAP_PAL_OPEN WM_CAP_PAL_OPENA
  2808. #define WM_CAP_PAL_SAVE WM_CAP_PAL_SAVEA
  2809. #endif
  2810. #define WM_CAP_PAL_PASTE (WM_CAP_START+ 82)
  2811. #define WM_CAP_PAL_AUTOCREATE (WM_CAP_START+ 83)
  2812. #define WM_CAP_PAL_MANUALCREATE (WM_CAP_START+ 84)
  2813. // Following added post VFW 1.1
  2814. #define WM_CAP_SET_CALLBACK_CAPCONTROL (WM_CAP_START+ 85)
  2815. // Defines end of the message range
  2816. #define WM_CAP_UNICODE_END WM_CAP_PAL_SAVEW
  2817. #define WM_CAP_END WM_CAP_UNICODE_END
  2818. // ------------------------------------------------------------------
  2819. // Message crackers for above
  2820. // ------------------------------------------------------------------
  2821. // message wrapper macros are defined for the default messages only. Apps
  2822. // that wish to mix Ansi and UNICODE message sending will have to
  2823. // reference the _A and _W messages directly
  2824. #define capSetCallbackOnError(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_ERROR, 0, (LPARAM)(LPVOID)(fpProc)))
  2825. #define capSetCallbackOnStatus(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_STATUS, 0, (LPARAM)(LPVOID)(fpProc)))
  2826. #define capSetCallbackOnYield(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_YIELD, 0, (LPARAM)(LPVOID)(fpProc)))
  2827. #define capSetCallbackOnFrame(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_FRAME, 0, (LPARAM)(LPVOID)(fpProc)))
  2828. #define capSetCallbackOnVideoStream(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, (LPARAM)(LPVOID)(fpProc)))
  2829. #define capSetCallbackOnWaveStream(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_WAVESTREAM, 0, (LPARAM)(LPVOID)(fpProc)))
  2830. #define capSetCallbackOnCapControl(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_CAPCONTROL, 0, (LPARAM)(LPVOID)(fpProc)))
  2831. #define capSetUserData(hwnd, lUser) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_USER_DATA, 0, (LPARAM)lUser))
  2832. #define capGetUserData(hwnd) (AVICapSM(hwnd, WM_CAP_GET_USER_DATA, 0, 0))
  2833. #define capDriverConnect(hwnd, i) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_CONNECT, (WPARAM)(i), 0L))
  2834. #define capDriverDisconnect(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_DISCONNECT, (WPARAM)0, 0L))
  2835. #define capDriverGetName(hwnd, szName, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_NAME, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2836. #define capDriverGetVersion(hwnd, szVer, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_VERSION, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szVer)))
  2837. #define capDriverGetCaps(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_CAPS, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPDRIVERCAPS)(s)))
  2838. #define capFileSetCaptureFile(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SET_CAPTURE_FILE, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2839. #define capFileGetCaptureFile(hwnd, szName, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_GET_CAPTURE_FILE, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2840. #define capFileAlloc(hwnd, dwSize) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_ALLOCATE, 0, (LPARAM)(DWORD)(dwSize)))
  2841. #define capFileSaveAs(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SAVEAS, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2842. #define capFileSetInfoChunk(hwnd, lpInfoChunk) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SET_INFOCHUNK, (WPARAM)0, (LPARAM)(LPCAPINFOCHUNK)(lpInfoChunk)))
  2843. #define capFileSaveDIB(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SAVEDIB, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2844. #define capEditCopy(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_EDIT_COPY, 0, 0L))
  2845. #define capSetAudioFormat(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_AUDIOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPWAVEFORMATEX)(s)))
  2846. #define capGetAudioFormat(hwnd, s, wSize) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_AUDIOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPWAVEFORMATEX)(s)))
  2847. #define capGetAudioFormatSize(hwnd) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_AUDIOFORMAT, (WPARAM)0, (LPARAM)0L))
  2848. #define capDlgVideoFormat(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEOFORMAT, 0, 0L))
  2849. #define capDlgVideoSource(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEOSOURCE, 0, 0L))
  2850. #define capDlgVideoDisplay(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEODISPLAY, 0, 0L))
  2851. #define capDlgVideoCompression(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEOCOMPRESSION, 0, 0L))
  2852. #define capGetVideoFormat(hwnd, s, wSize) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_VIDEOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(s)))
  2853. #define capGetVideoFormatSize(hwnd) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_VIDEOFORMAT, 0, 0L))
  2854. #define capSetVideoFormat(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_VIDEOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(s)))
  2855. #define capPreview(hwnd, f) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_PREVIEW, (WPARAM)(BOOL)(f), 0L))
  2856. #define capPreviewRate(hwnd, wMS) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_PREVIEWRATE, (WPARAM)(wMS), 0))
  2857. #define capOverlay(hwnd, f) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_OVERLAY, (WPARAM)(BOOL)(f), 0L))
  2858. #define capPreviewScale(hwnd, f) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SCALE, (WPARAM)(BOOL)f, 0L))
  2859. #define capGetStatus(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_GET_STATUS, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPSTATUS)(s)))
  2860. #define capSetScrollPos(hwnd, lpP) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SCROLL, (WPARAM)0, (LPARAM)(LPPOINT)(lpP)))
  2861. #define capGrabFrame(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_GRAB_FRAME, (WPARAM)0, (LPARAM)0L))
  2862. #define capGrabFrameNoStop(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_GRAB_FRAME_NOSTOP, (WPARAM)0, (LPARAM)0L))
  2863. #define capCaptureSequence(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SEQUENCE, (WPARAM)0, (LPARAM)0L))
  2864. #define capCaptureSequenceNoFile(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SEQUENCE_NOFILE, (WPARAM)0, (LPARAM)0L))
  2865. #define capCaptureStop(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_STOP, (WPARAM)0, (LPARAM)0L))
  2866. #define capCaptureAbort(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_ABORT, (WPARAM)0, (LPARAM)0L))
  2867. #define capCaptureSingleFrameOpen(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SINGLE_FRAME_OPEN, (WPARAM)0, (LPARAM)0L))
  2868. #define capCaptureSingleFrameClose(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SINGLE_FRAME_CLOSE, (WPARAM)0, (LPARAM)0L))
  2869. #define capCaptureSingleFrame(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SINGLE_FRAME, (WPARAM)0, (LPARAM)0L))
  2870. #define capCaptureGetSetup(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_GET_SEQUENCE_SETUP, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPTUREPARMS)(s)))
  2871. #define capCaptureSetSetup(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SEQUENCE_SETUP, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPTUREPARMS)(s)))
  2872. #define capSetMCIDeviceName(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_MCI_DEVICE, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2873. #define capGetMCIDeviceName(hwnd, szName, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_GET_MCI_DEVICE, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2874. #define capPaletteOpen(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_OPEN, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2875. #define capPaletteSave(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_SAVE, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  2876. #define capPalettePaste(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_PASTE, (WPARAM) 0, (LPARAM)0L))
  2877. #define capPaletteAuto(hwnd, iFrames, iColors) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_AUTOCREATE, (WPARAM)(iFrames), (LPARAM)(DWORD)(iColors)))
  2878. #define capPaletteManual(hwnd, fGrab, iColors) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_MANUALCREATE, (WPARAM)(fGrab), (LPARAM)(DWORD)(iColors)))
  2879. // ------------------------------------------------------------------
  2880. // Structures
  2881. // ------------------------------------------------------------------
  2882. typedef struct tagCapDriverCaps {
  2883. UINT wDeviceIndex; // Driver index in system.ini
  2884. BOOL fHasOverlay; // Can device overlay?
  2885. BOOL fHasDlgVideoSource; // Has Video source dlg?
  2886. BOOL fHasDlgVideoFormat; // Has Format dlg?
  2887. BOOL fHasDlgVideoDisplay; // Has External out dlg?
  2888. BOOL fCaptureInitialized; // Driver ready to capture?
  2889. BOOL fDriverSuppliesPalettes; // Can driver make palettes?
  2890. // following always NULL on Win32.
  2891. HANDLE hVideoIn; // Driver In channel
  2892. HANDLE hVideoOut; // Driver Out channel
  2893. HANDLE hVideoExtIn; // Driver Ext In channel
  2894. HANDLE hVideoExtOut; // Driver Ext Out channel
  2895. } CAPDRIVERCAPS, *PCAPDRIVERCAPS, FAR *LPCAPDRIVERCAPS;
  2896. typedef struct tagCapStatus {
  2897. UINT uiImageWidth; // Width of the image
  2898. UINT uiImageHeight; // Height of the image
  2899. BOOL fLiveWindow; // Now Previewing video?
  2900. BOOL fOverlayWindow; // Now Overlaying video?
  2901. BOOL fScale; // Scale image to client?
  2902. POINT ptScroll; // Scroll position
  2903. BOOL fUsingDefaultPalette; // Using default driver palette?
  2904. BOOL fAudioHardware; // Audio hardware present?
  2905. BOOL fCapFileExists; // Does capture file exist?
  2906. DWORD dwCurrentVideoFrame; // # of video frames cap'td
  2907. DWORD dwCurrentVideoFramesDropped;// # of video frames dropped
  2908. DWORD dwCurrentWaveSamples; // # of wave samples cap'td
  2909. DWORD dwCurrentTimeElapsedMS; // Elapsed capture duration
  2910. HPALETTE hPalCurrent; // Current palette in use
  2911. BOOL fCapturingNow; // Capture in progress?
  2912. DWORD dwReturn; // Error value after any operation
  2913. UINT wNumVideoAllocated; // Actual number of video buffers
  2914. UINT wNumAudioAllocated; // Actual number of audio buffers
  2915. } CAPSTATUS, *PCAPSTATUS, FAR *LPCAPSTATUS;
  2916. // Default values in parenthesis
  2917. typedef struct tagCaptureParms {
  2918. DWORD dwRequestMicroSecPerFrame; // Requested capture rate
  2919. BOOL fMakeUserHitOKToCapture; // Show "Hit OK to cap" dlg?
  2920. UINT wPercentDropForError; // Give error msg if > (10%)
  2921. BOOL fYield; // Capture via background task?
  2922. DWORD dwIndexSize; // Max index size in frames (32K)
  2923. UINT wChunkGranularity; // Junk chunk granularity (2K)
  2924. BOOL fUsingDOSMemory; // Use DOS buffers?
  2925. UINT wNumVideoRequested; // # video buffers, If 0, autocalc
  2926. BOOL fCaptureAudio; // Capture audio?
  2927. UINT wNumAudioRequested; // # audio buffers, If 0, autocalc
  2928. UINT vKeyAbort; // Virtual key causing abort
  2929. BOOL fAbortLeftMouse; // Abort on left mouse?
  2930. BOOL fAbortRightMouse; // Abort on right mouse?
  2931. BOOL fLimitEnabled; // Use wTimeLimit?
  2932. UINT wTimeLimit; // Seconds to capture
  2933. BOOL fMCIControl; // Use MCI video source?
  2934. BOOL fStepMCIDevice; // Step MCI device?
  2935. DWORD dwMCIStartTime; // Time to start in MS
  2936. DWORD dwMCIStopTime; // Time to stop in MS
  2937. BOOL fStepCaptureAt2x; // Perform spatial averaging 2x
  2938. UINT wStepCaptureAverageFrames; // Temporal average n Frames
  2939. DWORD dwAudioBufferSize; // Size of audio bufs (0 = default)
  2940. BOOL fDisableWriteCache; // Attempt to disable write cache
  2941. UINT AVStreamMaster; // Which stream controls length?
  2942. } CAPTUREPARMS, *PCAPTUREPARMS, FAR *LPCAPTUREPARMS;
  2943. // ------------------------------------------------------------------
  2944. // AVStreamMaster
  2945. // Since Audio and Video streams generally use non-synchronized capture
  2946. // clocks, this flag determines whether the audio stream is to be considered
  2947. // the master or controlling clock when writing the AVI file:
  2948. //
  2949. // AVSTREAMMASTER_AUDIO - Audio is master, video frame duration is forced
  2950. // to match audio duration (VFW 1.0, 1.1 default)
  2951. // AVSTREAMMASTER_NONE - No master, audio and video streams may be of
  2952. // different lengths
  2953. // ------------------------------------------------------------------
  2954. #define AVSTREAMMASTER_AUDIO 0 /* Audio master (VFW 1.0, 1.1) */
  2955. #define AVSTREAMMASTER_NONE 1 /* No master */
  2956. typedef struct tagCapInfoChunk {
  2957. FOURCC fccInfoID; // Chunk ID, "ICOP" for copyright
  2958. LPVOID lpData; // pointer to data
  2959. LONG cbData; // size of lpData
  2960. } CAPINFOCHUNK, *PCAPINFOCHUNK, FAR *LPCAPINFOCHUNK;
  2961. // ------------------------------------------------------------------
  2962. // Callback Definitions
  2963. // ------------------------------------------------------------------
  2964. typedef LRESULT (CALLBACK* CAPYIELDCALLBACK) (HWND hWnd);
  2965. typedef LRESULT (CALLBACK* CAPSTATUSCALLBACKW) (HWND hWnd, int nID, LPCWSTR lpsz);
  2966. typedef LRESULT (CALLBACK* CAPERRORCALLBACKW) (HWND hWnd, int nID, LPCWSTR lpsz);
  2967. typedef LRESULT (CALLBACK* CAPSTATUSCALLBACKA) (HWND hWnd, int nID, LPCSTR lpsz);
  2968. typedef LRESULT (CALLBACK* CAPERRORCALLBACKA) (HWND hWnd, int nID, LPCSTR lpsz);
  2969. #ifdef UNICODE
  2970. #define CAPSTATUSCALLBACK CAPSTATUSCALLBACKW
  2971. #define CAPERRORCALLBACK CAPERRORCALLBACKW
  2972. #else
  2973. #define CAPSTATUSCALLBACK CAPSTATUSCALLBACKA
  2974. #define CAPERRORCALLBACK CAPERRORCALLBACKA
  2975. #endif
  2976. typedef LRESULT (CALLBACK* CAPVIDEOCALLBACK) (HWND hWnd, LPVIDEOHDR lpVHdr);
  2977. typedef LRESULT (CALLBACK* CAPWAVECALLBACK) (HWND hWnd, LPWAVEHDR lpWHdr);
  2978. typedef LRESULT (CALLBACK* CAPCONTROLCALLBACK)(HWND hWnd, int nState);
  2979. // ------------------------------------------------------------------
  2980. // CapControlCallback states
  2981. // ------------------------------------------------------------------
  2982. #define CONTROLCALLBACK_PREROLL 1 /* Waiting to start capture */
  2983. #define CONTROLCALLBACK_CAPTURING 2 /* Now capturing */
  2984. // ------------------------------------------------------------------
  2985. // The only exported functions from AVICAP.DLL
  2986. // ------------------------------------------------------------------
  2987. HWND VFWAPI capCreateCaptureWindowA (
  2988. LPCSTR lpszWindowName,
  2989. DWORD dwStyle,
  2990. int x, int y, int nWidth, int nHeight,
  2991. HWND hwndParent, int nID);
  2992. BOOL VFWAPI capGetDriverDescriptionA (UINT wDriverIndex,
  2993. LPSTR lpszName, int cbName,
  2994. LPSTR lpszVer, int cbVer);
  2995. HWND VFWAPI capCreateCaptureWindowW (
  2996. LPCWSTR lpszWindowName,
  2997. DWORD dwStyle,
  2998. int x, int y, int nWidth, int nHeight,
  2999. HWND hwndParent, int nID);
  3000. BOOL VFWAPI capGetDriverDescriptionW (UINT wDriverIndex,
  3001. LPWSTR lpszName, int cbName,
  3002. LPWSTR lpszVer, int cbVer);
  3003. #ifdef UNICODE
  3004. #define capCreateCaptureWindow capCreateCaptureWindowW
  3005. #define capGetDriverDescription capGetDriverDescriptionW
  3006. #else
  3007. #define capCreateCaptureWindow capCreateCaptureWindowA
  3008. #define capGetDriverDescription capGetDriverDescriptionA
  3009. #endif
  3010. #endif /* RC_INVOKED */
  3011. // ------------------------------------------------------------------
  3012. // New Information chunk IDs
  3013. // ------------------------------------------------------------------
  3014. #define infotypeDIGITIZATION_TIME mmioFOURCC ('I','D','I','T')
  3015. #define infotypeSMPTE_TIME mmioFOURCC ('I','S','M','P')
  3016. // ------------------------------------------------------------------
  3017. // String IDs from status and error callbacks
  3018. // ------------------------------------------------------------------
  3019. #define IDS_CAP_BEGIN 300 /* "Capture Start" */
  3020. #define IDS_CAP_END 301 /* "Capture End" */
  3021. #define IDS_CAP_INFO 401 /* "%s" */
  3022. #define IDS_CAP_OUTOFMEM 402 /* "Out of memory" */
  3023. #define IDS_CAP_FILEEXISTS 403 /* "File '%s' exists -- overwrite it?" */
  3024. #define IDS_CAP_ERRORPALOPEN 404 /* "Error opening palette '%s'" */
  3025. #define IDS_CAP_ERRORPALSAVE 405 /* "Error saving palette '%s'" */
  3026. #define IDS_CAP_ERRORDIBSAVE 406 /* "Error saving frame '%s'" */
  3027. #define IDS_CAP_DEFAVIEXT 407 /* "avi" */
  3028. #define IDS_CAP_DEFPALEXT 408 /* "pal" */
  3029. #define IDS_CAP_CANTOPEN 409 /* "Cannot open '%s'" */
  3030. #define IDS_CAP_SEQ_MSGSTART 410 /* "Select OK to start capture\nof video sequence\nto %s." */
  3031. #define IDS_CAP_SEQ_MSGSTOP 411 /* "Hit ESCAPE or click to end capture" */
  3032. #define IDS_CAP_VIDEDITERR 412 /* "An error occurred while trying to run VidEdit." */
  3033. #define IDS_CAP_READONLYFILE 413 /* "The file '%s' is a read-only file." */
  3034. #define IDS_CAP_WRITEERROR 414 /* "Unable to write to file '%s'.\nDisk may be full." */
  3035. #define IDS_CAP_NODISKSPACE 415 /* "There is no space to create a capture file on the specified device." */
  3036. #define IDS_CAP_SETFILESIZE 416 /* "Set File Size" */
  3037. #define IDS_CAP_SAVEASPERCENT 417 /* "SaveAs: %2ld%% Hit Escape to abort." */
  3038. #define IDS_CAP_DRIVER_ERROR 418 /* Driver specific error message */
  3039. #define IDS_CAP_WAVE_OPEN_ERROR 419 /* "Error: Cannot open the wave input device.\nCheck sample size, frequency, and channels." */
  3040. #define IDS_CAP_WAVE_ALLOC_ERROR 420 /* "Error: Out of memory for wave buffers." */
  3041. #define IDS_CAP_WAVE_PREPARE_ERROR 421 /* "Error: Cannot prepare wave buffers." */
  3042. #define IDS_CAP_WAVE_ADD_ERROR 422 /* "Error: Cannot add wave buffers." */
  3043. #define IDS_CAP_WAVE_SIZE_ERROR 423 /* "Error: Bad wave size." */
  3044. #define IDS_CAP_VIDEO_OPEN_ERROR 424 /* "Error: Cannot open the video input device." */
  3045. #define IDS_CAP_VIDEO_ALLOC_ERROR 425 /* "Error: Out of memory for video buffers." */
  3046. #define IDS_CAP_VIDEO_PREPARE_ERROR 426 /* "Error: Cannot prepare video buffers." */
  3047. #define IDS_CAP_VIDEO_ADD_ERROR 427 /* "Error: Cannot add video buffers." */
  3048. #define IDS_CAP_VIDEO_SIZE_ERROR 428 /* "Error: Bad video size." */
  3049. #define IDS_CAP_FILE_OPEN_ERROR 429 /* "Error: Cannot open capture file." */
  3050. #define IDS_CAP_FILE_WRITE_ERROR 430 /* "Error: Cannot write to capture file. Disk may be full." */
  3051. #define IDS_CAP_RECORDING_ERROR 431 /* "Error: Cannot write to capture file. Data rate too high or disk full." */
  3052. #define IDS_CAP_RECORDING_ERROR2 432 /* "Error while recording" */
  3053. #define IDS_CAP_AVI_INIT_ERROR 433 /* "Error: Unable to initialize for capture." */
  3054. #define IDS_CAP_NO_FRAME_CAP_ERROR 434 /* "Warning: No frames captured.\nConfirm that vertical sync interrupts\nare configured and enabled." */
  3055. #define IDS_CAP_NO_PALETTE_WARN 435 /* "Warning: Using default palette." */
  3056. #define IDS_CAP_MCI_CONTROL_ERROR 436 /* "Error: Unable to access MCI device." */
  3057. #define IDS_CAP_MCI_CANT_STEP_ERROR 437 /* "Error: Unable to step MCI device." */
  3058. #define IDS_CAP_NO_AUDIO_CAP_ERROR 438 /* "Error: No audio data captured.\nCheck audio card settings." */
  3059. #define IDS_CAP_AVI_DRAWDIB_ERROR 439 /* "Error: Unable to draw this data format." */
  3060. #define IDS_CAP_COMPRESSOR_ERROR 440 /* "Error: Unable to initialize compressor." */
  3061. #define IDS_CAP_AUDIO_DROP_ERROR 441 /* "Error: Audio data was lost during capture, reduce capture rate." */
  3062. #define IDS_CAP_AUDIO_DROP_COMPERROR 442 /* "Error: Audio data was lost during capture. Try capturing without compressing." */
  3063. /* status string IDs */
  3064. #define IDS_CAP_STAT_LIVE_MODE 500 /* "Live window" */
  3065. #define IDS_CAP_STAT_OVERLAY_MODE 501 /* "Overlay window" */
  3066. #define IDS_CAP_STAT_CAP_INIT 502 /* "Setting up for capture - Please wait" */
  3067. #define IDS_CAP_STAT_CAP_FINI 503 /* "Finished capture, now writing frame %ld" */
  3068. #define IDS_CAP_STAT_PALETTE_BUILD 504 /* "Building palette map" */
  3069. #define IDS_CAP_STAT_OPTPAL_BUILD 505 /* "Computing optimal palette" */
  3070. #define IDS_CAP_STAT_I_FRAMES 506 /* "%d frames" */
  3071. #define IDS_CAP_STAT_L_FRAMES 507 /* "%ld frames" */
  3072. #define IDS_CAP_STAT_CAP_L_FRAMES 508 /* "Captured %ld frames" */
  3073. #define IDS_CAP_STAT_CAP_AUDIO 509 /* "Capturing audio" */
  3074. #define IDS_CAP_STAT_VIDEOCURRENT 510 /* "Captured %ld frames (%ld dropped) %d.%03d sec." */
  3075. #define IDS_CAP_STAT_VIDEOAUDIO 511 /* "Captured %d.%03d sec. %ld frames (%ld dropped) (%d.%03d fps). %ld audio bytes (%d,%03d sps)" */
  3076. #define IDS_CAP_STAT_VIDEOONLY 512 /* "Captured %d.%03d sec. %ld frames (%ld dropped) (%d.%03d fps)" */
  3077. #define IDS_CAP_STAT_FRAMESDROPPED 513 /* "Dropped %ld of %ld frames (%d.%02d%%) during capture." */
  3078. #endif /* NOAVIFILE */
  3079. #ifdef __cplusplus
  3080. } // extern "C"
  3081. #endif /* __cplusplus */
  3082. /****************************************************************************
  3083. *
  3084. * ACM (Audio compression manager)
  3085. *
  3086. ***************************************************************************/
  3087. #ifndef NOMSACM
  3088. #include <msacm.h>
  3089. #endif
  3090. #ifdef __cplusplus
  3091. extern "C" { /* Assume C declarations for C++ */
  3092. #endif /* __cplusplus */
  3093. /****************************************************************************
  3094. *
  3095. * FilePreview dialog.
  3096. *
  3097. ***************************************************************************/
  3098. #ifdef OFN_READONLY
  3099. BOOL
  3100. VFWAPI
  3101. GetOpenFileNamePreviewA(
  3102. IN OUT LPOPENFILENAMEA lpofn
  3103. );
  3104. BOOL
  3105. VFWAPI
  3106. GetSaveFileNamePreviewA(
  3107. IN OUT LPOPENFILENAMEA lpofn
  3108. );
  3109. BOOL
  3110. VFWAPI
  3111. GetOpenFileNamePreviewW(
  3112. IN OUT LPOPENFILENAMEW lpofn
  3113. );
  3114. BOOL
  3115. VFWAPI
  3116. GetSaveFileNamePreviewW(
  3117. IN OUT LPOPENFILENAMEW lpofn
  3118. );
  3119. #ifdef UNICODE
  3120. #define GetOpenFileNamePreview GetOpenFileNamePreviewW
  3121. #define GetSaveFileNamePreview GetSaveFileNamePreviewW
  3122. #else
  3123. #define GetOpenFileNamePreview GetOpenFileNamePreviewA
  3124. #define GetSaveFileNamePreview GetSaveFileNamePreviewA
  3125. #endif
  3126. #endif // OFN_READONLY
  3127. #ifndef RC_INVOKED
  3128. #include "poppack.h"
  3129. #endif
  3130. #ifdef __cplusplus
  3131. } /* End of extern "C" { */
  3132. #endif /* __cplusplus */
  3133. #endif /* _INC_VFW */