本文整理汇总了C++中IFilterGraph::RemoveFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ IFilterGraph::RemoveFilter方法的具体用法?C++ IFilterGraph::RemoveFilter怎么用?C++ IFilterGraph::RemoveFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFilterGraph
的用法示例。
在下文中一共展示了IFilterGraph::RemoveFilter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TryToLoadCorrectionFile
//.........这里部分代码省略.........
ZeroMemory(pszFileNameC, sizeof(WCHAR)*MAX_PATH);
int cch = lstrlenW(pszFileName);
CopyMemory(pszFileNameC, pszFileName, cch*sizeof(WCHAR));
pszFileNameC[cch] = 'c';
IFilterGraph* pFG = GetFilterGraph();
// Search in the graph in case the source filter with correction file already exist
hr = pFG->EnumFilters(&pEnumFilers);
IF_FAIL_BREAK(hr);
while(pEnumFilers->Next(1, &pSrcFilterCorr, 0) == S_OK)
{
HRESULT lhr;
lhr = pSrcFilterCorr->QueryInterface(IID_IFileSourceFilter, (void**)&pFSFCorr);
if(SUCCEEDED(lhr))
{
LPOLESTR pszFileNameCandidate = NULL;
pFSFCorr->GetCurFile(&pszFileNameCandidate, NULL);
if(memcmp(pszFileNameCandidate,pszFileNameC,(cch+1)*sizeof(WCHAR)) == 0)
{
// This is the good file
bSrcFileAlreadyLoaded = TRUE;
if(pszFileNameCandidate != NULL)
{
CoTaskMemFree(pszFileNameCandidate);
}
break;
}
if(pszFileNameCandidate != NULL)
{
CoTaskMemFree(pszFileNameCandidate);
}
}
pSrcFilterCorr->Release();
pSrcFilterCorr = NULL;
}
if(bSrcFileAlreadyLoaded == FALSE)
{
// Create new file source filter
hr = CoCreateInstance(CLSID_AsyncReader,
NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter,
(void**)&pSrcFilterCorr);
IF_FAIL_BREAK(hr);
hr = pFG->AddFilter(pSrcFilterCorr, pszFileNameC);
IF_FAIL_BREAK(hr);
hr = pSrcFilterCorr->QueryInterface(IID_IFileSourceFilter, (void**)&pFSFCorr);
IF_FAIL_BREAK(hr);
hr = pFSFCorr->Load(pszFileNameC, NULL);
IF_FAIL_BREAK(hr);
}
// Get first pin and connect it
hr = pSrcFilterCorr->EnumPins(&pEnum);
IF_FAIL_BREAK(hr);
if(pEnum->Next(1, &pPinNew, 0) == S_OK)
{
hr = pFG->ConnectDirect(pPinNew, m_pInputPinCorr, NULL);
bCorrectionFileLoaded = SUCCEEDED(hr);
}
} while(0);
if((bCorrectionFileLoaded == FALSE) && (pSrcFilterCorr != NULL))
{
IFilterGraph* pFG = GetFilterGraph();
pFG->RemoveFilter(pSrcFilterCorr);
}
// Cleanup
SAFE_RELEASE(pPinNew);
SAFE_RELEASE(pEnum);
SAFE_RELEASE(pEnumFilers);
SAFE_RELEASE(pFSFCorr);
SAFE_RELEASE(pSrcFilterCorr);
if(pszFileName != NULL)
{
CoTaskMemFree(pszFileName);
}
SAFE_RELEASE(pFSF);
SAFE_RELEASE(pPinOutSrc);
#undef IF_FAIL_BREAK
m_bDontTryToLoadCorrectionFileAgain = bCorrectionFileLoaded;
if(bCorrectionFileLoaded)
{
DebugLog("<=== Leaving TryToLoadCorrectionFile successfull 0x%08X", GetCurrentThreadId());
}
else
{
DebugLog("<=== Leaving TryToLoadCorrectionFile FAILED 0x%08X", GetCurrentThreadId());
}
return hr;
}