IMFVideoCaptureSampleAllocator::InitializeCaptureSampleAllocator method (mfidl.h)

Initializes the sample allocator with parameters relevant to video capture scenarios.

Syntax

HRESULT InitializeCaptureSampleAllocator(
  DWORD         cbSampleSize,
  DWORD         cbCaptureMetadataSize,
  DWORD         cbAlignment,
  DWORD         cMinimumSamples,
  IMFAttributes *pAttributes,
  IMFMediaType  *pMediaType
);

Parameters

cbSampleSize

A DWORD specifying the sample size in bytes. The actual sample size used by the allocator is the maximum of the size required by pMediaType and cbSampleSize.

cbCaptureMetadataSize

A DWORD specifying the capture metadata size in bytes. Applies only to callers that want to include additional metadata with the captured frames. The metadata size should include the size of a KSCAMERA_METADATA_ITEMHEADER in addition to the size of the metadata payload itself.

cbAlignment

A DWORD specifying the buffer alignment size in bytes. The default and minimum alignment size is 4KB. Custom alignment sizes less than 4KB will be treated as 4KB.

cMinimumSamples

A DWORD specifying the minimum number of pre-allocated samples. This method will fail if the allocator cannot pre-allocate the specified minimum number of samples.

pAttributes

Optional. An IMFAttributes store with additional configuration attributes for the sample allocator. The supported attributes are:

pMediaType

An IMFMediaType specifying the media type for which samples will be allocator. The sample allocator uses this parameter to calculate the minimum required size for the media samples.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK The method succeeded.
MF_E_INVALIDMEDIATYPE Invalid media type.

Requirements

Requirement Value
Minimum supported client Windows 10, version 2004 (10.0; Build 19041)
Minimum supported server Windows Server, version 2004 (10.0; Build 19041)
Header mfidl.h