本文整理汇总了C++中IEnumFilters::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ IEnumFilters::Reset方法的具体用法?C++ IEnumFilters::Reset怎么用?C++ IEnumFilters::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEnumFilters
的用法示例。
在下文中一共展示了IEnumFilters::Reset方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
示例2: RemoveAllFilter
HRESULT RemoveAllFilter(IFilterGraph* filterGraph, const std::vector<IBaseFilter*> &exceptList)
{
HRESULT hr;
IEnumFilters *enumFilters;
hr = filterGraph->EnumFilters(&enumFilters);
if (FAILED(hr))
{
ErrorPrint("Get enum filters error",hr);
return hr;
}
ComReleaser enumFilterReleaser(enumFilters);
IBaseFilter* filter;
while (S_OK == enumFilters->Next(1, &filter, NULL))
{
ComReleaser filterReleaser(filter);
if(std::find(exceptList.begin(), exceptList.end() , filter) == exceptList.end())
{
filterGraph->RemoveFilter(filter);
enumFilters->Reset();
}
}
return S_OK;
}
示例3: 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();
}
示例4: 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
}
示例5: 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;
}
示例6: DemolishGraphFilters
HRESULT __fastcall DemolishGraphFilters(IGraphBuilder *pFilterGraph)
{
HRESULT hr = S_OK;
IEnumFilters* pEnum = NULL;
if(!pFilterGraph)
return E_POINTER;
hr = pFilterGraph->EnumFilters(&pEnum);
if(SUCCEEDED(hr))
{
IBaseFilter *pFilter=NULL;
while(S_OK == pEnum->Next(1, &pFilter, NULL))
{
RemoveAndDeleteFilter(pFilterGraph, &pFilter);
pEnum->Reset(); //it is need because enumerator go confused
//after any "RemoveAndDeleteFilter" call
}
pEnum->Release();
}
return hr;
}
示例7: cleanUp
void cleanUp(IGraphBuilder** pGraphBuilder)
{
IMediaControl* pMediaControl;
vector<IBaseFilter*> filts;
IEnumFilters* filterList;
IBaseFilter* filt;
_RPT0(_CRT_WARN,"Releasing... \n");
if (SUCCEEDED((*pGraphBuilder)->EnumFilters(&filterList)))
{
filterList->Reset();
while (filterList->Next(1, &filt, NULL) == S_OK) filts.add(filt);
filterList->Release();
}
for (int i=0;i<filts.size();i++)
{
#ifdef _DEBUG
FILTER_INFO info;
filts.at(i)->QueryFilterInfo(&info);
char str[100];
WideCharToMultiByte( CP_ACP, 0, info.achName, -1, str, 100, NULL, NULL );
_RPT1(_CRT_WARN,"Releasing: %s\n",str);
#endif
(*pGraphBuilder)->RemoveFilter(filts.at(i));
filts.at(i)->Release();
}
(*pGraphBuilder)->Release();
(*pGraphBuilder) = NULL;
for (int i=0;i<newlist.size();i++) if (newlist.at(i)) delete [] newlist.at(i);
newlist.clear();
_CrtDumpMemoryLeaks();
}
示例8: Play
//-------------------------------------------------------------------------------------------------
HRESULT classMMPLAYER::Play (LPSTR argName)
{
WCHAR wFileName[MAX_PATH];
HRESULT hr;
IPin *pPin = NULL;
DWORD dwAttr = GetFileAttributes(argName);
if (dwAttr == (DWORD) -1)
return ERROR_FILE_NOT_FOUND;
#ifndef UNICODE
MultiByteToWideChar(CP_ACP, 0, argName, -1, wFileName, MAX_PATH);
#else
lstrcpy(wFileName, argName);
#endif
hr = m_pGraphBuilder->AddSourceFilter(wFileName, wFileName, &m_pSourceNext);
if ( SUCCEEDED(hr) )
{
hr = m_pSourceNext->FindPin(L"Output", &pPin);
}
if ( SUCCEEDED(hr) )
{
hr = m_pMediaControl->Stop();
}
if (SUCCEEDED(hr)) {
IEnumFilters *pFilterEnum = NULL;
IBaseFilter *pFilterTemp = NULL;
if(SUCCEEDED(hr = m_pGraphBuilder->EnumFilters(&pFilterEnum))){
int iFiltCount = 0;
int iPos = 0;
while( S_OK == pFilterEnum->Skip(1)){
iFiltCount++;
}
IBaseFilter **ppFilters = reinterpret_cast<IBaseFilter **>(_alloca(sizeof(IBaseFilter *) *iFiltCount));
pFilterEnum->Reset();
while(S_OK == pFilterEnum->Next(1, &(ppFilters[iPos++]), NULL));
SAFE_RELEASE(pFilterEnum);
for(iPos = 0;iPos < iFiltCount; iPos++){
m_pGraphBuilder->RemoveFilter(ppFilters[iPos]);
if(ppFilters[iPos] != m_pSourceCurrent)
{
m_pGraphBuilder->AddFilter(ppFilters[iPos], NULL);
}
SAFE_RELEASE(ppFilters[iPos]);
}
}
}
if ( SUCCEEDED(hr) ) {
hr = m_pGraphBuilder->Render(pPin);
m_pSourceCurrent = m_pSourceNext;
m_pSourceNext = NULL;
}
SAFE_RELEASE(pPin);
if ( SUCCEEDED(hr) ) {
LONGLONG IIPos = 0;
hr = m_pMediaSeeking->SetPositions(&IIPos, AM_SEEKING_AbsolutePositioning,
&IIPos, AM_SEEKING_NoPositioning);
}
if ( SUCCEEDED(hr) ) {
hr = m_pMediaControl->Run();
}
SAFE_RELEASE(m_pSourceCurrent);
return S_OK;
}
示例9: GetFileAttributes
BOOL CMP3Player::OnPlayAudio( TCHAR* szName, BOOL bLooped /*= FALSE */ )
{
//WCHAR wstrFileName[MAX_PATH];
HRESULT hr;
IPin *pPin = NULL;
// Make sure that this file exists
DWORD dwAttr = GetFileAttributes(szName);
if (dwAttr == (DWORD) -1)
{
return FALSE;
}
// OPTIMIZATION OPPORTUNITY
// This will open the file, which is expensive. To optimize, this
// should be done earlier, ideally as soon as we knew this was the
// next file to ensure that the file load doesn't add to the
// filter swapping time & cause a hiccup.
//
// Add the new source filter to the graph. (Graph can still be running)
hr = m_pGraphBuilder->AddSourceFilter(szName,szName, &m_pSourceNext);
// Get the first output pin of the new source filter. Audio sources
// typically have only one output pin, so for most audio cases finding
// any output pin is sufficient.
if (SUCCEEDED(hr)) {
hr = m_pSourceNext->FindPin(L"Output", &pPin);
}
// Stop the graph
if (SUCCEEDED(hr)) {
hr = m_pMediaControl->Stop();
}
// Break all connections on the filters. You can do this by adding
// and removing each filter in the graph
if (SUCCEEDED(hr)) {
IEnumFilters *pFilterEnum = NULL;
if (SUCCEEDED(hr = m_pGraphBuilder->EnumFilters(&pFilterEnum))) {
int iFiltCount = 0;
int iPos = 0;
// Need to know how many filters. If we add/remove filters during the
// enumeration we'll invalidate the enumerator
while (S_OK == pFilterEnum->Skip(1)) {
iFiltCount++;
}
// Allocate space, then pull out all of the
IBaseFilter **ppFilters = reinterpret_cast<IBaseFilter **>
(_alloca(sizeof(IBaseFilter *) * iFiltCount));
pFilterEnum->Reset();
while (S_OK == pFilterEnum->Next(1, &(ppFilters[iPos++]), NULL));
SAFE_RELEASE(pFilterEnum);
for (iPos = 0; iPos < iFiltCount; iPos++) {
m_pGraphBuilder->RemoveFilter(ppFilters[iPos]);
// Put the filter back, unless it is the old source
if (ppFilters[iPos] != m_pSourceCurrent) {
m_pGraphBuilder->AddFilter(ppFilters[iPos], NULL);
}
SAFE_RELEASE(ppFilters[iPos]);
}
}
}
// We have the new ouput pin. Render it
if (SUCCEEDED(hr)) {
hr = m_pGraphBuilder->Render(pPin);
m_pSourceCurrent = m_pSourceNext;
m_pSourceNext = NULL;
}
SAFE_RELEASE(pPin);
SAFE_RELEASE(m_pSourceNext); // In case of errors
// Re-seek the graph to the beginning
if (SUCCEEDED(hr)) {
LONGLONG llPos = 0;
hr = m_pMediaSeeking->SetPositions(&llPos, AM_SEEKING_AbsolutePositioning,
&llPos, AM_SEEKING_NoPositioning);
}
// Start the graph
if (SUCCEEDED(hr)) {
hr = m_pMediaControl->Run();
}
// Release the old source filter.
SAFE_RELEASE(m_pSourceCurrent);
return TRUE;
}
示例10: CoCreateInstance
void
recChannel_t::refresh_channel(bool all)
{
__CONTEXT("recChannel_t::refresh_channel");
pControl->Stop();
#ifdef _WINDOWS
if (fControl)
{
fControl->CWnd::ShowWindow(SW_HIDE);
}
#endif
if (pSource!=NULL)
{
pGraph->RemoveFilter(pSource);
camInfo->setFree(true);
}
// Enumerate the filters in the graph.
IEnumFilters *pEnum = NULL;
int hr = pGraph->EnumFilters(&pEnum);
if (SUCCEEDED(hr))
{
IBaseFilter *pFilter = NULL;
while (S_OK == pEnum->Next(1, &pFilter, NULL))
{
CLSID filterId;
pFilter->GetClassID(&filterId);
if(filterId == CLSID_VideoRenderer ||
filterId == CLSID_VideoMixingRenderer)
{
IVideoWindow *pWindowInfo = NULL;
pFilter->QueryInterface(IID_IVideoWindow, (void **)&pWindowInfo);
pWindowInfo->get_Height(&windowInfo.heigth);
pWindowInfo->get_Left(&windowInfo.left);
pWindowInfo->get_Top(&windowInfo.top);
pWindowInfo->get_Width(&windowInfo.width);
pWindowInfo->put_AutoShow(OAFALSE);
pWindowInfo->put_Visible(OAFALSE);
if (all)
{
pGraph->RemoveFilter(pFilter);
pFilter->Release();
pEnum->Reset();
pWindowInfo->Release();
}
}else{
pGraph->RemoveFilter(pFilter);
pFilter->Release();
pEnum->Reset();
}
}
pEnum->Release();
}
if (all)
{
pGraph->Release();
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&pGraph);
errorCheck(hr);
}
hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
errorCheck(hr);
}
示例11: setWindowGeometry
HRESULT
recChannel_t::map(void)
{
__CONTEXT("recChannel_t::map");
int hr = 0;
IBaseFilter * pFilter = NULL;
IBaseFilter * pFilter2 = NULL;
IPin * pVideoInputPin = NULL;
pControl->StopWhenReady();
mapping = true;
pOutput = camInfo->output;
if (remaped){
//refresh Codec BW before creation
pSender->sampleGrabber->BWController->refreshBW();
pSender->rebind();
hr = pGraph->Render(pOutput);
{
// Enumerate the filters in the graph.
IEnumFilters *pEnum = NULL;
int hr = pGraph->EnumFilters(&pEnum);
if (SUCCEEDED(hr))
{
IBaseFilter *pFilter = NULL;
pEnum->Reset();
while (S_OK == pEnum->Next(1, &pFilter, NULL))
{
CLSID filterId;
pFilter->GetClassID(&filterId);
if(filterId == CLSID_AviSplitter)
{
IEnumPins * pEnumpin = NULL;
hr = pFilter->EnumPins(&pEnumpin);
if (!hr)
{
IPin * pPin = NULL;
pEnumpin->Reset();
while (pEnumpin->Next(1, &pPin, 0) == S_OK)
{
bool break_loop = false;
AM_MEDIA_TYPE * mediaType;
IEnumMediaTypes * enumMedia = NULL;
hr = pPin->EnumMediaTypes(&enumMedia);
if(!hr)
{
enumMedia->Reset();
while(enumMedia->Next(1,&mediaType , NULL) == S_OK)
{
if (mediaType->majortype == MEDIATYPE_Audio)
{
pPin->Disconnect();
pGraph->Render(pPin);
pPin->Release();
break_loop = true;
break;
}
}
enumMedia->Release();
if (break_loop)
break;
}
}
pEnumpin->Release();
}
}
pFilter->Release();
}
pEnum->Release();
}
}
pipeCreated = true;
if (hr)
{
errorCheck(hr);
NOTIFY("[recChannel_t::map]WARNING :: Can't render actual format, restoring default settings...\r\n");
capInfo.heigth = DEFAULT_CAPTURE_HEIGTH;
capInfo.width = DEFAULT_CAPTURE_WIDTH;
ql_t<AM_MEDIA_TYPE *> auxFormats = camInfo->getFormatList();
pSender->SetActualCodec(DEFAULT_CODEC_STR);
}
}
if (fullScreen){
set_full_screen(true);
}else{
hr = setWindowGeometry(windowInfo);
errorCheck(hr);
//.........这里部分代码省略.........
示例12: FindRenderer
HRESULT FindRenderer(IGraphBuilder *pGB, const GUID *mediatype, IBaseFilter **ppFilter)
{
HRESULT hr;
IEnumFilters *pEnum = NULL;
IBaseFilter *pFilter = NULL;
IPin *pPin;
ULONG ulFetched, ulInPins, ulOutPins;
BOOL bFound=FALSE;
// Verify graph builder interface
if (!pGB)
return E_NOINTERFACE;
// Verify that a media type was passed
if (!mediatype)
return E_POINTER;
// Clear the filter pointer in case there is no match
if (ppFilter)
*ppFilter = NULL;
// Get filter enumerator
hr = pGB->EnumFilters(&pEnum);
if (FAILED(hr))
return hr;
pEnum->Reset();
// Enumerate all filters in the graph
while(!bFound && (pEnum->Next(1, &pFilter, &ulFetched) == S_OK))
{
#ifdef DEBUG
// Read filter name for debugging purposes
FILTER_INFO FilterInfo;
TCHAR szName[256];
hr = pFilter->QueryFilterInfo(&FilterInfo);
if (SUCCEEDED(hr))
{
// Show filter name in debugger
#ifdef UNICODE
lstrcpy(szName, FilterInfo.achName);
#else
WideCharToMultiByte(CP_ACP, 0, FilterInfo.achName, -1, szName, 256, 0, 0);
#endif
FilterInfo.pGraph->Release();
}
#endif
// Find a filter with one input and no output pins
hr = CountFilterPins(pFilter, &ulInPins, &ulOutPins);
if (FAILED(hr))
break;
if ((ulInPins == 1) && (ulOutPins == 0))
{
// Get the first pin on the filter
pPin=0;
pPin = GetInPin(pFilter, 0);
// Read this pin's major media type
AM_MEDIA_TYPE type= {0};
hr = pPin->ConnectionMediaType(&type);
if (FAILED(hr))
break;
// Is this pin's media type the requested type?
// If so, then this is the renderer for which we are searching.
// Copy the interface pointer and return.
if (type.majortype == *mediatype)
{
// Found our filter
*ppFilter = pFilter;
bFound = TRUE;;
}
// This is not the renderer, so release the interface.
else
pFilter->Release();
// Delete memory allocated by ConnectionMediaType()
FreeMediaType(type);
}
else
{
// No match, so release the interface
pFilter->Release();
}
}
pEnum->Release();
return hr;
}