I have built the ezrgb24 sample project successfully, which is in the DirectShow SDK. But I encountered a confused problem when I debug it.
The following Copy method was called by the Transform method.
HRESULT CEZrgb24::Copy(IMediaSample *pSource, IMediaSample *pDest) const
{
...
// Copy the sample data
BYTE *pSourceBuffer, *pDestBuffer;
long lSourceSize = pSource->GetActualDataLength();
#ifdef DEBUG
long lDestSize = pDest->GetSize();
ASSERT(lDestSize >= lSourceSize);
#endif
...
}
The assert statment failed. With graphedit, I checked the filter's input media type is RGB24 and the output is also RGB24. I cannot understand why the buffer size of the output will be smaller than acural data size of the input. Who can help me?
Thanks.
--------------------------------------------------2009/8/20 edited
O, I found the actually input media subtye is of RGB32 but output's subtype is RGB24. But why the type can be RGB32 for both the CEZrgb24::CheckInputType method and the CEZrgb24::CheckTransform only return OK for RGB24.
--------------------------------------------------2009/8/21 edited
I hit the problem. Modify the CEZrgb24::Copy methold as following,
HRESULT CEZrgb24::Copy(IMediaSample *pSource, IMediaSample *pDest) const
{
...
// Copy the sample data
BYTE *pSourceBuffer, *pDestBuffer;
long lSourceSize = m_pInput->CurrentMediaType().GetSampleSize();
#ifdef DEBUG
long lDestSize = m_pOutput->CurrentMediaType().GetSampleSize();
ASSERT(lDestSize >= lSourceSize);
#endif
...
}
Now, the assert successed.