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.

211 lines
6.2 KiB

  1. // Copyright (c) 1997 - 1998 Microsoft Corporation. All Rights Reserved.
  2. // MMStream.h : Declaration of the CMMStream
  3. #ifndef __AMMSTRM_H_
  4. #define __AMMSTRM_H_
  5. #define _DEBUG 1
  6. #include "resource.h" // main symbols
  7. #include "atlctl.h"
  8. /////////////////////////////////////////////////////////////////////////////
  9. // CMMStream
  10. class ATL_NO_VTABLE CMMStream :
  11. public CComObjectRootEx<CComMultiThreadModel>,
  12. public CComCoClass<CMMStream, &CLSID_AMMultiMediaStream>,
  13. public IAMMultiMediaStream,
  14. public IDispatchImpl<IDirectShowStream, &IID_IDirectShowStream, &LIBID_DirectShowStreamLib>,
  15. public IPersistPropertyBag,
  16. public IObjectSafety,
  17. public IAMClockAdjust
  18. {
  19. public:
  20. typedef CComObjectRootEx<CComMultiThreadModel> _BaseClass;
  21. CMMStream();
  22. HRESULT FinalConstruct();
  23. ULONG InternalRelease()
  24. {
  25. return CComObjectRootEx<CComMultiThreadModel>::InternalRelease();
  26. }
  27. public:
  28. DECLARE_GET_CONTROLLING_UNKNOWN()
  29. DECLARE_PROTECT_FINAL_CONSTRUCT()
  30. DECLARE_REGISTRY_RESOURCEID(IDR_MMSTREAM)
  31. BEGIN_COM_MAP(CMMStream)
  32. COM_INTERFACE_ENTRY2(IMultiMediaStream, IAMMediaStream)
  33. COM_INTERFACE_ENTRY(IAMMultiMediaStream)
  34. COM_INTERFACE_ENTRY2(IMultiMediaStream, IAMMultiMediaStream)
  35. COM_INTERFACE_ENTRY(IDirectShowStream)
  36. COM_INTERFACE_ENTRY(IDispatch)
  37. COM_INTERFACE_ENTRY(IPersist)
  38. COM_INTERFACE_ENTRY(IPersistPropertyBag)
  39. COM_INTERFACE_ENTRY(IObjectSafety)
  40. COM_INTERFACE_ENTRY(IAMClockAdjust)
  41. END_COM_MAP()
  42. // IAMMMStream
  43. STDMETHODIMP Initialize(
  44. STREAM_TYPE StreamType,
  45. DWORD dwFlags,
  46. IGraphBuilder *pFilterGraph
  47. );
  48. STDMETHODIMP GetFilterGraph(
  49. IGraphBuilder **ppGraphBuilder
  50. );
  51. STDMETHODIMP GetFilter(
  52. IMediaStreamFilter **ppFilter
  53. );
  54. STDMETHODIMP AddMediaStream(
  55. IUnknown *pStreamObject,
  56. const MSPID *pOptionalPurposeId,
  57. DWORD dwFlags,
  58. IMediaStream **ppNewStream
  59. );
  60. STDMETHODIMP OpenFile(
  61. LPCWSTR pszFileName,
  62. DWORD dwFlags
  63. );
  64. STDMETHODIMP OpenMoniker(
  65. IBindCtx *pCtx,
  66. IMoniker *pMoniker,
  67. DWORD dwFlags
  68. );
  69. STDMETHODIMP Render(
  70. DWORD dwFlags
  71. );
  72. // IMultiMediaStream
  73. STDMETHODIMP GetInformation(
  74. DWORD *pdwFlags,
  75. STREAM_TYPE *pStreamType
  76. );
  77. STDMETHODIMP GetMediaStream(
  78. REFMSPID idPurpose,
  79. IMediaStream **ppMediaStream
  80. );
  81. STDMETHODIMP EnumMediaStreams(
  82. long Index,
  83. IMediaStream **ppMediaStream
  84. );
  85. STDMETHODIMP GetState(
  86. STREAM_STATE *pCurrentState
  87. );
  88. STDMETHODIMP SetState(
  89. STREAM_STATE NewState
  90. );
  91. STDMETHODIMP GetTime(
  92. STREAM_TIME *pCurrentTime
  93. );
  94. STDMETHODIMP GetDuration(
  95. STREAM_TIME *pDuration
  96. );
  97. STDMETHODIMP Seek(
  98. STREAM_TIME SeekTime
  99. );
  100. STDMETHODIMP GetEndOfStreamEventHandle(
  101. HANDLE *phEOS
  102. );
  103. // IAMClockAdjust
  104. STDMETHODIMP SetClockDelta(REFERENCE_TIME rtAdjust);
  105. //
  106. // IDirectShowStream
  107. //
  108. STDMETHODIMP get_FileName(BSTR *pVal);
  109. STDMETHODIMP put_FileName(BSTR newVal);
  110. STDMETHODIMP get_Video(OUTPUT_STATE *pVal);
  111. STDMETHODIMP put_Video(OUTPUT_STATE newVal);
  112. STDMETHODIMP get_Audio(OUTPUT_STATE *pVal);
  113. STDMETHODIMP put_Audio(OUTPUT_STATE newVal);
  114. //
  115. // IPersistPropertyBag
  116. //
  117. STDMETHODIMP GetClassID(CLSID *pClsId);
  118. STDMETHODIMP InitNew(void);
  119. STDMETHODIMP Load(IPropertyBag* pPropBag, IErrorLog* pErrorLog);
  120. STDMETHODIMP Save(IPropertyBag* pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties);
  121. //
  122. // IObjectSafety
  123. //
  124. STDMETHODIMP GetInterfaceSafetyOptions(REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions);
  125. STDMETHODIMP SetInterfaceSafetyOptions(REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions);
  126. private:
  127. HRESULT SetStreamState(REFMSPID, OUTPUT_STATE, OUTPUT_STATE *);
  128. HRESULT CompleteOpen(IBaseFilter *pSource, DWORD dwFlags);
  129. HRESULT AddFilter(REFCLSID clsidFilter, IBaseFilter **ppFilter);
  130. HRESULT AddDefaultRenderer(REFMSPID PurposeId, DWORD dwFlags, IMediaStream **ppNewStream);
  131. HRESULT AddAMMediaStream(IAMMediaStream *pAMStream, REFMSPID PurposeId, IMediaStream **ppNewStream);
  132. HRESULT AddDefaultStream(
  133. IUnknown *pStreamObject,
  134. DWORD dwFlags,
  135. REFMSPID PurposeId,
  136. IMediaStream **ppNewStream);
  137. HRESULT GetClsidFromPurposeid(REFMSPID PurposeId, bool bRenderer, CLSID * pclsid);
  138. void CompleteAddGraph();
  139. HRESULT CheckGraph();
  140. void SetSeeking();
  141. private:
  142. /* Be careful of the ordering here
  143. The first one we declare will be released last
  144. */
  145. /* Can't release this in the constructor because this
  146. is what holds the object in place
  147. */
  148. CComPtr<IGraphBuilder> m_pGraphBuilder;
  149. CComPtr<IMediaSeeking> m_pMediaSeeking;
  150. CComPtr<IMediaControl> m_pMediaControl;
  151. CComPtr<IMediaStreamFilter> m_pMediaStreamFilter;
  152. CComPtr<IBaseFilter> m_pBaseFilter;
  153. /* Type of stream we've been initialized to */
  154. STREAM_TYPE m_StreamType;
  155. DWORD m_dwInitializeFlags;
  156. bool m_StreamTypeSet;
  157. bool m_bSeekingSet;
  158. OUTPUT_STATE m_VideoState;
  159. OUTPUT_STATE m_AudioState;
  160. CComBSTR m_bstrFileName;
  161. DWORD m_dwIDispSafety;
  162. DWORD m_dwIPropBagSafety;
  163. /* List of default filters added */
  164. CDynamicArray<IBaseFilter *, CComPtr<IBaseFilter> > m_FilterList;
  165. /* End of stream handle */
  166. HANDLE m_hEOS;
  167. STREAM_STATE m_MMStreamState;
  168. };
  169. #endif //__AMMSTRM_H_