共用方式為


Media Types and Sub Types

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

DirectShow uses the AM_MEDIA_TYPE structure to describe media samples.

This structure includes GUID fields for major type, subtype, and format type, as well as fields specifying other properties of the sample, such as whether the samples are compressed.

The following sections summarize the major type and subtype options registered by DirectShow. These media types are defined in the header file Uuids.h.

Media Types with No Subtype

The following table describes the media types with no subtype.

Type Description

MEDIATYPE_AnalogAudio

Analog audio connection.

MEDIATYPE_File

Media type is a file, used closed captions.

MEDIATYPE_Interleaved

Data is interleaved, used by Digital Video (DV).

MEDIATYPE_Midi

Data is MIDI format.

MEDIATYPE_ScriptCommand

Data is a script command, used by closed captions.

MEDIATYPE_Text

Data is text.

MEDIATYPE_Timecode

Data is timecode data.

Audio Media Types

The wFormatTag member in the WAVEFORMATEX structure specifies the audio format type.

The format type is generally FORMAT_WaveFormatEx. Media samples are generally whole number of samples as specified in the wBitsPerSample member in the WAVEFORMATEX structure. This is not necessarily true for MPEG audio samples that can come from packetized streams and are therefore not necessarily packaged on sample/frame boundaries.

For MPEG audio the time stamp in a media sample is the time stamp for the first frame whose first byte is contained in the media sample.

Media subtypes are defined for each wFormatTag as follows:

  • The Data1 subfield of the Media Subtype is the same as the wFormatTag value.
  • The Data 2 field is 0.
  • The Data 3 field is 0x0010.
  • The Data 4 field is 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71.

Thus, for PCM audio the subtype GUID would be:

{00000001-0000-0010-8000-00AA00389B71}

Older filters may still use GUID_NULL as the subtype so this should be checked for. However, registration of a filter with the explicit subtype greatly improves the speed of graph loading, especially when the given filter is not required.

The CreateAudioMediaType function can be used to create an AM_MEDIA_TYPE structure from a WAVEFORMATEX Structure.

The following table describes the audio media subtypes.

MEDIATYPE_Audio Data is audio

MEDIASUBTYPE_PCMAudio

PCM audio

MEDIASUBTYPE_MPEG1Packet

MPEG1 Audio Packet

MEDIASUBTYPE_MPEG1Payload

MPEG1 Audio Payload

Buffering Media Types

The media types MEDIATYPE_AudioBuffered and MEDIATYPE_VideoBuffered identify that an encoding filter cannot encode data in real time. The Capture Graph Builder inserts a buffering filter immediately upstream from the encoding filter whenever it encounters either of these media types. The MEDIATYPE_AudioBuffered and MEDIATYPE_VideoBuffered media types support the same subtypes as MEDIATYPE_Audio and MEDIATYPE_Video respectively.

Line 21 Media Types

The following table describes the line 21 closed captioning media subtypes.

MEDIATYPE_AUXLine21Data Data is line 21 type, used by closed captions

MEDIASUBTYPE_Line21_BytePair

Line 21 data as byte pairs

MEDIASUBTYPE_Line21_GOPPacket

Line 21 data in DVD GOP Packet

MEDIASUBTYPE_Line21_VBIRawData

Line 21 data in raw VBI format

MPEG-2 Media Types

The following table describes the MPEG-2 media subtypes.

MEDIATYPE_MPEG2_PES Data is MPEG-2 format, used by DVD

MEDIASUBTYPE_DVD_SUBPICTURE

Subpicture data

MEDIASUBTYPE_DOLBY_AC3

Dolby data

MEDIASUBTYPE_MPEG2_AUDIO

MPEG-2 audio data

MEDIASUBTYPE_DVD_LPCM_AUDIO

DVD audio data

Stream Media Types

Time stamps are byte positions * 10000000 (notionally 1 byte per second) rather than real times.

The following table describes the stream media subtypes.

MEDIATYPE_Stream Data is a non-time stamped byte stream

MEDIASUBTYPE_Avi

Data from AVI file

MEDIASUBTYPE_WAVE

Data from WAV file

MEDIASUBTYPE_AU

Data from AU file

MEDIASUBTYPE_AIFF

Data from AIFF file

MEDIASUBTYPE_MPEG1Video

MPEG video

MEDIASUBTYPE_MPEG1System

MPEG system

MEDIASUBTYPE_MPEG1VideoCD

MPEG video CD

MEDIASUBTYPE_MPEG1Audio

MPEG audio

MEDIASUBTYPE_DssVideo

Dss Video

MEDIASUBTYPE_DssAudio

Dss Audio

Video Media Types

The following table describes the video media subtypes.

MEDIATYPE_Video Data is video

