扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:智慧的鱼 来源:天极开发 2007年10月16日
关键字:
HRESULT FindFilterInterface( IGraphBuilder *pGraph, // Pointer to the Filter Graph Manager. REFGUID iid, // IID of the interface to retrieve. void **ppUnk) // Receives the interface pointer. { if (!pGraph || !ppUnk) return E_POINTER; HRESULT hr = E_FAIL; IEnumFilters *pEnum = NULL; IBaseFilter *pF = NULL; if (FAILED(pGraph->EnumFilters(&pEnum))) { return E_FAIL; } // Query every filter for the interface. while (S_OK == pEnum->Next(1, &pF, 0)) { hr = pF->QueryInterface(iid, ppUnk); pF->Release(); if (SUCCEEDED(hr)) { break; } } pEnum->Release(); return hr; } |
HRESULT FindPinInterface( IBaseFilter *pFilter, // Pointer to the filter to search. REFGUID iid, // IID of the interface. void **ppUnk) // Receives the interface pointer. { if (!pFilter || !ppUnk) return E_POINTER; HRESULT hr = E_FAIL; IEnumPins *pEnum = 0; if (FAILED(pFilter->EnumPins(&pEnum))) { return E_FAIL; } // Query every pin for the interface. IPin *pPin = 0; while (S_OK == pEnum->Next(1, &pPin, 0)) { hr = pPin->QueryInterface(iid, ppUnk); pPin->Release(); if (SUCCEEDED(hr)) { break; } } pEnum->Release(); return hr; } |
HRESULT FindInterfaceAnywhere( IGraphBuilder *pGraph, REFGUID iid, void **ppUnk) { if (!pGraph || !ppUnk) return E_POINTER; HRESULT hr = E_FAIL; IEnumFilters *pEnum = 0; if (FAILED(pGraph->EnumFilters(&pEnum))) { return E_FAIL; } // Loop through every filter in the graph. IBaseFilter *pF = 0; while (S_OK == pEnum->Next(1, &pF, 0)) { hr = pF->QueryInterface(iid, ppUnk); if (FAILED(hr)) { // The filter does not expose the interface, but maybe // one of its pins does. //调用的是上面的搜索pin的函数 hr = FindPinInterface(pF, iid, ppUnk); } pF->Release(); if (SUCCEEDED(hr)) { break; } } pEnum->Release(); return hr; } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者