Media Type Functions
[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
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.
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. |
Requirements
Requirement | Value |
---|---|
Header |
|
Library |
|