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.

116 lines
3.2 KiB

  1. #pragma once
  2. //==========================================================================;
  3. //
  4. // CWDMCaptureStream - Capture Stream base class declarations
  5. //
  6. // $Date: 22 Feb 1999 15:48:16 $
  7. // $Revision: 1.1 $
  8. // $Author: KLEBANOV $
  9. //
  10. // $Copyright: (c) 1997 - 1999 ATI Technologies Inc. All Rights Reserved. $
  11. //
  12. //==========================================================================;
  13. #include "i2script.h"
  14. #include "aticonfg.h"
  15. #include "VidStrm.h"
  16. typedef enum {
  17. ChangeComplete,
  18. Starting,
  19. Closing,
  20. Running,
  21. Pausing,
  22. Stopping,
  23. Initializing
  24. };
  25. #define DD_OK 0
  26. class CWDMCaptureStream : public CWDMVideoStream
  27. {
  28. public:
  29. CWDMCaptureStream(PHW_STREAM_OBJECT pStreamObject,
  30. CWDMVideoDecoder * pCWDMVideoDecoder,
  31. PUINT puiErrorCode)
  32. : CWDMVideoStream(pStreamObject, pCWDMVideoDecoder, puiErrorCode) {}
  33. void Startup(PUINT puiErrorCode);
  34. void Shutdown();
  35. VOID STREAMAPI VideoReceiveDataPacket(IN PHW_STREAM_REQUEST_BLOCK pSrb);
  36. void TimeoutPacket(IN OUT PHW_STREAM_REQUEST_BLOCK pSrb);
  37. VOID VideoSetState(PHW_STREAM_REQUEST_BLOCK, BOOL bVPConnected, BOOL bVPVBIConnected);
  38. VOID VideoGetProperty(PHW_STREAM_REQUEST_BLOCK);
  39. VOID VideoStreamGetConnectionProperty (PHW_STREAM_REQUEST_BLOCK);
  40. VOID VideoStreamGetDroppedFramesProperty(PHW_STREAM_REQUEST_BLOCK);
  41. VOID DataLock(PKIRQL pIrql) {
  42. KeAcquireSpinLock(&m_streamDataLock, pIrql);
  43. }
  44. VOID DataUnLock(KIRQL Irql) {
  45. KeReleaseSpinLock(&m_streamDataLock, Irql);
  46. }
  47. void CloseCapture();
  48. void CancelPacket( PHW_STREAM_REQUEST_BLOCK);
  49. protected:
  50. UINT m_stateChange;
  51. KSPIN_LOCK m_streamDataLock;
  52. // Incoming SRBs go here
  53. LIST_ENTRY m_incomingDataSrbQueue;
  54. // SRBs in DDraw-land are moved to this queue
  55. LIST_ENTRY m_waitQueue;
  56. // During some state transitions, we need to
  57. // temporarily move SRBs here (purely for the
  58. // purpose of reordering them) before being
  59. // returned to the incomingDataSrbQueue.
  60. LIST_ENTRY m_reversalQueue;
  61. // for synchronizing state changes
  62. KEVENT m_specialEvent;
  63. KEVENT m_SrbAvailableEvent;
  64. KEVENT m_stateTransitionEvent;
  65. // We get this from Ddraw
  66. HANDLE m_hCapture;
  67. private:
  68. BOOL FlushBuffers();
  69. BOOL ResetFieldNumber();
  70. BOOL ReleaseCaptureHandle();
  71. VOID EmptyIncomingDataSrbQueue();
  72. VOID HandleStateTransition();
  73. void AddBuffersToDirectDraw();
  74. BOOL AddBuffer(PHW_STREAM_REQUEST_BLOCK);
  75. VOID HandleBusmasterCompletion(PHW_STREAM_REQUEST_BLOCK);
  76. VOID TimeStampSrb(PHW_STREAM_REQUEST_BLOCK);
  77. virtual void ResetFrameCounters() = 0;
  78. virtual ULONG GetFrameSize() = 0;
  79. virtual void GetDroppedFrames(PKSPROPERTY_DROPPEDFRAMES_CURRENT_S pDroppedFrames) = 0;
  80. virtual BOOL GetCaptureHandle() = 0;
  81. virtual ULONG GetFieldInterval() = 0;
  82. virtual void SetFrameInfo(PHW_STREAM_REQUEST_BLOCK) = 0;
  83. void ThreadProc();
  84. static void ThreadStart(CWDMCaptureStream *pStream)
  85. { pStream->ThreadProc(); }
  86. };