Compartilhar via


CopyMediaType

 
Microsoft DirectShow 9.0

CopyMediaType

The CopyMediaType function copies an AM_MEDIA_TYPE structure into another structure, including the format block

Syntax

  HRESULT WINAPI CopyMediaType(
    AM_MEDIA_TYPE *pmtTarget,
    const AM_MEDIA_TYPE *pmtSource
);

Parameters

pmtTarget

Pointer to an AM_MEDIA_TYPE structure. The method copies the media type into this structure.

pmtSource

Pointer to a source AM_MEDIA_TYPE structure to copy.

Return Value

Returns S_OK or E_OUTOFMEMORY.

Remarks

This function allocates the memory for the format block. If the pmtTarget 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 on pmtTarget 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