本文整理汇总了C++中SmartPtr::AddFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ SmartPtr::AddFilter方法的具体用法?C++ SmartPtr::AddFilter怎么用?C++ SmartPtr::AddFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmartPtr
的用法示例。
在下文中一共展示了SmartPtr::AddFilter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConfigureVMR9
HRESULT ConfigureVMR9(HWND window)
{
assert(g_graph != NULL);
HRESULT hr = S_OK;
RECT rect;
SmartPtr<IVMRFilterConfig9> filterConfig;
// Create the VMR-9.
FAIL_RET( CoCreateInstance(CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&g_filter) );
// Configure the VMR-9.
// Set the maximum number of video streams, and set windowless mode.
FAIL_RET( g_filter->QueryInterface(IID_IVMRFilterConfig9, reinterpret_cast<void**>(&filterConfig)) );
FAIL_RET( filterConfig->SetNumberOfStreams( MAX_VIDEO_STREAMS ) );
FAIL_RET( filterConfig->SetRenderingMode( VMR9Mode_Windowless ) );
FAIL_RET( g_filter->QueryInterface(IID_IVMRWindowlessControl9, reinterpret_cast<void**>(&g_windowlessControl)) );
FAIL_RET( g_windowlessControl->SetVideoClippingWindow( window ) );
GetClientRect( window, & rect );
FAIL_RET( g_windowlessControl->SetVideoPosition(NULL, & rect) );
// Set the custom compositor on the VMR-9.
g_compositor.Attach( new CMyCompositor9() );
FAIL_RET( filterConfig->SetImageCompositor( g_compositor ));
// Add the VMR-9 to the filter graph.
FAIL_RET( g_graph->AddFilter(g_filter, L"Video Mixing Renderer 9") );
return hr;
}
示例2: StartGraph
HRESULT StartGraph(HWND window)
{
// Clear DirectShow interfaces (COM smart pointers)
CloseGraph(window);
SmartPtr<IVMRFilterConfig9> filterConfig;
BSTR path = GetMoviePath();
if( ! path )
{
return E_FAIL;
}
HRESULT hr;
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void**)&g_graph);
if (SUCCEEDED(hr))
{
hr = CoCreateInstance(CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&g_filter);
}
if (SUCCEEDED(hr))
{
hr = g_filter->QueryInterface(IID_IVMRFilterConfig9, reinterpret_cast<void**>(&filterConfig));
}
if (SUCCEEDED(hr))
{
hr = filterConfig->SetRenderingMode( VMR9Mode_Renderless );
}
if (SUCCEEDED(hr))
{
hr = filterConfig->SetNumberOfStreams(2);
}
if (SUCCEEDED(hr))
{
hr = SetAllocatorPresenter( g_filter, window );
}
if (SUCCEEDED(hr))
{
hr = g_graph->AddFilter(g_filter, L"Video Mixing Renderer 9");
}
if (SUCCEEDED(hr))
{
hr = g_graph->QueryInterface(IID_IMediaControl, reinterpret_cast<void**>(&g_mediaControl));
}
if (SUCCEEDED(hr))
{
hr = g_graph->RenderFile( path, NULL );
}
if (SUCCEEDED(hr))
{
hr = g_mediaControl->Run();
}
SysFreeString(path);
return hr;
}