ScaleFilter.h

Go to the documentation of this file.
00001 
00035 #pragma once
00036 
00037 #include <DirectShow/CustomBaseFilter.h>
00038 
00039 // {60E0821D-9E6C-48f4-8E1C-1B25E67488F8}
00040 static const GUID CLSID_ScaleFilter = 
00041 { 0x60e0821d, 0x9e6c, 0x48f4, { 0x8e, 0x1c, 0x1b, 0x25, 0xe6, 0x74, 0x88, 0xf8 } };
00042 
00043 // {1DE541CE-7FF7-47be-9CE7-055E6C2BD53F}
00044 static const GUID CLSID_ScaleProperties = 
00045 { 0x1de541ce, 0x7ff7, 0x47be, { 0x9c, 0xe7, 0x5, 0x5e, 0x6c, 0x2b, 0xd5, 0x3f } };
00046 
00047 
00048 #ifdef _BUILD_FOR_SHORT
00049 typedef short yuvType;
00050 #else
00051 typedef signed char yuvType ;
00052 #endif
00053 
00054 // Forward declarations
00055 class PicScalerBase;
00056 
00057 class CScaleFilter : public CCustomBaseFilter,
00058                                         public ISpecifyPropertyPages
00059 {
00060 public:
00061         DECLARE_IUNKNOWN;
00062 
00064         CScaleFilter();
00066         ~CScaleFilter();
00067 
00069         static CUnknown * WINAPI CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr); 
00070 
00074         HRESULT SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt);
00075 
00083         HRESULT GetMediaType(int iPosition, CMediaType *pMediaType);
00084 
00086 
00092         HRESULT DecideBufferSize(IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *pProp);
00093 
00098         HRESULT CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut);
00099 
00101         virtual void InitialiseInputTypes();
00102 
00104         virtual void initParameters()
00105         {
00106                 addParameter(TARGET_WIDTH, &m_nOutWidth, 0);
00107                 addParameter(TARGET_HEIGHT, &m_nOutHeight, 0);
00108         }
00109         STDMETHODIMP SetParameter( const char* type, const char* value);
00110 
00111         STDMETHODIMP GetPages(CAUUID *pPages)
00112         {
00113                 if (pPages == NULL) return E_POINTER;
00114                 pPages->cElems = 1;
00115                 pPages->pElems = (GUID*)CoTaskMemAlloc(sizeof(GUID));
00116                 if (pPages->pElems == NULL) 
00117                 {
00118                         return E_OUTOFMEMORY;
00119                 }
00120                 pPages->pElems[0] = CLSID_ScaleProperties;
00121                 return S_OK;
00122         }
00123 
00124         STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv)
00125         {
00126                 if (riid == IID_ISpecifyPropertyPages)
00127                 {
00128                         return GetInterface(static_cast<ISpecifyPropertyPages*>(this), ppv);
00129                 }
00130                 else
00131                 {
00132                         // Call the parent class.
00133                         return CCustomBaseFilter::NonDelegatingQueryInterface(riid, ppv);
00134                 }
00135         }
00136 private:
00142         DWORD ApplyTransform(BYTE* pBufferIn, BYTE* pBufferOut);
00143         
00144         HRESULT RecalculateFilterParameters();
00145 
00147         PicScalerBase* m_pScaler;
00149         double m_nBytesPerPixel;
00150 };

Generated on Fri Mar 13 14:12:38 2009 for RTVC by  doxygen 1.5.3