Working with DMO Media Types

The input and output media types that are used by the codec DMOs are defined using the DMO_MEDIA_TYPE structure. This structure is identical to both WM_MEDIA_TYPE, which is defined in the Windows Media Format SDK, and AM_MEDIA_TYPE, which is defined in Microsoft DirectShow®. Depending upon your application, you may use variables defined as any one of these three types. It is safe to cast a pointer to one of the media type structures as another. For example:

    DMO_MEDIA_TYPE MediaType;
    WM_MEDIA_TYPE* pMedia = NULL;
    pMedia = (WM_MEDIA_TYPE*)&MediaType;

The format types that are used by the codecs are generally limited to those described by the VIDEOINFOHEADER and WAVEFORMATEX structures. For convenience, constants for these format types are included in the wmcodecconst.h header file. The constant names are WMCFORMAT_VideoInfo and WMCFORMAT_WaveFormatEx respectively. The audio codecs can work with the WAVEFORMATEXTENSIBLE structure in some circumstances, and must use it in others. However, DMO_MEDIA_TYPE.formattype is set to the same value as it is for WAVEFORMATEX. For more information about using WAVEFORMATEXTENSIBLE, see Using High-Definition Audio.

Note     You must include the format type structure used as the encoder output in whatever container you use to store the compressed data. The decoders require the original format structure to decompress the content. In addition to the members of the structure, compressed Windows Media Audio and Video types require additional format information, which is appended to the structure. For more information, see Working with Audio and Working with Video.

Related topics

Working with Codec DMOs