Compartir a través de


AM_MEDIA_TYPE (Windows CE 5.0)

Send Feedback

This structure describes a media sample type.

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 MPEG1VIDEOINFO
    FORMAT_VideoInfo VIDEOINFOHEADER
    FORMAT_WaveFormatEx WAVEFORMATEX
    FORMAT_MPEG2Video MPEG2VIDEOINFO
    FORMAT_VideoInfo2 VIDEOINFOHEADER2

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

DirectShow applications and DirectShow filters have different include file and link library requirements. See Setting Up the Build Environment for more information.

Pocket PC: Windows Mobile 5.0 and later
Smartphone: Windows Mobile 5.0 and later
OS Versions: Windows CE 2.12 and later. Version 2.12 requires DXPAK 1.0 or later.
Header: Dshow.h.

See Also

DirectShow Structures

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.