www.pudn.com > VirtualVCR-src-v2.6.9.zip > FlowMeter.h


/* 
	Virtual VCR 
    Copyright (C) 2002  Shaun Faulds 
 
    This program is free software; you can redistribute it and/or modify 
    it under the terms of the GNU General Public License as published by 
    the Free Software Foundation; either version 2 of the License, or 
    (at your option) any later version. 
 
    This program is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    GNU General Public License for more details. 
 
    You should have received a copy of the GNU General Public License 
    along with this program; if not, write to the Free Software 
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
 
	Acknowledgments: 
	This application and associated filters are based on the examples 
	from the Microsoft DirectX DirectShow SDK. 
*/ 
 
#ifndef __FLOWMETERFILTER__ 
#define __FLOWMETERFILTER__ 
 
#include "../Common/Filter/iFilterProperties.h" 
 
class CFlowMeter :	public CTransInPlaceFilter, 
					public IFlowMeter, 
					public ISpecifyPropertyPages, 
					public IFilterProperties 
{ 
 
    public: 
 
        static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr); 
 
        DECLARE_IUNKNOWN; 
 
        // Basic COM - used here to reveal our property interface. 
        STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); 
 
		// Method to get/set Data 
		STDMETHODIMP get_FlowData(LONGLONG *FlowData); 
		STDMETHODIMP get_TransformCount(LONGLONG *TransCount); 
		STDMETHODIMP resetALL(); 
		STDMETHODIMP get_SamplesPerSecond(double *data); 
		STDMETHODIMP get_DroppedFrames(LONGLONG *data); 
		STDMETHODIMP get_DroppedFramesList(__int64 *&data); 
 
		// method to get prop pages 
        STDMETHODIMP GetPages(CAUUID *pPages); 
 
		// Properties Setting getting methods 
		STDMETHODIMP get_Prop(char*& data); 
		STDMETHODIMP set_Prop(char* data); 
		STDMETHODIMP get_Version(char *data); 
 
		HRESULT SetMediaType (PIN_DIRECTION direction, const CMediaType* mediaType); 
 
        HRESULT CheckInputType(const CMediaType* mtIn) 
            { UNREFERENCED_PARAMETER(mtIn);  return S_OK; } 
 
//		virtual CBasePin *GetPin( int n ); 
 
    private: 
 
        CFlowMeter(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr); 
 
		HRESULT SetInputMediaType (const CMediaType* mediaType); 
		HRESULT SetOutputMediaType (const CMediaType* mediaType); 
 
		HRESULT Transform(IMediaSample *pSample); 
 
		int MsgBOX(LPTSTR sz,...); 
 
//		virtual HRESULT AlterQuality(Quality q); 
 
		LONGLONG DataCount; 
		LONGLONG Transforms; 
 
		// Counter and timers 
		LARGE_INTEGER frequency; 
		LARGE_INTEGER timerHold; 
		//DWORD timerHold; 
		BOOL timerAvailable; 
		double samplesPerSecond; 
		DWORD prevTicks; 
		LARGE_INTEGER prevPC; 
		BOOL errorShown; 
 
		// Audio Data info 
		int m_SamplesPerSec; 
		int m_BytesPerSample; 
		int m_Channels; 
 
		double overALLSampSec; 
		__int64 dataHOLD; 
		__int64 tranHOLD; 
 
		// Dropped Frame values 
		LONGLONG lastSampleTime; 
		LONGLONG sampleTiming; 
		LONGLONG droppedFrames; 
		LONGLONG sampleSpacing; 
		__int64 droppedFrameList[5000]; 
		int droppedFrameCount; 
 
}; 
 
#endif