Compartir a través de


CreateAudioMediaType

 
Microsoft DirectShow 9.0

CreateAudioMediaType

The CreateAudioMediaType function initializes a media type from a WAVEFORMATEX structure.

Syntax

  STDAPI CreateAudioMediaType(
    const WAVEFORMATEX *pwfx,
    AM_MEDIA_TYPE *pmt,
    BOOL bSetFormat
);

Parameters

pwfx

Pointer to the supplied WAVEFORMATEX structure.

pmt

Pointer to the AM_MEDIA_TYPE structure to initialize.

bSetFormat

Flag indicating whether to initialize the format block. Specify TRUE to initialize it, or FALSE otherwise.

Return Value

Returns E_OUTOFMEMORY if memory could not be allocated for the format data; S_OK otherwise.

Remarks

If the bSetFormat parameter is TRUE, the method allocates the memory for the format block. If the pmt parameter already contains an allocated format block, a memory leak will occur. To avoid a memory leak, call FreeMediaType before calling this function. After the method returns, call FreeMediaType again to free the format block.

Requirements

**  Header:** Declared in Mtype.h; include Streams.h.

**  Library:** Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).

See Also