Index Topic Contents | |||
Previous Topic: Math Helper Functions Next Topic: Object and Pin Functions |
Media Type Functions
The Mtype.h header file in the DirectShow base classes provides helper functions for handling media types. These general-purpose functions create, 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:
- CreateMediaType is the opposite of DeleteMediaType.
- FreeMediaType is the opposite of CopyMediaType.
Function Description AreEqualVideoTypes Compares the format, height, and width of two video sources. 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. DeleteMediaType Deletes a task-allocated AM_MEDIA_TYPE structure. FreeMediaType Frees a task-allocated AM_MEDIA_TYPE structure from memory. Media Type Functions
AreEqualVideoTypesDetermines if two media types have the same video format, width, and height.
BOOL WINAPI AreEqualVideoTypes (
CMediaType *pmt1,
CMediaType *pmt2
);Parameters
- pmt1
- First media type to compare.
- pmt2
- Second media type to compare.
Return Values
Returns TRUE if pmt1 and pmt2 have the same video format, width, and height or FALSE otherwise.
Media Type Functions
CopyMediaTypeCopies a task-allocated AM_MEDIA_TYPE structure.
void WINAPI CopyMediaType(
AM_MEDIA_TYPE *pmtTarget,
const AM_MEDIA_TYPE *pmtSource
);Parameters
- pmtTarget
- Pointer to an area of memory in which to place the new copy of the structure.
- pmtSource
- Pointer to a source structure to copy.
Return Values
No return value.
Remarks
Free the resources in the pmtTarget structure by calling FreeMediaType when your code is done with the structure.
Media Type Functions
CreateAudioMediaTypeInitializes a media type structure given a wave format structure.
STDAPI CreateAudioMediaType(
const WAVEFORMATEX *pwfx,
AM_MEDIA_TYPE *pmt,
BOOL bSetFormat
);Parameters
- pwfx
- Pointer to the supplied WAVEFORMATEX structure.
- pmt
- Pointer to the AM_MEDIA_TYPE structure to initialize.
- bSetFormat
- Flag indicating whether to initialize the format section of the AM_MEDIA_TYPE structure, specifically the cbFormat and pbFormat members. Specify TRUE to initialize the format section, FALSE otherwise.
Return Values
Returns E_OUTOFMEMORY if memory could not be allocated for the format data; S_OK otherwise.
Media Type Functions
CreateMediaTypeCreates a task-allocated AM_MEDIA_TYPE structure.
AM_MEDIA_TYPE * WINAPI CreateMediaType(
AM_MEDIA_TYPE const *pSrc
);Parameters
- pSrc
- Pointer to an AM_MEDIA_TYPE source structure.
Return Values
Returns a new AM_MEDIA_TYPE structure, or NULL if there is an error.
Remarks
Free the structure and resources allocated by this routine by calling DeleteMediaType when your code is done with the structure.
Media Type Functions
DeleteMediaTypeDeletes a task-allocated AM_MEDIA_TYPE structure.
void WINAPI DeleteMediaType(
AM_MEDIA_TYPE *pmt
);Parameters
- pmt
- Pointer to an AM_MEDIA_TYPE structure.
Return Values
No return value.
Remarks
The structure should have been created by a call to CreateMediaType.
Media Type Functions
FreeMediaTypeFrees a task-allocated AM_MEDIA_TYPE structure from memory.
void WINAPI FreeMediaType(
AM_MEDIA_TYPE& mt
);Parameters
- mt
- Address of the structure.
Return Values
No return value.
Remarks
The structure should have been initialized by a call to CopyMediaType.
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.