0

大家都知道“OMX_BUFFERHEADERTYPE”这个结构体携带数据缓冲区。“pBuffer”字段指向数据缓冲区,“nFilledLen”表示当前缓冲区中的字节数。我尝试从 "OMX.cpp" 中的 "OnFillBufferDone()" 转储 yuvdata,但转储的数据已损坏且不完整。代码如下:

OMX_ERRORTYPE OMX::OnFillBufferDone(
    node_id node, buffer_id buffer, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer) {
ALOGV("OnFillBufferDone buffer=%p", pBuffer);

omx_message msg;
msg.type = omx_message::FILL_BUFFER_DONE;
msg.node = node;
msg.u.extended_buffer_data.buffer = buffer;
msg.u.extended_buffer_data.range_offset = pBuffer->nOffset;
msg.u.extended_buffer_data.range_length = pBuffer->nFilledLen;
msg.u.extended_buffer_data.flags = pBuffer->nFlags;
msg.u.extended_buffer_data.timestamp = pBuffer->nTimeStamp;
//dump date code
if(pBuffer->nFilledLen>0) {
FILE *fp=NULL;
fp=fopen("/data/video.yuv","a+");
if(fp) {
    fwrite((unsigned char *)pBuffer->pBuffer,1,pBuffer->nFilledLen,fp);
    fclose(fp);
}else {
    ALOGE(" catch data is failure");
}/*...*/}}}

转储 yuv 数据的方法是错误的吗?

你能告诉我如何转储 yuv 吗?谢谢!!!!

4

0 回答 0