有关Filter开发的问题,各位高手救命啊!陆老师,指点一下啊,谢谢!
我买了陆老师的三本书
但是呢,在实际操作中还有有点问题
------------------------------------------------------------------------------------
C:\DXSDK\Samples\C++\DirectShow\Filters\TestFilter\TestFilterL.cpp(26) : error C2512: 'CBaseFilter' : no appropriate default constructor available
C:\DXSDK\Samples\C++\DirectShow\Filters\TestFilter\TestFilterL.cpp(32) : error C2512: 'CBaseFilter' : no appropriate default constructor available
C:\DXSDK\Samples\C++\DirectShow\Filters\TestFilter\TestFilterL.cpp(48) : error C2065: 'pFilter' : undeclared identifier
Error executing cl.exe.
Creating browse info file...
TestFilter.ax - 3 error(s), 0 warning(s)
---------------------------------------------------------------------------------------
我干脆把源代码贴出来 ,请大家指点一下,谢谢谢谢!!
// TestFilterL.cpp: implementation of the CTestFilter class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "TestFilterL.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CTestFilter::CTestFilter()
{
}
CTestFilter::CTestFilter(TCHAR *pName,LPUNKNOWN pUnk,HRESULT *hr)
{
}
CTestFilter::~CTestFilter()
{
}
CUnknown * WINAPI CTestFilter::CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr)
{
// CTestFilter *pFilter = new CTestFilter(NAME("TestFilter"), pUnk, pHr);
// if (pFilter== NULL)
// {
// *pHr = E_OUTOFMEMORY;
// }
return pFilter;
}
========================================================------------------------------------------====================================----------------------------------------
// TestFilter.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "TestFilter.h"
#include "TestFilterL.h"
#include "Streams.h"
#include <initguid.h>
#include <bdaiface.h>
#include <bdatypes.h>
//
// DllRegisterServer
//
// Handles DLL registry
//
STDAPI DllRegisterServer()
{
return AMovieDllRegisterServer2(TRUE);
} // DllRegisterServer
//
// DllUnregisterServer
//
STDAPI DllUnregisterServer()
{
return AMovieDllRegisterServer2(FALSE);
} // DllUnregisterServer
// Setup data
const AMOVIESETUP_FILTER sudTestFilter =
{
&CLSID_TestFilter, // Filter CLSID
L"TestFilter", // String name
MERIT_DO_NOT_USE, // Filter merit
0,
NULL
};
CFactoryTemplate g_Templates[1] =
{
{
L"Test Filter", // Name
&CLSID_TestFilter, // CLSID
CTestFilter::CreateInstance, // Method to create an instance of MyComponent
NULL, // Initialization function
&sudTestFilter // Set-up information (for filters)
}
};
int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
//
// DllEntryPoint
//
extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
};
============================================================================
// TestFilterL.h: interface for the CTestFilter class.
//
//////////////////////////////////////////////////////////////////////
#include <streams.h>
#include "amfilter.h "
#include "initguid.h"
#if !defined(AFX_TESTFILTERL_H__4F5D951A_9829_40A8_B69F_DD12A42D6848__INCLUDED_)
#define AFX_TESTFILTERL_H__4F5D951A_9829_40A8_B69F_DD12A42D6848__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CTestFilter : public CBaseFilter,public CCritSec
{
public:
CTestFilter();
CTestFilter(TCHAR *pName,LPUNKNOWN pUnk,HRESULT *hr);
virtual ~CTestFilter();
static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr);
};
#endif // !defined(AFX_TESTFILTERL_H__4F5D951A_9829_40A8_B69F_DD12A42D6848__INCLUDED_)