Source code of Windows XP (NT5)
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.

183 lines
5.2 KiB

  1. // IDCAP.H
  2. //
  3. // Created 31-Jul-96 [JonT]
  4. #ifndef _IDCAP_H
  5. #define _IDCAP_H
  6. // Set a define saying we're building QKCAP so that
  7. // we use the proper DLL import switches
  8. #define __DCAP_BUILD__
  9. // Debug stuff
  10. #if defined (DEBUG) || defined (_DEBUG)
  11. #define Assert(x, msg) { if (!(x)) { char szBuf[256]; \
  12. wsprintf((LPSTR)szBuf, (LPSTR)"DCAP: %s %s(%d)\r\n", (LPSTR)(msg),\
  13. (LPSTR)__FILE__, __LINE__); \
  14. OutputDebugString((LPSTR)szBuf); DebugBreak(); } }
  15. #define DebugSpew(msg) { char szBuf[256]; \
  16. wsprintf((LPSTR)szBuf, (LPSTR)"DCAP: %s %s(%d)\r\n", (LPSTR)(msg),\
  17. (LPSTR)__FILE__, __LINE__); \
  18. OutputDebugString((LPSTR)szBuf); }
  19. #else
  20. #define Assert(x, msg)
  21. #define DebugSpew(msg)
  22. #endif
  23. // Equates
  24. #define DCAP_MAX_DEVICES 10 // Arbitrary
  25. #define DCAP_MAX_VFW_DEVICES 10 // MSVIDEO's limit
  26. // INTERNALCAPDEV flags
  27. #define HCAPDEV_STREAMING 0x0001
  28. #define HCAPDEV_STREAMING_INITIALIZED 0x0002
  29. #define HCAPDEV_STREAMING_FRAME_GRAB 0x0004
  30. #define HCAPDEV_STREAMING_FRAME_TIME 0x0008
  31. #define HCAPDEV_STREAMING_PAUSED 0x0010
  32. #define HCAPDEV_IN_DRIVER_DIALOG 0x0020
  33. #define CAPTURE_DEVICE_DISABLED 0x0040
  34. #define CAPTURE_DEVICE_OPEN 0x0080
  35. #define WDM_CAPTURE_DEVICE 0x0100
  36. // LOCKEDINFO flags
  37. #define LIF_STOPSTREAM 0x0001
  38. // Structures
  39. // CAPTUREDEVICE flags
  40. #define MAX_VERSION 80
  41. #ifdef WIN32
  42. typedef struct tagVS_VERSION
  43. {
  44. WORD wTotLen;
  45. WORD wValLen;
  46. TCHAR szSig[16];
  47. VS_FIXEDFILEINFO vffInfo;
  48. } VS_VERSION;
  49. #endif
  50. #ifdef __NT_BUILD__
  51. #define LPCAPBUFFER16 DWORD
  52. #define LPCAPBUFFER32 LPCAPBUFFER
  53. #endif //__NT_BUILD__
  54. typedef struct _CAPBUFFERHDR FAR* LPCAPBUFFER;
  55. // We will deal with CAPBUFFER pointers as always 16:16 pointers. So, we
  56. // use this #define to make sure that we don't accidentally indirect them on
  57. // the 32-bit side. We need to always MapSL them on the 32-bit side before
  58. // using.
  59. #ifndef WIN32
  60. #define LPCAPBUFFER16 LPCAPBUFFER
  61. #define LPCAPBUFFER32 DWORD
  62. #else
  63. #define LPCAPBUFFER16 DWORD
  64. #define LPCAPBUFFER32 LPCAPBUFFER
  65. #endif
  66. typedef struct _CAPBUFFERHDR
  67. {
  68. VIDEOHDR vh;
  69. LPCAPBUFFER32 lpNext; // Double linked list pointers for ready queue
  70. LPCAPBUFFER32 lpPrev;
  71. #ifndef __NT_BUILD__
  72. LPCAPBUFFER16 lp1616Next; // Double linked list pointers for ready queue
  73. LPCAPBUFFER16 lp1616Prev;
  74. #endif
  75. } CAPBUFFERHDR, FAR* LPCAPBUFFER;
  76. #ifndef __NT_BUILD__
  77. typedef struct _LOCKEDINFO
  78. {
  79. LPCAPBUFFER16 lp1616Head; // Queue of ready items
  80. LPCAPBUFFER16 lp1616Tail;
  81. LPCAPBUFFER16 lp1616Current; // Item being used by 32-bit side
  82. DWORD pevWait;
  83. DWORD dwFlags;
  84. } LOCKEDINFO, FAR* LPLOCKEDINFO;
  85. #endif
  86. #ifdef WIN32
  87. typedef struct _INTERNALCAPDEV
  88. {
  89. DWORD dwFlags;
  90. #ifndef __NT_BUILD__
  91. LOCKEDINFO* lpli;
  92. WORD wselLockedInfo;
  93. WORD wPad;
  94. #endif
  95. int nDeviceIndex;
  96. HVIDEO hvideoIn;
  97. HVIDEO hvideoCapture;
  98. HVIDEO hvideoOverlay;
  99. LPCAPBUFFER32 lpcbufList; // List of all allocated buffers so we can free them
  100. DWORD dwcbBuffers;
  101. DWORD dw_usecperframe;
  102. UINT timerID;
  103. HANDLE hevWait;
  104. LONG busyCount;
  105. LPCAPBUFFER32 lpHead;
  106. LPCAPBUFFER32 lpTail;
  107. LPCAPBUFFER32 lpCurrent;
  108. CRITICAL_SECTION bufferlistCS;
  109. DWORD dwDevNode;
  110. char szDeviceName[MAX_PATH];
  111. char szDeviceDescription[MAX_PATH];
  112. char szDeviceVersion[MAX_VERSION];
  113. PVOID pCWDMPin;
  114. PVOID pCWDMStreamer;
  115. } INTERNALCAPDEV, *HCAPDEV, *LPINTERNALCAPDEV;
  116. #define HFRAMEBUF LPCAPBUFFER
  117. #define INTERNAL_MAGIC 0x50414344
  118. #define VALIDATE_CAPDEV(h) if (!h || !(h->dwFlags & CAPTURE_DEVICE_OPEN)) { \
  119. SetLastError(ERROR_INVALID_PARAMETER); return FALSE; }
  120. #include <dcap.h>
  121. // Globals
  122. extern int g_cDevices;
  123. extern LPINTERNALCAPDEV g_aCapDevices[DCAP_MAX_DEVICES];
  124. #ifdef __cplusplus
  125. extern "C" {
  126. #endif // __cplusplus
  127. #ifdef __NT_BUILD__
  128. #define _OpenDriver OpenDriver
  129. #define _CloseDriver CloseDriver
  130. #define _SendDriverMessage SendDriverMessage
  131. #else
  132. HANDLE __stdcall _OpenDriver(LPCSTR lpDriverName, LPSTR lpSectionName, LONG lpvop);
  133. DWORD __stdcall _CloseDriver(HANDLE h, LPVOID lpReserved1, LPVOID lpReserved2);
  134. DWORD __stdcall _SendDriverMessage(HANDLE h, DWORD msg, DWORD param1, DWORD param2);
  135. void __stdcall _CloseVxDHandle(DWORD pev);
  136. WORD __stdcall _AllocateLockableBuffer(DWORD dwSize);
  137. void __stdcall _FreeLockableBuffer(WORD wBuffer);
  138. BOOL __stdcall _LockBuffer(WORD wBuffer);
  139. void __stdcall _UnlockBuffer(WORD wBuffer);
  140. #endif
  141. BOOL __stdcall _GetVideoPalette(HVIDEO hvideo, CAPTUREPALETTE* lpcp, DWORD dwcbSize);
  142. DWORD _stdcall _GetVideoFormatSize(HDRVR hvideo);
  143. BOOL __stdcall _GetVideoFormat(HVIDEO hvideo, LPBITMAPINFOHEADER lpbmih);
  144. BOOL __stdcall _SetVideoFormat(HVIDEO hvideoExtIn, HVIDEO hvideoIn, LPBITMAPINFOHEADER lpbmih);
  145. BOOL __stdcall _InitializeVideoStream(HVIDEO hvideo, DWORD dwMicroSecPerFrame, DWORD_PTR dwParam);
  146. BOOL __stdcall _UninitializeVideoStream(HVIDEO hvideo);
  147. BOOL __stdcall _InitializeExternalVideoStream(HVIDEO hvideo);
  148. DWORD __stdcall _GetVideoFrame(HVIDEO hvideo, DWORD lpvideohdr);
  149. #endif //Win32
  150. #ifdef __cplusplus
  151. } // extern "C"
  152. #endif // __cplusplus
  153. #endif // #ifndef _IDCAP_H
  154.