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