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.

101 lines
2.4 KiB

  1. // Copyright (c) 1997 - 2000 Microsoft Corporation. All Rights Reserved.
  2. #ifndef _CVPMThread
  3. #define _CVPMThread
  4. class CVPMFilter;
  5. class CAMEvent;
  6. struct VPNotifyData;
  7. class CVPMThread
  8. {
  9. public:
  10. CVPMThread( CVPMFilter* pFilter );
  11. ~CVPMThread();
  12. HRESULT Run();
  13. HRESULT Pause();
  14. HRESULT Stop();
  15. HRESULT SignalNewVP( LPDIRECTDRAWVIDEOPORT pVP );
  16. static DWORD WINAPI StaticThreadProc(LPVOID);
  17. protected:
  18. virtual DWORD ThreadProc();
  19. private:
  20. void ProcessEvents( LPDDVIDEOPORTNOTIFY pNotify);
  21. HRESULT AdvanceTimer();
  22. HANDLE m_hThread;
  23. DWORD m_dwThreadID;
  24. CVPMFilter* m_pFilter;
  25. IReferenceClock* m_pClock;
  26. bool m_fProcessFrames; // nonzero means process frames, zero means do not.
  27. DWORD m_dwCount;
  28. VPNotifyData* m_pVPData;
  29. // mini client server message queue
  30. struct Message {
  31. enum Type {
  32. kVP,
  33. kEndThread,
  34. kGraphState
  35. };
  36. Message( Type type )
  37. : m_Type( type )
  38. {}
  39. virtual ~Message() {};
  40. void Reply( HRESULT hr );
  41. Message* m_pNext;
  42. CAMEvent m_eReply;
  43. HRESULT m_hrResult;
  44. Type m_Type;
  45. };
  46. struct MsgQueue: public CCritSec
  47. {
  48. MsgQueue();
  49. CAMEvent m_ePost;
  50. Message* m_pMsgList;
  51. void Insert( Message* pMessage );
  52. Message* Remove();
  53. } m_MsgQueue;
  54. struct VPMessage: public Message
  55. {
  56. VPMessage( LPDIRECTDRAWVIDEOPORT pVP )
  57. : Message( kVP )
  58. , m_pVP( pVP )
  59. {}
  60. LPDIRECTDRAWVIDEOPORT m_pVP;
  61. };
  62. struct EndThreadMessage: public Message
  63. {
  64. EndThreadMessage()
  65. : Message( kEndThread )
  66. {};
  67. };
  68. struct GraphStateMessage: public Message
  69. {
  70. GraphStateMessage( FILTER_STATE fs )
  71. : Message( kGraphState )
  72. , m_state( fs )
  73. {};
  74. FILTER_STATE m_state;
  75. };
  76. HRESULT Post( Message* pMessage );
  77. private:
  78. HRESULT ProcessMessage( Message* pMessage, bool* pfQuit );
  79. HRESULT ProcessVPMsg( VPMessage* pVPMsg );
  80. HRESULT ProcessGraphStateMsg( GraphStateMessage* pStateMsg );
  81. };
  82. #endif