www.pudn.com > VirtualVCR-src-v2.6.9.zip > AudioResample.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 __AudioResample__
#define __AudioResample__
#include "../Common/Filter/iFilterProperties.h"
class CAudioResample : public CTransformFilter,
public IAudioResample,
public ISpecifyPropertyPages,
public IFilterProperties
{
public:
DECLARE_IUNKNOWN;
static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
//STDMETHODIMP JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName);
// Overrriden from CTransformFilter base class
HRESULT CheckOutputType (const CMediaType* mediaType);
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);
HRESULT SetMediaType (PIN_DIRECTION direction, const CMediaType* mediaType);
// These implement the custom IIPEffect interface
STDMETHODIMP CAudioResample::get_Percent(double* data);
STDMETHODIMP CAudioResample::set_Percent(double data);
STDMETHODIMP CAudioResample::get_SamplesAdded(__int64* data);
STDMETHODIMP CAudioResample::get_RawTotal(__int64* data);
STDMETHODIMP CAudioResample::get_ActualPercent(double* data);
// Properties Setting getting methods
STDMETHODIMP get_Prop(char*& data);
STDMETHODIMP set_Prop(char* data);
STDMETHODIMP get_Version(char *data);
calculateInterval();
// ISpecifyPropertyPages interface
STDMETHODIMP GetPages(CAUUID *pPages);
CMediaType outputMediaType;
private:
// Constructor
CAudioResample(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr);
// Look after doing the special effect
BOOL CanPerformEZrgb24(const CMediaType *pMediaType) const;
HRESULT Copy(IMediaSample *pSource, IMediaSample *pDest) const;
HRESULT Transform(IMediaSample *pMediaSample);
HRESULT SetInputMediaType (const CMediaType* mediaType);
HRESULT SetOutputMediaType (const CMediaType* mediaType);
HRESULT PrepareOutputSample (IMediaSample* inSample, IMediaSample* outSample);
int MsgBOX(LPTSTR sz,...);
BOOL ReconnectOutputPins();
int m_SamplesPerSec;
int m_BytesPerSample;
int m_Channels;
__int64 totalAdded;
__int64 totalRaw;
double actualPercent;
double percentChange;
double percent;
double carryOverAdd;
BOOL seen;
};
#endif