IMemoryData Interface


The IMemoryData interface contains methods which set and retrieve memory data on audio data objects. Audio data objects provide the underlying data which stream samples access. This interface provides a way to initialize memory buffers and to set actual amounts of audio data in the objects. Additionally, the GetInfo method can be used to retrieve audio memory data.

When to Implement

Implement this interface on underlying audio data objects which will be accessed by audio stream sample objects.

When to Use

Typically these methods are usually called by the IAudioMediaStream or IAudioStreamSample object rather than by the application.

Methods in Vtable Order
IUnknown methods Description
QueryInterface Retrieves pointers to supported interfaces.
AddRef Increments the reference count.
Release Decrements the reference count.
IMemoryData methods Description
SetBuffer Initializes a memory buffer with a pointer to memory and length.
GetInfo Retrieves information describing an audio data object including how much data is actually in the object at the moment as last set by SetActual.
SetActual Sets the actual amount of audio data now in the object, in bytes.


IMemoryData::GetInfo

IMemoryData Interface

Retrieves information describing an audio data object including how much data is actually in the object at the moment as last set by SetActual.

HRESULT GetInfo(
  DWORD *pdwLength,
  BYTE **ppbData,
  DWORD *pcbActualData );

Parameters
pdwLength
[out] Length of memory in bytes, if non-NULL.
ppbData
[out] Pointer to the memory, if non-NULL.
pcbActualData
[out]Length of actual data in bytes, if non-NULL.
Return Values

Returns S_OK if successful.


IMemoryData::SetActual

IMemoryData Interface

Sets the actual amount of audio data now in the object, in bytes.

HRESULT SetActual(
  DWORD cbDataValid
  );

Parameters
cbDataValid
[in] The actual amount of data in bytes.
Return Values

Returns S_OK if successful or E_POINTER if required parameters is null.

Remarks

This method is usually called by the IAudioMediaStream or IAudioStreamSample object rather than by the application.


IMemoryData::SetBuffer

IMemoryData Interface

Initializes a memory buffer with a pointer to memory and length.

HRESULT SetBuffer(
  DWORD cbSize,
  BYTE *pbData,
  DWORD dwFlags );

Parameters
cbSize
[in] Size in bytes of memory pointed to by pbData.
pbData
[in] Pointer to memory to be used by this object.
dwFlags
[in] Flags. Must be 0.
Return Values

Returns S_OK if successful or E_INVALIDARG if either the cbSize is 0 or pbData is NULL.

Remarks

This method can be called more than once but should not be called when owned by a sample being processed by the IStreamSample::Update method.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.