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