IAudioMediaStream Interface


The IAudioMediaStream interface controls audio media streams. This interface inherits from the IMediaStream interface and is used to create one or more IAudioStreamSample objects. It is also used to set and retrieve the current format of the stream data.

Note, this interface is currently only defined for PCM format audio data.

For sample code which implements the audio streaming interfaces see Multimedia Streaming Sample Code.

When to Implement

Like video, audio is considered to be contained in a self-describing container object. Implement this interface on objects that control streaming audio.

When to Use

Use this interface when you want to output audio.

Methods in Vtable Order
IUnknown methods Description
QueryInterface Retrieves pointers to supported interfaces.
AddRef Increments the reference count.
Release Decrements the reference count.
IAudioMediaStream methods Description
GetFormat Retrieves the current format of the stream data in a WAVEFORMATEX structure.
SetFormat Sets the format for the stream.
CreateSample Creates an audio stream sample for use with this stream.


IAudioMediaStream::CreateSample

IAudioMediaStream Interface

Creates an audio stream sample for use with this stream.

HRESULT CreateSample(
  IAudioData *pAudioData,
  DWORD dwFlags,
  IAudioStreamSample **ppSample
  );

Parameters
pAudioData
[in] Pointer to an IAudioData container. IAudioData objects can be referenced by samples in more than one stream.
dwFlags
[in] Flags. Must be 0.
ppSample
[out] Address of a pointer to the new IAudioStreamSample interface.
Return Values

Returns S_OK if successful or E_POINTER if one or more of the required parameters are null.

Remarks

The format of the data is defined by the pAudioData object.


IAudioMediaStream::GetFormat

IAudioMediaStream Interface

Retrieves the current format of the stream data in a WAVEFORMATEX structure.

HRESULT GetFormat(
  WAVEFORMATEX *pWaveFormatCurrent );

Parameters
pWaveFormatCurrent
[out] Pointer to a WAVEFORMATEX structure.
Return Values

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

Remarks

Currently only PCM wave data is supported.


IAudioMediaStream::SetFormat

IAudioMediaStream Interface

Sets the format for the stream.

HRESULT SetFormat(
  const WAVEFORMATEX *lpWaveFormat
  );

Parameters
lpWaveFormat
[in] Pointer to a WAVEFORMATEX structure.
Return Values

Returns an HRESULT value, which can include the following values or others not listed.
Value Meaning
MS_E_INCOMPATIBLE Format of IAudioData object is not compatible with stream.
E_POINTER NULL pointer argument.
E_INVALIDARG Invalid argument.
S_OK Success.

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