Microsoft DirectX 8.0 |
Describes the format of a media sample.
See Media Type Functions for more information on working with the AM_MEDIA_TYPE structure.
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
- Globally unique identifier (GUID) that specifies the major type of the media sample.
- subtype
- GUID that specifies the subtype of the media sample. For more information, see Media Types
- bFixedSizeSamples
- If TRUE, samples are of a fixed size. This field is informational only. For audio, it is generally set to TRUE. For video, it is usually TRUE for uncompressed video and FALSE for compressed video.
- bTemporalCompression
- If TRUE, samples are compressed using temporal (interframe) compression. A value of TRUE indicates that not all frames are key frames. This field is informational only.
- lSampleSize
- Size of the sample in bytes. For compressed data, the value can be zero.
- formattype
- GUID that specifies the format type. The pbFormat member points to the corresponding format structure. Format types include the following:
Format Type Format Structure FORMAT_None No format type FORMAT_MPEGVideo MPEG1VIDEOINFO FORMAT_MPEG2Video MPEG2VIDEOINFO FORMAT_VideoInfo VIDEOINFOHEADER FORMAT_VideoInfo2 VIDEOINFOHEADER2 FORMAT_WaveFormatEx WAVEFORMATEX - pUnk
- Not used.
- cbFormat
- Size of the format block of the media type.
- pbFormat
- Pointer to the format structure. The structure type is specified by the formattype member. The format structure must be present, unless formattype is GUID_NULL or FORMAT_None.
Remarks
When filters connect, they typically negotiate a media type. The media type describes the format of the data that the filters will exchange. If the filters do not agree on a media type, they cannot connect. Microsoft® DirectShow® describes media types with the AM_MEDIA_TYPE structure.
The first part of the media type contains generic attributes of a data stream. For example, the bFixedSizeSamples member declares whether data will be passed in fixed-size buffers. The second part is a variable-length block of data that contains a format-specific header, called the format block. The pbFormat member points to this block. The layout of the format block depends on the type of data in the stream. For example, if the data stream contains video frames, the format block is a VIDEOINFOHEADER structure.
The stream type is specified by two GUIDs, called the major type and the subtype. The major type defines the general category, such as video, audio, or byte stream. The subtype defines a narrower category within the major type. For example, video subtypes include 8-bit, 16-bit, 24-bit, and 32-bit RGB.
In some cases, the subtype duplicates information that is specified in the format (such as the bit depth). However, sometimes it is useful to specify GUID_NULL for the format type. The subtype enables you to specify some format information without giving the complete format. For example, you can specify 24-bit RGB without giving a particular width or height for the video frame.