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.

247 lines
5.6 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. MSPCall.h
  5. Abstract:
  6. Definitions for MSP utililty functions. There are all related to
  7. active movie filter manipulation.
  8. Author:
  9. Mu Han (muhan) 1-November-1997
  10. --*/
  11. #ifndef __MSPUTIL_H
  12. #define __MSPUTIL_H
  13. const DWORD PAYLOAD_G711U = 0;
  14. const DWORD PAYLOAD_G721 = 2;
  15. const DWORD PAYLOAD_GSM = 3;
  16. const DWORD PAYLOAD_G723 = 4;
  17. const DWORD PAYLOAD_DVI4_8 = 5;
  18. const DWORD PAYLOAD_DVI4_16 = 6;
  19. const DWORD PAYLOAD_G711A = 8;
  20. const DWORD PAYLOAD_MSAUDIO = 66;
  21. const DWORD PAYLOAD_H261 = 31;
  22. const DWORD PAYLOAD_H263 = 34;
  23. const WCHAR gszMSPLoopback[] = L"Loopback";
  24. const WCHAR gszAEC[] = L"AEC";
  25. const WCHAR gszNumVideoCaptureBuffers[] = L"NumVideoCaptureBuffers";
  26. const TCHAR gszSDPMSPKey[] =
  27. _T("Software\\Microsoft\\Windows\\CurrentVersion\\IPConfMSP\\");
  28. BOOL
  29. IsPayloadSupported(IN DWORD dwPT);
  30. HRESULT
  31. FindPin(
  32. IN IBaseFilter * pIFilter,
  33. OUT IPin ** ppIPin,
  34. IN PIN_DIRECTION direction,
  35. IN BOOL bFree = TRUE
  36. );
  37. HRESULT
  38. PinSupportsMediaType(
  39. IN IPin * pIPin,
  40. IN const GUID & MediaType
  41. );
  42. HRESULT
  43. AddFilter(
  44. IN IGraphBuilder * pIGraph,
  45. IN const CLSID & Clsid,
  46. IN LPCWSTR pwstrName,
  47. OUT IBaseFilter ** ppIBaseFilter
  48. );
  49. HRESULT
  50. SetLoopbackOption(
  51. IN IBaseFilter *pIBaseFilter,
  52. IN MULTICAST_LOOPBACK_MODE LoopbackMode
  53. );
  54. HRESULT
  55. SetQOSOption(
  56. IN IBaseFilter * pIBaseFilter,
  57. IN DWORD dwPayloadType,
  58. IN DWORD dwMaxBitRate,
  59. IN BOOL bFailIfNoQOS,
  60. IN BOOL bReceive = FALSE,
  61. IN DWORD dwNumStreams = 1,
  62. IN BOOL bCIF = FALSE
  63. );
  64. HRESULT
  65. ConnectFilters(
  66. IN IGraphBuilder * pIGraph,
  67. IN IBaseFilter * pIFilter1,
  68. IN IBaseFilter * pIFilter2,
  69. IN BOOL fDirect = TRUE,
  70. IN AM_MEDIA_TYPE * pmt = NULL
  71. );
  72. HRESULT
  73. ConnectFilters(
  74. IN IGraphBuilder * pIGraph,
  75. IN IPin * pIPinOutput,
  76. IN IBaseFilter * pIFilter,
  77. IN BOOL fDirect = TRUE,
  78. IN AM_MEDIA_TYPE * pmt = NULL
  79. );
  80. HRESULT
  81. ConnectFilters(
  82. IN IGraphBuilder * pIGraph,
  83. IN IBaseFilter * pIFilter,
  84. IN IPin * pIPinInput,
  85. IN BOOL fDirect = TRUE,
  86. IN AM_MEDIA_TYPE * pmt = NULL
  87. );
  88. HRESULT
  89. EnableRTCPEvents(
  90. IN IBaseFilter *pIBaseFilter
  91. );
  92. void WINAPI MSPDeleteMediaType(AM_MEDIA_TYPE *pmt);
  93. BOOL
  94. GetRegValue(
  95. IN LPCWSTR szName,
  96. OUT DWORD *pdwValue
  97. );
  98. HRESULT
  99. FindACMAudioCodec(
  100. IN DWORD dwPayloadType,
  101. OUT IBaseFilter **ppIBaseFilter
  102. );
  103. HRESULT SetAudioFormat(
  104. IN IUnknown* pIUnknown,
  105. IN WORD wBitPerSample,
  106. IN DWORD dwSampleRate
  107. );
  108. HRESULT SetAudioBufferSize(
  109. IN IUnknown* pIUnknown,
  110. IN DWORD dwNumBuffers,
  111. IN DWORD dwBufferSize
  112. );
  113. template <class T>
  114. HRESULT CreateCComObjectInstance (
  115. CComObject<T> **ppObject
  116. )
  117. /*++
  118. Create a new CComObject instance. Use try/except to catch exception.
  119. --*/
  120. {
  121. HRESULT hr;
  122. __try
  123. {
  124. hr = CComObject<T>::CreateInstance(ppObject);
  125. }
  126. __except (EXCEPTION_EXECUTE_HANDLER)
  127. {
  128. *ppObject = NULL;
  129. return E_OUTOFMEMORY;
  130. }
  131. return hr;
  132. }
  133. inline DWORD FindSampleRate(AM_MEDIA_TYPE *pMediaType)
  134. {
  135. _ASSERT(!IsBadReadPtr(pMediaType, sizeof(AM_MEDIA_TYPE)));
  136. if (pMediaType->majortype == MEDIATYPE_Audio &&
  137. pMediaType->formattype == FORMAT_WaveFormatEx &&
  138. pMediaType->pbFormat != NULL &&
  139. pMediaType->cbFormat != 0)
  140. {
  141. WAVEFORMATEX *pWaveFormatEx = (WAVEFORMATEX *) pMediaType->pbFormat;
  142. return pWaveFormatEx->nSamplesPerSec;
  143. }
  144. return 90000; // default media clock rate, including video.
  145. }
  146. class ATL_NO_VTABLE CMSPStreamClock :
  147. public CComObjectRootEx<CComMultiThreadModelNoCS>,
  148. public IReferenceClock
  149. {
  150. private:
  151. LONGLONG m_lPerfFrequency;
  152. union {
  153. LONGLONG m_lRtpRefTime;
  154. DWORD m_dwRtpRefTime;
  155. };
  156. public:
  157. BEGIN_COM_MAP(CMSPStreamClock)
  158. COM_INTERFACE_ENTRY(IReferenceClock)
  159. END_COM_MAP()
  160. void InitReferenceTime(void);
  161. HRESULT GetTimeOfDay(OUT REFERENCE_TIME *pTime);
  162. CMSPStreamClock()
  163. {
  164. InitReferenceTime();
  165. }
  166. STDMETHOD (GetTime) (
  167. OUT REFERENCE_TIME *pTime
  168. )
  169. {
  170. return(GetTimeOfDay(pTime));
  171. }
  172. STDMETHOD (AdviseTime) (
  173. IN REFERENCE_TIME baseTime, // base reference time
  174. IN REFERENCE_TIME streamTime, // stream offset time
  175. IN HEVENT hEvent, // advise via this event
  176. OUT DWORD_PTR *pdwAdviseCookie // where your cookie goes
  177. )
  178. {
  179. _ASSERT(!"AdviseTime is called");
  180. return E_NOTIMPL;
  181. }
  182. STDMETHOD (AdvisePeriodic) (
  183. IN REFERENCE_TIME StartTime, // starting at this time
  184. IN REFERENCE_TIME PeriodTime, // time between notifications
  185. IN HSEMAPHORE hSemaphore, // advise via a semaphore
  186. OUT DWORD_PTR *pdwAdviseCookie // where your cookie goes
  187. )
  188. {
  189. _ASSERT(!"AdvisePeriodic is called");
  190. return E_NOTIMPL;
  191. }
  192. STDMETHOD (Unadvise) (
  193. IN DWORD_PTR dwAdviseCookie
  194. )
  195. {
  196. _ASSERT(!"Unadvise is called");
  197. return E_NOTIMPL;
  198. }
  199. };
  200. #endif