00001 #pragma once
00002
00003 class CBaseVideoFilter : public CTransformFilter
00004 {
00005 private:
00006 HRESULT Receive(IMediaSample* pIn);
00007 HRESULT ReconnectOutput(int w, int h);
00008
00009
00010 DWORD m_win, m_hin, m_arxin, m_aryin;
00011 DWORD m_wout, m_hout, m_arxout, m_aryout;
00012
00013 protected:
00014 CCritSec m_csReceive;
00015
00016 int m_w, m_h, m_arx, m_ary;
00017
00018 HRESULT GetDeliveryBuffer(int w, int h, IMediaSample** ppOut);
00019 HRESULT CopyBuffer(BYTE* pOut, BYTE* pIn, int w, int h, int pitchIn, const GUID& subtype);
00020 HRESULT CopyBuffer(BYTE* pOut, BYTE** ppIn, int w, int h, int pitchIn, const GUID& subtype);
00021
00022 virtual void GetOutputSize(int& w, int& h, int& arx, int& ary) {}
00023 virtual HRESULT Transform(IMediaSample* pIn) = 0;
00024
00025 public:
00026 CBaseVideoFilter(TCHAR* pName, LPUNKNOWN lpunk, HRESULT* phr, REFCLSID clsid);
00027 virtual ~CBaseVideoFilter();
00028
00029 int GetPinCount();
00030 CBasePin* GetPin(int n);
00031
00032 HRESULT CheckInputType(const CMediaType* mtIn);
00033 HRESULT CheckOutputType(const CMediaType& mtOut);
00034 HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
00035 HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
00036 HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
00037 HRESULT SetMediaType(PIN_DIRECTION dir, const CMediaType* pmt);
00038 };
00039
00040 class CBaseVideoInputAllocator : public CMemAllocator
00041 {
00042 CMediaType m_mt;
00043
00044 public:
00045 CBaseVideoInputAllocator(HRESULT* phr);
00046 void SetMediaType(const CMediaType& mt);
00047 STDMETHODIMP GetBuffer(IMediaSample** ppBuffer, REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime, DWORD dwFlags);
00048 };
00049
00050 class CBaseVideoInputPin : public CTransformInputPin
00051 {
00052 CBaseVideoInputAllocator* m_pAllocator;
00053
00054 public:
00055 CBaseVideoInputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName);
00056 ~CBaseVideoInputPin();
00057
00058 STDMETHODIMP GetAllocator(IMemAllocator** ppAllocator);
00059 STDMETHODIMP ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt);
00060 };
00061
00062 class CBaseVideoOutputPin : public CTransformOutputPin
00063 {
00064 public:
00065 CBaseVideoOutputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName);
00066
00067 HRESULT CheckMediaType(const CMediaType* mtOut);
00068 };