本文整理汇总了C++中IBaseFilter::QueryFilterInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ IBaseFilter::QueryFilterInfo方法的具体用法?C++ IBaseFilter::QueryFilterInfo怎么用?C++ IBaseFilter::QueryFilterInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBaseFilter
的用法示例。
在下文中一共展示了IBaseFilter::QueryFilterInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrintAllFilters
void PrintAllFilters(IFilterGraph* filterGraph)
{
IEnumFilters *enumFilters;
HRESULT hr;
hr = filterGraph->EnumFilters(&enumFilters);
if(FAILED(hr))
{
ErrorPrint("Enum filters error", hr);
return ;
}
ComReleaser enumFiltersReleaser(enumFilters);
std::cout<<"Start print filter graphs:"<<endl;
IBaseFilter* filter;
while (S_OK == enumFilters->Next(1, &filter, NULL))
{
ComReleaser filterReleaser(filter);
FILTER_INFO filterInfo;
filter->QueryFilterInfo(&filterInfo);
char* name = WideCharToChar(filterInfo.achName);
std::cout<<name<<endl;
delete[] name;
}
std::cout<<"Print end"<<endl;
}
示例2: 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;
}
示例3: 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;
}
示例4: show_filters_in_filtergraph
//Show Filter in FilterGpragh
int show_filters_in_filtergraph(IGraphBuilder *pGraph){
printf("Filters in FilterGpragh=======\n");
USES_CONVERSION;
IEnumFilters *pFilterEnum=NULL;
if(FAILED(pGraph->EnumFilters(&pFilterEnum))){
pFilterEnum->Release();
return -1;
}
pFilterEnum->Reset();
IBaseFilter * filter = NULL;
ULONG fetchCount = 0;
//Pin Info
while (SUCCEEDED(pFilterEnum->Next(1, &filter, &fetchCount)) && fetchCount){
if (!filter){
continue;
}
FILTER_INFO FilterInfo;
if (FAILED(filter->QueryFilterInfo(&FilterInfo))){
continue;
}
printf("[%s]\n",W2A(FilterInfo.achName));
filter->Release();
}
pFilterEnum->Release();
printf("==============================\n");
return 0;
}
示例5: QueryFilterInfoReleaseGraph
/* Display filter or pin */
CDisp::CDisp(IUnknown *pUnk)
{
IBaseFilter *pf;
HRESULT hr = pUnk->QueryInterface(IID_IBaseFilter, (void **)&pf);
if(SUCCEEDED(hr))
{
FILTER_INFO fi;
hr = pf->QueryFilterInfo(&fi);
if(SUCCEEDED(hr))
{
QueryFilterInfoReleaseGraph(fi);
m_pString = new TCHAR[lstrlenW(fi.achName) + 1];
if(m_pString)
{
wsprintf(m_pString, TEXT("%ls"), fi.achName);
}
}
pf->Release();
return;
}
IPin *pp;
hr = pUnk->QueryInterface(IID_IPin, (void **)&pp);
if(SUCCEEDED(hr))
{
CDisp::CDisp(pp);
pp->Release();
return;
}
}
示例6: ShowProperties
void CFilterProp::ShowProperties()
{
if ( !pGB ) return;
HRESULT hr;
IBaseFilter *pFilter = NULL;
TCHAR szNameToFind[128];
ISpecifyPropertyPages *pSpecify;
// Read the current filter name from the list box
int nCurSel = m_ListFilters.GetCurSel();
m_ListFilters.GetText(nCurSel, szNameToFind);
// Read the current list box name and find it in the graph
pFilter = FindFilterFromName(szNameToFind);
if (!pFilter)
return;
// Discover if this filter contains a property page
hr = pFilter->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pSpecify);
if (SUCCEEDED(hr))
{
do
{
FILTER_INFO FilterInfo;
hr = pFilter->QueryFilterInfo(&FilterInfo);
if (FAILED(hr))
break;
CAUUID caGUID;
hr = pSpecify->GetPages(&caGUID);
if (FAILED(hr))
break;
pSpecify->Release();
// Display the filter's property page
OleCreatePropertyFrame(
m_hWnd, // Parent window
0, // x (Reserved)
0, // y (Reserved)
FilterInfo.achName, // Caption for the dialog box
1, // Number of filters
(IUnknown **)&pFilter, // Pointer to the filter
caGUID.cElems, // Number of property pages
caGUID.pElems, // Pointer to property page CLSIDs
0, // Locale identifier
0, // Reserved
NULL // Reserved
);
CoTaskMemFree(caGUID.pElems);
FilterInfo.pGraph->Release();
} while(0);
}
pFilter->Release();
}
示例7: 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;
}
示例8: 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);
}
示例9: RegisterDeviceFilter
HRESULT CNetworkProvider::RegisterDeviceFilter(IUnknown* pUnkFilterControl,ULONG* ppvRegisitrationContext) {
RegisterDevice* device;
FILTER_INFO filterinfo;
HRESULT hr;
IBaseFilter* filter;
LOG4CPLUS_INFO(logger,"RegisterDeviceFilter start");
IMpeg2Demultiplexer* demux;
if (m_pNetworkProviderPin->GetConnected() != NULL){
hr = m_pNetworkProviderPin->CreateOutputPin(m_pNetworkProviderPin->GetConnected());
}
CAutoLock lock(&m_Lock);
if (pUnkFilterControl == NULL){
return E_POINTER;
}
if (&ppvRegisitrationContext == NULL ){
return E_POINTER;
}
hr = pUnkFilterControl->QueryInterface(IID_IBaseFilter, (void**) &filter);
if (hr != S_OK ){
return S_FALSE;
}
hr = filter->QueryFilterInfo(&filterinfo);
filterinfo.pGraph = NULL;
if (hr != S_OK ){
return S_FALSE;
}
LOG4CPLUS_DEBUG(logger,"RegisterDeviceFilter checks finished");
m_fid = m_fid + 1;
device = new RegisterDevice();
device->id = m_fid;
device->control = filter;
wcstombs( device->name, filterinfo.achName, sizeof(device->name));
ppvRegisitrationContext = &m_fid;
hr = pUnkFilterControl->QueryInterface(IID_IMpeg2Demultiplexer, (void**) &demux);
if (hr == S_OK ){
LOG4CPLUS_DEBUG(logger,"RegisterDeviceFilter device prepared for registration - Name: "<<device->name<<" - "<<m_fid<<" - "<<&m_fid);
device->control = NULL;
delete device;
LOG4CPLUS_INFO(logger,"RegisterDeviceFilter demux skipped");
return S_FALSE;
}else{
LOG4CPLUS_INFO(logger,"RegisterDeviceFilter device prepared for registration - Name: "<<device->name<<" - "<<m_fid<<" - "<<&m_fid);
IBDA_DeviceControl* ctrl;
if( filter->QueryInterface(_uuidof(IBDA_DeviceControl), (void**) &ctrl)==S_OK){
device->deviceControl=ctrl;
}
m_vecDevices.push_back(device);
CheckCapabilities(filter);
}
LOG4CPLUS_DEBUG(logger,"RegisterDeviceFilter finished");
return S_OK;
}
示例10: 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;
}
示例11: OnConnect
//
// OnConnect
//
// Called when the property page connects to a filter
//
HRESULT CProgramProperties::OnConnect(IUnknown *pUnknown)
{
ASSERT(m_pProgram == NULL);
CheckPointer(pUnknown,E_POINTER);
HRESULT hr = pUnknown->QueryInterface(IID_IMpeg2PsiParser, (void **) &m_pProgram);
if(FAILED(hr))
{
return E_NOINTERFACE;
}
ASSERT(m_pProgram);
IBaseFilter * pParserFilter ;
hr = m_pProgram->QueryInterface(IID_IBaseFilter, (void **) &pParserFilter);
RETURN_FALSE_IF_FAILED(TEXT("CProgramProperties::OnUpdate() QueryInterface() failed."), hr);
FILTER_INFO Info;
IFilterGraph * pGraph;
hr = pParserFilter->QueryFilterInfo(&Info);
RETURN_FALSE_IF_FAILED(TEXT("CProgramProperties::OnUpdate() QueryFilterInfo() failed."), hr);
pGraph = Info.pGraph;
pParserFilter->Release();
hr = pGraph->QueryInterface(IID_IGraphBuilder, (void **) & m_pGraphBuilder);
RETURN_FALSE_IF_FAILED(TEXT("CProgramProperties::OnUpdate() QueryInterface() failed."), hr);
// get demux filter
hr = GetDemuxFilter(pGraph, &m_pDemux);
RETURN_FALSE_IF_FAILED(TEXT("CProgramProperties::OnUpdate() GetDemuxFilter() failed."), hr);
pGraph->Release();
// if there is no streaming, the following variables will not be initialized.
if(m_pDemux != NULL && m_pGraphBuilder != NULL){
hr = m_pGraphBuilder->QueryInterface(IID_IMediaControl, (void **) & m_pMediaControl);
RETURN_FALSE_IF_FAILED( TEXT(" CProgramProperties::OnUpdate():Failed to QI IMediaControl."), hr);
// Get the initial Program value
m_pProgram->GetTransportStreamId( &m_stream_id);
m_pProgram->GetPatVersionNumber( &m_pat_version);
m_pProgram->GetCountOfPrograms( &m_number_of_programs );
}
if(!OnUpdate())
return FALSE;
return NOERROR;
}
示例12: 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;
}
示例13: Destroy
HRESULT CTMReceiverGraph::Destroy()
{
HRESULT hr = S_OK;
m_pMediaEvent = NULL;
m_pMeidaSeeking = NULL;
m_pRecordStream = NULL;
m_pSetCallBack = NULL;
m_pVideoWindow = NULL;
m_pBasicVideo = NULL;
if(m_pGraphBuilder && m_pMediaControl)
{
m_pMediaControl->Stop();
CComPtr<IEnumFilters> pEnum = NULL;
hr = m_pGraphBuilder->EnumFilters(&pEnum);
if(SUCCEEDED(hr))
{
IBaseFilter *pFilter = NULL;
while(S_OK == pEnum->Next(1, &pFilter, NULL))
{
FILTER_INFO filterInfo;
if(SUCCEEDED(pFilter->QueryFilterInfo(&filterInfo)))
{
SAFE_RELEASE(filterInfo.pGraph);
CComPtr<IEnumPins> pIEnumPins = NULL;
hr = pFilter->EnumPins(&pIEnumPins);
if(SUCCEEDED(hr))
{
IPin *pIPin = NULL;
while(S_OK == pIEnumPins->Next(1, &pIPin, NULL))
{
m_pGraphBuilder->Disconnect(pIPin);
SAFE_RELEASE(pIPin);
}
}
}
SAFE_RELEASE(pFilter);
}
}
}
else
{
hr = S_FALSE;
}
return hr;
}
示例14: loadAVInameAndPreset
int TffDecoder::loadAVInameAndPreset(void)
{
IEnumFilters *eff=NULL;
int cnt=0;
if (m_pGraph->EnumFilters(&eff)==S_OK)
{
eff->Reset();
IBaseFilter *bff;
while (eff->Next(1,&bff,NULL)==S_OK)
{
CLSID iffclsid;
bff->GetClassID(&iffclsid);
if (iffclsid==CLSID_FFDSHOW) cnt++;
if (AVIname[0]=='\0')
{
FILTER_INFO iff;
bff->QueryFilterInfo(&iff);
IFileSourceFilter *ifsf=NULL;
bff->QueryInterface(IID_IFileSourceFilter,(void**)&ifsf);
if (ifsf)
{
LPOLESTR aviNameL;
ifsf->GetCurFile(&aviNameL,NULL);
ifsf->Release();
WideCharToMultiByte(CP_ACP,0,aviNameL,-1,AVIname,511, NULL, NULL );
if (globalSettings.autoPreset)
{
TpresetSettings *preset=presets.getAutoPreset(AVIname,globalSettings.autoPresetFileFirst);
if (preset)
setPresetPtr(preset);
}
}
if (iff.pGraph) iff.pGraph->Release();
}
bff->Release();
}
eff->Release();
}
return cnt;
}
示例15: QueryFilterInfoReleaseGraph
/* Display filter or pin */
CDisp::CDisp(IUnknown *pUnk)
{
IBaseFilter *pf;
HRESULT hr = pUnk->QueryInterface(IID_IBaseFilter, (void **)&pf);
if(SUCCEEDED(hr))
{
FILTER_INFO fi;
hr = pf->QueryFilterInfo(&fi);
if(SUCCEEDED(hr))
{
QueryFilterInfoReleaseGraph(fi);
size_t len = lstrlenW(fi.achName) + 1;
m_pString = new TCHAR[len];
if(m_pString)
{
#ifdef UNICODE
LPCTSTR FORMAT_STRING = TEXT("%s");
#else
LPCTSTR FORMAT_STRING = TEXT("%S");
#endif
(void)StringCchPrintf(m_pString, len, FORMAT_STRING, fi.achName);
}
}
pf->Release();
return;
}
IPin *pp;
hr = pUnk->QueryInterface(IID_IPin, (void **)&pp);
if(SUCCEEDED(hr))
{
CDisp::CDisp(pp);
pp->Release();
return;
}
}