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


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

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


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

示例1: FAILED

STDMETHODIMP CVMR7AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
{
	CheckPointer(ppRenderer, E_POINTER);

	*ppRenderer = NULL;

	HRESULT hr;

	do {
		CComPtr<IBaseFilter> pBF;

		if (FAILED(hr = pBF.CoCreateInstance(CLSID_VideoMixingRenderer))) {
			break;
		}

		CComQIPtr<IVMRFilterConfig> pConfig = pBF;
		if (!pConfig) {
			break;
		}

		if (FAILED(hr = pConfig->SetRenderingMode(VMRMode_Renderless))) {
			break;
		}

		CComQIPtr<IVMRSurfaceAllocatorNotify> pSAN = pBF;
		if (!pSAN) {
			break;
		}

		if (FAILED(hr = pSAN->AdviseSurfaceAllocator(MY_USER_ID, static_cast<IVMRSurfaceAllocator*>(this)))
				|| FAILED(hr = AdviseNotify(pSAN))) {
			break;
		}

		CComPtr<IPin> pPin = GetFirstPin(pBF);
		CComQIPtr<IMemInputPin> pMemInputPin = pPin;
		m_fUseInternalTimer = HookNewSegmentAndReceive((IPinC*)(IPin*)pPin, (IMemInputPinC*)(IMemInputPin*)pMemInputPin);

		*ppRenderer = (IUnknown*)pBF.Detach();

		return S_OK;
	} while (0);

	return E_FAIL;
}
开发者ID:WinnerSoftLab,项目名称:WinnerMediaPlayer,代码行数:45,代码来源:VMR7AllocatorPresenter.cpp

示例2: CheckPointer

STDMETHODIMP CVMR9AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
{
    CheckPointer(ppRenderer, E_POINTER);
    *ppRenderer = nullptr;

    CMacrovisionKicker* pMK = DEBUG_NEW CMacrovisionKicker(NAME("CMacrovisionKicker"), nullptr);
    CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)pMK;

    COuterVMR9* pOuter = DEBUG_NEW COuterVMR9(NAME("COuterVMR9"), pUnk, &m_VMR9AlphaBitmap, this);

    pMK->SetInner((IUnknown*)(INonDelegatingUnknown*)pOuter);
    CComQIPtr<IBaseFilter> pBF = pUnk;

    CComPtr<IPin> pPin = GetFirstPin(pBF);
    CComQIPtr<IMemInputPin> pMemInputPin = pPin;
    m_fUseInternalTimer = HookNewSegmentAndReceive((IPinC*)(IPin*)pPin, (IMemInputPinC*)(IMemInputPin*)pMemInputPin);

    if (CComQIPtr<IAMVideoAccelerator> pAMVA = pPin) {
        HookAMVideoAccelerator((IAMVideoAcceleratorC*)(IAMVideoAccelerator*)pAMVA);
    }

    CComQIPtr<IVMRFilterConfig9> pConfig = pBF;
    if (!pConfig) {
        return E_FAIL;
    }

    const CRenderersSettings& r = GetRenderersSettings();

    if (r.fVMR9MixerMode) {
        if (FAILED(pConfig->SetNumberOfStreams(1))) {
            return E_FAIL;
        }

        if (CComQIPtr<IVMRMixerControl9> pMC = pBF) {
            DWORD dwPrefs;
            pMC->GetMixingPrefs(&dwPrefs);

            // See http://msdn.microsoft.com/en-us/library/dd390928(VS.85).aspx
            dwPrefs |= MixerPref9_NonSquareMixing;
            dwPrefs |= MixerPref9_NoDecimation;
            if (r.fVMR9MixerYUV && !SysVersion::IsVistaOrLater()) {
                dwPrefs &= ~MixerPref9_RenderTargetMask;
                dwPrefs |= MixerPref9_RenderTargetYUV;
            }
            pMC->SetMixingPrefs(dwPrefs);
        }
    }

    if (FAILED(pConfig->SetRenderingMode(VMR9Mode_Renderless))) {
        return E_FAIL;
    }

    CComQIPtr<IVMRSurfaceAllocatorNotify9> pSAN = pBF;
    if (!pSAN) {
        return E_FAIL;
    }

    if (FAILED(pSAN->AdviseSurfaceAllocator(MY_USER_ID, static_cast<IVMRSurfaceAllocator9*>(this)))
            || FAILED(AdviseNotify(pSAN))) {
        return E_FAIL;
    }

    *ppRenderer = (IUnknown*)pBF.Detach();

    return S_OK;
}
开发者ID:1ldk,项目名称:mpc-hc,代码行数:66,代码来源:VMR9AllocatorPresenter.cpp


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