I'm using VTDecompressionSession to decode an H.264 stream over a network. I need to copy the YUV buffer from the given image buffer. I've verified that the given imageBuffer's typeID is equal to CVPixelBufferGetTypeID().
But whenever I try to retrieve the base address of the buffer or any of the planes, they always come back NULL. The OSStatus that iOS is passing is 0, so my assumption is that nothing is wrong here. Perhaps I don't know how to expect to extract the data. Can anyone help?
void decompressionCallback(void * CM_NULLABLE decompressionOutputRefCon,
void * CM_NULLABLE sourceFrameRefCon,
OSStatus status,
VTDecodeInfoFlags infoFlags,
CM_NULLABLE CVImageBufferRef imageBuffer,
CMTime presentationTimeStamp,
CMTime presentationDuration )
{
CFShow(imageBuffer);
size_t dataSize = CVPixelBufferGetDataSize(imageBuffer);
void * decodedBuffer = CVPixelBufferGetBaseAddress(imageBuffer);
memcpy(pYUVBuffer, decodedBuffer, dataSize);
}
Aucun commentaire:
Enregistrer un commentaire