Share via


CMediaType::SetFormat

 
Microsoft DirectShow 9.0

CMediaType::SetFormat

The SetFormat method initializes the format block.

Syntax

  BOOL SetFormat(
    BYTE *pFormat,
    ULONG length
);

Parameters

pFormat

Pointer to a block of memory that contains the format block.

length

Length of the format block, in bytes.

Return Value

Returns TRUE if successful, or FALSE if an error occurred.

Remarks

This method allocates memory for the format block and copies the buffer specified by pFormat into the new format block. If the media type already contains a format block, the old one is released. The method also sets the cbFormat member of the AM_MEDIA_TYPE structure.

To set the format type, call the CMediaType::SetFormatType method.

Requirements

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

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

See Also