当前位置: 首页>>代码示例>>C++>>正文


C++ SmartPtr::Attach方法代码示例

本文整理汇总了C++中SmartPtr::Attach方法的典型用法代码示例。如果您正苦于以下问题:C++ SmartPtr::Attach方法的具体用法?C++ SmartPtr::Attach怎么用?C++ SmartPtr::Attach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SmartPtr的用法示例。


在下文中一共展示了SmartPtr::Attach方法的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;
}
开发者ID:AbdoSalem95,项目名称:WindowsSDK7-Samples,代码行数:35,代码来源:vmr9compositor.cpp

示例2: SetAllocatorPresenter

HRESULT SetAllocatorPresenter( IBaseFilter *filter, HWND window )
{
    if( filter == NULL )
    {
        return E_FAIL;
    }

    HRESULT hr;

    SmartPtr<IVMRSurfaceAllocatorNotify9> lpIVMRSurfAllocNotify;
    FAIL_RET( filter->QueryInterface(IID_IVMRSurfaceAllocatorNotify9, reinterpret_cast<void**>(&lpIVMRSurfAllocNotify)) );

    // create our surface allocator
    g_allocator.Attach(new CAllocator( hr, window ));
    if( FAILED( hr ) )
    {
        g_allocator = NULL;
        return hr;
    }

    // let the allocator and the notify know about each other
    FAIL_RET( lpIVMRSurfAllocNotify->AdviseSurfaceAllocator( g_userId, g_allocator ) );
    FAIL_RET( g_allocator->AdviseNotify(lpIVMRSurfAllocNotify) );
    
    return hr;
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:26,代码来源:vmr9allocator.cpp


注:本文中的SmartPtr::Attach方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。