IAudioMediaStream Interface

The IAudioMediaStream interface controls audio media streams by providing methods that set and get the stream's format. This interface inherits from the IMediaStream interface and is used to create one or more IAudioStreamSample objects. You can also use it to set and retrieve the stream data's current format.

This interface is currently defined only for PCM format audio data.

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

Like video, audio is contained in a self-describing container object. Implement this interface when an object needs to control streaming audio.

Use this interface when you want to generate audio in your application.

Methods in Vtable Order

IUnknown methodsDescription
QueryInterface Retrieves pointers to supported interfaces.
AddRef Increments the reference count.
Release Decrements the reference count.
IAudioMediaStream methodsDescription
GetFormat Retrieves the stream data's current format.
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 the specified stream.

Syntax

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] Reserved for flag data. Must be zero.
ppSample
[out] Address of a pointer to the new IAudioStreamSample interface.

Return Value

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

Remarks

The pAudioData object defines the data's format.

IAudioMediaStream::GetFormat

IAudioMediaStream Interface

Retrieves the stream data's current format.

Syntax

HRESULT GetFormat(
    WAVEFORMATEX *pWaveFormatCurrent );

Parameters

pWaveFormatCurrent
[out] Pointer to a WAVEFORMATEX structure that contains the stream data's current format.

Return Value

Returns S_OK if successful or E_POINTER if the required parameter is NULL.

Remarks

Currently, Microsoft® DirectShow® supports only PCM wave data.

IAudioMediaStream::SetFormat

IAudioMediaStream Interface

Sets the format for the stream.

Syntax

HRESULT SetFormat(
    const WAVEFORMATEX *lpWaveFormat
    );

Parameters

lpWaveFormat
[in] Pointer to a WAVEFORMATEX structure that contains stream format information.

Return Value

Returns an HRESULT value, which can include the following values or others not listed.
MS_E_INCOMPATIBLEFormat of the IAudioData object is not compatible with stream.
E_POINTERNull pointer argument.
E_INVALIDARGInvalid argument.
S_OK Success.


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.