CImagePalette.CopyPalette method

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The CopyPalette method copies the palette from any VIDEOINFO structure to any palettized VIDEOINFO structure.

Syntax

HRESULT CopyPalette(
   const CMediaType *pSrc,
   const CMediaType *pDest
);

Parameters

pSrc

Pointer to the source media type.

pDest

Pointer to the destination media type.

Return value

Returns S_OK if the palette was copied. Returns S_FALSE if either the source or destination media type does not have a palette.

Remarks

The pDest media type must be a palettized format with a color depth of 8 bits or less. The pSrc media type can be any VIDEOINFOHEADER type with a palette, including YUV and true-color formats with palette entries. The method copies the palette entries from pSrc into a new palette, and attaches the new palette to pDest.

Requirements

Requirement Value
Header
Winutil.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

CImagePalette Class