When the client application is ready, it sends the ICM_DRAW_BEGIN message to the driver to prepare the driver for decompressing the stream. Your driver should create any tables and allocate any memory that it needs to decompress data efficiently.
The client application sets dwParam1 to the ICDRAWBEGIN data structure. The size of this structure is contained in dwParam2. If the ICDRAW_QUERY flag is set in the dwFlags member, the client application is interrogating your driver to determine if can decompress the data with the parameters specified in the ICDRAWBEGIN data structure. Your driver should return ICM_ERR_OK if it can accept the parameters. It should return ICM_ERR_NOTSUPPORTED if it does not accept them.
When the ICDRAW_QUERY flag is set, ICM_DRAW_BEGIN will not be paired with ICM_DRAW_END. Your driver will receive another ICM_DRAW_BEGIN message without this flag to start the actual decompression sequence.
Your driver can ignore the palette handle specified in the hpal member.
The hwnd and hdc members specify the handle of the window and DC used for drawing. These members are valid only if the ICDRAW_HDC flag is set in the dwFlags member.
The xDst and yDst members specify the x- and y-position of the upper-right corner of the destination rectangle. (This is relative to the current window or display context.) The dxDst and dyDst members specify the width and height of the destination rectangle. These members are valid only if the ICDRAW_HDC flag is set. The ICDRAW_FULLSCREEN flag indicates the entire screen should be used for display and overrides any values specified for these members.
The xSrc, ySrc, dxSrc, and dySrc members specify a source rectangle used to clip the frames of the video sequence. The source rectangle is stretched to fill the destination rectangle. The xSrc and ySrc members specify the x- and y-position of the upper-right corner of the source rectangle. (This is relative to a full-frame image of the video.) The dxSrc and dySrc members specify the width and height of the source rectangle.
Your driver should stretch the image from the source rectangle to fit the destination rectangle. If the client application changes the size of the source and destination rectangles, it will send the ICM_DRAW_END message and specify new rectangles with a new ICM_DRAW_BEGIN message. For more information about handling the source and destination rectangles, see the StretchDIBits function.
The lpbi member specifies a pointer to a BITMAPINFOHEADER data structure containing the input format.
The dwRate member specifies the decompression rate in an integer format. To obtain the rate in frames-per-second, divide this value by the value in dwScale. Your driver uses these values when it handles the ICM_DRAW_START message.
If your driver can decompress the data with the parameters specified in the ICDRAWBEGIN data structure, your driver should return ICERR_OK and allocate any resources it needs to efficiently decompress the data. If your driver cannot decompress the data with the parameters specified, your driver should fail the message by returning ICERR_NOTSUPPORTED. When this message fails, your driver does not receive an ICM_DRAW_END message, so it should not prepare its resources for other ICM_DRAW messages.