如何从OMX codeC的解码输出转储YUV [英] How to dump YUV from OMXCodec decoding output

查看:242
本文介绍了如何从OMX codeC的解码输出转储YUV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从 OMX codeC 解码输出转储 YUV 数据。 这是 MediaBuffer 键入。这是不可能的访问数据()指针。

I'd like to dump YUV data from OMXCodec decoding output. It's MediaBuffer type. It's impossible to access data() pointer.

如果我试图访问数据时,会发生死机由于下面的检查code。

If I try to access data, crash happens due to the check code below.

frameworks/av/media/libstagefright/MediaBuffer.cpp:119 CHECK(mGraphicBuffer == NULL) failed.

请让我知道解决这一提取物 YUV 数据 MediaBuffer

Please let me know the solution to extract YUV data from this MediaBuffer.

推荐答案

MediaBuffer ,我觉得下面的应该是功能。我还没有尝试过同样的但并与RG2的解决方案,即直接根据 gralloc 处理工作,但觉得以下也应该是功能性的。

From the MediaBuffer, I feel that the following should be functional. I haven't tried the same yet and have worked with rg2's solution i.e. directly based on gralloc handle, but feel that the following should also be functional.

 sp<GraphicBuffer> mCurrGraphicBuffer;
 void *vaddr;

 err = source->read(&buffer, &options); // Where buffer is of MediaBuffer type

 mCurrGraphicBuffer = buffer->graphicBuffer();
 width  = mCurrGraphicBuffer->getWidth();
 height = mCurrGraphicBuffer->getWidth();
 format = mCurrGraphicBuffer->getFormat();

 mCurrGraphicBuffer->lock(GRALLOC_USAGE_SW_READ_OFTEN, &vaddr);
 //Dump the YUV file based on the vaddr, width, height, format
 mCurrGraphicBuffer->unlock();

编辑:

为了对上述解决方案的工作,实际 GraphicBuffer 应创建或分配相应的使用标志即缓冲区应该用一个暗示,CPU会被创建访问相同。否则, -EINVAL 将返回按照的 gralloc 。文件

In order for the aforementioned solution to work, the actual GraphicBuffer should be created or allocated with appropriate usage flags i.e. the buffer should be created with a hint that CPU would be accessing the same. Else, -EINVAL would be returned as per the documentation in gralloc.

这篇关于如何从OMX codeC的解码输出转储YUV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