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.

126 lines
4.4 KiB

  1. /****************************************************************************
  2. * @doc INTERNAL WDMPIN
  3. *
  4. * @module WDMPin.h | Include file for <c CWDMPin> class used to access
  5. * video data on a video streaming pin exposed by the WDM class driver.
  6. *
  7. * @comm This code is based on the VfW to WDM mapper code written by
  8. * FelixA and E-zu Wu. The original code can be found on
  9. * \\redrum\slmro\proj\wdm10\\src\image\vfw\win9x\raytube.
  10. *
  11. * Documentation by George Shaw on kernel streaming can be found in
  12. * \\popcorn\razzle1\src\spec\ks\ks.doc.
  13. *
  14. * WDM streaming capture is discussed by Jay Borseth in
  15. * \\blues\public\jaybo\WDMVCap.doc.
  16. ***************************************************************************/
  17. #ifndef _WDMPIN_H // { _WDMPIN_H
  18. #define _WDMPIN_H
  19. /*****************************************************************************
  20. * @doc INTERNAL VIDEOSTRUCTENUM
  21. *
  22. * @struct DATAPINCONNECT | The <t DATAPINCONNECT> structure is used to
  23. * connect to a streaming video pin.
  24. *
  25. * @field KSPIN_CONNECT | Connect | Describes how the connection is to be
  26. * done.
  27. *
  28. * @field KS_DATAFORMAT_VIDEOINFOHEADER | Data | Describes the video format
  29. * of the video data streaming from a video pin.
  30. ***************************************************************************/
  31. // Structure used to connect to a streaming video pin
  32. typedef struct _tagStreamConnect
  33. {
  34. KSPIN_CONNECT Connect;
  35. KS_DATAFORMAT_VIDEOINFOHEADER Data;
  36. } DATAPINCONNECT, *PDATAPINCONNECT;
  37. /*****************************************************************************
  38. * @doc INTERNAL VIDEOSTRUCTENUM
  39. *
  40. * @struct KS_HEADER_AND_INFO | The <t KS_HEADER_AND_INFO> structure is used
  41. * stream data from a video pin.
  42. *
  43. * @field KSSTREAM_HEADER | StreamHeader | Describes how the streaming is to be
  44. * done.
  45. *
  46. * @field KS_FRAME_INFO | FrameInfo | Describes the video format
  47. * of the video data streaming from a video pin.
  48. ***************************************************************************/
  49. // Video streaming data structure
  50. typedef struct
  51. {
  52. KSSTREAM_HEADER StreamHeader;
  53. KS_FRAME_INFO FrameInfo;
  54. } KS_HEADER_AND_INFO;
  55. // For GetProcAddresss on KsCreatePin
  56. typedef DWORD (WINAPI *LPFNKSCREATEPIN)(IN HANDLE FilterHandle, IN PKSPIN_CONNECT Connect, IN ACCESS_MASK DesiredAccess, OUT PHANDLE ConnectionHandle);
  57. // Default frame rate: 30 fps
  58. #define DEFAULT_AVG_TIME_PER_FRAME 333330UL
  59. /****************************************************************************
  60. * @doc INTERNAL CWDMPINCLASS
  61. *
  62. * @class CWDMPin | This class provides support for streaming video
  63. * data from WDM device streaming pin.
  64. *
  65. * @mdata BOOL | CWDMPin | m_hKS | Handle to the video streaming pin.
  66. *
  67. * @mdata KS_BITMAPINFOHEADER | CWDMPin | m_biHdr | Video format
  68. * of the video data used by the streaming pin.
  69. *
  70. * @mdata DWORD | CWDMPin | m_dwAvgTimePerFrame | Frame rate.
  71. *
  72. * @mdata BOOL | CWDMPin | m_fStarted | Video streaming channel
  73. * status.
  74. ***************************************************************************/
  75. class CWDMPin : public CWDMDriver
  76. {
  77. public:
  78. CWDMPin(DWORD dwDeviceID);
  79. ~CWDMPin();
  80. // Pin and class driver management functions
  81. BOOL OpenDriverAndPin();
  82. HANDLE GetPinHandle() const { return m_hKS; }
  83. // Pin video format functions
  84. BOOL GetBitmapInfo(PKS_BITMAPINFOHEADER pbInfo, WORD wSize);
  85. BOOL SetBitmapInfo(PKS_BITMAPINFOHEADER pbInfo);
  86. BOOL GetPaletteInfo(CAPTUREPALETTE *pPal, DWORD dwcbSize);
  87. DWORD GetFrameSize() { return m_biHdr.biSizeImage; }
  88. DWORD GetAverageTimePerFrame() { return m_dwAvgTimePerFrame; }
  89. BOOL SetAverageTimePerFrame(DWORD dwNewAvgTimePerFrame);
  90. // Data access functions
  91. BOOL GetFrame(LPVIDEOHDR lpVHdr);
  92. // Streaming state functions
  93. BOOL Start();
  94. BOOL Stop();
  95. private:
  96. HANDLE m_hKS;
  97. KS_BITMAPINFOHEADER m_biHdr;
  98. DWORD m_dwAvgTimePerFrame;
  99. BOOL m_fStarted;
  100. HINSTANCE m_hKsUserDLL;
  101. LPFNKSCREATEPIN m_pKsCreatePin;
  102. // Pin video format function
  103. PKS_DATARANGE_VIDEO FindMatchDataRangeVideo(PKS_BITMAPINFOHEADER pbiHdr, BOOL *pfValidMatch);
  104. // Pin and class driver management functions
  105. BOOL CreatePin(PKS_BITMAPINFOHEADER pbiNewHdr, DWORD dwAvgTimePerFrame = DEFAULT_AVG_TIME_PER_FRAME);
  106. BOOL DestroyPin();
  107. // Streaming state function
  108. BOOL SetState(KSSTATE ksState);
  109. };
  110. #endif // } _WDMPIN_H