扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:智慧的鱼 来源:天极开发 2007年10月16日
关键字:
HRESULT EnumFilters (IFilterGraph *pGraph) { IEnumFilters *pEnum = NULL; IBaseFilter *pFilter; ULONG cFetched; HRESULT hr = pGraph->EnumFilters(&pEnum); if (FAILED(hr)) return hr; while(pEnum->Next(1, &pFilter, &cFetched) == S_OK) { FILTER_INFO FilterInfo; hr = pFilter->QueryFilterInfo(&FilterInfo); if (FAILED(hr)) { MessageBox(NULL, TEXT("Could not get the filter info"),TEXT("Error"), MB_OK | MB_ICONERROR); continue; // Maybe the next one will work. } #ifdef UNICODE MessageBox(NULL, FilterInfo.achName, TEXT("Filter Name"), MB_OK); #else char szName[MAX_FILTER_NAME]; int cch = WideCharToMultiByte(CP_ACP, 0, FilterInfo.achName,MAX_FILTER_NAME, szName, MAX_FILTER_NAME, 0, 0); if (chh > 0) MessageBox(NULL, szName, TEXT("Filter Name"), MB_OK); #endif // The FILTER_INFO structure holds a pointer to the Filter Graph // Manager, with a reference count that must be released. if (FilterInfo.pGraph != NULL) { FilterInfo.pGraph->Release(); } pFilter->Release(); } pEnum->Release(); return S_OK; } |
HRESULT GetPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir, IPin **ppPin) { IEnumPins *pEnum = NULL; IPin *pPin = NULL; HRESULT hr; if (ppPin == NULL) { return E_POINTER; } hr = pFilter->EnumPins(&pEnum); if (FAILED(hr)) { return hr; } while(pEnum->Next(1, &pPin, 0) == S_OK) { PIN_DIRECTION PinDirThis; hr = pPin->QueryDirection(&PinDirThis); if (FAILED(hr)) { pPin->Release(); pEnum->Release(); return hr; } if (PinDir == PinDirThis) //如果类型符合 { // Found a match. Return the IPin pointer to the caller. **ppPin = pPin; pEnum->Release(); return S_OK; } // Release the pin for the next time through the loop. pPin->Release(); } // No more pins. We did not find a match. pEnum->Release(); return E_FAIL; } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者