Bewerken

Delen via


Selecting a Stream Format

Video capture devices can capture video in a number of different formats. The KSDATARANGE structure is used to convey information about the width, height, granularity, cropping, and frame rates for a particular color space. The structures KS_DATARANGE_VIDEO and KS_DATARANGE_VIDEO2 are extensions of the KSDATARANGE structure and should be used for describing video capture formats. Use KS_DATARANGE_VIDEO to describe video frames only. Use KS_DATARANGE_VIDEO2 to describe video fields and video frames, with or without bob or weave settings.

The process of selecting a stream format is called performing a data intersection. The Stream class interface sends an SRB_GET_DATA_INTERSECTION request to a Stream class minidriver to perform a data intersection. The minidriver is responsible for determining the validity of the data range requested and then selecting a particular stream format from the supplied data range, typically using KS_DATAFORMAT_VIDEOINFOHEADER or KS_DATAFORMAT_VIDEOINFOHEADER2 structures.

Finally, the minidriver must set certain members of the resulting format as shown below:

.
.
.
// Calculate biSizeImage for this request, and put the result in both
// the biSizeImage field of the bmiHeader AND in the SampleSize field
// of the DataFormat.
//
// Note that for compressed sizes, this calculation will probably not
// be just width * height * bitdepth
 
DataFormatVideoInfoHeaderOut->VideoInfoHeader.bmiHeader.biSizeImage =
DataFormatVideoInfoHeaderOut->DataFormat.SampleSize = 
KS_DIBSIZE(DataFormatVideoInfoHeaderOut->VideoInfoHeader.bmiHeader);
.
.