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