00001
00002
00003
00004
00005
00006 #ifndef __TRANSIP__
00007 #define __TRANSIP__
00008
00009 class CTransInPlaceFilter;
00010
00011 class CTransInPlaceInputPin : public CTransformInputPin
00012 {
00013
00014 protected:
00015 CTransInPlaceFilter * const m_pTIPFilter;
00016 BOOL m_bReadOnly;
00017
00018 public:
00019
00020 CTransInPlaceInputPin(
00021 TCHAR *pObjectName,
00022 CTransInPlaceFilter *pFilter,
00023 HRESULT *phr,
00024 LPCWSTR pName);
00025
00026 STDMETHODIMP EnumMediaTypes( IEnumMediaTypes **ppEnum );
00027
00028
00029 HRESULT CheckMediaType(const CMediaType* pmt);
00030
00031
00032 STDMETHODIMP GetAllocator(IMemAllocator ** ppAllocator);
00033
00034
00035
00036 STDMETHODIMP NotifyAllocator(IMemAllocator * pAllocator,
00037 BOOL bReadOnly);
00038
00039 IMemAllocator * PeekAllocator() const
00040 { return m_pAllocator; }
00041
00042
00043 STDMETHODIMP
00044 CTransInPlaceInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES *pProps);
00045
00046 inline const BOOL ReadOnly() { return m_bReadOnly ; }
00047
00048 };
00049
00050 class CTransInPlaceOutputPin : public CTransformOutputPin
00051 {
00052
00053 protected:
00054
00055 CTransInPlaceFilter * const m_pTIPFilter;
00056
00057 public:
00058
00059 CTransInPlaceOutputPin(
00060 TCHAR *pObjectName,
00061 CTransInPlaceFilter *pFilter,
00062 HRESULT *phr,
00063 LPCWSTR pName);
00064
00065 virtual HRESULT DecideAllocator(IMemInputPin * pPin, IMemAllocator ** pAlloc);
00066
00067
00068 STDMETHODIMP EnumMediaTypes( IEnumMediaTypes **ppEnum );
00069
00070
00071 HRESULT CheckMediaType(const CMediaType* pmt);
00072
00073 void SetAllocator(IMemAllocator * pAllocator);
00074
00075 IMemInputPin * ConnectedIMemInputPin()
00076 { return m_pInputPin; }
00077
00078 IMemAllocator * PeekAllocator() const
00079 { return m_pAllocator; }
00080 };
00081
00082 class AM_NOVTABLE CTransInPlaceFilter : public CTransformFilter
00083 {
00084
00085 public:
00086
00087 virtual CBasePin *GetPin(int n);
00088
00089 public:
00090
00091 CTransInPlaceFilter(TCHAR *, LPUNKNOWN, REFCLSID clsid, HRESULT *,
00092 bool bModifiesData = true);
00093 #ifdef UNICODE
00094 CTransInPlaceFilter(CHAR *, LPUNKNOWN, REFCLSID clsid, HRESULT *,
00095 bool bModifiesData = true);
00096 #endif
00097
00098 HRESULT GetMediaType(int iPosition, CMediaType *pMediaType)
00099 { DbgBreak("CTransInPlaceFilter::GetMediaType should never be called");
00100 return E_UNEXPECTED;
00101 }
00102
00103
00104 HRESULT DecideBufferSize(IMemAllocator*, ALLOCATOR_PROPERTIES *);
00105
00106 HRESULT CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut)
00107 {
00108 return S_OK;
00109 };
00110
00111 HRESULT CompleteConnect(PIN_DIRECTION dir,IPin *pReceivePin);
00112
00113 virtual HRESULT Receive(IMediaSample *pSample);
00114
00115 virtual HRESULT Transform(IMediaSample *pSample) PURE;
00116
00117
00118 #ifdef PERF
00119
00120 virtual void RegisterPerfId()
00121 {m_idTransInPlace = MSR_REGISTER(TEXT("TransInPlace"));}
00122 #endif
00123
00124 protected:
00125
00126 IMediaSample * CTransInPlaceFilter::Copy(IMediaSample *pSource);
00127
00128 #ifdef PERF
00129 int m_idTransInPlace;
00130 #endif
00131 bool m_bModifiesData;
00132
00133 friend class CTransInPlaceInputPin;
00134 friend class CTransInPlaceOutputPin;
00135
00136 CTransInPlaceInputPin *InputPin() const
00137 {
00138 return (CTransInPlaceInputPin *)m_pInput;
00139 };
00140 CTransInPlaceOutputPin *OutputPin() const
00141 {
00142 return (CTransInPlaceOutputPin *)m_pOutput;
00143 };
00144
00145
00146 BOOL TypesMatch()
00147 {
00148 return InputPin()->CurrentMediaType() ==
00149 OutputPin()->CurrentMediaType();
00150 }
00151
00152
00153 BOOL UsingDifferentAllocators() const
00154 {
00155 return InputPin()->PeekAllocator() != OutputPin()->PeekAllocator();
00156 }
00157 };
00158
00159 #endif
00160