Export (0) Print
Expand All

CreateAudioMediaType function

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

Syntax


HRESULT 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

Mtype.h (include Streams.h)

Library

Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

Media Type Functions

 

 

Community Additions

ADD
Show:
© 2014 Microsoft