www.pudn.com > VirtualVCR-src-v2.6.9.zip > VideoCrop.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 __VideoCrop__ 
#define __VideoCrop__ 
 
#include "VideoCropPropData.h" 
#include "../Common/Filter/iFilterProperties.h" 
 
class CVideoCrop : public CTransformFilter, 
		 public IVideoCrop, 
		 public ISpecifyPropertyPages, 
		 public IFilterProperties 
{ 
 
public: 
 
    DECLARE_IUNKNOWN; 
    static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr); 
 
    // Reveals IEZrgb24 and ISpecifyPropertyPages 
    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 get_Data(VideoCropPropData*& data); 
    STDMETHODIMP set_Data(VideoCropPropData*& data); 
 
	// Properties Setting getting methods 
	STDMETHODIMP get_Prop(char*& data); 
	STDMETHODIMP set_Prop(char* data); 
	STDMETHODIMP get_Version(char *data); 
 
    // ISpecifyPropertyPages interface 
    STDMETHODIMP GetPages(CAUUID *pPages); 
 
	//CMediaType outputMediaType; 
 
private: 
 
    // Constructor 
    CVideoCrop(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(); 
 
	// Define a lot of data 
	int input_width; 
	int input_height; 
	int output_width; 
	int output_height; 
 
	int crop_left; 
	int crop_right; 
	int crop_top; 
	int crop_bottom; 
 
	int pixel_length_bytes; 
	BOOL bottom_up; 
 
}; 
 
#endif