I'm learning to use the H.264 encoder in Windows Media Foundation.
What I currently have are media samples in YUV420p format, so that's buffers containing YYYYYYYYUUVV data.
Since the H.264 encoder MFT requires input in form of IMFSample, I'm not sure how to convert the data in buffer into IMFSample.
May I just do like this:
IMFMediaBuffer *pBuffer = NULL;
MFCreateMemoryBuffer(cbSize, &pBuffer);
BYTE *pData = NULL;
pBuffer->Lock(&pData, NULL, NULL);
memcpy(pData, bufferIhaveinYYYYUV format, buffer size); // is it correct?
pBuffer->Unlock();
IMFSample *pSample = NULL;
MFCreateSample(&pSample);
pSample->AddBuffer(pBuffer);
Thanks
This is how I do it (full example at https://github.com/sipsorcery/mediafoundationsamples/blob/master/MFMP4ToYUVWithMFT/MFMP4ToYUVWithMFT.cpp):