The Mtype.h header file in the DirectShow base classes provides helper functions for handling media types. These general-purpose functions copy and delete a task-allocated AM_MEDIA_TYPE structure. This is useful when using the IEnumMediaTypes interface, because the implementation allocates the structures that must be deleted later.
The functions are paired as follows:
Function | Description |
AreEqualVideoTypes | Compares the format, height, and width of two video sources. |
CopyMediaType | Copies a task-allocated AM_MEDIA_TYPE structure. |
CreateMediaType | Allocates and initializes an AM_MEDIA_TYPE structure. |
DeleteMediaType | Deletes a task-allocated AM_MEDIA_TYPE structure. |
FreeMediaType | Frees a task-allocated AM_MEDIA_TYPE structure from memory. |
Determines if two media types have the same video format, width, and height.
BOOL WINAPI AreEqualVideoTypes (
CMediaType *pmt1,
CMediaType *pmt2
);
Returns TRUE if pmt1 and pmt2 have the same video format, width, and height or FALSE otherwise.
Copies a task-allocated AM_MEDIA_TYPE structure.
void WINAPI CopyMediaType(
AM_MEDIA_TYPE *pmtTarget,
const AM_MEDIA_TYPE *pmtSource
);
No return value.
Free the resources in the pmtTarget structure by calling FreeMediaType when your code is done with the structure.
Creates a task-allocated AM_MEDIA_TYPE structure.
AM_MEDIA_TYPE * WINAPI CreateMediaType(
AM_MEDIA_TYPE const *pSrc
);
Returns a new AM_MEDIA_TYPE structure, or NULL if there is an error.
Free the structure and resources allocated by this routine by calling DeleteMediaType when your code is done with the structure.
Deletes a task-allocated AM_MEDIA_TYPE structure.
void WINAPI DeleteMediaType(
AM_MEDIA_TYPE *pmt
);
No return value.
The structure should have been created by a call to CreateMediaType.
Frees a task-allocated AM_MEDIA_TYPE structure from memory.
void WINAPI FreeMediaType(
AM_MEDIA_TYPE& mt
);
No return value.
The structure should have been initialized by a call to CopyMediaType.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.