Microsoft DirectX 8.0 |
This interface provides methods for manipulating a data buffer. Any buffer passed to a Microsoft® DirectX® Media Object (DMO) must implement this interface.
IUnknown methods Description QueryInterface Retrieves pointers to supported interfaces. AddRef Increments the reference count. Release Decrements the reference count. IMediaBuffer methods Description SetLength Specifies the length of the data currently in the buffer. GetMaxLength Retrieves the maximum number of bytes this buffer can hold. GetBufferAndLength Retrieves the buffer and the size of the valid data in the buffer.
Specifies the length of the data currently in the buffer.
Syntax
HRESULT SetLength( DWORD cbLength );
Parameters
- cbLength
- Size of the data, in bytes. The value must not exceed the buffer's maximum size. Call the GetMaxLength method to obtain the maximum size.
Return Value
Returns S_OK if successful. Otherwise, returns an HRESULT value indicating the cause of the error.
Remarks
This method sets the size of the valid data currently in the buffer, not the buffer's allocated size.
Retrieves the maximum number of bytes this buffer can hold.
Syntax
HRESULT GetMaxLength( DWORD *pcbMaxLength );
Parameters
- pcbMaxLength
- [out] Pointer to a variable that receives the buffer's maximum size, in bytes.
Return Value
Returns S_OK if successful. Otherwise, returns an HRESULT value indicating the cause of the error.
Retrieves the buffer and the size of the valid data in the buffer.
Syntax
HRESULT GetBufferAndLength( BYTE **ppBuffer, DWORD *pcbLength );
Parameters
- ppBuffer
- [out] Address of a pointer that receives the buffer array. Can be NULL if pcbLength is not NULL.
- pcbLength
- [out] 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 the following.
S_OK Success E_POINTER NULL pointer argument
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 GetMaxLength method.