共用方式為


IVMRSurfaceAllocatorNotify9::AllocateSurfaceHelper method (vmr9.h)

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The AllocateSurfaceHelper method allocates a Direct3D surface based on application-specified parameters.

If you are implementing a custom allocator-presenter for the VMR-9, you can use this method to allocate the surfaces.

Syntax

HRESULT AllocateSurfaceHelper(
  [in]      VMR9AllocationInfo *lpAllocInfo,
  [in, out] DWORD              *lpNumBuffers,
  [out]     IDirect3DSurface9  **lplpSurface
);

Parameters

[in] lpAllocInfo

Pointer to a VMR9AllocationInfo structure that describes the surfaces to create.

[in, out] lpNumBuffers

On input, this parameter specifies the number of surfaces to create. On output, this parameter contains the number of surfaces that the method created.

[out] lplpSurface

Address of an array of IDirect3DSurface9 interface pointers. The size of the array must equal the value in lpNumBuffers. The method fills the array with valid IDirect3DSurface9 pointers for each Direct3D surface that it creates. The caller must release the interface pointers. (Do not put any valid pointers into the array before you call this method, because the method will overwrite them, causing a memory leak.)

Return value

The method returns an HRESULT. Possible values include those in the following table.

Return code Description
S_OK
The method succeeded.

Remarks

Include DShow.h and D3d9.h before Vmr9.h.

Requirements

Requirement Value
Minimum supported client Windows XP with SP2 [desktop apps only]
Minimum supported server Windows Server 2003 R2 [desktop apps only]
Target Platform Windows
Header vmr9.h
Library Strmiids.lib

See also

IVMRSurfaceAllocatorNotify9 Interface

Using the Video Mixing Renderer