www.pudn.com > SourceFilter.rar > Snake.cpp
//------------------------------------------------------------------------------ // File: Snake.cpp // // Desc: Snake DirectShow filter // // Author : Ashok Jaiswal // // Data/Time : September 2004 //------------------------------------------------------------------------------ #include "stdafx.h" #include "fSnake.h" #include#include "Snake.h" // // Setup data for filter registration // const AMOVIESETUP_MEDIATYPE sudPinTypes = { &MEDIATYPE_NULL, // Major CLSID &MEDIASUBTYPE_NULL // Minor type }; const AMOVIESETUP_PIN psudPins[] = { { L"Output", // Pin's string name FALSE, // Is it rendered TRUE, // Is it an output FALSE, // Allowed none FALSE, // Allowed many &CLSID_NULL, // Connects to filter L"Input", // Connects to pin 1, // Number of types &sudPinTypes // Pin type information }, }; const AMOVIESETUP_FILTER sudSnake = { &CLSID_Snake, // CLSID of filter L"Snake Filter", // Filter's name MERIT_DO_NOT_USE, // Filter merit 1, // Number of pins psudPins // Pin information }; // // Object creation template // CFactoryTemplate g_Templates[] = { { L"Snake Filter", &CLSID_Snake, CSnakeFilter::CreateInstance, NULL, &sudSnake }, }; int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]); // // Filter registration functions // HRESULT DllRegisterServer() { return AMovieDllRegisterServer2(TRUE); } HRESULT DllUnregisterServer() { return AMovieDllRegisterServer2(FALSE); } // // Create a new instance of this class // CUnknown *CSnakeFilter::CreateInstance(LPUNKNOWN pUnk, HRESULT *phr) { // DLLEntry does the right thing with the return code and // returned value on failure CUnknown *pUnknown = new CSnakeFilter(pUnk, phr); if (pUnknown == NULL) { *phr = E_OUTOFMEMORY; } return pUnknown; }