Supporting Operations on Video Substream and Destination Surfaces
This section applies only to Windows Server 2003 with SP1 and later, and Windows XP with SP2 and later.
The VMR on Microsoft Windows Server 2003 SP1 and later and Windows XP SP2 and later must be able to perform certain operations on video substream and destination surfaces.
Operations on Video Substream Surfaces
Color Filling Substream Surfaces
The VMR and other Microsoft DirectShow components must be able to fill video substream surfaces to a known initial color value, such as transparent black. Therefore, your driver should support calls to its DdBlt callback function using the DDBLT_COLORFILL flag where the video substream surface is the target for the bit-block transfer (blt).
For video substream surfaces with the AYUV FOURCC format, the VMR specifies the AYUV color for transparent black in the dwFillColor member of the DDBLTFX structure. The driver receives DDBLTFX in the bltFX member of the DD_BLTDATA structure when its DdBlt function is called. For information about the DDBLTFX structure, see the Windows SDK documentation.
The AYUV color for transparent black is set as follows:
DXVA_AYUVsample2 clr; clr.bCrValue = 0x80; clr.bCbValue = 0x80; clr.bY_Value = 0x10; clr.bSampleAlpha8 = 0x00; DWORD dwFillColor = *(DWORD*)&clr;
For video substream surfaces with the AI44 or IA44 format, the low-order byte of the value in the dwFillColor member indicates the color value that the driver should use to fill the surface. Typically, the color value is 0.
Copying Contents to Substream Surfaces
The Line21 closed caption decoder and the teletext decoder create a source video substream surface that contains a series of cached-character glyphs. Your driver should generate each frame of output by copying the appropriate characters from the glyph cache to the video substream surface. The VMR then sends the video substream surface to your driver's DeinterlaceBltEx function.
Therefore, your driver's DdBlt function should support copying any FOURCC surface to a video substream surface of the same FOURCC format.
Your driver should indicate that it supports copying FOURCC formats by setting the DDCAPS2_COPYFOURCC flag in the dwCaps2 member of the DDCORECAPS structure. The driver specifies the DDCORECAPS structure in the ddCaps member of a DD_HALINFO structure. DD_HALINFO is returned by the driver's DrvGetDirectDrawInfo function.
In a FOURCC video substream surface copy operation, the driver should not perform stretching or color-space conversion operations.
Operations on Destination Surfaces
Your driver must support the following operations on the destination surface that is used in your driver's DeinterlaceBltEx function:
Color Filling the Destination Surface
Because the VMR must initialize the destination surface to YUV opaque black, your driver must also support calls to its DdBlt callback function using the DDBLT_COLORFILL flag where the target for the bit-block transfer is the destination surface. The VMR specifies the color for opaque black in the dwFillColor member of the DDBLTFX structure. The driver receives the DDBLTFX structure in the bltFX member of the DD_BLTDATA structure when its DdBlt is called.
For YUV packed surface types, the VMR sets the fill color DWORD to the appropriate byte pattern for opaque black. For a YUY2 surface, the fill color DWORD for opaque black is 0x80108010.
For planar surface types, the VMR sets the AYUV color for opaque black as follows:
DXVA_AYUVsample2 clr; clr.bCrValue = 0x80; clr.bCbValue = 0x80; clr.bY_Value = 0x10; clr.bSampleAlpha8 = 0xFF; DWORD dwFillColor = *(DWORD*)&clr;
Your driver should ensure that the correct pixel values are written to each plane of the YUV surface.
Stretching the Destination Surface
Your driver must also support the destination surface being used as a source surface for a bit-block transfer that combines a stretching operation with a color-space conversion. For more information, see Supporting Stretch Blit Operations.
Copying Contents from the Destination Surface
Your driver's DdBlt function must support copying the FOURCC destination surface to a surface of the same FOURCC format. The destination surface is used as the source surface in the copy operation. Your driver should indicate that it supports copying FOURCC formats by setting the DDCAPS2_COPYFOURCC flag.
The destination surface for the bit-block transfer operations can be the primary surface or a Direct3D texture.