www.pudn.com > colortracker.rar > MPColorTrackerFilter.h


//==========================================================================; 
// 
//  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR 
//  PURPOSE. 
// 
//  Copyright (c) 1992 - 1998  Microsoft Corporation.  All Rights Reserved. 
// 
//--------------------------------------------------------------------------; 
#ifndef __MPCOLORTRACKERFILTER_H__ 
#define __MPCOLORTRACKERFILTER_H__ 
 
#include "FilterInterface.h" 
 
class MPColorTrackerFilter 
: public CTransformFilter 
, public IIPEffect 
, public ISpecifyPropertyPages 
, public CPersistStream 
{ 
public: 
 
	DECLARE_IUNKNOWN; 
	static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr); 
 
	// Reveals IEZMPColorTrackerFilter and ISpecifyPropertyPages 
	STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); 
 
	// CPersistStream stuff 
	HRESULT ScribbleToStream(IStream *pStream); 
	HRESULT ReadFromStream(IStream *pStream); 
 
	// Overrriden from CTransformFilter base class 
 
	HRESULT Transform(IMediaSample *pIn, IMediaSample *pOut); 
	HRESULT CheckInputType(const CMediaType *mtIn); 
	HRESULT CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut); 
	HRESULT DecideBufferSize(IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *pProperties); 
	HRESULT GetMediaType(int iPosition, CMediaType *pMediaType); 
 
	virtual HRESULT StartStreaming(); // frame dependent initialization 
	virtual HRESULT StopStreaming(); 
 
	// These implement the custom IIPEffect interface 
 
	STDMETHODIMP get_IPEffect(int *IPEffect); //, REFTIME *StartTime, REFTIME *Length); 
	STDMETHODIMP put_IPEffect(int IPEffect); //, REFTIME StartTime, REFTIME Length); 
 
	// ISpecifyPropertyPages interface 
	STDMETHODIMP GetPages(CAUUID *pPages); 
 
	// CPersistStream override 
	STDMETHODIMP GetClassID(CLSID *pClsid); 
 
private: 
 
	MPColorTrackerFilter(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr);    // Constructor 
	~MPColorTrackerFilter();	// Destructor 
 
	// Look after doing the special effect 
	BOOL CanPerformMPColorTrackerFilter(const CMediaType *pMediaType) const; 
	HRESULT Copy(IMediaSample *pSource, IMediaSample *pDest); 
	HRESULT Transform(IMediaSample *pMediaSample); 
 
	CCritSec	m_MPColorTrackerFilterLock;          // Private play critical section 
	int m_effect;               // Which effect are we processing 
	const long m_lBufferRequest;	// The number of buffers to use 
	int m_imgWidth; 
	int m_imgHeight; 
 
	CRefTime    m_currentTime;      // time of currently executing filter. 
	CRefTime    m_lastValidTime;    // last time something valid was tracked 
	CRefTime    m_resetInterval;    // when this much time passes since last valid 
 
	FilterInterface m_interface; 
 
}; // EZMPColorTrackerFilter 
 
#endif __MPCOLORTRACKERFILTER_H__