This is the FillBuffer
function:
HRESULT CVCamStream::FillBuffer(IMediaSample *pms)
{
REFERENCE_TIME rtNow;
REFERENCE_TIME avgFrameTime = ((VIDEOINFOHEADER*)m_mt.pbFormat)->AvgTimePerFrame;
rtNow = m_rtLastTime;
m_rtLastTime += avgFrameTime;
pms->SetTime(&rtNow, &m_rtLastTime);
pms->SetSyncPoint(TRUE);
BYTE *pData;
pms->GetPointer(&pData);
long lDataLen = pms->GetSize();
ProcessFrame(hdc, &pData);
return NOERROR;
}
and here what I do inside ProcessFrame
:
void ProcessFrame(HDC hdc, BYTE **lpbitmap)
{
BYTE *q = *lpbitmap;
const int32_t height = 640;
const int32_t width = 480;
for (int y = 0; y < height; y++)
{
uint8_t* p = bgra_image_data;
for (int x = 0; x < width; x++)
{
if (p[3] > 0) for (int i = 0; i < 3; i++) q[i] = p[i];
p += 4;
q += 3;
}
}
}
In details, I'm playing with the bytes of a BRGA
images, with the same dimensions.
Well, using graphedt it works like a charm! Instead, selecting this filter as Skype source sometimes it renders completely black, sometimes it messes up everything - the image is not readable.
In any case after few seconds it crashes due to a write access violation. Do you see any evidence of errors in my code, that graphedt might ignore?