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.

424 lines
10 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. Confvid.h
  5. Abstract:
  6. Definitions for audio streams
  7. Author:
  8. Mu Han (muhan) 15-September-1998
  9. --*/
  10. #ifndef __CONFVID_H_
  11. #define __CONFVID_H_
  12. // if there is no data for five senconds, the pin can be reused.
  13. const DWORD g_dwVideoPinTimeOut = 5000;
  14. const DWORD g_dwVideoThreadPriority = THREAD_PRIORITY_NORMAL;
  15. const DWORD g_dwVideoChannels = 20;
  16. const BOOL g_fCIF = FALSE;
  17. const DWORD g_dwVideoSampleRate = 7;
  18. const int CIFWIDTH = 0x160;
  19. const int CIFHEIGHT = 0x120;
  20. const int QCIFWIDTH = 0xb0;
  21. const int QCIFHEIGHT = 0x90;
  22. const DWORD LAYERID = 0;
  23. typedef struct _PINMAPEVENT
  24. {
  25. IPin * pIPin;
  26. DWORD dwSSRC;
  27. } PINMAPEVENT;
  28. // This data structure keeps the information for on brach of filters off one
  29. // demux output pin.
  30. typedef struct _BRANCH
  31. {
  32. IPin * pIPin;
  33. DWORD dwSSRC;
  34. IBaseFilter * pCodecFilter;
  35. ITTerminal * pITTerminal;
  36. ITSubStream * pITSubStream;
  37. IBitrateControl *pBitrateControl;
  38. } BRANCH;
  39. class ATL_NO_VTABLE CStreamVideoRecv :
  40. public CIPConfMSPStream,
  41. public IDispatchImpl<ITSubStreamControl,
  42. &__uuidof(ITSubStreamControl), &LIBID_TAPI3Lib>,
  43. public IDispatchImpl<ITParticipantSubStreamControl,
  44. &__uuidof(ITParticipantSubStreamControl), &LIBID_IPConfMSPLib>
  45. {
  46. public:
  47. CStreamVideoRecv();
  48. BEGIN_COM_MAP(CStreamVideoRecv)
  49. COM_INTERFACE_ENTRY(ITSubStreamControl)
  50. COM_INTERFACE_ENTRY(ITParticipantSubStreamControl)
  51. COM_INTERFACE_ENTRY2(IDispatch, ITStream)
  52. COM_INTERFACE_ENTRY_CHAIN(CIPConfMSPStream)
  53. END_COM_MAP()
  54. // ITStream
  55. STDMETHOD (StopStream) ();
  56. // ITSubStreamControl methods, called by the app.
  57. STDMETHOD (CreateSubStream) (
  58. IN OUT ITSubStream ** ppSubStream
  59. );
  60. STDMETHOD (RemoveSubStream) (
  61. IN ITSubStream * pSubStream
  62. );
  63. STDMETHOD (EnumerateSubStreams) (
  64. OUT IEnumSubStream ** ppEnumSubStream
  65. );
  66. STDMETHOD (get_SubStreams) (
  67. OUT VARIANT * pSubStreams
  68. );
  69. // ITParticipantSubStreamControl methods, called by the app.
  70. STDMETHOD (get_SubStreamFromParticipant) (
  71. IN ITParticipant * pITParticipant,
  72. OUT ITSubStream ** ppITSubStream
  73. );
  74. STDMETHOD (get_ParticipantFromSubStream) (
  75. IN ITSubStream * pITSubStream,
  76. OUT ITParticipant ** ppITParticipant
  77. );
  78. STDMETHOD (SwitchTerminalToSubStream) (
  79. IN ITTerminal * pITTerminal,
  80. IN ITSubStream * pITSubStream
  81. );
  82. // method called by the MSPCall object.
  83. virtual HRESULT Init(
  84. IN HANDLE hAddress,
  85. IN CMSPCallBase * pMSPCall,
  86. IN IMediaEvent * pGraph,
  87. IN DWORD dwMediaType,
  88. IN TERMINAL_DIRECTION Direction
  89. );
  90. HRESULT SubStreamSelectTerminal(
  91. IN ITSubStream * pITSubStream,
  92. IN ITTerminal * pITTerminal
  93. );
  94. //
  95. // ITStreamQualityControl methods
  96. //
  97. STDMETHOD (Set) (
  98. IN StreamQualityProperty Property,
  99. IN long lValue,
  100. IN TAPIControlFlags lFlags
  101. );
  102. //
  103. //IInnerStreamQualityControl methods
  104. //
  105. STDMETHOD (Get) (
  106. IN InnerStreamQualityProperty property,
  107. OUT LONG *plValue,
  108. OUT TAPIControlFlags *plFlags
  109. );
  110. // method called by quality controller
  111. INT GetSubStreamCount () { return m_SubStreams.GetSize (); }
  112. protected:
  113. HRESULT CheckTerminalTypeAndDirection(
  114. IN ITTerminal * pTerminal
  115. );
  116. HRESULT ShutDown();
  117. HRESULT SetUpFilters();
  118. HRESULT SetUpInternalFilters();
  119. HRESULT ConnectTerminal(
  120. IN ITTerminal * pITTerminal
  121. );
  122. HRESULT DisconnectTerminal(
  123. IN ITTerminal * pITTerminal
  124. );
  125. HRESULT ConfigureRTPFormats(
  126. IN IBaseFilter * pIRTPFilter,
  127. IN IStreamConfig * pIStreamConfig
  128. );
  129. HRESULT InternalCreateSubStream(
  130. OUT ITSubStream ** ppITSubStream
  131. );
  132. HRESULT ProcessTalkingEvent(
  133. IN DWORD dwSSRC
  134. );
  135. HRESULT ProcessSilentEvent(
  136. IN DWORD dwSSRC
  137. );
  138. HRESULT ProcessPinMappedEvent(
  139. IN DWORD dwSSRC,
  140. IN IPin * pIPin
  141. );
  142. HRESULT ProcessPinUnmapEvent(
  143. IN DWORD dwSSRC,
  144. IN IPin * pIPin
  145. );
  146. HRESULT ProcessParticipantLeave(
  147. IN DWORD dwSSRC
  148. );
  149. HRESULT NewParticipantPostProcess(
  150. IN DWORD dwSSRC,
  151. IN ITParticipant *pITParticipant
  152. );
  153. HRESULT AddOneBranch(
  154. BRANCH * pBranch,
  155. BOOL fFirstBranch,
  156. BOOL fDirectRTP
  157. );
  158. HRESULT RemoveOneBranch(
  159. BRANCH * pBranch
  160. );
  161. HRESULT ConnectPinToTerminal(
  162. IN IPin * pOutputPin,
  163. IN ITTerminal * pITTerminal
  164. );
  165. protected:
  166. CMSPArray <ITSubStream *> m_SubStreams;
  167. // This array store information about all the branches off the demux
  168. CMSPArray <BRANCH> m_Branches;
  169. CMSPArray <PINMAPEVENT> m_PinMappedEvents;
  170. };
  171. class ATL_NO_VTABLE CStreamVideoSend :
  172. public CIPConfMSPStream
  173. {
  174. BEGIN_COM_MAP(CStreamVideoSend)
  175. COM_INTERFACE_ENTRY_CHAIN(CIPConfMSPStream)
  176. END_COM_MAP()
  177. public:
  178. CStreamVideoSend();
  179. ~CStreamVideoSend();
  180. HRESULT ShutDown ();
  181. //
  182. //IInnerStreamQualityControl methods
  183. //
  184. STDMETHOD (GetRange) (
  185. IN InnerStreamQualityProperty property,
  186. OUT LONG *plMin,
  187. OUT LONG *plMax,
  188. OUT LONG *plSteppingDelta,
  189. OUT LONG *plDefault,
  190. OUT TAPIControlFlags *plFlags
  191. );
  192. STDMETHOD (Get) (
  193. IN InnerStreamQualityProperty property,
  194. OUT LONG *plValue,
  195. OUT TAPIControlFlags *plFlags
  196. );
  197. STDMETHOD (Set) (
  198. IN InnerStreamQualityProperty property,
  199. IN LONG lValue,
  200. IN TAPIControlFlags lFlags
  201. );
  202. protected:
  203. HRESULT CheckTerminalTypeAndDirection(
  204. IN ITTerminal * pTerminal
  205. );
  206. HRESULT SetUpFilters();
  207. HRESULT GetVideoCapturePins(
  208. IN ITTerminalControl* pTerminal,
  209. OUT BOOL *pfDirectRTP
  210. );
  211. HRESULT ConnectCaptureTerminal(
  212. IN ITTerminal * pITTerminal
  213. );
  214. HRESULT ConnectPreviewTerminal(
  215. IN ITTerminal * pITTerminal
  216. );
  217. HRESULT ConnectTerminal(
  218. IN ITTerminal * pITTerminal
  219. );
  220. HRESULT DisconnectTerminal(
  221. IN ITTerminal * pITTerminal
  222. );
  223. HRESULT CreateSendFilters(
  224. IN IPin *pCapturePin,
  225. IN IPin *pRTPPin,
  226. IN BOOL fDirectRTP
  227. );
  228. HRESULT FindPreviewInputPin(
  229. IN ITTerminalControl* pTerminal,
  230. OUT IPin ** ppIpin
  231. );
  232. HRESULT ConnectRTPFilter(
  233. IN IGraphBuilder *pIGraphBuilder,
  234. IN IPin *pCapturePin,
  235. IN IPin *pRTPPin,
  236. IN IBaseFilter *pRTPFilter
  237. );
  238. HRESULT ConfigureRTPFormats(
  239. IN IBaseFilter * pIRTPFilter,
  240. IN IStreamConfig * pIStreamConfig
  241. );
  242. void CleanupCachedInterface();
  243. protected:
  244. DWORD m_dwFrameRate;
  245. ITTerminal * m_pCaptureTerminal;
  246. ITTerminal * m_pPreviewTerminal;
  247. IBaseFilter * m_pCaptureFilter;
  248. IPin * m_pCapturePin;
  249. IFrameRateControl * m_pCaptureFrameRateControl;
  250. IBitrateControl * m_pCaptureBitrateControl;
  251. IPin * m_pPreviewPin;
  252. IFrameRateControl * m_pPreviewFrameRateControl;
  253. IPin * m_pRTPPin;
  254. };
  255. class ATL_NO_VTABLE CSubStreamVideoRecv :
  256. public CComObjectRootEx<CComMultiThreadModelNoCS>,
  257. public IDispatchImpl<ITSubStream, &__uuidof(ITSubStream), &LIBID_IPConfMSPLib>,
  258. public CMSPObjectSafetyImpl
  259. {
  260. public:
  261. BEGIN_COM_MAP(CSubStreamVideoRecv)
  262. COM_INTERFACE_ENTRY(IDispatch)
  263. COM_INTERFACE_ENTRY(ITSubStream)
  264. COM_INTERFACE_ENTRY(IObjectSafety)
  265. COM_INTERFACE_ENTRY_AGGREGATE(__uuidof(IMarshal), m_pFTM)
  266. END_COM_MAP()
  267. DECLARE_GET_CONTROLLING_UNKNOWN()
  268. #ifdef DEBUG_REFCOUNT
  269. ULONG InternalAddRef();
  270. ULONG InternalRelease();
  271. #endif
  272. CSubStreamVideoRecv();
  273. // methods of the CComObject
  274. virtual void FinalRelease();
  275. // ITSubStream methods, called by the app.
  276. STDMETHOD (SelectTerminal) (
  277. IN ITTerminal * pTerminal
  278. );
  279. STDMETHOD (UnselectTerminal) (
  280. IN ITTerminal * pTerminal
  281. );
  282. STDMETHOD (EnumerateTerminals) (
  283. OUT IEnumTerminal ** ppEnumTerminal
  284. );
  285. STDMETHOD (get_Terminals) (
  286. OUT VARIANT * pTerminals
  287. );
  288. STDMETHOD (get_Stream) (
  289. OUT ITStream ** ppITStream
  290. );
  291. STDMETHOD (StartSubStream) ();
  292. STDMETHOD (PauseSubStream) ();
  293. STDMETHOD (StopSubStream) ();
  294. // methods called by the videorecv object.
  295. virtual HRESULT Init(
  296. IN CStreamVideoRecv * pStream
  297. );
  298. BOOL GetCurrentParticipant(
  299. DWORD *pdwSSRC,
  300. ITParticipant ** ppParticipant
  301. );
  302. VOID SetCurrentParticipant(
  303. DWORD dwSSRC,
  304. ITParticipant * pParticipant
  305. );
  306. BOOL ClearCurrentTerminal();
  307. BOOL SetCurrentTerminal(ITTerminal * pTerminal);
  308. protected:
  309. // Pointer to the free threaded marshaler.
  310. IUnknown * m_pFTM;
  311. // The list of terminal objects in the substream.
  312. CMSPArray <ITTerminal *> m_Terminals;
  313. // The lock that protects the substream object. The stream object
  314. // should never acquire the lock and then call a MSPCall method
  315. // that might lock. This is protected by having a const pointer
  316. // to the call object.
  317. CMSPCritSection m_lock;
  318. CStreamVideoRecv * m_pStream;
  319. ITParticipant * m_pCurrentParticipant;
  320. };
  321. #endif