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.

242 lines
5.2 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. wavestrm.h
  5. Abstract:
  6. Declaration of the CWaveMSPStream
  7. Author:
  8. Zoltan Szilagyi September 7th, 1998
  9. --*/
  10. #ifndef __WAVESTRM_H_
  11. #define __WAVESTRM_H_
  12. #if _MSC_VER >= 1000
  13. #pragma once
  14. #endif // _MSC_VER >= 1000
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CWaveMSPStream
  17. /////////////////////////////////////////////////////////////////////////////
  18. class ATL_NO_VTABLE CWaveMSPStream : public CMSPStream, public CMSPObjectSafetyImpl
  19. {
  20. public:
  21. // DECLARE_POLY_AGGREGATABLE(CWaveMSP)
  22. // To add extra interfaces to this class, use the following:
  23. BEGIN_COM_MAP(CWaveMSPStream)
  24. COM_INTERFACE_ENTRY(IObjectSafety)
  25. COM_INTERFACE_ENTRY_CHAIN(CMSPStream)
  26. END_COM_MAP()
  27. virtual ULONG STDMETHODCALLTYPE AddRef(void)
  28. {
  29. return CMSPStream::AddRef();
  30. }
  31. virtual ULONG STDMETHODCALLTYPE Release(void)
  32. {
  33. return CMSPStream::Release();
  34. }
  35. public:
  36. //
  37. // Construction and destruction.
  38. //
  39. CWaveMSPStream();
  40. virtual ~CWaveMSPStream();
  41. virtual void FinalRelease();
  42. //
  43. // Required base class overrides.
  44. //
  45. STDMETHOD (get_Name) (
  46. OUT BSTR * ppName
  47. );
  48. //
  49. // We override these methods to implement our terminal handling.
  50. // This consists of only allowing one terminal on the stream at a time
  51. // and adding our filters and the terminal to the graph at the right
  52. // times.
  53. //
  54. STDMETHOD (SelectTerminal) (
  55. IN ITTerminal * pTerminal
  56. );
  57. STDMETHOD (UnselectTerminal) (
  58. IN ITTerminal * pTerminal
  59. );
  60. STDMETHOD (StartStream) ();
  61. STDMETHOD (PauseStream) ();
  62. STDMETHOD (StopStream) ();
  63. //
  64. // Overrides for event handling.
  65. //
  66. virtual HRESULT ProcessGraphEvent(
  67. IN long lEventCode,
  68. IN LONG_PTR lParam1,
  69. IN LONG_PTR lParam2
  70. );
  71. //
  72. // Public methods specific to our implementation.
  73. //
  74. virtual HRESULT SuspendStream(void);
  75. virtual HRESULT ResumeStream (void);
  76. static DWORD WINAPI ResumeStreamWI(VOID * pContext);
  77. virtual HRESULT ResumeStreamAsync(void);
  78. virtual HRESULT SetWaveID(DWORD dwWaveID);
  79. virtual HRESULT FireEvent(IN MSP_CALL_EVENT type,
  80. IN HRESULT hrError,
  81. IN MSP_CALL_EVENT_CAUSE cause);
  82. protected:
  83. //
  84. // Protected data members.
  85. //
  86. BOOL m_fHaveWaveID;
  87. BOOL m_fTerminalConnected;
  88. DWORD m_dwSuspendCount;
  89. IBaseFilter * m_pFilter;
  90. IBaseFilter * m_pG711Filter;
  91. FILTER_STATE m_DesiredGraphState;
  92. FILTER_STATE m_ActualGraphState;
  93. private:
  94. //
  95. // Private helper methods.
  96. //
  97. HRESULT ConnectTerminal(
  98. IN ITTerminal * pTerminal
  99. );
  100. HRESULT ConnectToTerminalPin(
  101. IN IPin * pTerminalPin
  102. );
  103. HRESULT TryToConnect(
  104. IN IPin * pOutputPin,
  105. IN IPin * pInputPin,
  106. OUT BOOL * pfIntelligent
  107. );
  108. //
  109. // remove all filters from the filter graph
  110. //
  111. HRESULT RemoveAllFilters();
  112. //
  113. // helper function that removes all the filters and then adds the wave filter
  114. //
  115. HRESULT CleanFilterGraph();
  116. //
  117. // a helper function that disconnects terminal and removes its filters from
  118. // the filter graph
  119. //
  120. HRESULT RemoveTerminal();
  121. //
  122. // a helper function that adds the terminal to the filter graph
  123. //
  124. HRESULT ReAddTerminal();
  125. //
  126. // this function will attempt to create g711 if needed and add it to the graph.
  127. //
  128. HRESULT AddG711();
  129. HRESULT RemoveAndReAddFilter(
  130. IN IBaseFilter * pFilter
  131. );
  132. void RemoveAndReAddG711(
  133. void
  134. );
  135. void DisconnectAllFilters(
  136. void
  137. );
  138. void RemoveAndReAddTerminal(
  139. void
  140. );
  141. HRESULT ConnectUsingG711(
  142. IN IPin * pOutputPin,
  143. IN IPin * pInputPin
  144. );
  145. HRESULT FindPinInFilter(
  146. IN BOOL bWantOutputPin, // if false, we want the input pin
  147. IN IBaseFilter * pFilter, // the filter to examine
  148. OUT IPin ** ppPin // the pin we found
  149. );
  150. HRESULT FindPin(
  151. OUT IPin ** ppPin
  152. );
  153. HRESULT DecideDesiredCaptureBufferSize(
  154. IN IPin * pPin,
  155. OUT long * plDesiredSize
  156. );
  157. HRESULT ExamineCaptureProperties(
  158. IN IPin *pPin
  159. );
  160. HRESULT ConfigureCapture(
  161. IN IPin * pOutputPin,
  162. IN IPin * pInputPin,
  163. IN long lDefaultBufferSize
  164. );
  165. HRESULT SetLiveMode(
  166. IN BOOL fEnable,
  167. IN IBaseFilter * pFilter
  168. );
  169. HRESULT ProcessSoundDeviceEvent(
  170. IN long lEventCode,
  171. IN LONG_PTR lParam1,
  172. IN LONG_PTR lParam2
  173. );
  174. };
  175. #endif //__WAVESTRM_H_