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.

385 lines
10 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. h323Strm.h
  5. Abstract:
  6. Definitions for CH323MSPStream class.
  7. Author:
  8. Mu Han (muhan) 1-November-1997
  9. --*/
  10. #ifndef __CONFSTRM_H
  11. #define __CONFSTRM_H
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CH323MSPStream
  14. /////////////////////////////////////////////////////////////////////////////
  15. // We support at most one codec filters per stream for now.
  16. const DWORD MAX_CODECS = 1;
  17. #ifdef DEBUG_REFCOUNT
  18. extern LONG g_lStreamObjects;
  19. #endif
  20. class CH323MSPStream :
  21. public ISubstreamControl,
  22. public ITFormatControl,
  23. public ITStreamQualityControl,
  24. public IH245SubstreamControl,
  25. public IInnerStreamQualityControl,
  26. public CMSPObjectSafetyImpl,
  27. public CMSPStream
  28. {
  29. BEGIN_COM_MAP(CH323MSPStream)
  30. COM_INTERFACE_ENTRY(ISubstreamControl)
  31. COM_INTERFACE_ENTRY(ITFormatControl)
  32. COM_INTERFACE_ENTRY(ITStreamQualityControl)
  33. COM_INTERFACE_ENTRY(IH245SubstreamControl)
  34. COM_INTERFACE_ENTRY(IInnerStreamQualityControl)
  35. COM_INTERFACE_ENTRY(IObjectSafety)
  36. COM_INTERFACE_ENTRY_CHAIN(CMSPStream)
  37. END_COM_MAP()
  38. public:
  39. //
  40. // ITFormatControl methods
  41. //
  42. STDMETHOD (GetCurrentFormat) (
  43. OUT AM_MEDIA_TYPE **ppMediaType
  44. );
  45. STDMETHOD (ReleaseFormat) (
  46. IN AM_MEDIA_TYPE *pMediaType
  47. );
  48. STDMETHOD (GetNumberOfCapabilities) (
  49. OUT DWORD *pdwCount
  50. );
  51. STDMETHOD (GetStreamCaps) (
  52. IN DWORD dwIndex,
  53. OUT AM_MEDIA_TYPE **ppMediaType,
  54. OUT TAPI_STREAM_CONFIG_CAPS *pStreamConfigCaps,
  55. OUT BOOL *pfEnabled
  56. );
  57. STDMETHOD (ReOrderCapabilities) (
  58. IN DWORD *pdwIndices,
  59. IN BOOL *pfEnabled,
  60. IN BOOL *pfPublicize,
  61. IN DWORD dwNumIndices
  62. );
  63. //
  64. // ITStreamQualityControl methods
  65. //
  66. STDMETHOD (GetRange) (
  67. IN StreamQualityProperty Property,
  68. OUT long *plMin,
  69. OUT long *plMax,
  70. OUT long *plSteppingDelta,
  71. OUT long *plDefault,
  72. OUT TAPIControlFlags *plFlags
  73. );
  74. STDMETHOD (Get) (
  75. IN StreamQualityProperty Property,
  76. OUT long *plValue,
  77. OUT TAPIControlFlags *plFlags
  78. );
  79. STDMETHOD (Set) (
  80. IN StreamQualityProperty Property,
  81. IN long lValue,
  82. IN TAPIControlFlags lFlags
  83. );
  84. //
  85. // ISubstreamControl methods.
  86. //
  87. STDMETHOD (SC_SetFormat) (
  88. IN AM_MEDIA_TYPE *pMediaType,
  89. IN DWORD dwFormatID,
  90. IN DWORD dwPayloadType
  91. );
  92. STDMETHOD (SC_Start) (BOOL fRequestedByApplication);
  93. STDMETHOD (SC_Stop) (BOOL fRequestedByApplication);
  94. STDMETHOD (SC_Pause) (VOID);
  95. STDMETHOD (SC_SetBitrate) (
  96. IN DWORD dwBitsPerSecond
  97. );
  98. STDMETHOD (SC_RemoteTemporalSpatialTradeoff) (
  99. IN USHORT uTSRemoteValue
  100. );
  101. STDMETHOD (SC_CreateSubstream) (
  102. OUT ISubstreamControl *pSubStream
  103. );
  104. STDMETHOD (SC_SetRemoteAddress) (
  105. IN OUT HANDLE * phRTPSession, // handle to the shared RTP session.
  106. IN PSOCKADDR_IN pRemoteMediaAddr,
  107. IN PSOCKADDR_IN pRemoteControlAddr
  108. );
  109. STDMETHOD (SC_SetSource) (
  110. // indicates the low 8 bits of the local SSRC (if this is a send substream)
  111. // or the low 8 bits of the senders SSRC (if this is a receive substream)
  112. IN BYTE bSource
  113. );
  114. STDMETHOD (SC_SelectLocalAddress) (
  115. IN OUT HANDLE * phRTPSession, // handle to the shared RTP session.
  116. IN PSOCKADDR_IN pLocalAddress, // local IP address (same as H.245)
  117. OUT PSOCKADDR_IN pLocalMediaAddress, // NULL if opening TX channel, else we want to know the local RTP receive address
  118. OUT PSOCKADDR_IN pLocalControlAddress // We want to know the local RTCP address
  119. );
  120. STDMETHOD (SC_SetLocalReceiveAddress) ( // only called when the receive address is non-negotiable (e.g. multicast case)
  121. IN OUT HANDLE * phRTPSession, // handle to the shared RTP session.
  122. IN PSOCKADDR_IN pLocalMediaAddr, // local IP address (same as H.245)
  123. IN PSOCKADDR_IN pLocalControlAddress,
  124. IN PSOCKADDR_IN pRemoteControlAddress
  125. );
  126. STDMETHOD (SC_SendDTMF) (
  127. IN LPWSTR pwstrDialChars
  128. );
  129. STDMETHOD (SC_SetDESKey52) (
  130. IN BYTE *pKey
  131. );
  132. STDMETHOD (SC_SelectTerminal) (
  133. IN ITTerminal *pTerminal
  134. );
  135. STDMETHOD (SC_UnselectTerminal) (
  136. IN ITTerminal *pTerminal
  137. );
  138. //
  139. // IH245SubstreamControl
  140. //
  141. STDMETHOD (H245SC_BeginControlSession) (
  142. IN IH245ChannelControl *pIChannelControl
  143. );
  144. STDMETHOD (H245SC_EndControlSession) (VOID);
  145. STDMETHOD (H245SC_GetNumberOfCapabilities) (
  146. OUT DWORD *pdwTemplateCount,
  147. OUT DWORD *pdwFormatCount
  148. );
  149. STDMETHOD (H245SC_GetStreamCaps) (
  150. IN DWORD dwIndex,
  151. OUT const H245MediaCapability** pph245Capability,
  152. OUT AM_MEDIA_TYPE **ppMediaType,
  153. OUT TAPI_STREAM_CONFIG_CAPS *pStreamConfigCaps,
  154. OUT DWORD *pdwUniqueID,
  155. OUT UINT *puResourceBoundArrayEntries,
  156. OUT const FormatResourceBounds **ppResourceBoundArray
  157. );
  158. STDMETHOD (H245SC_RefineStreamCap) (
  159. IN DWORD dwUniqueID,
  160. IN DWORD dwResourceBoundIndex,
  161. IN OUT H245MediaCapability* ph245Capability
  162. );
  163. STDMETHOD (H245SC_SetIDBase) (
  164. IN UINT uNewBase
  165. );
  166. STDMETHOD (H245SC_FindIDByRange) (
  167. IN AM_MEDIA_TYPE *pAMMediaType,
  168. OUT DWORD *pdwUniqueID
  169. );
  170. STDMETHOD (H245SC_FindIDByMode) (
  171. IN H245_MODE_ELEMENT *pModeElement,
  172. OUT DWORD *pdwUniqueID
  173. );
  174. STDMETHOD (H245SC_IntersectFormats) (
  175. IN const H245MediaCapability *pLocalCapability,
  176. IN DWORD dwUniqueID,
  177. IN const H245MediaCapability *pRemoteCapability,
  178. OUT const H245MediaCapability **pIntersectedCapability,
  179. OUT DWORD *pdwPayloadType
  180. );
  181. STDMETHOD (H245SC_GetLocalFormat) (
  182. IN DWORD dwUniqueID,
  183. IN const H245MediaCapability *pIntersectedCapability,
  184. OUT AM_MEDIA_TYPE **ppAMMediaType
  185. );
  186. STDMETHOD (H245SC_ReleaseNegotiatedCapability) (
  187. IN DWORD dwUniqueID,
  188. IN const H245MediaCapability *pIntersectedCapability
  189. );
  190. //
  191. // IInnerStreamQualityControl
  192. //
  193. STDMETHOD (LinkInnerCallQC) (
  194. IN IInnerCallQualityControl *pIInnerCallQC
  195. );
  196. STDMETHOD (UnlinkInnerCallQC) (
  197. IN BOOL fByStream
  198. );
  199. STDMETHOD (GetRange) (
  200. IN InnerStreamQualityProperty property,
  201. OUT LONG *plMin,
  202. OUT LONG *plMax,
  203. OUT LONG *plSteppingDelta,
  204. OUT LONG *plDefault,
  205. OUT TAPIControlFlags *plFlags
  206. );
  207. STDMETHOD (Set) (
  208. IN InnerStreamQualityProperty property,
  209. IN LONG lValue1,
  210. IN TAPIControlFlags lFlags
  211. );
  212. STDMETHOD (Get) (
  213. IN InnerStreamQualityProperty property,
  214. OUT LONG *plValue,
  215. OUT TAPIControlFlags *plFlags
  216. );
  217. STDMETHOD (TryLockStream)() { return m_lock.TryLock()?S_OK:S_FALSE; }
  218. STDMETHOD (UnlockStream)() { m_lock.Unlock(); return S_OK; }
  219. STDMETHOD (IsAccessingQC)() { return m_fAccessingQC?S_OK:S_FALSE; }
  220. public:
  221. CH323MSPStream();
  222. #ifdef DEBUG_REFCOUNT
  223. ULONG InternalAddRef();
  224. ULONG InternalRelease();
  225. #endif
  226. // CMSPStream methods.
  227. HRESULT ShutDown ();
  228. // ITStream
  229. STDMETHOD (get_Name) (
  230. OUT BSTR * ppName
  231. );
  232. STDMETHOD (StartStream) ();
  233. STDMETHOD (PauseStream) ();
  234. STDMETHOD (StopStream) ();
  235. STDMETHOD (SelectTerminal)(
  236. IN ITTerminal * pTerminal
  237. );
  238. STDMETHOD (UnselectTerminal)(
  239. IN ITTerminal * pTerminal
  240. );
  241. protected:
  242. virtual HRESULT CheckTerminalTypeAndDirection(
  243. IN ITTerminal * pTerminal
  244. );
  245. virtual HRESULT SendStreamEvent(
  246. IN MSP_CALL_EVENT Event,
  247. IN MSP_CALL_EVENT_CAUSE Cause,
  248. IN HRESULT hrError,
  249. IN ITTerminal * pTerminal
  250. );
  251. virtual HRESULT ConnectTerminal(
  252. IN ITTerminal * pITTerminal
  253. ) = 0;
  254. virtual HRESULT DisconnectTerminal(
  255. IN ITTerminal * pITTerminal
  256. );
  257. virtual HRESULT CleanUpFilters();
  258. HRESULT ProcessGraphEvent(
  259. IN long lEventCode,
  260. IN LONG_PTR lParam1,
  261. IN LONG_PTR lParam2
  262. );
  263. HRESULT EnableQOS(
  264. IN AM_MEDIA_TYPE *pMediaType
  265. );
  266. virtual HRESULT ProcessQOSEvent(
  267. IN long lEventCode
  268. );
  269. virtual HRESULT InitializeH245CapabilityTable();
  270. virtual HRESULT CleanupH245CapabilityTable();
  271. virtual HRESULT AddCodecToTable(IPin *pIPin);
  272. protected:
  273. const WCHAR * m_szName;
  274. // the filter before the terminal.
  275. IBaseFilter * m_pEdgeFilter;
  276. // the RTP filter.
  277. IBaseFilter * m_pRTPFilter;
  278. // used to remember the shared RTP session.
  279. HANDLE m_hRTPSession;
  280. // additional state for the stream
  281. BOOL m_fTimeout;
  282. // Callback interface to the H.245 module.
  283. IH245ChannelControl * m_pChannelControl;
  284. // Callback interface to the quality controller.
  285. CStreamQualityControlRelay * m_pStreamQCRelay;
  286. // capability related members.
  287. DWORD m_dwCapabilityIDBase;
  288. DWORD m_dwNumCodecs;
  289. DWORD m_dwNumH245Caps;
  290. DWORD m_dwTotalVariations;
  291. IStreamConfig * m_StreamConfigInterfaces[MAX_CODECS];
  292. IH245Capability * m_H245Interfaces[MAX_CODECS];
  293. H245MediaCapabilityTable m_H245CapabilityTables[MAX_CODECS];
  294. // flag will be set when stream is accessing quality control methods
  295. // that will in turn lock the stream list lock inside quality control.
  296. BOOL m_fAccessingQC;
  297. };
  298. #endif