Override the Transform Function (Windows Embedded CE 6.0)
1/6/2010
To perform the desired transformation on your input media, your must override the Transform function 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 pOut parameter) 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;
}
The second form of the overloaded Transform function calls a third form of the overloaded Transform function.