Microsoft Windows CE 3.0  

Override the Transform Function

This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

To perform the desired transformation on your input media, your must override the Transformfunction of your transform base class, or implement your own transformation functions. (This does not apply to filter classes derived from CBaseFilter.)

For example, consider the following code from the Contrast sample. You override the CContrast::Transform function as follows:

HRESULT CContrast::Transform(IMediaSample *pIn,
IMediaSample *pOut) { HRESULT hr = Copy(pIn, pOut); if (FAILED(hr))
{ return hr; } return Transform(pOut); }

The first CContrast::Transform function copies the media data, and then passes the copy (pointed to by the pOutparameter) to a second Transform function. The first Transform function in the Contrast sample is an overloaded function, and the second form of the Transform function performs an in-place transform on the copy of the input media, as shown in the following code fragment.

HRESULT CContrast::Transform(IMediaSample
*pMediaSample) { signed char ContrastLevel; ContrastLevel =
m_ContrastLevel; AM_MEDIA_TYPE *pAdjustedType = NULL;
pMediaSample->GetMediaType(&pAdjustedType); HRESULT hr =
Transform(&AdjustedType, ContrastLevel);
pMediaSample->SetMediaType(&AdjustedType); return NOERROR;

Note that the second form of the overloaded Transform function calls a third form of the overloaded Transform function.

 Last updated on Tuesday, May 18, 2004

© 2004 Microsoft Corporation. All rights reserved.