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.

219 lines
6.0 KiB

  1. //
  2. // FPTrack.h
  3. //
  4. #ifndef __FP_TRACK_TERMINAL__
  5. #define __FP_TRACK_TERMINAL__
  6. #include "FPFilter.h"
  7. #include "FPPriv.h"
  8. #include "..\Storage\pbfilter.h"
  9. /////////////////////////////////////////////////////////////////
  10. // Intermediate classes used for DISPID encoding
  11. template <class T>
  12. class ITFileTrackVtblFPT : public ITFileTrack
  13. {
  14. };
  15. //
  16. // CFilePlaybackTrackTerminal
  17. // This is the class that implements a track terminal
  18. //
  19. class CFPTrack :
  20. public IDispatchImpl<ITFileTrackVtblFPT<CFPTrack>, &IID_ITFileTrack, &LIBID_TAPI3Lib>,
  21. public IDispatchImpl<ITMediaControl, &IID_ITMediaControl, &LIBID_TAPI3Lib>,
  22. public ITPluggableTerminalEventSinkRegistration,
  23. public ITPluggableTerminalInitialization,
  24. public ITFPTrackEventSink,
  25. public CMSPObjectSafetyImpl,
  26. public CSingleFilterTerminal
  27. {
  28. public:
  29. // --- Constructor / Destructor ---
  30. CFPTrack();
  31. ~CFPTrack();
  32. public:
  33. // --- Interfaces suppoted ---
  34. BEGIN_COM_MAP(CFPTrack)
  35. COM_INTERFACE_ENTRY2(IDispatch, ITFileTrack)
  36. COM_INTERFACE_ENTRY(ITFileTrack)
  37. COM_INTERFACE_ENTRY(ITFPTrackEventSink)
  38. COM_INTERFACE_ENTRY(ITPluggableTerminalInitialization)
  39. COM_INTERFACE_ENTRY(ITPluggableTerminalEventSinkRegistration)
  40. COM_INTERFACE_ENTRY(IObjectSafety)
  41. COM_INTERFACE_ENTRY_CHAIN(CSingleFilterTerminal)
  42. END_COM_MAP()
  43. public:
  44. // --- IDispatch ---
  45. STDMETHOD(GetIDsOfNames)(REFIID riid,
  46. LPOLESTR* rgszNames,
  47. UINT cNames,
  48. LCID lcid,
  49. DISPID* rgdispid
  50. );
  51. STDMETHOD(Invoke)(DISPID dispidMember,
  52. REFIID riid,
  53. LCID lcid,
  54. WORD wFlags,
  55. DISPPARAMS* pdispparams,
  56. VARIANT* pvarResult,
  57. EXCEPINFO* pexcepinfo,
  58. UINT* puArgErr
  59. );
  60. // --- CBaseTerminal ---
  61. virtual HRESULT AddFiltersToGraph();
  62. virtual DWORD GetSupportedMediaTypes(void)
  63. {
  64. return m_dwMediaType;
  65. }
  66. // --- ITPluggableTerminalInitialization ---
  67. STDMETHOD (InitializeDynamic)(
  68. IN IID iidTerminalClass,
  69. IN DWORD dwMediaType,
  70. IN TERMINAL_DIRECTION Direction,
  71. IN MSP_HANDLE htAddress
  72. );
  73. //
  74. // public methods used by the parent terminal
  75. //
  76. STDMETHOD (SetParent) (
  77. IN ITTerminal* pParent,
  78. OUT LONG *plCurrentRefcount
  79. );
  80. // --- ITFPEventSink ---
  81. //
  82. // a helper method called by pin when it wants to report that it had to stop
  83. //
  84. STDMETHOD (PinSignalsStop)(FT_STATE_EVENT_CAUSE why, HRESULT hrErrorCode);
  85. // --- ITPluggableTerminalEventSinkRegistration ---
  86. STDMETHOD(RegisterSink)(
  87. IN ITPluggableTerminalEventSink *pSink
  88. );
  89. STDMETHOD(UnregisterSink)();
  90. // --- ITFileTrack ---
  91. virtual HRESULT STDMETHODCALLTYPE get_Format(
  92. OUT AM_MEDIA_TYPE **ppmt
  93. );
  94. virtual HRESULT STDMETHODCALLTYPE put_Format(
  95. IN const AM_MEDIA_TYPE *pmt
  96. );
  97. virtual HRESULT STDMETHODCALLTYPE get_ControllingTerminal(
  98. OUT ITTerminal **ppControllingTerminal
  99. );
  100. STDMETHOD(get_AudioFormatForScripting)(
  101. OUT ITScriptableAudioFormat** ppAudioFormat
  102. );
  103. STDMETHOD(put_AudioFormatForScripting)(
  104. IN ITScriptableAudioFormat* pAudioFormat
  105. );
  106. /*
  107. STDMETHOD(get_VideoFormatForScripting)(
  108. OUT ITScriptableVideoFormat** ppVideoFormat
  109. );
  110. STDMETHOD(put_VideoFormatForScripting)(
  111. IN ITScriptableVideoFormat* pVideoFormat
  112. );
  113. STDMETHOD(get_EmptyVideoFormatForScripting)(
  114. OUT ITScriptableVideoFormat** ppVideoFormat
  115. );
  116. */
  117. STDMETHOD(get_EmptyAudioFormatForScripting)(
  118. OUT ITScriptableAudioFormat** ppAudioFormat
  119. );
  120. // --- ITMediaControl methods ---
  121. virtual HRESULT STDMETHODCALLTYPE Start( void);
  122. virtual HRESULT STDMETHODCALLTYPE Stop( void);
  123. virtual HRESULT STDMETHODCALLTYPE Pause( void);
  124. virtual HRESULT STDMETHODCALLTYPE get_MediaState(
  125. OUT TERMINAL_MEDIA_STATE *pMediaState);
  126. public:
  127. // --- Public methods ---
  128. HRESULT InitializePrivate(
  129. IN DWORD dwMediaType,
  130. IN AM_MEDIA_TYPE* pMediaType,
  131. IN ITTerminal* pParent,
  132. IN ALLOCATOR_PROPERTIES allocprop,
  133. IN IStream* pStream
  134. );
  135. //
  136. // a method used by file playback terminal to fire events
  137. //
  138. HRESULT FireEvent(
  139. TERMINAL_MEDIA_STATE tmsState,
  140. FT_STATE_EVENT_CAUSE ftecEventCause,
  141. HRESULT hrErrorCode
  142. );
  143. //
  144. // need to override these so we can notify the parent of addrefs and releases
  145. //
  146. ULONG InternalAddRef();
  147. ULONG InternalRelease();
  148. private:
  149. // --- Helper methods --
  150. HRESULT SetTerminalInfo();
  151. HRESULT CreateFilter();
  152. HRESULT FindPin();
  153. private:
  154. // --- Members ---
  155. CMSPCritSection m_Lock; // Critical section
  156. DWORD m_dwMediaType; // Media type supported
  157. CFPFilter* m_pFPFilter; // Filter
  158. ITPluggableTerminalEventSink * m_pEventSink; // Fire events to client
  159. ITTerminal* m_pParentTerminal; // Multitrack parent terminal
  160. TERMINAL_MEDIA_STATE m_TrackState; // Terminal state
  161. AM_MEDIA_TYPE* m_pMediaType; // Media type supported
  162. ALLOCATOR_PROPERTIES m_AllocProp; // Allocator properties for the filter
  163. IStream* m_pSource; // Source stream
  164. };
  165. #endif
  166. // eof