Applications can set and retrieve the palette used with captured video. This gives applications the ability to control and modify the palette used for video sequences. The palette messages apply only to the video in and video out channels. The DVM_PALETTE assigns or obtains palette information and the DVM_PALETTERGB555 message associates an RGB555 palette with a video device channel.
The calling application must modify these messages with flags to indicate their purpose. Your driver must examine the flags sent with the messages to determine the proper response. The flags are specified in lParam1.
The VIDEO_CONFIGURE_GET or VIDEO_CONFIGURE_SET flag modifies the DVM_PALETTE message to indicate that the driver should return the current palette or that the driver should set a new palette. The lParam2 parameter used with DVM_PALETTE contains a pointer to a VIDEOCONFIGPARMS data structure. This structure has the following members:
typedef struct tag_video_configure_parms {
LPDWORD lpdwReturn;
LPVOID lpData1;
DWORD dwSize1;
LPVOID lpData2;
DWORD dwSize2;
} VIDEOCONFIGPARMS;
If the VIDEO_CONFIGURE_SET flag is used with DVM_PALETTE, the lpData1 member points to a LOGPALETTE structure containing the new palette. The size of the memory allocated for the LOGPALETTE structure is specified in the dwSize1 member.
If the VIDEO_CONFIGURE_GET flag is used with DVM_PALETTE, the lpData1 member points to a LOGPALETTE structure used to retrieve the palette. The size of the memory allocated for the LOGPALETTE structure is specified in the dwSize1 member. Your driver should transfer the palette to the structure indicated by lpData1.
If an application just wants to determine the size of the palette, it sends the DVM_PALETTE message with both the VIDEO_CONFIGURE_GET and VIDEO_CONFIGURE_QUERYSIZE flags. Your driver should return the palette size in the lpdwReturn member.
If an application just wants to know if your driver supports DVM_PALETTE and its flags, it also sets the VIDEO_CONFIGURE_QUERY flag with VIDEO_CONFIGURE_GET or VIDEO_CONFIGURE_SET. (The VIDEO_CONFIGURE_QUERY flag without VIDEO_CONFIGURE_GET or VIDEO_CONFIGURE_SET is invalid.) Your device driver should return DV_ERR_OK if it supports the DVM_PALETTE message and the operation indicated with the set or get flag. Otherwise, it should return DV_ERR_NOTSUPPORTED.
DVM_PALETTE does not use the lpData2 and dwSize2 members.
Applications use the DVM_PALETTERGB555 message to associate an RGB555 palette with a video device channel. Only the VIDEO_CONFIGURE_SET and VIDEO_CONFIGURE_QUERY flags apply to this message. The VIDEO_CONFIGURE_SET flag modifies the DVM_PALETTERGB555 message to indicate that the driver should set a new palette. The lParam2 parameter used with DVM_PALETTERGB555 contains a pointer to a VIDEOCONFIGPARMS data structure.
When setting the palette, the lpData1 member points to a LOGPALETTE structure containing the new palette. The lpData2 member points to a 32 kilobyte RGB555 translation table. The device driver uses this table to translate the RGB555 triples into palette colors when capturing data in an 8 bit palette mode. The dwSize1 and dwSize2 members specify the size of the structures indicated by lpData1 and lpData2.
If an application just wants to know if your driver supports DVM_PALETTERGB555, it sends the VIDEO_CONFIGURE_QUERY flag with VIDEO_CONFIGURE_SET. (The VIDEO_CONFIGURE_QUERY flag without VIDEO_CONFIGURE_SET is invalid.) Your device driver should return DV_ERR_OK if it supports the DVM_PALETTERGB555 message. Otherwise, it should return DV_ERR_NOTSUPPORTED.