AM_MEDIA_TYPE
A version of this page is also available for
4/8/2010
This structure describes a media sample type.
Syntax
typedef struct _MediaType{
GUID majortype;
GUID subtype;
BOOL bFixedSizeSamples;
BOOL bTemporalCompression;
ULONG lSampleSize;
GUID formattype;
IUnknown* pUnk;
ULONG cbFormat;
/* [size_is] */ BYTE __RPC_FAR* pbFormat;
} AM_MEDIA_TYPE;
Members
- majortype
Major type of the media sample.
- subtype
Subtype of the media sample.
- bFixedSizeSamples
If TRUE, samples are of a fixed size.
- bTemporalCompression
If TRUE, samples are compressed.
- lSampleSize
Size of the sample in bytes.
- formattype
Registered (GUID) format type.
- pUnk
Pointer to the IUnknown interface.
- cbFormat
Size of the format section of the media type.
pbFormat
Pointer to the format section of the media type. The layout of this is determined by the format type GUID.Format types include the following.
Format type Structure pointed to FORMAT_MPEGVideo
FORMAT_VideoInfo
FORMAT_WaveFormatEx
FORMAT_MPEG2Video
FORMAT_VideoInfo2
Remarks
Media Types
In any function that receives an AM_MEDIA_TYPE parameter, always validate the values of cbFormat and formattype before dereferencing the pbFormat member.
The following code is incorrect:
if (pmt->formattype == FORMAT_VideoInfo)
{
VIDEOINFOHEADER *pVIH = (VIDEOINFOHEADER*)pmt->pbFormat;
// **** Wrong! ****
}
The following code is correct:
if ((pmt->formattype == FORMAT_VideoInfo) &&
(pmt->cbFormat > sizeof(VIDEOINFOHEADER) &&
(pbFormat != NULL))
{
VIDEOINFOHEADER *pVIH = (VIDEOINFOHEADER*)pmt->pbFormat;
// Now you can use pVIH.
}
Requirements
Header | dshow.h |
Windows Embedded CE | Windows CE 2.12 and later |
Windows Mobile | Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later |
Note | Microsoft DirectShow applications and DirectShow filters have different include file and Library requirements For more information, see Setting Up the Build Environment, Version 2.12 requires DXPAK 1.0 or later |