Display by SurfaceComposerClient
来源:互联网 发布:多核处理器编程的艺术 编辑:程序博客网 时间:2024/06/05 09:25
#include <binder/IServiceManager.h>#include <binder/ProcessState.h>#include <binder/IPCThreadState.h>#include <android/native_window.h>#include <gui/Surface.h>#include <gui/SurfaceComposerClient.h>#include <gui/ISurfaceComposer.h>#include <ui/DisplayStatInfo.h>int main (int argc, char *argv[]) { long tOSDWidth = 0; long tOSDHeight = 0; sp<IServiceManager> sm = defaultServiceManager(); sp<ISurfaceComposer> composer = interface_cast<ISurfaceComposer>(sm->checkService(String16("SurfaceFlinger"))); //FIXME tOSDWidth = 1920; tOSDHeight = 1080; if (composer != NULL){ DisplayStatInfo stats; status_t res = composer->getDisplayStats(NULL , &stats); if (res == NO_ERROR){ ALOGI("OSD width=%d height=%d", stats.displayWidth, stats.displayHeight); tOSDWidth = stats.displayWidth; tOSDHeight = stats.displayHeight; } else ALOGW("getDisplayStats returned %d", res); } else ALOGW("could not get surface Composer service"); sp<SurfaceComposerClient> composerClient = new SurfaceComposerClient; sp<SurfaceControl> surfaceControl = composerClient->createSurface( String8("video"), tOSDWidth, tOSDHeight, HAL_PIXEL_FORMAT_YV12, 0); sp<Surface> surface = surfaceControl->getSurface(); SurfaceComposerClient::openGlobalTransaction(); surfaceControl->setLayer(INT_MAX); SurfaceComposerClient::closeGlobalTransaction(); ANativeWindow* window = surface.get(); native_window_set_buffers_dimensions(window, tWidth, tHeight); native_window_set_buffers_format(window, HAL_PIXEL_FORMAT_YV12); native_window_set_scaling_mode(window, NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW); ANativeWindow_Buffer outBuffer; surface->lock(&outBuffer, NULL); //pBuffer point to graphic data FIXME memcpy(outBuffer.bits, pBuffer, outBuffer.width * outBuffer.height * 3/2); surface->unlockAndPost();}
阅读全文
0 0
- Display by SurfaceComposerClient
- Display layout of linerlayout by %
- SurfaceComposerClient object 问题
- AndroidN SurfaceComposerClient 时序图
- Android forward display screen(pages), by intent.
- Display yuv formatted video by shader
- Display yuv formatted video by shader
- Display web JSP page section by section
- GUI系统之SurfaceFlinger(11)SurfaceComposerClient
- GUI系统之SurfaceFlinger(11)SurfaceComposerClient
- Display Custom Fields in a Content By Query Web Part
- Interfaces Implemented By the User-Mode Display Driver WDDM
- Display the linear linked list by traversing reverse
- 如何用循环方式来display LLL by reverse way
- display
- display
- Display
- display
- Java动态代理与反射详解
- ANDROID STUDIO 生成AAR和引用AAR
- 结构体的4种初始化方式
- c++之ist双向链表
- Linux(openSSL)上RSA密钥生成和使用(java)
- Display by SurfaceComposerClient
- 2017:Chris Lattner 谈 Swift
- 【备忘】2017新版 MySQL加强视频教程 46课 附课件源码
- Floyd poj1125 poj3615
- JAVA基础
- WebView的一种使用方法
- 微服务架构
- C++11 std::function和std::bind绑定器
- 从零开始学java(二)安装idea