分类: WINDOWS
2007-02-01 09:22:55
转载此文主要是给不用调用*.ax的朋友参考:
http://dev.10026.com/special/multimedia/2005610601_3966553.shtml
陆老师,我直接使用字符叠加例子中的Hqtlystd.ax,但不知道怎么使用。书中也没有说明,
我是这样用的:
#include
#include
#include
#include "CFilterTitleOverlay.h"
int main()
{
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
IGraphBuilder *pGraph=NULL;
HRESULT hr=CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC_SERVER,
IID_IGraphBuilder,(void **)&pGraph);
if(FAILED(hr))
return 0;
hr=pGraph->RenderFile(L"c:\\ado.rm",NULL);
IMediaControl *pMC=NULL;
IMediaEvent *pME=NULL;
IBaseFilter *pF=NULL;
hr=CoCreateInstance(CLSID_HQTitleOverlay,0,CLSCTX_INPROC_SERVER,
IID_IBaseFilter,reinterpret_cast
hr=pGraph->AddFilter(pF,L"HQ Title Overlay Std.");
hr=pGraph->QueryInterface(IID_IMediaControl,((void **)&pMC));
hr=pGraph->QueryInterface(IID_IMediaEvent,((void **)&pME));
OAEVENT oEvent;
hr=pME->GetEventHandle(&oEvent);
//pGraph->AddRef();
hr=pMC->Run();
if(SUCCEEDED(hr))
{
long reCode=0;
hr=pME->WaitForCompletion(40000,&reCode);
}
hr=pGraph->Release();
pMC->Release();
pME->Release();
CoUninitialize();
return 1;
}
Linking...
memfile.obj : error LNK2001: unresolved external symbol _CLSID_HQTitleOverlay
Debug/memfile.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
memfile.exe - 2 error(s), 0 warning(s)
提示没有链接到CLSID_HQTitleOverlay,我把头文件加进来了啊,把
DEFINE_GUID(CLSID_HQTitleOverlay,
0xe3fb4bfe, 0x8e5c, 0x4aec, 0x81, 0x62, 0x7d, 0xa5, 0x5b, 0xe4, 0x86, 0xa1);
加在main也还是一样的提示,先谢谢各位帮助。
牛奶沙漠 [等级:◆(初级)] (信誉值: 100) 回复于: 2005-4-26 11:32:50 Top
Filter源码中有判断创建者是否合法的代码.
把那段修改一下再重新编译就可以了.
爱老婆更爱键盘! [等级:◆(初级)] (信誉值: 100) 回复于: 2005-4-27 15:22:45 Top
THS
牛奶沙漠 [等级:◆(初级)] (信誉值: 100) 回复于: 2005-4-27 16:50:13 Top
^_^
zpk [等级:◆◆◆◆◆(中级)] (信誉值: 100) 回复于: 2005-4-29 9:33:42 Top
filter注册过了吗?
还了你的.rm 文件如果没有第三方解码组件,
可能这个文件也播放不了