home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / msinc.pak / AVICAP.H next >
C/C++ Source or Header  |  1997-07-23  |  30KB  |  565 lines

  1. /****************************************************************************
  2.  *
  3.  *   avicap.h
  4.  *
  5.  *   Main include file.
  6.  *
  7.  *   Microsoft Video for Windows Sample Capture Class
  8.  *
  9.  *    You have a royalty-free right to use, modify, reproduce and
  10.  *    distribute the Sample Files (and/or any modified version) in
  11.  *    any way you find useful, provided that you agree that
  12.  *    Microsoft has no warranty obligations or liability for any
  13.  *    Sample Application Files which are modified.
  14.  *
  15.  ***************************************************************************/
  16.  
  17. /*
  18.  *      C/C++ Run Time Library - Version 6.5
  19.  *
  20.  *      Copyright (c) 1994 by Borland International
  21.  *      All Rights Reserved.
  22.  *
  23.  */
  24.  
  25. #ifndef _INC_AVICAP
  26. #define _INC_AVICAP
  27. #define __AVICAP_H
  28.  
  29. #if !defined(RC_INVOKED) && !defined(VFWAPI)
  30. #ifdef _WIN32
  31.     #define VFWAPI  __stdcall
  32.     #define VFWAPIV __stdcall
  33.     #define _LOADDS
  34.     #pragma message("AVICAP.H: Defining VFWAPIV to be __stdcall...................")
  35. #else
  36.     #define VFWAPI  FAR PASCAL
  37.     #define VFWAPIV FAR CDECL
  38. #endif
  39. #endif
  40.  
  41. #ifdef __cplusplus
  42. #define AVICapSM ::SendMessage  /* SendMessage in C++*/
  43. #else
  44. #define AVICapSM SendMessage    /* SendMessage in C */
  45. #endif  /* __cplusplus */
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {            /* Assume C declarations for C++ */
  49. #endif  /* __cplusplus */
  50.  
  51. #ifdef __BORLANDC__
  52.   #include <pshpack1.h>
  53. #endif
  54.  
  55. #ifndef RC_INVOKED
  56.  
  57. // ------------------------------------------------------------------
  58. //  Window Messages  WM_CAP... which can be sent to an AVICAP window
  59. // ------------------------------------------------------------------
  60.  
  61.  
  62.  
  63. // UNICODE
  64. //
  65. // The Win32 version of AVICAP supports UNICODE applications:
  66. // for each API or message that takes a char or string parameter, there are
  67. // two versions, ApiNameA and ApiNameW. The default name ApiName is #defined
  68. // to one or other depending on whether UNICODE is defined. Apps can call
  69. // the A and W apis directly, and mix them.
  70. //
  71. // The 32-bit AVICAP uses unicode exclusively internally. ApiNameA() will be
  72. // implemented as a call to ApiNameW() together with translation of strings.
  73.  
  74.  
  75.  
  76.  
  77. // Defines start of the message range
  78. #define WM_CAP_START                    WM_USER
  79.  
  80. // start of unicode messages
  81. #define WM_CAP_UNICODE_START            WM_USER+100
  82.  
  83. #define WM_CAP_GET_CAPSTREAMPTR         (WM_CAP_START+  1)
  84.  
  85. #ifdef _WIN32
  86. #define WM_CAP_SET_CALLBACK_ERRORW     (WM_CAP_UNICODE_START+  2)
  87. #define WM_CAP_SET_CALLBACK_STATUSW    (WM_CAP_UNICODE_START+  3)
  88. #define WM_CAP_SET_CALLBACK_ERRORA     (WM_CAP_START+  2)
  89. #define WM_CAP_SET_CALLBACK_STATUSA    (WM_CAP_START+  3)
  90. #ifdef UNICODE
  91. #define WM_CAP_SET_CALLBACK_ERROR       WM_CAP_SET_CALLBACK_ERRORW
  92. #define WM_CAP_SET_CALLBACK_STATUS      WM_CAP_SET_CALLBACK_STATUSW
  93. #else
  94. #define WM_CAP_SET_CALLBACK_ERROR       WM_CAP_SET_CALLBACK_ERRORA
  95. #define WM_CAP_SET_CALLBACK_STATUS      WM_CAP_SET_CALLBACK_STATUSA
  96. #endif
  97. #else
  98. #define WM_CAP_SET_CALLBACK_ERROR       (WM_CAP_START+  2)
  99. #define WM_CAP_SET_CALLBACK_STATUS      (WM_CAP_START+  3)
  100. #endif
  101.  
  102.  
  103. #define WM_CAP_SET_CALLBACK_YIELD       (WM_CAP_START+  4)
  104. #define WM_CAP_SET_CALLBACK_FRAME       (WM_CAP_START+  5)
  105. #define WM_CAP_SET_CALLBACK_VIDEOSTREAM (WM_CAP_START+  6)
  106. #define WM_CAP_SET_CALLBACK_WAVESTREAM  (WM_CAP_START+  7)
  107. #define WM_CAP_GET_USER_DATA            (WM_CAP_START+  8)
  108. #define WM_CAP_SET_USER_DATA            (WM_CAP_START+  9)
  109.  
  110. #define WM_CAP_DRIVER_CONNECT           (WM_CAP_START+  10)
  111. #define WM_CAP_DRIVER_DISCONNECT        (WM_CAP_START+  11)
  112.  
  113. #ifdef _WIN32
  114. #define WM_CAP_DRIVER_GET_NAMEA        (WM_CAP_START+  12)
  115. #define WM_CAP_DRIVER_GET_VERSIONA     (WM_CAP_START+  13)
  116. #define WM_CAP_DRIVER_GET_NAMEW        (WM_CAP_UNICODE_START+  12)
  117. #define WM_CAP_DRIVER_GET_VERSIONW     (WM_CAP_UNICODE_START+  13)
  118. #ifdef UNICODE
  119. #define WM_CAP_DRIVER_GET_NAME          WM_CAP_DRIVER_GET_NAMEW
  120. #define WM_CAP_DRIVER_GET_VERSION       WM_CAP_DRIVER_GET_VERSIONW
  121. #else
  122. #define WM_CAP_DRIVER_GET_NAME          WM_CAP_DRIVER_GET_NAMEA
  123. #define WM_CAP_DRIVER_GET_VERSION       WM_CAP_DRIVER_GET_VERSIONA
  124. #endif
  125. #else
  126. #define WM_CAP_DRIVER_GET_NAME          (WM_CAP_START+  12)
  127. #define WM_CAP_DRIVER_GET_VERSION       (WM_CAP_START+  13)
  128. #endif
  129.  
  130. #define WM_CAP_DRIVER_GET_CAPS          (WM_CAP_START+  14)
  131.  
  132. #ifdef _WIN32
  133. #define WM_CAP_FILE_SET_CAPTURE_FILEA  (WM_CAP_START+  20)
  134. #define WM_CAP_FILE_GET_CAPTURE_FILEA  (WM_CAP_START+  21)
  135. #define WM_CAP_FILE_SAVEASA            (WM_CAP_START+  23)
  136. #define WM_CAP_FILE_SAVEDIBA           (WM_CAP_START+  25)
  137. #define WM_CAP_FILE_SET_CAPTURE_FILEW  (WM_CAP_UNICODE_START+  20)
  138. #define WM_CAP_FILE_GET_CAPTURE_FILEW  (WM_CAP_UNICODE_START+  21)
  139. #define WM_CAP_FILE_SAVEASW            (WM_CAP_UNICODE_START+  23)
  140. #define WM_CAP_FILE_SAVEDIBW           (WM_CAP_UNICODE_START+  25)
  141. #ifdef UNICODE
  142. #define WM_CAP_FILE_SET_CAPTURE_FILE    WM_CAP_FILE_SET_CAPTURE_FILEW
  143. #define WM_CAP_FILE_GET_CAPTURE_FILE    WM_CAP_FILE_GET_CAPTURE_FILEW
  144. #define WM_CAP_FILE_SAVEAS              WM_CAP_FILE_SAVEASW
  145. #define WM_CAP_FILE_SAVEDIB             WM_CAP_FILE_SAVEDIBW
  146. #else
  147. #define WM_CAP_FILE_SET_CAPTURE_FILE    WM_CAP_FILE_SET_CAPTURE_FILEA
  148. #define WM_CAP_FILE_GET_CAPTURE_FILE    WM_CAP_FILE_GET_CAPTURE_FILEA
  149. #define WM_CAP_FILE_SAVEAS              WM_CAP_FILE_SAVEASA
  150. #define WM_CAP_FILE_SAVEDIB             WM_CAP_FILE_SAVEDIBA
  151. #endif
  152. #else
  153. #define WM_CAP_FILE_SET_CAPTURE_FILE    (WM_CAP_START+  20)
  154. #define WM_CAP_FILE_GET_CAPTURE_FILE    (WM_CAP_START+  21)
  155. #define WM_CAP_FILE_SAVEAS              (WM_CAP_START+  23)
  156. #define WM_CAP_FILE_SAVEDIB             (WM_CAP_START+  25)
  157. #endif
  158.  
  159. // out of order to save on ifdefs
  160. #define WM_CAP_FILE_ALLOCATE            (WM_CAP_START+  22)
  161. #define WM_CAP_FILE_SET_INFOCHUNK       (WM_CAP_START+  24)
  162.  
  163. #define WM_CAP_EDIT_COPY                (WM_CAP_START+  30)
  164.  
  165. #define WM_CAP_SET_AUDIOFORMAT          (WM_CAP_START+  35)
  166. #define WM_CAP_GET_AUDIOFORMAT          (WM_CAP_START+  36)
  167.  
  168. #define WM_CAP_DLG_VIDEOFORMAT          (WM_CAP_START+  41)
  169. #define WM_CAP_DLG_VIDEOSOURCE          (WM_CAP_START+  42)
  170. #define WM_CAP_DLG_VIDEODISPLAY         (WM_CAP_START+  43)
  171. #define WM_CAP_GET_VIDEOFORMAT          (WM_CAP_START+  44)
  172. #define WM_CAP_SET_VIDEOFORMAT          (WM_CAP_START+  45)
  173. #define WM_CAP_DLG_VIDEOCOMPRESSION     (WM_CAP_START+  46)
  174.  
  175. #define WM_CAP_SET_PREVIEW              (WM_CAP_START+  50)
  176. #define WM_CAP_SET_OVERLAY              (WM_CAP_START+  51)
  177. #define WM_CAP_SET_PREVIEWRATE          (WM_CAP_START+  52)
  178. #define WM_CAP_SET_SCALE                (WM_CAP_START+  53)
  179. #define WM_CAP_GET_STATUS               (WM_CAP_START+  54)
  180. #define WM_CAP_SET_SCROLL               (WM_CAP_START+  55)
  181.  
  182. #define WM_CAP_GRAB_FRAME               (WM_CAP_START+  60)
  183. #define WM_CAP_GRAB_FRAME_NOSTOP        (WM_CAP_START+  61)
  184.  
  185. #define WM_CAP_SEQUENCE                 (WM_CAP_START+  62)
  186. #define WM_CAP_SEQUENCE_NOFILE          (WM_CAP_START+  63)
  187. #define WM_CAP_SET_SEQUENCE_SETUP       (WM_CAP_START+  64)
  188. #define WM_CAP_GET_SEQUENCE_SETUP       (WM_CAP_START+  65)
  189.  
  190. #ifdef _WIN32
  191. #define WM_CAP_SET_MCI_DEVICEA         (WM_CAP_START+  66)
  192. #define WM_CAP_GET_MCI_DEVICEA         (WM_CAP_START+  67)
  193. #define WM_CAP_SET_MCI_DEVICEW         (WM_CAP_UNICODE_START+  66)
  194. #define WM_CAP_GET_MCI_DEVICEW         (WM_CAP_UNICODE_START+  67)
  195. #ifdef UNICODE
  196. #define WM_CAP_SET_MCI_DEVICE           WM_CAP_SET_MCI_DEVICEW
  197. #define WM_CAP_GET_MCI_DEVICE           WM_CAP_GET_MCI_DEVICEW
  198. #else
  199. #define WM_CAP_SET_MCI_DEVICE           WM_CAP_SET_MCI_DEVICEA
  200. #define WM_CAP_GET_MCI_DEVICE           WM_CAP_GET_MCI_DEVICEA
  201. #endif
  202. #else
  203. #define WM_CAP_SET_MCI_DEVICE           (WM_CAP_START+  66)
  204. #define WM_CAP_GET_MCI_DEVICE           (WM_CAP_START+  67)
  205. #endif
  206.  
  207.  
  208.  
  209. #define WM_CAP_STOP                     (WM_CAP_START+  68)
  210. #define WM_CAP_ABORT                    (WM_CAP_START+  69)
  211.  
  212. #define WM_CAP_SINGLE_FRAME_OPEN        (WM_CAP_START+  70)
  213. #define WM_CAP_SINGLE_FRAME_CLOSE       (WM_CAP_START+  71)
  214. #define WM_CAP_SINGLE_FRAME             (WM_CAP_START+  72)
  215.  
  216. #ifdef _WIN32
  217. #define WM_CAP_PAL_OPENA               (WM_CAP_START+  80)
  218. #define WM_CAP_PAL_SAVEA               (WM_CAP_START+  81)
  219. #define WM_CAP_PAL_OPENW               (WM_CAP_UNICODE_START+  80)
  220. #define WM_CAP_PAL_SAVEW               (WM_CAP_UNICODE_START+  81)
  221. #ifdef UNICODE
  222. #define WM_CAP_PAL_OPEN                 WM_CAP_PAL_OPENW
  223. #define WM_CAP_PAL_SAVE                 WM_CAP_PAL_SAVEW
  224. #else
  225. #define WM_CAP_PAL_OPEN                 WM_CAP_PAL_OPENA
  226. #define WM_CAP_PAL_SAVE                 WM_CAP_PAL_SAVEA
  227. #endif
  228. #else
  229. #define WM_CAP_PAL_OPEN                 (WM_CAP_START+  80)
  230. #define WM_CAP_PAL_SAVE                 (WM_CAP_START+  81)
  231. #endif
  232.  
  233. #define WM_CAP_PAL_PASTE                (WM_CAP_START+  82)
  234. #define WM_CAP_PAL_AUTOCREATE           (WM_CAP_START+  83)
  235. #define WM_CAP_PAL_MANUALCREATE         (WM_CAP_START+  84)
  236.  
  237. // Following added post VFW 1.1
  238. #define WM_CAP_SET_CALLBACK_CAPCONTROL  (WM_CAP_START+  85)
  239.  
  240.  
  241. // Defines end of the message range
  242. #ifdef _WIN32
  243. #define WM_CAP_UNICODE_END              WM_CAP_PAL_SAVEW
  244. #define WM_CAP_END                      WM_CAP_UNICODE_END
  245. #else
  246. #define WM_CAP_END                      WM_CAP_SET_CALLBACK_CAPCONTROL
  247. #endif
  248.  
  249. // ------------------------------------------------------------------
  250. //  Message crackers for above
  251. // ------------------------------------------------------------------
  252.  
  253. // message wrapper macros are defined for the default messages only. Apps
  254. // that wish to mix Ansi and UNICODE message sending will have to
  255. // reference the _A and _W messages directly
  256.  
  257. #define capSetCallbackOnError(hwnd, fpProc)        ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_ERROR, 0, (LPARAM)(LPVOID)(fpProc)))
  258. #define capSetCallbackOnStatus(hwnd, fpProc)       ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_STATUS, 0, (LPARAM)(LPVOID)(fpProc)))
  259. #define capSetCallbackOnYield(hwnd, fpProc)        ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_YIELD, 0, (LPARAM)(LPVOID)(fpProc)))
  260. #define capSetCallbackOnFrame(hwnd, fpProc)        ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_FRAME, 0, (LPARAM)(LPVOID)(fpProc)))
  261. #define capSetCallbackOnVideoStream(hwnd, fpProc)  ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, (LPARAM)(LPVOID)(fpProc)))
  262. #define capSetCallbackOnWaveStream(hwnd, fpProc)   ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_WAVESTREAM, 0, (LPARAM)(LPVOID)(fpProc)))
  263. #define capSetCallbackOnCapControl(hwnd, fpProc)   ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_CAPCONTROL, 0, (LPARAM)(LPVOID)(fpProc)))
  264.  
  265. #define capSetUserData(hwnd, lUser)        ((BOOL)AVICapSM(hwnd, WM_CAP_SET_USER_DATA, 0, (LPARAM)lUser))
  266. #define capGetUserData(hwnd)               (AVICapSM(hwnd, WM_CAP_GET_USER_DATA, 0, 0))
  267.  
  268. #define capDriverConnect(hwnd, i)                  ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_CONNECT, (WPARAM)(i), 0L))
  269. #define capDriverDisconnect(hwnd)                  ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_DISCONNECT, (WPARAM)0, 0L))
  270. #define capDriverGetName(hwnd, szName, wSize)      ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_NAME, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szName)))
  271. #define capDriverGetVersion(hwnd, szVer, wSize)    ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_VERSION, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szVer)))
  272. #define capDriverGetCaps(hwnd, s, wSize)           ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_CAPS, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPDRIVERCAPS)(s)))
  273.  
  274. #define capFileSetCaptureFile(hwnd, szName)        ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SET_CAPTURE_FILE, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  275. #define capFileGetCaptureFile(hwnd, szName, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_GET_CAPTURE_FILE, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szName)))
  276. #define capFileAlloc(hwnd, dwSize)                 ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_ALLOCATE, 0, (LPARAM)(DWORD)(dwSize)))
  277. #define capFileSaveAs(hwnd, szName)                ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SAVEAS, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  278. #define capFileSetInfoChunk(hwnd, lpInfoChunk)     ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SET_INFOCHUNK, (WPARAM)0, (LPARAM)(LPCAPINFOCHUNK)(lpInfoChunk)))
  279. #define capFileSaveDIB(hwnd, szName)               ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SAVEDIB, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  280.  
  281. #define capEditCopy(hwnd)                          ((BOOL)AVICapSM(hwnd, WM_CAP_EDIT_COPY, 0, 0L))
  282.  
  283. #define capSetAudioFormat(hwnd, s, wSize)          ((BOOL)AVICapSM(hwnd, WM_CAP_SET_AUDIOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPWAVEFORMATEX)(s)))
  284. #define capGetAudioFormat(hwnd, s, wSize)          ((DWORD)AVICapSM(hwnd, WM_CAP_GET_AUDIOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPWAVEFORMATEX)(s)))
  285. #define capGetAudioFormatSize(hwnd)                ((DWORD)AVICapSM(hwnd, WM_CAP_GET_AUDIOFORMAT, (WPARAM)0, (LPARAM)0L))
  286.  
  287. #define capDlgVideoFormat(hwnd)                    ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEOFORMAT, 0, 0L))
  288. #define capDlgVideoSource(hwnd)                    ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEOSOURCE, 0, 0L))
  289. #define capDlgVideoDisplay(hwnd)                   ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEODISPLAY, 0, 0L))
  290. #define capDlgVideoCompression(hwnd)               ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEOCOMPRESSION, 0, 0L))
  291.  
  292. #define capGetVideoFormat(hwnd, s, wSize)          ((DWORD)AVICapSM(hwnd, WM_CAP_GET_VIDEOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(s)))
  293. #define capGetVideoFormatSize(hwnd)            ((DWORD)AVICapSM(hwnd, WM_CAP_GET_VIDEOFORMAT, 0, 0L))
  294. #define capSetVideoFormat(hwnd, s, wSize)          ((BOOL)AVICapSM(hwnd, WM_CAP_SET_VIDEOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(s)))
  295.  
  296. #define capPreview(hwnd, f)                        ((BOOL)AVICapSM(hwnd, WM_CAP_SET_PREVIEW, (WPARAM)(BOOL)(f), 0L))
  297. #define capPreviewRate(hwnd, wMS)                  ((BOOL)AVICapSM(hwnd, WM_CAP_SET_PREVIEWRATE, (WPARAM)(wMS), 0))
  298. #define capOverlay(hwnd, f)                        ((BOOL)AVICapSM(hwnd, WM_CAP_SET_OVERLAY, (WPARAM)(BOOL)(f), 0L))
  299. #define capPreviewScale(hwnd, f)                   ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SCALE, (WPARAM)(BOOL)f, 0L))
  300. #define capGetStatus(hwnd, s, wSize)               ((BOOL)AVICapSM(hwnd, WM_CAP_GET_STATUS, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPSTATUS)(s)))
  301. #define capSetScrollPos(hwnd, lpP)                 ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SCROLL, (WPARAM)0, (LPARAM)(LPPOINT)(lpP)))
  302.  
  303. #define capGrabFrame(hwnd)                         ((BOOL)AVICapSM(hwnd, WM_CAP_GRAB_FRAME, (WPARAM)0, (LPARAM)0L))
  304. #define capGrabFrameNoStop(hwnd)                   ((BOOL)AVICapSM(hwnd, WM_CAP_GRAB_FRAME_NOSTOP, (WPARAM)0, (LPARAM)0L))
  305.  
  306. #define capCaptureSequence(hwnd)                   ((BOOL)AVICapSM(hwnd, WM_CAP_SEQUENCE, (WPARAM)0, (LPARAM)0L))
  307. #define capCaptureSequenceNoFile(hwnd)             ((BOOL)AVICapSM(hwnd, WM_CAP_SEQUENCE_NOFILE, (WPARAM)0, (LPARAM)0L))
  308. #define capCaptureStop(hwnd)                       ((BOOL)AVICapSM(hwnd, WM_CAP_STOP, (WPARAM)0, (LPARAM)0L))
  309. #define capCaptureAbort(hwnd)                      ((BOOL)AVICapSM(hwnd, WM_CAP_ABORT, (WPARAM)0, (LPARAM)0L))
  310.  
  311. #define capCaptureSingleFrameOpen(hwnd)            ((BOOL)AVICapSM(hwnd, WM_CAP_SINGLE_FRAME_OPEN, (WPARAM)0, (LPARAM)0L))
  312. #define capCaptureSingleFrameClose(hwnd)           ((BOOL)AVICapSM(hwnd, WM_CAP_SINGLE_FRAME_CLOSE, (WPARAM)0, (LPARAM)0L))
  313. #define capCaptureSingleFrame(hwnd)                ((BOOL)AVICapSM(hwnd, WM_CAP_SINGLE_FRAME, (WPARAM)0, (LPARAM)0L))
  314.  
  315. #define capCaptureGetSetup(hwnd, s, wSize)         ((BOOL)AVICapSM(hwnd, WM_CAP_GET_SEQUENCE_SETUP, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPTUREPARMS)(s)))
  316. #define capCaptureSetSetup(hwnd, s, wSize)         ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SEQUENCE_SETUP, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPTUREPARMS)(s)))
  317.  
  318. #define capSetMCIDeviceName(hwnd, szName)          ((BOOL)AVICapSM(hwnd, WM_CAP_SET_MCI_DEVICE, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  319. #define capGetMCIDeviceName(hwnd, szName, wSize)   ((BOOL)AVICapSM(hwnd, WM_CAP_GET_MCI_DEVICE, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szName)))
  320.  
  321. #define capPaletteOpen(hwnd, szName)               ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_OPEN, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  322. #define capPaletteSave(hwnd, szName)               ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_SAVE, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
  323. #define capPalettePaste(hwnd)                      ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_PASTE, (WPARAM) 0, (LPARAM)0L))
  324. #define capPaletteAuto(hwnd, iFrames, iColors)     ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_AUTOCREATE, (WPARAM)(iFrames), (LPARAM)(DWORD)(iColors)))
  325. #define capPaletteManual(hwnd, fGrab, iColors)     ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_MANUALCREATE, (WPARAM)(fGrab), (LPARAM)(DWORD)(iColors)))
  326.  
  327. // ------------------------------------------------------------------
  328. //  Structures
  329. // ------------------------------------------------------------------
  330.  
  331. typedef struct tagCapDriverCaps {
  332.     UINT        wDeviceIndex;               // Driver index in system.ini
  333.     BOOL        fHasOverlay;                // Can device overlay?
  334.     BOOL        fHasDlgVideoSource;         // Has Video source dlg?
  335.     BOOL        fHasDlgVideoFormat;         // Has Format dlg?
  336.     BOOL        fHasDlgVideoDisplay;        // Has External out dlg?
  337.     BOOL        fCaptureInitialized;        // Driver ready to capture?
  338.     BOOL        fDriverSuppliesPalettes;    // Can driver make palettes?
  339.  
  340. // following always NULL on Win32.
  341.     HANDLE      hVideoIn;                   // Driver In channel
  342.     HANDLE      hVideoOut;                  // Driver Out channel
  343.     HANDLE      hVideoExtIn;                // Driver Ext In channel
  344.     HANDLE      hVideoExtOut;               // Driver Ext Out channel
  345. } CAPDRIVERCAPS, *PCAPDRIVERCAPS, FAR *LPCAPDRIVERCAPS;
  346.  
  347. typedef struct tagCapStatus {
  348.     UINT        uiImageWidth;               // Width of the image
  349.     UINT        uiImageHeight;              // Height of the image
  350.     BOOL        fLiveWindow;                // Now Previewing video?
  351.     BOOL        fOverlayWindow;             // Now Overlaying video?
  352.     BOOL        fScale;                     // Scale image to client?
  353.     POINT       ptScroll;                   // Scroll position
  354.     BOOL        fUsingDefaultPalette;       // Using default driver palette?
  355.     BOOL        fAudioHardware;             // Audio hardware present?
  356.     BOOL        fCapFileExists;             // Does capture file exist?
  357.     DWORD       dwCurrentVideoFrame;        // # of video frames cap'td
  358.     DWORD       dwCurrentVideoFramesDropped;// # of video frames dropped
  359.     DWORD       dwCurrentWaveSamples;       // # of wave samples cap'td
  360.     DWORD       dwCurrentTimeElapsedMS;     // Elapsed capture duration
  361.     HPALETTE    hPalCurrent;                // Current palette in use
  362.     BOOL        fCapturingNow;              // Capture in progress?
  363.     DWORD       dwReturn;                   // Error value after any operation
  364.     UINT        wNumVideoAllocated;         // Actual number of video buffers
  365.     UINT        wNumAudioAllocated;         // Actual number of audio buffers
  366. } CAPSTATUS, *PCAPSTATUS, FAR *LPCAPSTATUS;
  367.  
  368.                         // Default values in parenthesis
  369. typedef struct tagCaptureParms {
  370.     DWORD       dwRequestMicroSecPerFrame;  // Requested capture rate
  371.     BOOL        fMakeUserHitOKToCapture;    // Show "Hit OK to cap" dlg?
  372.     UINT        wPercentDropForError;       // Give error msg if > (10%)
  373.     BOOL        fYield;                     // Capture via background task?
  374.     DWORD       dwIndexSize;                // Max index size in frames (32K)
  375.     UINT        wChunkGranularity;          // Junk chunk granularity (2K)
  376.     BOOL        fUsingDOSMemory;            // Use DOS buffers?
  377.     UINT        wNumVideoRequested;         // # video buffers, If 0, autocalc
  378.     BOOL        fCaptureAudio;              // Capture audio?
  379.     UINT        wNumAudioRequested;         // # audio buffers, If 0, autocalc
  380.     UINT        vKeyAbort;                  // Virtual key causing abort
  381.     BOOL        fAbortLeftMouse;            // Abort on left mouse?
  382.     BOOL        fAbortRightMouse;           // Abort on right mouse?
  383.     BOOL        fLimitEnabled;              // Use wTimeLimit?
  384.     UINT        wTimeLimit;                 // Seconds to capture
  385.     BOOL        fMCIControl;                // Use MCI video source?
  386.     BOOL        fStepMCIDevice;             // Step MCI device?
  387.     DWORD       dwMCIStartTime;             // Time to start in MS
  388.     DWORD       dwMCIStopTime;              // Time to stop in MS
  389.     BOOL        fStepCaptureAt2x;           // Perform spatial averaging 2x
  390.     UINT        wStepCaptureAverageFrames;  // Temporal average n Frames
  391.     DWORD       dwAudioBufferSize;          // Size of audio bufs (0 = default)
  392.     BOOL        fDisableWriteCache;         // Attempt to disable write cache
  393. } CAPTUREPARMS, *PCAPTUREPARMS, FAR *LPCAPTUREPARMS;
  394.  
  395. typedef struct tagCapInfoChunk {
  396.     FOURCC      fccInfoID;                  // Chunk ID, "ICOP" for copyright
  397.     LPVOID      lpData;                     // pointer to data
  398.     LONG        cbData;                     // size of lpData
  399. } CAPINFOCHUNK, *PCAPINFOCHUNK, FAR *LPCAPINFOCHUNK;
  400.  
  401.  
  402. // ------------------------------------------------------------------
  403. //  Callback Definitions
  404. // ------------------------------------------------------------------
  405.  
  406. typedef LRESULT (CALLBACK* CAPYIELDCALLBACK)  (HWND hWnd);
  407. #ifdef _WIN32
  408. typedef LRESULT (CALLBACK* CAPSTATUSCALLBACKW) (HWND hWnd, int nID, LPCWSTR lpsz);
  409. typedef LRESULT (CALLBACK* CAPERRORCALLBACKW)  (HWND hWnd, int nID, LPCWSTR lpsz);
  410. typedef LRESULT (CALLBACK* CAPSTATUSCALLBACKA) (HWND hWnd, int nID, LPCSTR lpsz);
  411. typedef LRESULT (CALLBACK* CAPERRORCALLBACKA)  (HWND hWnd, int nID, LPCSTR lpsz);
  412. #ifdef UNICODE
  413. #define CAPSTATUSCALLBACK  CAPSTATUSCALLBACKW
  414. #define CAPERRORCALLBACK   CAPERRORCALLBACKW
  415. #else
  416. #define CAPSTATUSCALLBACK  CAPSTATUSCALLBACKA
  417. #define CAPERRORCALLBACK   CAPERRORCALLBACKA
  418. #endif
  419. #else
  420. typedef LRESULT (CALLBACK* CAPSTATUSCALLBACK) (HWND hWnd, int nID, LPCSTR lpsz);
  421. typedef LRESULT (CALLBACK* CAPERRORCALLBACK)  (HWND hWnd, int nID, LPCSTR lpsz);
  422. #endif
  423. typedef LRESULT (CALLBACK* CAPVIDEOCALLBACK)  (HWND hWnd, LPVIDEOHDR lpVHdr);
  424. typedef LRESULT (CALLBACK* CAPWAVECALLBACK)   (HWND hWnd, LPWAVEHDR lpWHdr);
  425. typedef LRESULT (CALLBACK* CAPCONTROLCALLBACK)(HWND hWnd, int nState);
  426.  
  427. // ------------------------------------------------------------------
  428. //  CapControlCallback states
  429. // ------------------------------------------------------------------
  430. #define CONTROLCALLBACK_PREROLL         1 /* Waiting to start capture */
  431. #define CONTROLCALLBACK_CAPTURING       2 /* Now capturing */
  432.  
  433. // ------------------------------------------------------------------
  434. //  The only exported functions from AVICAP.DLL
  435. // ------------------------------------------------------------------
  436.  
  437. #ifdef _WIN32
  438. HWND VFWAPI capCreateCaptureWindowA (
  439.     LPCSTR lpszWindowName,
  440.     DWORD dwStyle,
  441.     int x, int y, int nWidth, int nHeight,
  442.     HWND hwndParent, int nID);
  443.  
  444. BOOL VFWAPI capGetDriverDescriptionA (UINT wDriverIndex,
  445.     LPSTR lpszName, int cbName,
  446.     LPSTR lpszVer, int cbVer);
  447.  
  448. HWND VFWAPI capCreateCaptureWindowW (
  449.     LPCWSTR lpszWindowName,
  450.     DWORD dwStyle,
  451.     int x, int y, int nWidth, int nHeight,
  452.     HWND hwndParent, int nID);
  453.  
  454. BOOL VFWAPI capGetDriverDescriptionW (UINT wDriverIndex,
  455.     LPWSTR lpszName, int cbName,
  456.     LPWSTR lpszVer, int cbVer);
  457. #ifdef UNICODE
  458. #define capCreateCaptureWindow  capCreateCaptureWindowW
  459. #define capGetDriverDescription capGetDriverDescriptionW
  460. #else
  461. #define capCreateCaptureWindow  capCreateCaptureWindowA
  462. #define capGetDriverDescription capGetDriverDescriptionA
  463. #endif
  464. #else
  465. HWND VFWAPI capCreateCaptureWindow (
  466.     LPCSTR lpszWindowName,
  467.     DWORD dwStyle,
  468.     int x, int y, int nWidth, int nHeight,
  469.     HWND hwndParent, int nID);
  470.  
  471. BOOL VFWAPI capGetDriverDescription (UINT wDriverIndex,
  472.     LPSTR lpszName, int cbName,
  473.     LPSTR lpszVer, int cbVer);
  474. #endif
  475.  
  476. #endif  /* RC_INVOKED */
  477.  
  478. // ------------------------------------------------------------------
  479. // New Information chunk IDs
  480. // ------------------------------------------------------------------
  481. #define infotypeDIGITIZATION_TIME  mmioFOURCC ('I','D','I','T')
  482. #define infotypeSMPTE_TIME         mmioFOURCC ('I','S','M','P')
  483.  
  484. // ------------------------------------------------------------------
  485. // String IDs from status and error callbacks
  486. // ------------------------------------------------------------------
  487.  
  488. #define IDS_CAP_BEGIN               300  /* "Capture Start" */
  489. #define IDS_CAP_END                 301  /* "Capture End" */
  490.  
  491. #define IDS_CAP_INFO                401  /* "%s" */
  492. #define IDS_CAP_OUTOFMEM            402  /* "Out of memory" */
  493. #define IDS_CAP_FILEEXISTS          403  /* "File '%s' exists -- overwrite it?" */
  494. #define IDS_CAP_ERRORPALOPEN        404  /* "Error opening palette '%s'" */
  495. #define IDS_CAP_ERRORPALSAVE        405  /* "Error saving palette '%s'" */
  496. #define IDS_CAP_ERRORDIBSAVE        406  /* "Error saving frame '%s'" */
  497. #define IDS_CAP_DEFAVIEXT           407  /* "avi" */
  498. #define IDS_CAP_DEFPALEXT           408  /* "pal" */
  499. #define IDS_CAP_CANTOPEN            409  /* "Cannot open '%s'" */
  500. #define IDS_CAP_SEQ_MSGSTART        410  /* "Select OK to start capture\nof video sequence\nto %s." */
  501. #define IDS_CAP_SEQ_MSGSTOP         411  /* "Hit ESCAPE or click to end capture" */
  502.  
  503. #define IDS_CAP_VIDEDITERR          412  /* "An error occurred while trying to run VidEdit." */
  504. #define IDS_CAP_READONLYFILE        413  /* "The file '%s' is a read-only file." */
  505. #define IDS_CAP_WRITEERROR          414  /* "Unable to write to file '%s'.\nDisk may be full." */
  506. #define IDS_CAP_NODISKSPACE         415  /* "There is no space to create a capture file on the specified device." */
  507. #define IDS_CAP_SETFILESIZE         416  /* "Set File Size" */
  508. #define IDS_CAP_SAVEASPERCENT       417  /* "SaveAs: %2ld%%  Hit Escape to abort." */
  509.  
  510. #define IDS_CAP_DRIVER_ERROR        418  /* Driver specific error message */
  511.  
  512. #define IDS_CAP_WAVE_OPEN_ERROR     419  /* "Error: Cannot open the wave input device.\nCheck sample size, frequency, and channels." */
  513. #define IDS_CAP_WAVE_ALLOC_ERROR    420  /* "Error: Out of memory for wave buffers." */
  514. #define IDS_CAP_WAVE_PREPARE_ERROR  421  /* "Error: Cannot prepare wave buffers." */
  515. #define IDS_CAP_WAVE_ADD_ERROR      422  /* "Error: Cannot add wave buffers." */
  516. #define IDS_CAP_WAVE_SIZE_ERROR     423  /* "Error: Bad wave size." */
  517.  
  518. #define IDS_CAP_VIDEO_OPEN_ERROR    424  /* "Error: Cannot open the video input device." */
  519. #define IDS_CAP_VIDEO_ALLOC_ERROR   425  /* "Error: Out of memory for video buffers." */
  520. #define IDS_CAP_VIDEO_PREPARE_ERROR 426  /* "Error: Cannot prepare video buffers." */
  521. #define IDS_CAP_VIDEO_ADD_ERROR     427  /* "Error: Cannot add video buffers." */
  522. #define IDS_CAP_VIDEO_SIZE_ERROR    428  /* "Error: Bad video size." */
  523.  
  524. #define IDS_CAP_FILE_OPEN_ERROR     429  /* "Error: Cannot open capture file." */
  525. #define IDS_CAP_FILE_WRITE_ERROR    430  /* "Error: Cannot write to capture file.  Disk may be full." */
  526. #define IDS_CAP_RECORDING_ERROR     431  /* "Error: Cannot write to capture file.  Data rate too high or disk full." */
  527. #define IDS_CAP_RECORDING_ERROR2    432  /* "Error while recording" */
  528. #define IDS_CAP_AVI_INIT_ERROR      433  /* "Error: Unable to initialize for capture." */
  529. #define IDS_CAP_NO_FRAME_CAP_ERROR  434  /* "Warning: No frames captured.\nConfirm that vertical sync interrupts\nare configured and enabled." */
  530. #define IDS_CAP_NO_PALETTE_WARN     435  /* "Warning: Using default palette." */
  531. #define IDS_CAP_MCI_CONTROL_ERROR   436  /* "Error: Unable to access MCI device." */
  532. #define IDS_CAP_MCI_CANT_STEP_ERROR 437  /* "Error: Unable to step MCI device." */
  533. #define IDS_CAP_NO_AUDIO_CAP_ERROR  438  /* "Error: No audio data captured.\nCheck audio card settings." */
  534. #define IDS_CAP_AVI_DRAWDIB_ERROR   439  /* "Error: Unable to draw this data format." */
  535. #define IDS_CAP_COMPRESSOR_ERROR    440  /* "Error: Unable to initialize compressor." */
  536. #define IDS_CAP_AUDIO_DROP_ERROR    441  /* "Error: Audio data was lost during capture, reduce capture rate." */
  537.  
  538. /* status string IDs */
  539. #define IDS_CAP_STAT_LIVE_MODE      500  /* "Live window" */
  540. #define IDS_CAP_STAT_OVERLAY_MODE   501  /* "Overlay window" */
  541. #define IDS_CAP_STAT_CAP_INIT       502  /* "Setting up for capture - Please wait" */
  542. #define IDS_CAP_STAT_CAP_FINI       503  /* "Finished capture, now writing frame %ld" */
  543. #define IDS_CAP_STAT_PALETTE_BUILD  504  /* "Building palette map" */
  544. #define IDS_CAP_STAT_OPTPAL_BUILD   505  /* "Computing optimal palette" */
  545. #define IDS_CAP_STAT_I_FRAMES       506  /* "%d frames" */
  546. #define IDS_CAP_STAT_L_FRAMES       507  /* "%ld frames" */
  547. #define IDS_CAP_STAT_CAP_L_FRAMES   508  /* "Captured %ld frames" */
  548. #define IDS_CAP_STAT_CAP_AUDIO      509  /* "Capturing audio" */
  549. #define IDS_CAP_STAT_VIDEOCURRENT   510  /* "Captured %ld frames (%ld dropped) %d.%03d sec." */
  550. #define IDS_CAP_STAT_VIDEOAUDIO     511  /* "Captured %d.%03d sec.  %ld frames (%ld dropped) (%d.%03d fps).  %ld audio bytes (%d,%03d sps)" */
  551. #define IDS_CAP_STAT_VIDEOONLY      512  /* "Captured %d.%03d sec.  %ld frames (%ld dropped) (%d.%03d fps)" */
  552. #define IDS_CAP_STAT_FRAMESDROPPED  513  /* "Dropped %ld of %ld frames (%d.%02d%%) during capture." */
  553.  
  554. #ifdef __BORLANDC__
  555.   #include <poppack.h>
  556. #endif
  557.  
  558. #ifdef __cplusplus
  559. }                       /* End of extern "C" { */
  560. #endif    /* __cplusplus */
  561.  
  562. #endif /* INC_AVICAP */
  563.  
  564.  
  565.