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


C++ CComPtr::AdviseSurfaceAllocator方法代码示例

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


在下文中一共展示了CComPtr::AdviseSurfaceAllocator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetAllocatorPresenter

HRESULT CMovie::SetAllocatorPresenter( CComPtr<IBaseFilter> filter )
{
    if( filter == NULL )
    {
        return E_FAIL;
    }

    HRESULT hr;

    CComPtr<IVMRSurfaceAllocatorNotify9> lpIVMRSurfAllocNotify;
    hr = filter->QueryInterface(IID_IVMRSurfaceAllocatorNotify9, reinterpret_cast<void**>(&lpIVMRSurfAllocNotify));

    // create our surface allocator
	m_Allocator = new CAllocator( m_D3D, m_D3DDev );
	m_surfaceAllocator.Attach( m_Allocator );
    if( FAILED( hr ) )
    {
        m_surfaceAllocator = NULL;
        return hr;
    }

    // let the allocator and the notify know about each other
	DWORD_PTR	userId = 0xACDCACDC ;
    hr = lpIVMRSurfAllocNotify->AdviseSurfaceAllocator( userId, m_surfaceAllocator );
    hr = m_surfaceAllocator->AdviseNotify(lpIVMRSurfAllocNotify);
    
    return hr;
}
开发者ID:childs-heart,项目名称:ChiruhaSyana,代码行数:28,代码来源:CLIB_Movie.cpp

示例2: if

/*
 * Class:     sage_DShowMediaPlayer
 * Method:    setVideoRendererFilter0
 * Signature: (JLjava/lang/String;Ljava/util/Map;)V
 */
JNIEXPORT void JNICALL Java_sage_DShowMediaPlayer_setVideoRendererFilter0
  (JNIEnv *env, jobject jo, jlong dataPtr, jstring jfilterName, jobject jfilterOptions)
{
	if (jfilterName == NULL || env->GetStringLength(jfilterName) == 0 || !dataPtr){return;}
	CPlayerData* pData = (CPlayerData*) dataPtr;
	const char* cName = env->GetStringUTFChars(jfilterName, NULL);
	slog((env, "DShowPlayer setVideoRendererFilter0(%s) called\r\n", cName));
	CComPtr<IBaseFilter> pFilter = NULL;
	HRESULT hr = FindFilterByName(&pFilter, CLSID_LegacyAmFilterCategory, cName);
	env->ReleaseStringUTFChars(jfilterName, cName);
	BOOL vmr9Config = FALSE;
	BOOL evrConfig = FALSE;
	if (SUCCEEDED(hr) && jfilterOptions)
	{
		jint dxvaMode = 0;
		jint dxvaDeinterlace = 0;
		GetMapIntValue(env, jfilterOptions, "dxva_mpeg_mode", &dxvaMode);
		GetMapIntValue(env, jfilterOptions, "force_deinterlace", &dxvaDeinterlace);
		pData->SetDXVAParameters(dxvaMode, dxvaDeinterlace);

		jboolean ccOK = JNI_TRUE;
		GetMapBoolValue(env, jfilterOptions, "enable_cc", &ccOK);
		if (!ccOK)
			pData->DisableCC();
		// Get the DX9 device pointers, if they don't exist we can't use our custom VMR9 renderer
		jlong jD3D = 0;
		jlong jD3DDevice = 0;
		if (GetMapLongValue(env, jfilterOptions, "d3d_object_ptr", &jD3D) &&
			GetMapLongValue(env, jfilterOptions, "d3d_device_ptr", &jD3DDevice))
		{
			IDirect3D9* pD3D = (IDirect3D9*) jD3D;
			IDirect3DDevice9* pD3DDevice = (IDirect3DDevice9*) jD3DDevice;
			// Set the rendering mode and number of streams.
			CComPtr<IVMRFilterConfig9> pConfig = NULL;
			// See if it's EVR or VMR
			hr = pFilter->QueryInterface(IID_IVMRFilterConfig9, (void**)&(pConfig.p));
			if (SUCCEEDED(hr))
			{
				slog((env, "Using VMR9 for video rendering\r\n"));
				hr = pConfig->SetRenderingMode(VMR9Mode_Renderless);
				PLAYEXCEPT_RET(sage_PlaybackException_DIRECTX_INSTALL);

				/*
				 * NOTE: If we don't set the number of streams than we don't get the optimal
				 * format types as choices and end up using a private texture when we don't need to.
				 * I think this is because certain features of the
				 * VMR are not available in mixing mode or something like that.
				 * Update: 10/12/2004 - I have now learned that when you put the VMR9
				 * into mixing mode that it will then use the D3DRenderTarget itself
				 * to do the mixing.  I saw a usenet post of the exact VMR9 corruption
				 * problem I was having where the OSD was showing up on the video frame surface.
				 * By not setting the number of streams I keep the VMR9 in Renderless non-mixing mode.
				 * BUT this has the downside of breaking CC support for the VMR9 so we have a registry
				 * setting to allow this.
				 * 10/13/04 - The first problem came back where the format types are wrong. No idea
				 * why this was working fine yesterday.
				 */
				if (GetRegistryDword(HKEY_LOCAL_MACHINE,
					"Software\\Frey Technologies\\SageTV\\DirectX9", "AllowCCForVMR9", 1) &&
					ccOK)
				{
					// NOTE: We changed this from 2 to 3 because on Vista you need another input
					// to handle subpicture blending for DVD playback. And I don't believe there's any
					// negative to having 3 instead of 2; the big difference is between 1 and 2.
					hr = pConfig->SetNumberOfStreams(3); // video + CC + subpicture
					PLAYEXCEPT_RET(sage_PlaybackException_DIRECTX_INSTALL);
				}
				else
				{
					hr = pConfig->SetNumberOfStreams(1);
					PLAYEXCEPT_RET(sage_PlaybackException_DIRECTX_INSTALL);
				}

				CComPtr<IVMRSurfaceAllocatorNotify9> lpIVMRSurfAllocNotify = NULL;
				pFilter->QueryInterface(IID_IVMRSurfaceAllocatorNotify9,
					(void**)&(lpIVMRSurfAllocNotify.p));

				// create our surface allocator
				CVMRAllocator* myVMRAllocator = new CVMRAllocator(hr, pD3D, pD3DDevice);
				PLAYEXCEPT_RET(sage_PlaybackException_SAGETV_INSTALL);
				pData->SetVMR9Allocator(myVMRAllocator);

				// let the allocator and the notify know about each other
				hr = lpIVMRSurfAllocNotify->AdviseSurfaceAllocator(0xCAFEBABE, myVMRAllocator);
				HTESTPRINT(hr);
				hr = myVMRAllocator->AdviseNotify(lpIVMRSurfAllocNotify);
				HTESTPRINT(hr);

				hr = S_OK;

				vmr9Config = TRUE;
			}
			else
			{
				slog((env, "Using EVR for video render\r\n"));
//.........这里部分代码省略.........
开发者ID:bryanzim,项目名称:sagetv,代码行数:101,代码来源:PlaybackGraph.cpp


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