Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

612 lines
31 KiB

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