Creates a media buffer that wraps an existing media buffer. The new media buffer points to the same memory as the original media buffer, or to an offset from the start of the memory.
HRESULT MFCreateMediaBufferWrapper(
IMFMediaBuffer *pBuffer,
DWORD cbOffset,
DWORD dwLength,
IMFMediaBuffer **ppBuffer
)
pBuffer
Type: IMFMediaBuffer *
[in] A pointer to the IMFMediaBuffer interface of the original media buffer.
cbOffset
Type: DWORD
[in] The start of the new buffer, as an offset in bytes from the start of the original buffer.
dwLength
Type: DWORD
[in] The size of the new buffer. The value of cbOffset + dwLength must be less than or equal to the size of valid data the original buffer. (The size of the valid data is returned by the IMFMediaBuffer::GetCurrentLength method.)
ppBuffer
Type: IMFMediaBuffer **
[out] Receives a pointer to the IMFMediaBuffer interface. The caller must release the interface.
Type: HRESULT
The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.
| Return code | Description |
|---|---|
| S_OK | The function succeeded. |
| E_INVALIDARG | The requested offset or the requested length is not valid. |
Refer to Media Foundation return codes.
The maximum size of the wrapper buffer is limited to the size of the valid data in the original buffer. This might be less than the allocated size of the original buffer. To set the size of the valid data, call IMFMediaBuffer::SetCurrentLength.
Header: Declared in mfapi.h.
Library: Use Mfplat.lib.