次の方法で共有


Media Type Functions

 
Microsoft DirectShow 9.0

Media Type Functions

The DirectShow base classes provides helper functions for handling the AM_MEDIA_TYPE structure.

The AM_MEDIA_TYPE structure contains a pointer (the pbFormat member) to another block of memory, which is called the format block. When you work with this structure, therefore, you must be careful about memory allocation in order to avoid memory leaks.

The following functions allocate memory:

  • CreateMediaType allocates a new AM_MEDIA_TYPE structure and the format block.
  • CopyMediaType copies to an existing AM_MEDIA_TYPE structure, but allocates the format block.
  • CreateAudioMediaType initializes an existing AM_MEDIA_TYPE structure, and optionally allocates the format block.

The following functions free memory:

  • FreeMediaType releases the format block.
  • DeleteMediaType frees an AM_MEDIA_TYPE structure, including the format block.

Requirements

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

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

Function Description
CopyMediaType Copies a task-allocated AM_MEDIA_TYPE structure.
CreateAudioMediaType Initializes a media type structure given a wave format structure.
CreateMediaType Allocates and initializes an AM_MEDIA_TYPE structure, from an existing AM_MEDIA_TYPE structure.
DeleteMediaType Deletes a task-allocated AM_MEDIA_TYPE structure.
FreeMediaType Frees a task-allocated AM_MEDIA_TYPE structure from memory.