MEDIASUBTYPE_YVU9

Standard YVU9 format uncompressed data. A planar YUV format.

A Y sample at every pixel, a U and V sample at every fourth pixel horizontally on each line; a Y sample on every vertical line, a U and V sample at every fourth vertical line.

9 bits per pixel.

MEDIASUBTYPE_Y411

YUV 411 format data.

Same as Y41P.

MEDIASUBTYPE_Y41P

Y41P format data. A packed YUV format.

A Y sample at every pixel, a U and V sample at every fourth pixel horizontally on each line; every vertical line sampled.

Byte ordering (lowest first) is U0, Y0, V0, Y1, U4, Y2, V4, Y3, Y4, Y5, Y6, Y7, where the suffix 0 is the leftmost pixel and increasing numbers are pixels increasing left to right.

Each 12-byte block is 8 image pixels.

MEDIASUBTYPE_YUY2

YUY2 format data. Same as UYVY but with different pixel ordering.

Byte ordering (lowest first) is Y0, U0, Y1, V0, Y2, U2, Y3, V2, Y4, U4, Y5, V4, where the suffix 0 is the leftmost pixel and increasing numbers are pixels increasing left to right.

Each 4-byte block is 2 image pixels.

MEDIASUBTYPE_YVYU

YVYU format data. A packed YUV format. Same as UYVY but with different pixel ordering.

Byte ordering (lowest first) is Y0, V0, Y1, U0, Y2, V2, Y3, U2, Y4, V4, Y5, U4, where the suffix 0 is the leftmost pixel and increasing numbers are pixels increasing left to right.

Each 4-byte block is 2 image pixels.

MEDIASUBTYPE_UYVY

UYVY format data. A packed YUV format. A Y sample at every pixel, a U and V sample at every second pixel horizontally on each line; every vertical line sampled. Probably the most popular of the various YUV 4:2:2 formats. Byte ordering (lowest first) is U0, Y0, V0, Y1, U2, Y2, V2, Y3, U4, Y4, V4, Y5, where the suffix 0 is the leftmost pixel and increasing numbers are pixels increasing left to right. Each 4-byte block is 2 image pixels.

MEDIASUBTYPE_Y211

YUV 211 format data.

A packed YUV format.

A Y sample at every second pixel, a U and V sample at every fourth pixel horizontally on each line; every vertical line sampled.

Byte ordering (lowest first) is Y0, U0, Y2, V0, Y4, U4, Y6, V4, Y8, U8, Y10, V8, where the suffix 0 is the leftmost pixel and increasing numbers are pixels increasing left to right.

Each 4-byte block is 4 image pixels.

MEDIASUBTYPE_CLJR

Cirrus Logic Jr YUV 411 format with less than 8 bits per Y, U, and V sample.

A Y sample at every pixel, a U and V sample at every fourth pixel horizontally on each line; every vertical line sampled.

MEDIASUBTYPE_IF09

Indeo produced YVU9 format with additional information about differences from the last frame. 9.5 bits per pixel but reported as 9.

MEDIASUBTYPE_MJPG

Motion JPEG (MJPG) compressed video.

MEDIASUBTYPE_TVMJ

TrueVision MJPG format.

MEDIASUBTYPE_WAKE

MJPG format produced by some cards.

MEDIASUBTYPE_CFCC

MJPG format produced by some cards.

MEDIASUBTYPE_IJPG

JPEG format.

MEDIASUBTYPE_Plum

Plum MJPG format.

MEDIASUBTYPE_RGB1

RGB 1 bit per pixel. Palettized.

MEDIASUBTYPE_RGB4

RGB 4 bits per pixel. Palettized.

MEDIASUBTYPE_RGB8

RGB 8 bits per pixel. Palettized.

MEDIASUBTYPE_RGB565

565 format of RGB, 16 bits per pixel. Uncompressed RGB samples.

MEDIASUBTYPE_RGB555

555 format of RGB, 16 bits per pixel. Uncompressed RGB samples.

MEDIASUBTYPE_RGB24

RGB 24 bits per pixel. Uncompressed RGB samples.

MEDIASUBTYPE_RGB32

RGB 32 bits per pixel. Uncompressed RGB samples.

MEDIASUBTYPE_Overlay

Video delivered using hardware overlay.

MEDIASUBTYPE_dvsd

Standard DV format.

MEDIASUBTYPE_dvhd

High Definition DV format.

MEDIASUBTYPE_dvsl

Long Play DV format.

MEDIASUBTYPE_MPEG1Packet

MPEG1 Video Packet.

MEDIASUBTYPE_MPEG1Payload

MPEG1 Video Payload.

MEDIASUBTYPE_VideoPort

Data is video port data, used with DVD.