#include <utils/CallStack.h>
#include <ui/DisplayInfo.h>
#include <cutils/memory.h>
#include <unistd.h>
#include <utils/Log.h>
#include <binder/IPCThreadState.h>
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
#include <media/stagefright/foundation/ADebug.h>
#include <gui/Surface.h>
#include <gui/SurfaceComposerClient.h>
#include <gui/ISurfaceComposer.h>
#include <ui/DisplayInfo.h>
#include <android/native_window.h>
#include <system/window.h>
#include <ui/GraphicBufferMapper.h>
//ANativeWindow 就是surface,对应surface.cpp里的code
using namespace android;
extern "C" int mainxx123(void);
//将x规整为y的倍数,也就是将x按y对齐
static int ALIGN(int x, int y) {
// y must be a power of 2.
return (x + y - 1) & ~(y - 1);
}
void fill_color(void *vaddr)
{
int cnt;
unsigned int * p_data;
p_data = (unsigned int *)vaddr;
for( int i=0x00; i<60*640; i++ ){
p_data[i] = 0xff0000ff;
}
}
void render(
const void *data, size_t size, const sp<ANativeWindow> &nativeWindow,int width,int height) {
sp<ANativeWindow> mNativeWindow = nativeWindow;
int err;
int mCropWidth = width;
int mCropHeight = height;

这个博客展示了如何在Android中从文件读取YUV数据并将其渲染到Surface上。通过使用SurfaceComposerClient、ANativeWindow和 GraphicBufferMapper等组件,实现了YUV数据的显示。代码中包含了内存对齐、图形缓冲区的申请和释放,以及YUV数据的拷贝到缓冲区的过程。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



