DWORD effectiveSize = size + sizeof(WMT_VIDEOIMAGE_SAMPLE2);
BYTE * dst = this->AllocateBuffer(effectiveSize);
WMT_VIDEOIMAGE_SAMPLE2 sample = {0};
sample.dwMagic = WMT_VIDEOIMAGE_MAGIC_NUMBER_2;
sample.dwStructSize = sizeof(WMT_VIDEOIMAGE_SAMPLE2);
sample.dwControlFlags =
WMT_VIDEOIMAGE_SAMPLE_INPUT_FRAME ;
err = memcpy_s(dst, dstSize, &sample, sizeof
(WMT_VIDEOIMAGE_SAMPLE2));
err = memcpy_s(dst + sizeof(WMT_VIDEOIMAGE_SAMPLE2), size,
srcBuffer, size);
hr = this->sampleBuffer->SetLength(effectiveSize);
hr = m_pWriter->WriteSample( wStreamNum, cnsSampleTime, dwFlags,
this->sampleBuffer);
srcBuffer is the raw bits of the bitmaps with 3 bytes per pixel.
is the WMT_VIDEOIMAGE_SAMPLE2 structure set correctly?
Do we need to append some kind of bitmap header to the raw data ?