Microsoft DirectX 9.0

VIDEOINFOHEADER2 Structure

The VIDEOINFOHEADER2 structure describes the bitmap and color information for a video image, including interlace, copy protection, and pixel aspect ratio information.

Syntax

typedef struct tagVIDEOINFOHEADER2 {
    RECT                rcSource;
    RECT                rcTarget;
    DWORD               dwBitRate;
    DWORD               dwBitErrorRate;
    REFERENCE_TIME      AvgTimePerFrame;
    DWORD               dwInterlaceFlags;
    DWORD               dwCopyProtectFlags;
    DWORD               dwPictAspectRatioX; 
    DWORD               dwPictAspectRatioY; 
    union {
        DWORD           dwControlFlags;
        DWORD           dwReserved1;
    };
    DWORD               dwReserved2;
    BITMAPINFOHEADER    bmiHeader;
} VIDEOINFOHEADER2;

Members

rcSource

RECT structure that specifies what part of the source stream should be used to fill the destination buffer. Renderers can use this field to ask the decoders to stretch or clip. For more information, see Source and Target Rectangles in Video Renderers

rcTarget

RECT structure that specifies that specifies what part of the destination buffer should be used

dwBitRate

Approximate data rate of the video stream, in bits per second.

dwBitErrorRate

Data error rate of the video stream, in bits per second.

AvgTimePerFrame

The video frame's average display time, in 100-nanosecond units. For more information, see the Remarks section for the VIDEOINFOHEADER structure.

dwInterlaceFlags

Flags that specify how the video is interlaced. This member is a bit-wise combination of zero or more of the following flags. The flags in Group 2 are mutually exclusive, and so are the flags in Group 3. (The flags in Group 2 are not recommended.) The flags in Group 1 may be combined with each other, and with one flag each from Group 2 and Group 3. See the table at the bottom of this page for more information about flag combinations.

Flag Description
Group 1  
AMINTERLACE_IsInterlaced The stream is interlaced. If this flag is absent, the video is progressive and the other bits are irrelevant.
AMINTERLACE_1FieldPerSample Each media sample contains one field. If this flag is absent, each media sample contains two fields.
AMINTERLACE_Field1First Field 1 is first. If this flag is absent, field 2 is first. (The top field in PAL is field 1, and the top field in NTSC is field 2.)
Group 2  
AMINTERLACE_FieldPatField1Only The stream never contains a field 2.
AMINTERLACE_FieldPatField2Only The stream never contains a field 1.
AMINTERLACE_FieldPatBothRegular There is one field 2 for every field 1.
AMINTERLACE_FieldPatBothIrregular The stream contains an irregular pattern of field 1 and field 2.
Group 3  
AMINTERLACE_DisplayModeBobOnly Bob display mode only.
AMINTERLACE_DisplayModeWeaveOnly Weave display mode only.
AMINTERLACE_DisplayModeBobOrWeave Either bob or weave mode.

Set undefined flags to zero, or the connection will be rejected.

dwCopyProtectFlags

Flag set with the AMCOPYPROTECT_RestrictDuplication value (0x00000001) to indicate that the duplication of the stream should be restricted. If undefined, specify zero or else the connection will be rejected.

dwPictAspectRatioX

The X dimension of picture aspect ratio. For example, 16 for a 16-inch x 9-inch display.

dwPictAspectRatioY

The Y dimension of picture aspect ratio. For example, 9 for a 16-inch x 9-inch display.

dwControlFlags, dwReserved1

This field was originally named dwReserved, and was required to be zero. The field was renamed to dwControlFlags, and must now contain a bitwise OR of zero or more of the following flags:

AMCONTROL_USED 0x00000001
AMCONTROL_PAD_TO_4x3 0x00000002
AMCONTROL_PAD_TO_16x9 0x00000004

