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.

341 lines
7.9 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. typedef struct _PINMAPEVENT
  23. {
  24. IPin * pIPin;
  25. DWORD dwSSRC;
  26. } PINMAPEVENT;
  27. // This data structure keeps the information for on brach of filters off one
  28. // demux output pin.
  29. typedef struct _BRANCH
  30. {
  31. IPin * pIPin;
  32. DWORD dwSSRC;
  33. IBaseFilter * pRPHFilter;
  34. IBaseFilter * pCodecFilter;
  35. ITTerminal * pITTerminal;
  36. ITSubStream * pITSubStream;
  37. } BRANCH;
  38. class ATL_NO_VTABLE CStreamVideoRecv :
  39. public CIPConfMSPStream,
  40. public IDispatchImpl<ITSubStreamControl,
  41. &IID_ITSubStreamControl, &LIBID_TAPI3Lib>,
  42. public IDispatchImpl<ITParticipantSubStreamControl,
  43. &IID_ITParticipantSubStreamControl, &LIBID_IPConfMSPLib>
  44. {
  45. public:
  46. CStreamVideoRecv();
  47. BEGIN_COM_MAP(CStreamVideoRecv)
  48. COM_INTERFACE_ENTRY(ITSubStreamControl)
  49. COM_INTERFACE_ENTRY(ITParticipantSubStreamControl)
  50. COM_INTERFACE_ENTRY2(IDispatch, ITStream)
  51. COM_INTERFACE_ENTRY_CHAIN(CIPConfMSPStream)
  52. END_COM_MAP()
  53. // ITSubStreamControl methods, called by the app.
  54. STDMETHOD (CreateSubStream) (
  55. IN OUT ITSubStream ** ppSubStream
  56. );
  57. STDMETHOD (RemoveSubStream) (
  58. IN ITSubStream * pSubStream
  59. );
  60. STDMETHOD (EnumerateSubStreams) (
  61. OUT IEnumSubStream ** ppEnumSubStream
  62. );
  63. STDMETHOD (get_SubStreams) (
  64. OUT VARIANT * pSubStreams
  65. );
  66. // ITParticipantSubStreamControl methods, called by the app.
  67. STDMETHOD (get_SubStreamFromParticipant) (
  68. IN ITParticipant * pITParticipant,
  69. OUT ITSubStream ** ppITSubStream
  70. );
  71. STDMETHOD (get_ParticipantFromSubStream) (
  72. IN ITSubStream * pITSubStream,
  73. OUT ITParticipant ** ppITParticipant
  74. );
  75. STDMETHOD (SwitchTerminalToSubStream) (
  76. IN ITTerminal * pITTerminal,
  77. IN ITSubStream * pITSubStream
  78. );
  79. // method called by the MSPCall object.
  80. virtual HRESULT Init(
  81. IN HANDLE hAddress,
  82. IN CMSPCallBase * pMSPCall,
  83. IN IMediaEvent * pGraph,
  84. IN DWORD dwMediaType,
  85. IN TERMINAL_DIRECTION Direction
  86. );
  87. HRESULT Configure(
  88. IN STREAMSETTINGS &StreamSettings
  89. );
  90. HRESULT SubStreamSelectTerminal(
  91. IN ITSubStream * pITSubStream,
  92. IN ITTerminal * pITTerminal
  93. );
  94. protected:
  95. HRESULT CheckTerminalTypeAndDirection(
  96. IN ITTerminal * pTerminal
  97. );
  98. HRESULT ShutDown();
  99. HRESULT SetUpFilters();
  100. HRESULT SetUpInternalFilters();
  101. HRESULT ConnectTerminal(
  102. IN ITTerminal * pITTerminal
  103. );
  104. HRESULT DisconnectTerminal(
  105. IN ITTerminal * pITTerminal
  106. );
  107. HRESULT ConfigureRTPFilter(
  108. IN IBaseFilter * pIBaseFilter
  109. );
  110. HRESULT InternalCreateSubStream(
  111. OUT ITSubStream ** ppITSubStream
  112. );
  113. HRESULT ProcessPinMappedEvent(
  114. IN IPin * pIPin
  115. );
  116. HRESULT ProcessPinUnmapEvent(
  117. IN IPin * pIPin
  118. );
  119. HRESULT ProcessParticipantLeave(
  120. IN DWORD dwSSRC
  121. );
  122. HRESULT ProcessNewSender(
  123. IN DWORD dwSSRC,
  124. IN ITParticipant *pITParticipant
  125. );
  126. HRESULT NewParticipantPostProcess(
  127. IN DWORD dwSSRC,
  128. IN ITParticipant *pITParticipant
  129. );
  130. HRESULT ProcessGraphEvent(
  131. IN long lEventCode,
  132. IN long lParam1,
  133. IN long lParam2
  134. );
  135. HRESULT AddOneBranch(
  136. BRANCH * pBranch
  137. );
  138. HRESULT RemoveOneBranch(
  139. BRANCH * pBranch
  140. );
  141. HRESULT ConnectCodecToTerminal(
  142. IN IBaseFilter * pCodecFilter,
  143. IN ITTerminal * pITTerminal
  144. );
  145. protected:
  146. IRTPDemuxFilter * m_pIRTPDemux;
  147. CMSPArray <ITSubStream *> m_SubStreams;
  148. // This array store information about all the branches off the demux
  149. CMSPArray <BRANCH> m_Branches;
  150. CMSPArray <PINMAPEVENT> m_PinMappedEvents;
  151. };
  152. class ATL_NO_VTABLE CStreamVideoSend : public CIPConfMSPStream
  153. {
  154. public:
  155. CStreamVideoSend();
  156. HRESULT Configure(
  157. IN STREAMSETTINGS &StreamSettings
  158. );
  159. protected:
  160. HRESULT CheckTerminalTypeAndDirection(
  161. IN ITTerminal * pTerminal
  162. );
  163. HRESULT SetUpFilters();
  164. HRESULT ConnectTerminal(
  165. IN ITTerminal * pITTerminal
  166. );
  167. HRESULT CStreamVideoSend::CreateSendFilters(
  168. IN IPin *pCapturePin
  169. );
  170. HRESULT CStreamVideoSend::ConnectPreview(
  171. IN IPin *pPreviewInputPin
  172. );
  173. HRESULT ConfigureVideoCaptureTerminal(
  174. IN ITTerminalControl* pTerminal,
  175. IN WCHAR * szPinName,
  176. OUT IPin ** ppIPin
  177. );
  178. HRESULT FindPreviewInputPin(
  179. IN ITTerminalControl* pTerminal,
  180. OUT IPin ** ppIpin
  181. );
  182. HRESULT ConfigureRTPFilter(
  183. IN IBaseFilter * pIBaseFilter
  184. );
  185. protected:
  186. DWORD m_dwFrameRate;
  187. };
  188. class ATL_NO_VTABLE CSubStreamVideoRecv :
  189. public CComObjectRootEx<CComMultiThreadModelNoCS>,
  190. public IDispatchImpl<ITSubStream, &IID_ITSubStream, &LIBID_IPConfMSPLib>,
  191. public CMSPObjectSafetyImpl
  192. {
  193. public:
  194. BEGIN_COM_MAP(CSubStreamVideoRecv)
  195. COM_INTERFACE_ENTRY(IDispatch)
  196. COM_INTERFACE_ENTRY(ITSubStream)
  197. COM_INTERFACE_ENTRY(IObjectSafety)
  198. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pFTM)
  199. END_COM_MAP()
  200. DECLARE_GET_CONTROLLING_UNKNOWN()
  201. #ifdef DEBUG_REFCOUNT
  202. ULONG InternalAddRef();
  203. ULONG InternalRelease();
  204. #endif
  205. CSubStreamVideoRecv();
  206. // methods of the CComObject
  207. virtual void FinalRelease();
  208. // ITSubStream methods, called by the app.
  209. STDMETHOD (SelectTerminal) (
  210. IN ITTerminal * pTerminal
  211. );
  212. STDMETHOD (UnselectTerminal) (
  213. IN ITTerminal * pTerminal
  214. );
  215. STDMETHOD (EnumerateTerminals) (
  216. OUT IEnumTerminal ** ppEnumTerminal
  217. );
  218. STDMETHOD (get_Terminals) (
  219. OUT VARIANT * pTerminals
  220. );
  221. STDMETHOD (get_Stream) (
  222. OUT ITStream ** ppITStream
  223. );
  224. STDMETHOD (StartSubStream) ();
  225. STDMETHOD (PauseSubStream) ();
  226. STDMETHOD (StopSubStream) ();
  227. // methods called by the videorecv object.
  228. virtual HRESULT Init(
  229. IN CStreamVideoRecv * pStream
  230. );
  231. BOOL GetCurrentParticipant(
  232. DWORD *pdwSSRC,
  233. ITParticipant ** ppParticipant
  234. );
  235. VOID SetCurrentParticipant(
  236. DWORD dwSSRC,
  237. ITParticipant * pParticipant
  238. );
  239. BOOL ClearCurrentTerminal();
  240. BOOL SetCurrentTerminal(ITTerminal * pTerminal);
  241. protected:
  242. // Pointer to the free threaded marshaler.
  243. IUnknown * m_pFTM;
  244. // The list of terminal objects in the substream.
  245. CMSPArray <ITTerminal *> m_Terminals;
  246. // The lock that protects the substream object. The stream object
  247. // should never acquire the lock and then call a MSPCall method
  248. // that might lock. This is protected by having a const pointer
  249. // to the call object.
  250. CMSPCritSection m_lock;
  251. CStreamVideoRecv * m_pStream;
  252. ITParticipant * m_pCurrentParticipant;
  253. };
  254. #endif