本文以一个Transform Filter为例,一步步整理Transform Filter一般开发步骤。
本文的Filter名为GrayFilter,把YUV视频信号转化为灰度信号,造成黑白电视的效果。
1. 配置开发环境
1. VC中在Tools->Options->Directories 设置好DirectX SDK的头文件和库文件路径
2. 编译了基类源码,生成strmbasd.lib (debug版), strmbase.lib(release版)
3. VC向导新建一个win32 DLL工程
4. Setting->Link->Output file name: GrayFilter.ax
5. Setting->Link加入strmbasd.lib winmm.lib quartz.lib vfw32.lib
6. 定义一个同名.def文件,加入到工程,内容如下:
LIBRARY GrayFilter.ax
EXPORTS
DllMain PRIVATE
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
7. 定义DLL的入口函数及注册
extern
"
C
"
BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
... {
return DllEntryPoint((HINSTANCE)(hModule), ul_reason_for_call, lpReserved);
}
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
... {
return DllEntryPoint((HINSTANCE)(hModule), ul_reason_for_call, lpReserved);
}