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.

179 lines
2.4 KiB

  1. //
  2. // Playback unit
  3. //
  4. #ifndef _PLAYBACK_UNIT_
  5. #define _PLAYBACK_UNIT_
  6. #include <fpbridge.h>
  7. class CFPTerminal;
  8. class CPBFilter;
  9. class CPBPin;
  10. class CPlaybackUnit
  11. {
  12. public:
  13. //
  14. // --- Contstructor/Destructor ---
  15. //
  16. CPlaybackUnit();
  17. ~CPlaybackUnit();
  18. public:
  19. //
  20. // --- Public methods ---
  21. //
  22. //
  23. // create graph and stuff
  24. //
  25. HRESULT Initialize(
  26. );
  27. //
  28. // communicate file name.
  29. //
  30. HRESULT SetupFromFile(
  31. IN BSTR bstrFileName
  32. );
  33. //
  34. // start the filter graph
  35. //
  36. HRESULT Start();
  37. //
  38. // Stop the filter graph
  39. //
  40. HRESULT Stop();
  41. //
  42. // Pause the filter graph
  43. //
  44. HRESULT Pause();
  45. //
  46. // get filter graph's state
  47. //
  48. HRESULT GetState(
  49. OUT OAFilterState *pGraphState
  50. );
  51. //
  52. // cleanup
  53. //
  54. HRESULT Shutdown();
  55. //
  56. // retrieve the media supported by the filter
  57. //
  58. HRESULT get_MediaTypes(
  59. OUT long* pMediaTypes
  60. );
  61. HRESULT GetMediaPin(
  62. IN long nMediaType,
  63. IN int nIndex,
  64. OUT CPBPin** ppPin
  65. );
  66. private:
  67. //
  68. // --- Private methods ---
  69. //
  70. //
  71. // the callback called on a filter graph event
  72. //
  73. static VOID CALLBACK HandleGraphEvent( IN VOID *pContext,
  74. IN BOOLEAN bReason);
  75. //
  76. // transition playback unit into new state
  77. //
  78. HRESULT ChangeState(
  79. IN OAFilterState DesiredState
  80. );
  81. private:
  82. //
  83. // --- Members ---
  84. //
  85. //
  86. // direct show filter graph
  87. //
  88. IGraphBuilder *m_pIGraphBuilder;
  89. //
  90. // critical section used for thread syncronization
  91. //
  92. CRITICAL_SECTION m_CriticalSection;
  93. //
  94. // The source filter
  95. //
  96. IBaseFilter* m_pSourceFilter;
  97. //
  98. // The bridge filter
  99. //
  100. CPBFilter* m_pBridgeFilter;
  101. HANDLE m_hGraphEventHandle;
  102. private:
  103. //
  104. // --- Helper methods ---
  105. //
  106. HRESULT IsGraphInState(
  107. IN OAFilterState State
  108. );
  109. HRESULT AddBridgeFilter(
  110. );
  111. HRESULT RemoveBridgeFilter(
  112. );
  113. HRESULT RemoveSourceFilter(
  114. );
  115. HRESULT GetSourcePin(
  116. OUT IPin** ppPin
  117. );
  118. };
  119. #endif
  120. // eof