IMediaBuffer::GetBufferAndLength method (mediaobj.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 GetBufferAndLength method retrieves the buffer and the size of the valid data in the buffer.

Syntax

HRESULT GetBufferAndLength(
  [out] BYTE  **ppBuffer,
  [out] DWORD *pcbLength
);

Parameters

[out] ppBuffer

Address of a pointer that receives the buffer array. Can be NULL if pcbLength is not NULL.

[out] pcbLength

Pointer to a variable that receives the size of the valid data, in bytes. Can be NULL if ppBuffer is not NULL.

Return value

Returns an HRESULT value. Possible values include those in the following table.

Return code Description
E_POINTER
NULL pointer argument
S_OK
Success

Remarks

Either parameter can be NULL, in which case it does not receive a value. At least one parameter must be non-NULL. If both parameters are NULL, the method returns E_POINTER.

The value returned in the pcbLength parameter is the size of the valid data in the buffer, not the buffer's allocated size. To obtain the buffer's allocated size, call the IMediaBuffer::GetMaxLength method.

Requirements

   
Target Platform Windows
Header mediaobj.h (include Dmo.h)
Library Dmoguids.lib

See also

IMediaBuffer Interface

Implementing IMediaBuffer