Index Topic Contents | |||
Previous Topic: IDirectDrawStreamSample Interface Next Topic: IAudioStreamSample Interface |
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.
When to Implement
Like video, audio is contained in a self-describing container object. Implement this interface when an object needs to control streaming audio.
When to Use
Use this interface when you want to generate audio in your application.
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 stream data's current format. SetFormat Sets the format for the stream. CreateSample Creates an audio stream sample for use with this stream. IAudioMediaStream Interface
IAudioMediaStream::CreateSampleCreates an audio stream sample for use with the specified 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] Reserved for flag data. Must be zero.
- 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 pAudioData object defines the data's format.
IAudioMediaStream Interface
IAudioMediaStream::GetFormatRetrieves the stream data's current format.
HRESULT GetFormat(
WAVEFORMATEX *pWaveFormatCurrent );Parameters
- pWaveFormatCurrent
- [out] Pointer to a WAVEFORMATEX structure that contains the stream data's current format.
Return Values
Returns S_OK if successful or E_POINTER if the required parameter is NULL.
Remarks
Currently, DirectShow only supports PCM wave data.
IAudioMediaStream Interface
IAudioMediaStream::SetFormatSets the format for the stream.
HRESULT SetFormat(
const WAVEFORMATEX *lpWaveFormat
);Parameters
- lpWaveFormat
- [in] Pointer to a WAVEFORMATEX structure that contains stream format information.
Return Values
Returns an HRESULT value, which can include the following values or others not listed.
Value Meaning MS_E_INCOMPATIBLE Format of the IAudioData object is not compatible with stream. E_POINTER Null pointer argument. E_INVALIDARG Invalid argument. S_OK Success. © 1998 Microsoft Corporation. All rights reserved. Terms of Use.