First you have to specify the correct bitmapinfoheader on your output pin's GetMediaType(), are you doing that?
DecideBufferSize() is the correct place to call SetProperties() on the allocator. Make sure you are calculating the size correctly. Here's a sample:
//
// DecideBufferSize
//
// Tell the output pin's allocator what size buffers we
// require. Can only do this when the input is connected
//
HRESULT CCSVideoDecoder::DecideBufferSize(IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *pProperties)
{
// Is the input pin connected
if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
ASSERT(pAlloc);
ASSERT(pProperties);
HRESULT hr = NOERROR;
// get input dimensions
CMediaType outMediaType = m_pOutput->CurrentMediaType();
if (*outMediaType.FormatType() == FORMAT_VideoInfo)
{
VIDEOINFOHEADER *vihOut = (VIDEOINFOHEADER *)outMediaType.Format();
pProperties->cbBuffer = GetBitmapSize(&vihOut->bmiHeader);
ASSERT(pProperties->cbBuffer);
}
pProperties->cBuffers = MAX_SAMPLE_QUEUE;
// Ask the allocator to reserve us some sample memory
ALLOCATOR_PROPERTIES Actual;
hr = pAlloc->SetProperties(pProperties,&Actual);
if (FAILED(hr)) {
return hr;
}
ASSERT( Actual.cBuffers >= 1 );
if (pProperties->cBuffers > Actual.cBuffers ||
pProperties->cbBuffer > Actual.cbBuffer) {
return E_FAIL;
}
return NOERROR;
}
www.chrisnet.net