本文整理汇总了C++中IBaseFilter::QueryInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ IBaseFilter::QueryInterface方法的具体用法?C++ IBaseFilter::QueryInterface怎么用?C++ IBaseFilter::QueryInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBaseFilter
的用法示例。
在下文中一共展示了IBaseFilter::QueryInterface方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitializeWindowlessVMR
/* 创建VMR,添加、设置VMR */
HRESULT CVMR_Capture::InitializeWindowlessVMR(HWND hWnd)
{
IBaseFilter* pVmr = NULL;
// 创建VMR
HRESULT hr = CoCreateInstance(CLSID_VideoMixingRenderer, NULL,
CLSCTX_INPROC, IID_IBaseFilter, (void**)&pVmr);
if (SUCCEEDED(hr))
{
//添加VMR到滤波器链表中
hr = m_pGB->AddFilter(pVmr, L"Video Mixing Renderer");
if (SUCCEEDED(hr))
{
// 设置无窗口渲染模式
IVMRFilterConfig* pConfig;
hr = pVmr->QueryInterface(IID_IVMRFilterConfig, (void**)&pConfig);
if( SUCCEEDED(hr))
{
pConfig->SetRenderingMode(VMRMode_Windowless);
pConfig->Release();
}
// 设置传入的窗口为显示窗口
hr = pVmr->QueryInterface(IID_IVMRWindowlessControl, (void**)&m_pWC);
if( SUCCEEDED(hr))
{
m_pWC->SetVideoClippingWindow(hWnd);
}
}
pVmr->Release();
}
return hr;
}
示例2: InitializeWindowlessVMR
HRESULT CVMR_Capture::InitializeWindowlessVMR(HWND hWnd)
{
IBaseFilter* pVmr = NULL;
// Create the VMR and add it to the filter graph.
HRESULT hr = CoCreateInstance(CLSID_VideoMixingRenderer, NULL,
CLSCTX_INPROC, IID_IBaseFilter, (void**)&pVmr);
if (SUCCEEDED(hr))
{
hr = m_pGB->AddFilter(pVmr, L"Video Mixing Renderer");
if (SUCCEEDED(hr))
{
// Set the rendering mode and number of streams.
IVMRFilterConfig* pConfig;
hr = pVmr->QueryInterface(IID_IVMRFilterConfig, (void**)&pConfig);
if( SUCCEEDED(hr))
{
pConfig->SetRenderingMode(VMRMode_Windowless);
pConfig->Release();
}
hr = pVmr->QueryInterface(IID_IVMRWindowlessControl, (void**)&m_pWC);
if( SUCCEEDED(hr))
{
m_pWC->SetVideoClippingWindow(hWnd);
}
}
pVmr->Release();
}
return hr;
}
示例3: CoCreateInstance
/******************************Public*Routine******************************\
* AddVideoMixingRendererToFG
*
\**************************************************************************/
HRESULT
CMovie::AddVideoMixingRendererToFG()
{
IBaseFilter* pBF = NULL;
HRESULT hRes = CoCreateInstance(CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC,
IID_IBaseFilter, (LPVOID *)&pBF);
if(SUCCEEDED(hRes))
{
hRes = m_Fg->AddFilter(pBF, L"Video Mixing Renderer 9");
if(SUCCEEDED(hRes))
{
// Test VMRConfig, VMRMonitorConfig
IVMRFilterConfig9* pConfig;
HRESULT hRes2 = pBF->QueryInterface(IID_IVMRFilterConfig9, (LPVOID *)&pConfig);
if(SUCCEEDED(hRes2))
{
hRes2 = pConfig->SetNumberOfStreams(2);
hRes2 = pConfig->SetRenderingMode(VMR9Mode_Windowless);
//hRes2 = pConfig->SetRenderingPrefs(RenderPrefs_AllowOverlays);
pConfig->Release();
}
IVMRMonitorConfig9* pMonitorConfig;
HRESULT hRes3 = pBF->QueryInterface(IID_IVMRMonitorConfig9, (LPVOID *)&pMonitorConfig);
if(SUCCEEDED(hRes3))
{
UINT iCurrentMonitor;
HRESULT hr4 = pMonitorConfig->GetMonitor(&iCurrentMonitor);
pMonitorConfig->Release();
}
hRes = pBF->QueryInterface(IID_IVMRWindowlessControl9, (LPVOID *)&m_Wc);
}
}
if(pBF)
{
pBF->Release();
}
if(SUCCEEDED(hRes))
{
HRESULT hr = m_Wc->SetVideoClippingWindow(m_hwndApp);
hr = m_Wc->SetAspectRatioMode(VMR_ARMODE_LETTER_BOX);
}
else
{
if(m_Wc)
{
m_Wc->Release();
m_Wc = NULL;
}
}
return hRes;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8:
HRESULT
recChannel_t::unmap(void)
{
__CONTEXT("recChannel_t::unmap");
IBaseFilter * pFilter = NULL;
int hr =0;
hr = pGraph->FindFilterByName(L"Video Renderer",&pFilter);
if (!hr)
{
IVideoWindow *pWindowInfo = NULL;
hr = pFilter->QueryInterface(IID_IVideoWindow, (void **)&pWindowInfo);
errorCheck(hr);
pWindowInfo->put_Visible(OAFALSE);
pWindowInfo->put_AutoShow(OAFALSE);
pWindowInfo->Release();
}
pControl->StopWhenReady();
#ifdef _WINDOWS
if (fControl)
{
fControl->CWnd::ShowWindow(SW_HIDE);
}
#endif
mapping = false;
return 0;
}
示例9: 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;
}
示例10: 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;
}
示例11: 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;
}
示例12: AddDMOToFilterGraph
//Добавляет к текущему Filter Graph оболочку 'DMOWrapper' и вызывает инициализацию
//DMO объекта с именем lpwDMOName
//Перед вызовом этой функции необходимо вызвать UpdateDMOArray(...) (если она не вызывалась)
//В случае ошибки функция вернет значение меньше нуля
int CDirectShow::AddDMOToFilterGraph(LPCWSTR lpwDMOName)
{
if (!m_pGraphBuilder) return -1;
if (!m_lDMOCount) return -1;
IBaseFilter *pDMOWBaseFilter = NULL;
IDMOWrapperFilter *pDMOWrapper;
for (m_lCounter = 0; m_lCounter < m_lDMOCount; m_lCounter++)
{
if (_wcsicmp(m_lpwDMONames[m_lCounter], lpwDMOName) == 0)
{
if (FAILED(CoCreateInstance(CLSID_DMOWrapperFilter, NULL, CLSCTX_INPROC,
IID_IBaseFilter, (LPVOID *)&pDMOWBaseFilter))) return -1;
if (FAILED(pDMOWBaseFilter->QueryInterface(IID_IDMOWrapperFilter,
(LPVOID *)&pDMOWrapper))) return -1;
pDMOWrapper->Init(m_cDMOCLSIDs[m_lCounter], m_gidRecentDMOCat);
pDMOWrapper->Release();
m_pGraphBuilder->AddFilter(pDMOWBaseFilter, m_lpwDMONames[m_lCounter]);
pDMOWBaseFilter->Release();
}
else
{
if (m_lCounter >= (m_lDMOCount - 1))
return -1; else continue;
}
}
return 0;
}
示例13: 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();
}
示例14: CoCreateInstance
/******************************Public*Routine******************************\
* AddVideoMixingRendererToFG
*
\**************************************************************************/
HRESULT
CMpegMovie::AddVideoMixingRendererToFG()
{
if ( m_Vw ) {
return FALSE;
} else {
IBaseFilter* pBF = NULL;
HRESULT hRes = CoCreateInstance(CLSID_VideoMixingRenderer,
NULL,
CLSCTX_INPROC,
IID_IBaseFilter,
(LPVOID *)&pBF);
if(SUCCEEDED(hRes))
{
hRes = m_Fg->AddFilter(pBF, L"Video Mixing Renderer");
if(SUCCEEDED(hRes))
{
hRes = SetRenderingMode(pBF, VMRMode_Renderless);
hRes = pBF->QueryInterface(IID_IVMRSurfaceAllocatorNotify,
(LPVOID *)&m_San);
hRes = CreateDefaultAllocatorPresenter();
hRes = m_San->AdviseSurfaceAllocator(MY_USER_ID, this);
}
}
if(pBF)
{
pBF->Release();
}
if(SUCCEEDED(hRes))
{
HRESULT hr = m_Wc->SetVideoClippingWindow(m_hwndApp);
hr = m_Wc->SetAspectRatioMode(VMR_ARMODE_LETTER_BOX);
}
else
{
if(m_Wc)
{
m_Wc->Release();
m_Wc = NULL;
}
}
return hRes;
}
}
示例15: 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;
}