These flags are used by decoders to determine the aspect ratio of the output rectangle. The AMCONTROL_USED flag is used to test whether these flags are supported. A source filter should set the AMCONTROL_USED flag and see if QueryAccept succeeds on the downstream pin. If it is rejected, then the AMCONTROL flags cannot be used, and the field must be set to zero. The AMCONTROL_PAD_TO_4x3 flag indicates that the image should be padded and displayed in a 4x3 area. The AMCONTROL_PAD_TO_16x9 flag indicates that the image should be padded and displayed in a 16x9 area. For more information on the use of these flags, see MPEG Decoder Preprocessing Transformations.

dwReserved2

Reserved for future use. Must be zero.

bmiHeader

BITMAPINFOHEADER structure that contains color and dimension information for the video image bitmap.

Remarks

The dwInterlaceFlags field indicates whether the video is interlaced, and if so, the format of the fields within the media samples. The following table shows the valid interlace modes for the Overlay Mixer and Video Mixing Renderer filters.

Display Mode Interlace Flags Description
Progressive frames None The video stream is not interlaced.
Non-interleaved bob AMINTERLACE_IsInterlaced |

AMINTERLACE_1FieldPerSample |

AMINTERLACE_DisplayModeBobOnly

The entire video stream is interlaced, and each media sample contains a single video field.
Interleaved bob AMINTERLACE_IsInterlaced |

AMINTERLACE_DisplayModeBobOnly

The entire video stream is interlaced. Each media sample contains two video fields. Flags on the media sample indicate which field to display first.
Weave AMINTERLACE_IsInterlaced |

AMINTERLACE_FieldPatBothRegular |

AMINTERLACE_DisplayModeWeaveOnly

The video stream is interlaced, and each sample contains two video fields. The fields should not be deinterlaced.
Bob or weave AMINTERLACE_IsInterlaced |

AMINTERLACE_DisplayModeBobOrWeave

The video stream varies between progressive and interlaced content.  Each media sample contains either a progressive frame or two video fields. Flags on the media sample indicate the correct way to display the contents.

If the video is interlaced, the media samples may carry flags that describe the contents of the sample (such as field 1 or field 2), along with the rendering requirements. These are specified by setting the dwTypeSpecificFlags member of each media sample's AM_SAMPLE2_PROPERTIES structure. The following table shows the valid media sample flags for each of the display modes listed in the previous table.

Display ModeMedia Sample Properties
Progressive frames None
Non-interleaved bob AM_VIDEO_FLAG_FIELD1 or AM_VIDEO_FLAG_FIELD2
Interleaved bob Field 1 first AM_VIDEO_FLAG_FIELD1FIRST
Field 2 First None
Weave AM_VIDEO_FLAG_WEAVE
Bob or weave Bob, field 1 first AM_VIDEO_FLAG_FIELD1FIRST
Bob, field 2 first None
Weave AM_VIDEO_FLAG_WEAVE
Use the bit mask AMINTERLACE_FieldPatternMask to check the field pattern flags in dwInterlaceFlags:

switch (dwInterlaceFlags & AMINTERLACE_FieldPatternMask)
{
case AMINTERLACE_FieldPatField1Only:
    // Stream never contains a Field 2.

case AMINTERLACE_FieldPatField2Only:
    // Stream never contains a Field 1.

case AMINTERLACE_FieldPatBothRegular:
    // One Field 2 for every Field 1.

case AMINTERLACE_FieldPatBothIrregular:
    // Random pattern of Field 1 and Field 2.
}

Use the bit mask AMINTERLACE_DisplayModeMask to check the display mode flags in dwInterlaceFlags:

switch (dwInterlaceFlags & AMINTERLACE_DisplayModeMask)
{
case AMINTERLACE_DisplayModeBobOnly:
    // Bob display mode only.

case AMINTERLACE_DisplayModeWeaveOnly:
    // Weave display mode only.

case AMINTERLACE_DisplayModeBobOrWeave:
    // Either bob or weave mode.
}

Requirements

Include Dvdmedia.h.