我不知道的使用具有一個參數表示爲雙指針函數裏面的但是CComPtr這樣:雙指針函數參數和但是CComPtr
HRESULT D3DPresentEngine::CreateD3DSample(
IDirect3DSwapChain9 *pSwapChain,
IMFSample **ppVideoSample
)
{
// Caller holds the object lock.
D3DCOLOR clrBlack = D3DCOLOR_ARGB(0xFF, 0x00, 0x00, 0x00);
CComPtr<IDirect3DSurface9> pSurface;
CComPtr<IMFSample> pSample;
// Get the back buffer surface.
ReturnIfFail(pSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &pSurface));
// Fill it with black.
ReturnIfFail(m_pDevice->ColorFill(pSurface, NULL, clrBlack));
// Create the sample.
ReturnIfFail(MFCreateVideoSampleFromSurface(pSurface, &pSample));
// Return the pointer to the caller.
*ppVideoSample = pSample;
(*ppVideoSample)->AddRef();
return S_OK;
}
我有一個關於過去的分配無疑+ AddRef調用。
他們是OK的嗎?
在此先感謝
看起來好像沒什麼問題。 –