阅读:1923回复:4
关于directShow编程?//After loading the source filter, //retrieve a pointer to the IKsPropertySet, as follows. CoInitialize(NULL); IBaseFilter *pSrcFilter; IKsPropertySet *pIPropertySet; pSrcFilter->QueryInterface( IID_IKsPropertySet,(PVOID *)&pIPropertySet );//???? CoUninitialize(); 这段程序如何理解? 此外我想知道为什么我执行queryinterface时出错(编译通过,运行时报告该内存不能读)?? 是不是因为我没有用CoCreateInstance创建一个IBaseFilter?如果是,该如何创建? 谢谢! |
|
最新喜欢:HuYugu... |
沙发#
发布于:2003-07-08 09:26
因为你的 pSrcFilter 相当于未初始化。你需要用相关API创建一个IBaseFilter。
|
|
|
板凳#
发布于:2003-07-08 18:35
因为你的 pSrcFilter 相当于未初始化。你需要用相关API创建一个IBaseFilter。 请教大虾:具体如何做呢?给个引子吧! :P |
|
|
地板#
发布于:2003-07-10 15:18
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
IID_IGraphBuilder, (void **)&pGraph); // Create the capture graph builder. CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC, IID_ICaptureGraphBuilder2, (void **)&pBuilder); if(pGraph==NULL||pBuilder==NULL) { printf(\"1build base graph error\\n\"); CoUninitialize(); return; } pBuilder->SetFiltergraph(pGraph); // Create the system device enumerator. ICreateDevEnum *pDevEnum = NULL; CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC, IID_ICreateDevEnum, (void **)&pDevEnum); // Create an enumerator for video capture devices. IEnumMoniker *pClassEnum = NULL; pDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pClassEnum, 0); if (pClassEnum->Next(1, &pMoniker, &cFetched) == S_OK) { // Bind the first moniker to a filter object. pMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&pSrc); pMoniker->Release(); } pClassEnum->Release(); pDevEnum->Release(); if(pSrc) { ll_return=pGraph->AddFilter(pSrc, L\"Video Capture\"); if(ll_return==S_OK) { printf(\"add video capture ok\\n\"); } ll_return=pSrc->QueryInterface(IID_IAMCameraControl ,(void**)&pRemote); if(ll_return==S_OK) { printf(\"get camera ok\\n\"); } else { printf(\"get camera false\\n\"); } } [编辑 - 7/10/03 by mike_wang] |
|
地下室#
发布于:2003-10-23 20:53
//After loading the source filter,
//retrieve a pointer to the IKsPropertySet, as follows. CoInitialize(NULL); IBaseFilter* pSrcFilter=NULL; IKsPropertySet* pIPropertySet=NULL; //------------- //....create your pSrcFilter //------------- if(pSrcFilter) { pSrcFilter->QueryInterface( IID_IKsPropertySet,(PVOID *)&pIPropertySet );//???? } CoUninitialize(); |
|