Microsoft DirectX 8.0 |
Declaration: Mtype.h.
The Mtype.h header file in the Microsoft® 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:
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.
Determines if two media types have the same video format, width, and height.
Syntax
BOOL WINAPI AreEqualVideoTypes ( CMediaType *pmt1, CMediaType *pmt2 );
Parameters
- pmt1
- Pointer to the first media type to compare.
- pmt2
- Pointer to the second media type to compare.
Return Value
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.
Syntax
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 Value
No return value.
Remarks
Free the resources in the pmtTarget structure by calling FreeMediaType when your code is done with the structure.
Initializes a media type structure given a wave format structure.
Syntax
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 Value
Returns E_OUTOFMEMORY if memory could not be allocated for the format data; S_OK otherwise.
Creates a task-allocated AM_MEDIA_TYPE structure.
Syntax
AM_MEDIA_TYPE * WINAPI CreateMediaType( AM_MEDIA_TYPE const *pSrc );
Parameters
- pSrc
- Pointer to an AM_MEDIA_TYPE source structure.
Return Value
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.
Deletes a task-allocated AM_MEDIA_TYPE structure.
Syntax
void WINAPI DeleteMediaType( AM_MEDIA_TYPE *pmt );
Parameters
- pmt
- Pointer to an AM_MEDIA_TYPE structure.
Return Value
No return value.
Remarks
The structure should have been created by a call to CreateMediaType.
Frees a task-allocated AM_MEDIA_TYPE structure from memory.
Syntax
void WINAPI FreeMediaType( AM_MEDIA_TYPE& mt );
Parameters
- mt
- Pointer to the structure.
Return Value
No return value.
Remarks
The structure should have been initialized by a call to CopyMediaType.