home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / VFW.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  136.6 KB  |  3,473 lines

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