本文整理汇总了C++中IEnumFilters::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ IEnumFilters::Release方法的具体用法?C++ IEnumFilters::Release怎么用?C++ IEnumFilters::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEnumFilters
的用法示例。
在下文中一共展示了IEnumFilters::Release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindFilterInterface
//查找Filter上某一个接口,只要找到FilterGraph上某一个Filter有该接口即返回
BOOL FindFilterInterface(IGraphBuilder* pGraphBuilder, REFGUID iid, void** ppUnk)
{
if(!pGraphBuilder || !ppUnk)
return FALSE;
IEnumFilters* pEnumFilter = NULL;
IBaseFilter* pFilter = NULL;
if(FAILED(pGraphBuilder->EnumFilters(&pEnumFilter)))
{
return FALSE;
}
HRESULT hr = E_FAIL;
while(S_OK == pEnumFilter->Next(1,&pFilter,NULL))
{
hr = pFilter->QueryInterface(iid,ppUnk);
pFilter->Release();
if(SUCCEEDED(hr))
{
pEnumFilter->Release();
return TRUE;
}
}
pEnumFilter->Release();
return FALSE;
}
示例2: while
//
// The GraphBuilder interface provides a FindFilterByName() method,
// which provides similar functionality to the method below.
// This local method is provided for educational purposes.
//
IBaseFilter *FindFilterFromName(IGraphBuilder *pGB, LPTSTR szNameToFind)
{
USES_CONVERSION;
HRESULT hr;
IEnumFilters *pEnum = NULL;
IBaseFilter *pFilter = NULL;
ULONG cFetched;
BOOL bFound = FALSE;
// Verify graph builder interface
if (!pGB)
return NULL;
// Get filter enumerator
hr = pGB->EnumFilters(&pEnum);
if (FAILED(hr))
return NULL;
// Enumerate all filters in the graph
while((pEnum->Next(1, &pFilter, &cFetched) == S_OK) && (!bFound))
{
FILTER_INFO FilterInfo;
TCHAR szName[256];
hr = pFilter->QueryFilterInfo(&FilterInfo);
if (FAILED(hr))
{
pFilter->Release();
pEnum->Release();
return NULL;
}
// Compare this filter's name with the one we want
lstrcpy(szName, W2T(FilterInfo.achName));
if (! lstrcmp(szName, szNameToFind))
{
bFound = TRUE;
}
FilterInfo.pGraph->Release();
// If we found the right filter, don't release its interface.
// The caller will use it and release it later.
if (!bFound)
pFilter->Release();
else
break;
}
pEnum->Release();
return (bFound ? pFilter : NULL);
}
示例3: FindFilterInterface
HRESULT CDShowUtility::FindFilterInterface(IGraphBuilder *pGraph, REFGUID iid, void **ppUnk)
{
if (!pGraph || !ppUnk)
{
return E_POINTER;
}
HRESULT hr = E_FAIL;
IEnumFilters *pEnum = NULL;
IBaseFilter *pF = NULL;
if (FAILED(pGraph->EnumFilters(&pEnum)))
{
return E_FAIL;
}
//分别调用 Queryinterface, 枚举filter Graph 中的所有Filter
while (S_OK == pEnum->Next(1, &pF, 0))
{
hr = pF->QueryInterface(iid, ppUnk);
pF->Release();
if (SUCCEEDED(hr))
{
break;
}
}
pEnum->Release();
return hr;
}
示例4: FindFilterInterface
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;
}
示例5: FindInterfaceAnywhere
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.
hr = FindPinInterface(pF, iid, ppUnk);
}
pF->Release();
if (SUCCEEDED(hr))
{
break;
}
}
pEnum->Release();
return hr;
}
示例6: while
/*****************************Public*Routine******************************\
* FindInterfaceFromFilterGraph
*
\**************************************************************************/
HRESULT
CMovie::FindInterfaceFromFilterGraph(
REFIID iid, // interface to look for
LPVOID *lp // place to return interface pointer in
)
{
IEnumFilters* pEF;
IBaseFilter* pFilter;
// Grab an enumerator for the filter graph.
HRESULT hr = m_Fg->EnumFilters(&pEF);
if(FAILED(hr))
{
return hr;
}
// Check out each filter.
while(pEF->Next(1, &pFilter, NULL) == S_OK)
{
hr = pFilter->QueryInterface(iid, lp);
pFilter->Release();
if(SUCCEEDED(hr))
{
break;
}
}
pEF->Release();
return hr;
}
示例7: RemoveAllFilters
//
// Removes any filters in the audio graph - called before rebuilding the audio graph.
//
void CMediaPlayer::RemoveAllFilters()
{
IEnumFilters *enumFilters;
HRESULT hr = _GraphBuilder->EnumFilters(&enumFilters);
if (SUCCEEDED(hr))
{
IBaseFilter *filter = NULL;
hr = enumFilters->Next(1, &filter, NULL);
while (hr == S_OK)
{
//
// Remove the filter from the graph.
//
_GraphBuilder->RemoveFilter(filter);
filter->Release();
//
// Reset the enumeration since we removed the filter (which invalidates the enumeration).
//
enumFilters->Reset();
hr = enumFilters->Next(1, &filter, NULL);
}
enumFilters->Release();
}
}
示例8: FindSubtitleFilter
//
// FindSubtitleFilter
//
// be careful with this method, can cause deadlock with CSync::Stop, so should only be called in Run()
HRESULT CTsReaderFilter::FindSubtitleFilter()
{
if( m_pDVBSubtitle )
{
return S_OK;
}
//LogDebug( "FindSubtitleFilter - start");
IEnumFilters * piEnumFilters = NULL;
if (GetFilterGraph() && SUCCEEDED(GetFilterGraph()->EnumFilters(&piEnumFilters)))
{
IBaseFilter * pFilter;
while (piEnumFilters->Next(1, &pFilter, 0) == NOERROR )
{
FILTER_INFO filterInfo;
if (pFilter->QueryFilterInfo(&filterInfo) == S_OK)
{
if (!wcsicmp(L"MediaPortal DVBSub2", filterInfo.achName))
{
HRESULT fhr = pFilter->QueryInterface( IID_IDVBSubtitle2, ( void**)&m_pDVBSubtitle );
assert( fhr == S_OK);
//LogDebug("Testing that DVBSub2 works");
m_pDVBSubtitle->Test(1);
}
filterInfo.pGraph->Release();
}
pFilter->Release();
pFilter = NULL;
}
piEnumFilters->Release();
}
//LogDebug( "FindSubtitleFilter - End");
return S_OK;
}
示例9: FindSubtitleFilter
HRESULT CBDReaderFilter::FindSubtitleFilter()
{
if (m_pDVBSubtitle)
return S_OK;
HRESULT hr = S_FALSE;
ULONG fetched = 0;
IEnumFilters * piEnumFilters = NULL;
if (GetFilterGraph() && SUCCEEDED(GetFilterGraph()->EnumFilters(&piEnumFilters)))
{
IBaseFilter * pFilter;
while (piEnumFilters->Next(1, &pFilter, &fetched) == NOERROR)
{
FILTER_INFO filterInfo;
if (pFilter->QueryFilterInfo(&filterInfo) == S_OK)
{
if (!wcsicmp(L"MediaPortal DVBSub3", filterInfo.achName))
hr = pFilter->QueryInterface(IID_IDVBSubtitle3, (void**)&m_pDVBSubtitle);
filterInfo.pGraph->Release();
}
pFilter->Release();
pFilter = NULL;
}
piEnumFilters->Release();
}
return hr;
}
示例10: EnumFilters
HRESULT CFilterProp::EnumFilters()
{
if ( !pGB ) return E_FAIL;
HRESULT hr;
IEnumFilters *pEnum = NULL;
IBaseFilter *pFilter = NULL;
ULONG cFetched;
// Clear filters list box
m_ListFilters.ResetContent();
// Get filter enumerator
hr = pGB->EnumFilters(&pEnum);
if (FAILED(hr))
{
m_ListFilters.AddString(TEXT("<ERROR>"));
return hr;
}
// Enumerate all filters in the graph
while(pEnum->Next(1, &pFilter, &cFetched) == S_OK)
{
FILTER_INFO FilterInfo;
TCHAR szName[256];
hr = pFilter->QueryFilterInfo(&FilterInfo);
if (FAILED(hr))
{
m_ListFilters.AddString(TEXT("<ERROR>"));
}
else
{
ISpecifyPropertyPages *pSpecify;
hr = pFilter->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pSpecify);
if (SUCCEEDED(hr))
{
pSpecify->Release();
// Add the filter name to the filters listbox
USES_CONVERSION;
lstrcpy(szName, W2T(FilterInfo.achName));
m_ListFilters.AddString(szName);
}
FilterInfo.pGraph->Release();
}
pFilter->Release();
}
pEnum->Release();
return hr;
}
示例11: UpdateFGFiltersArray
//Обновляет массив m_pFGBaseFilter[], хранящий список фильтров DirectShow в текущем Filter Graph
//Функция Open() вызывает эту функцию автоматически
//Однако, крайне желательно вызывать её повторно перед вызовом функций,
//работающих с m_pFGBaseFilter[] массивом
void CDirectShow::UpdateFGFiltersArray()
{
IEnumFilters *pEnumFilters = NULL;
if (FAILED(m_pGraphBuilder->EnumFilters(&pEnumFilters))) return;
for (m_lCounter = 0; m_lCounter < E_MAX_ARR_SIZE; m_lCounter++)
{
SR(m_pFGBaseFilter[m_lCounter]);
m_pFGBaseFilter[m_lCounter] = NULL;
}
pEnumFilters->Reset();
pEnumFilters->Next(E_MAX_ARR_SIZE, &m_pFGBaseFilter[0], &m_lFGFilCount);
pEnumFilters->Release();
}
示例12: remap
recChannel_t::~recChannel_t(void)
{
__CONTEXT("recChannel_t::~recChannel_t");
IBaseFilter * pFilter = NULL;
if (camInfo->getKind() == TEST)
{
looper->EndThread();
}
unmap();
camList->lookUp(sourceId)->setFree(true);
pControl->Stop();
looper->EndThread();
delete looper;
delete pSender;
remap();
int hr = 0;
// Enumerate the filters in the graph.
IEnumFilters *pEnum = NULL;
hr = pGraph->EnumFilters(&pEnum);
if (SUCCEEDED(hr))
{
IBaseFilter *pFilter = NULL;
while (S_OK == pEnum->Next(1, &pFilter, NULL))
{
pGraph->RemoveFilter(pFilter);
pFilter->Release();
pEnum->Reset();
}
pEnum->Release();
}
pControl->Release();
pEvent->Release();
pGraph->Release();
channelList->remove(getId());
rtpSession->deleteSender (getId(), "Channel deleted");
#ifdef _WINDOWS
EndThread();
TerminateThread(hThread,0);
#endif
}
示例13: AddGraphFiltersToList
HRESULT AddGraphFiltersToList (IGraphBuilder *pGB, CListBox& m_ListFilters)
{
HRESULT hr;
IEnumFilters *pEnum = NULL;
IBaseFilter *pFilter = NULL;
ULONG cFetched;
// Clear filters list box
m_ListFilters.ResetContent();
// Verify graph builder interface
if (!pGB)
return E_NOINTERFACE;
// Get filter enumerator
hr = pGB->EnumFilters(&pEnum);
if (FAILED(hr))
{
m_ListFilters.AddString(TEXT("<ERROR>"));
return hr;
}
// Enumerate all filters in the graph
while(pEnum->Next(1, &pFilter, &cFetched) == S_OK)
{
FILTER_INFO FilterInfo;
TCHAR szName[256];
hr = pFilter->QueryFilterInfo(&FilterInfo);
if (FAILED(hr))
{
m_ListFilters.AddString(TEXT("<ERROR>"));
}
else
{
USES_CONVERSION;
// Add the filter name to the filters listbox
lstrcpy(szName, W2T(FilterInfo.achName));
m_ListFilters.AddString(szName);
// Must release filter graph reference
FilterInfo.pGraph->Release();
}
pFilter->Release();
}
pEnum->Release();
return hr;
}
示例14: destroyGraph
void videoInputCamera::destroyGraph(){
HRESULT hr = NULL;
int FuncRetval=0;
int NumFilters=0;
int i = 0;
while (hr == NOERROR)
{
IEnumFilters * pEnum = 0;
ULONG cFetched;
// We must get the enumerator again every time because removing a filter from the graph
// invalidates the enumerator. We always get only the first filter from each enumerator.
hr = pGraphBuilder->EnumFilters(&pEnum);
//if (FAILED(hr)) { printf("SETUP: pGraph->EnumFilters() failed. \n"); return; }
IBaseFilter * pFilter = NULL;
if (pEnum->Next(1, &pFilter, &cFetched) == S_OK)
{
FILTER_INFO FilterInfo={0};
hr = pFilter->QueryFilterInfo(&FilterInfo);
FilterInfo.pGraph->Release();
int count = 0;
char buffer[255];
memset(buffer, 0, 255 * sizeof(char));
while( FilterInfo.achName[count] != 0x00 )
{
buffer[count] = static_cast<char>(FilterInfo.achName[count]);
count++;
}
//printf("SETUP: removing filter %s...\n", buffer);
hr = pGraphBuilder->RemoveFilter(pFilter);
//if (FAILED(hr)) { printf("SETUP: pGraph->RemoveFilter() failed. \n"); return; }
//printf("SETUP: filter removed %s \n",buffer);
pFilter->Release();
pFilter = NULL;
}
else hr = 1;
pEnum->Release();
pEnum = NULL;
i++;
}
return;
}
示例15: EmptyGraph
void PlaybackControls::EmptyGraph()
{
IEnumFilters *pEnum = NULL;
if (mpGraph)
{
HRESULT hr = mpGraph->EnumFilters(&pEnum);
if (SUCCEEDED(hr))
{
IBaseFilter *pFilter = NULL;
while (S_OK == pEnum->Next(1, &pFilter, NULL))
{
mpGraph->RemoveFilter(pFilter);
pEnum->Reset();
pFilter->Release();
}
pEnum->Release();
}
}
mGraphValid = false;
}