|
请问直接调用surface c++层有旋转的函数吗
发表于 2015-7-27 09:11:17
浏览:16078
|
回复:11
打印
只看该作者
[复制链接]
楼主
我调用的surface c++层接口来直接显示的yuv数据,在特殊的情景下,我得到的jpeg是倒得,想在显示的时候旋转过来,不知道用什么方法可以,下面是部分代码。谢谢
static RK_S32 surface_init()
{
if (init_flag == 0)
{
DisplayInfo dinfo;
// create a client to surfaceflinger
client = new SurfaceComposerClient();
sp<IBinder> dtoken(SurfaceComposerClient::getBuiltInDisplay(
ISurfaceComposer::eDisplayIdMain));
//获取屏幕的宽高等信息
status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &dinfo);
SHOW_YUV_LOGI("w=%d,h=%d,xdpi=%f,ydpi=%f,fps=%f,ds=%f\n",
dinfo.w, dinfo.h, dinfo.xdpi, dinfo.ydpi, dinfo.fps, dinfo.density);
if (status)
return -1;
//创建surface
surfaceControl = client->createSurface(String8("surface"),
dinfo.w, dinfo.h, PIXEL_FORMAT_RGBA_8888, 0);
init_flag = 1;
}
return 0;
}
RK_S32 show_yuv(RK_U8 *yuv_data, RK_U32 frameSize, jpeg_info jpg_info)
{
if (yuv_data == NULL)
{
SHOW_YUV_LOGW("input yuv_data is null\n");
return -1;
}
surface_init();
/*************************get yuv data from file;****************************************/
SHOW_YUV_LOGI("frameSize:%d\n", frameSize);
unsigned char *data = new unsigned char[frameSize];
memcpy(data, yuv_data, frameSize);
/*********************配置surface************************************/
SurfaceComposerClient::openGlobalTransaction();
surfaceControl->setLayer(100000);//设定Z坐标
SHOW_YUV_LOGI("left:%d top:%d\n", jpg_info.left, jpg_info.top);
surfaceControl->setPosition(jpg_info.left, jpg_info.top);//以左上角为(0,0)设定显示位置
surfaceControl->setSize(jpg_info.width, jpg_info.height);//设定视频显示大小
SurfaceComposerClient::closeGlobalTransaction();
sp<Surface> surface = surfaceControl->getSurface();
/**********************显示yuv数据*****************************************/
render(data,frameSize,surface,jpg_info.width,jpg_info.height); //这个函数的实现没有贴出来
delete [] data;
data = NULL;
return 0;
} |
|