Source code of Windows XP (NT5)
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.

192 lines
4.6 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. rcastrm.h
  5. Abstract:
  6. Declaration of the CRCAMSPStream
  7. Author:
  8. Zoltan Szilagyi September 7th, 1998
  9. --*/
  10. #ifndef __RCASTRM_H_
  11. #define __RCASTRM_H_
  12. #if _MSC_VER >= 1000
  13. #pragma once
  14. #endif // _MSC_VER >= 1000
  15. #define BITS_PER_SAMPLE_AT_TERMINAL 16
  16. #define SAMPLE_RATE_AT_TERMINAL 8000
  17. // rest of format is assumed to be mono, linear pcm at the terminal.
  18. // See SetAudioFormat helper function.
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CRCAMSPStream
  21. /////////////////////////////////////////////////////////////////////////////
  22. class CRCAMSPStream : public CMSPStream, public CMSPObjectSafetyImpl
  23. {
  24. public:
  25. // DECLARE_POLY_AGGREGATABLE(CRCAMSP)
  26. // To add extra interfaces to this class, use the following:
  27. BEGIN_COM_MAP(CRCAMSPStream)
  28. COM_INTERFACE_ENTRY( IObjectSafety )
  29. COM_INTERFACE_ENTRY_CHAIN(CMSPStream)
  30. END_COM_MAP()
  31. public:
  32. //
  33. // Construction and destruction.
  34. //
  35. CRCAMSPStream();
  36. virtual ~CRCAMSPStream();
  37. virtual void FinalRelease();
  38. //
  39. // Required base class overrides.
  40. //
  41. STDMETHOD (get_Name) (
  42. OUT BSTR * ppName
  43. );
  44. //
  45. // Override to allow us to create our filter on initialization.
  46. //
  47. virtual HRESULT Init(
  48. IN HANDLE hAddress,
  49. IN CMSPCallBase * pMSPCall,
  50. IN IMediaEvent * pGraph,
  51. IN DWORD dwMediaType,
  52. IN TERMINAL_DIRECTION Direction
  53. );
  54. //
  55. // We override these methods to implement our terminal handling.
  56. // This consists of only allowing one terminal on the stream at a time
  57. // and adding our filters and the terminal to the graph at the right
  58. // times.
  59. //
  60. STDMETHOD (SelectTerminal) (
  61. IN ITTerminal * pTerminal
  62. );
  63. STDMETHOD (UnselectTerminal) (
  64. IN ITTerminal * pTerminal
  65. );
  66. STDMETHOD (StartStream) ();
  67. STDMETHOD (PauseStream) ();
  68. STDMETHOD (StopStream) ();
  69. //
  70. // Overrides for event handling.
  71. //
  72. virtual HRESULT ProcessGraphEvent(
  73. IN long lEventCode,
  74. IN LONG_PTR lParam1,
  75. IN LONG_PTR lParam2
  76. );
  77. //
  78. // Public methods specific to our implementation.
  79. //
  80. virtual HRESULT SetVCHandle(IN DWORD dwVCHandle);
  81. virtual HRESULT FireEvent(IN MSP_CALL_EVENT type,
  82. IN HRESULT hrError,
  83. IN MSP_CALL_EVENT_CAUSE cause);
  84. protected:
  85. //
  86. // Protected data members.
  87. //
  88. BOOL m_fHaveVCHandle;
  89. DWORD m_dwBufferSizeOnWire;
  90. BOOL m_fTerminalConnected;
  91. IBaseFilter * m_pFilter;
  92. IBaseFilter * m_pG711Filter;
  93. FILTER_STATE m_DesiredGraphState;
  94. private:
  95. //
  96. // Private helper methods.
  97. //
  98. BOOL UseMulaw( void );
  99. HRESULT GetBufferSizeFromPin(
  100. IN IPin * pPin,
  101. OUT DWORD * pdwSize
  102. );
  103. HRESULT SetVCHandleOnPin(LPWSTR pszFileName, REFGUID formattype);
  104. HRESULT SetDataFormatOnPin(IPin *pBridgePin);
  105. HRESULT SetMediaTypeFormat(AM_MEDIA_TYPE* pAmMediaType,
  106. BYTE* pformat,
  107. ULONG length);
  108. HRESULT CreateRCAFilter( void );
  109. HRESULT PrepareG711Filter( void );
  110. HRESULT ConnectTerminal( IN ITTerminal * pTerminal );
  111. HRESULT ConnectToTerminalPin( IN IPin * pTerminalPin );
  112. HRESULT TryToConnect( IN IPin * pOutputPin,
  113. IN IPin * pInputPin );
  114. HRESULT ConnectUsingG711( IN IPin * pOutputPin,
  115. IN IPin * pInputPin );
  116. HRESULT FindPinInFilter(
  117. IN BOOL bWantOutputPin, // if false, want input pin
  118. IN IBaseFilter * pFilter, // the filter to examine
  119. OUT IPin ** ppPin // the pin we found
  120. );
  121. HRESULT FindPin(
  122. OUT IPin ** ppPin
  123. );
  124. HRESULT ConfigureCapture( IN IPin * pOutputPin,
  125. IN IPin * pInputPin );
  126. HRESULT ExamineCaptureSettings( IN IPin *pPin );
  127. };
  128. //////////////////////////////////////////////////////////////////////////////
  129. //////////////////////////////////////////////////////////////////////////////
  130. //
  131. // Helper functions -- non-class members.
  132. //
  133. HRESULT SetAudioFormat(
  134. IN IUnknown* pIUnknown,
  135. IN WORD wBitPerSample,
  136. IN DWORD dwSampleRate
  137. );
  138. #endif //__WAVEADDR_H_