modify 修改后置camera方向/镜像diff --git a/frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp b/frameworks/av/services/camera/libc
old mode 100644
new mode 100755
index 8497ff6..e5519c1
--- a/frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp
+++ b/frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp
@@ -45,6 +45,8 @@ static int getCallingPid() {return IPCThreadState::self()->getCallingPid();}+static int cameraIdd = 0;
+CameraClient::CameraClient(const sp<CameraService>& cameraService,const sp<hardware::ICameraClient>& cameraClient,const String16& clientPackageName,
@@ -55,6 +57,7 @@ CameraClient::CameraClient(const sp<CameraService>& cameraService,String8::format("%d", cameraId), cameraFacing, clientPid,clientUid, servicePid){
+       cameraIdd = cameraId;int callingPid = getCallingPid();bool mirror;LOG1("CameraClient::CameraClient E (pid %d, id %d)", callingPid, cameraId);
@@ -67,11 +70,14 @@ CameraClient::CameraClient(const sp<CameraService>& cameraService,// Callback is disabled by defaultmPreviewCallbackFlag = CAMERA_FRAME_CALLBACK_FLAG_NOOP;
-    if (((cameraId == 0) && (mCameraFacing == CAMERA_FACING_FRONT)) || (cameraId == 1))
-        mirror = true;
+    /*if (((cameraId == 0) && (mCameraFacing == CAMERA_FACING_FRONT)) || (cameraId == 1))
+        mirror = false;elsemirror = false;
+       *///mOrientation = getOrientation(0, mCameraFacing == CAMERA_FACING_FRONT);
+    mirror=false;
+mOrientation = getOrientation(0, mirror);mLegacyMode = legacyMode;mPlayShutterSound = true;
@@ -771,17 +777,42 @@ status_t CameraClient::enableShutterSound(bool enable) {status_t CameraClient::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) {LOG1("sendCommand (pid %d)", getCallingPid());
-    int orientation;
+    int orientation=0;Mutex::Autolock lock(mLock);status_t result = checkPidAndHardware();if (result != NO_ERROR) return result;if (cmd == CAMERA_CMD_SET_DISPLAY_ORIENTATION) {//!++
-        LOG1("CAMERA_CMD_SET_DISPLAY_ORIENTATION - tid(%d), (degrees, mirror)=(%d, %d)", ::gettid(), arg1, mCameraFacing); //Add debug log
+        LOG1("leon 11  CAMERA_CMD_SET_DISPLAY_ORIENTATION - tid(%d), (degrees, mirror)=(%d, %d)", ::gettid(), arg1, mCameraFacing); //Add debug log//!--// Mirror the preview if the camera is front-facing.
-        orientation = getOrientation(arg1, mCameraFacing == CAMERA_FACING_FRONT);
+               if(mCameraFacing==0){//back
+                       if(arg1==0){
+                               orientation = getOrientation(0, false);
+                               arg1=0;
+                       }else if(arg1==90){
+                               orientation = getOrientation(90, false);
+                               arg1=90;
+                       }else if(arg1==180){
+                               orientation = getOrientation(180, false);
+                               arg1=180;
+                       }else if(arg1==270){
+                               orientation = getOrientation(270, false);
+                               arg1=270;
+                       }
+               }else if(mCameraFacing == 1){//front
+                       orientation = getOrientation(arg1, false);
+               }if (orientation == -1) return BAD_VALUE;if (mOrientation != orientation) {
@@ -1242,6 +1273,12 @@ void CameraClient::copyFrameAndPostCopiedFrame(}int CameraClient::getOrientation(int degrees, bool mirror) {
+       if (!mirror) {
+        if (degrees == 0) return 0;
+        else if (degrees == 90) return HAL_TRANSFORM_ROT_90;
+        else if (degrees == 180) return HAL_TRANSFORM_ROT_180;
+        else if (degrees == 270) return HAL_TRANSFORM_ROT_270;
+    }

MTK 修改后置Camera方向/镜像 Patch相关推荐

  1. Android前置后置摄像头录制视频综合版

    公司有个项目,有一个需求是录制视频上传到网上,原本准备使用系统的录制功能,发现界面的跳转不能满足需求.于是就只能用自己写的,然后我也不会,就找了很多网上的例子,发现总是有些问题,然后我总结了一下写成了 ...

  2. 【Android RTMP】NV21 图像旋转处理 ( 快速搭建 RTMP 服务器 Shell 脚本 | 创建 RTMP 服务器镜像 | 浏览器观看直播 | 前置 / 后置摄像头图像旋转效果展示 )

    文章目录 安卓直播推流专栏博客总结 一. 编写快速搭建 RTMP 服务器 Shell 脚本 二. RTMP 快速搭建方法 三.创建阿里云 RTMP 服务器镜像 四.浏览器查看直播内容 五.前置 / 后 ...

  3. AOP开发——在不修改源代码的前提下,对类里面的方法进行增强 : 前置 后置 环绕 异常||如何得到目标方法的参数和返回值

    AOP开发 @Transactionl 在不修改源代码的前提下,对类里面的方法进行增强 前置 后置 环绕 异常 创建项目前引入aop的包 <dependency>     <grou ...

  4. 使用docker commit将修改后的容器保存为镜像及其使用注意事项

    docker commit使用示例 我们修改了容器的文件,也就是改动了容器的存储层.我们可以通过 docker diff 命令看到具体的改动. $ docker diff webserver C /r ...

  5. Docker 容器里镜像的迁移,或者将修改后的新的容器重新做成一个镜像

    ----继上次docker制作nginx容器... [Docker  容器里镜像的迁移,或者将修改后的新的容器重新做成一个镜像,] 1.进入容器里nginx镜像里. 2.写测试内容到nginx的默认首 ...

  6. rk3399 采集摄像头数据_[Camera]摄像头镜像

    platform:RK3399 OS:Android 7.1 参考: 1.石先 https://www.jianshu.com/p/7d88ec1347b6 2.KrisFei https://blo ...

  7. windows上dmg转换cdr_云主机装黑果实践(6):处理云主机上变色龙启动后置过程:驱动和黑屏...

    本文关键字:无显驱vesa方式驱动osx10.14,mojave vga黑屏,云主机的显示器,非n非a卡黑果,waitting for root device,apfs modules stop 14 ...

  8. 怎么通过media foundation将图像数据写入虚拟摄像头_[Camera]摄像头镜像

    platform:RK3399 OS:Android 7.1 参考: 1.石先 https://www.jianshu.com/p/7d88ec1347b6 2.KrisFei https://blo ...

  9. 云主机装黑果实践(6):处理云主机上变色龙启动后置过程:驱动和黑屏

    本文关键字:无显驱vesa方式驱动osx10.14,mojave vga黑屏,云主机的显示器,非n非a卡黑果,waitting for root device,apfs modules stop 14 ...

最新文章

  1. 系统安全攻防战:DLL注入技术详解
  2. 深入浅出 SpringMVC - 2 提升篇
  3. 如何在SAP的的凭证流浏览器(DRB)中显示客户自定义的凭证
  4. Apache Flink 零基础入门(六)Flink核心概念
  5. 省常中模拟 Test3 Day2
  6. SQL Server timeout分析和总结
  7. python怎样画动态文字_Python制作动态字符图的实例
  8. 惠普修复已存在8年的可蠕虫漏洞,影响150多款多功能打印机
  9. @property 参数问题
  10. Android 平台视频播放器demo
  11. Linux USB驱动详解
  12. pdf去除密码 html,pdf加密文件如何去除密码?求解密pdf文件的技巧
  13. 「经济理财」跟简七学理财之理财训练营(下)
  14. 关于《走进名企之微软亚洲研究院》的观后感
  15. 资产泡沫即将湮灭! 转折全面到来!
  16. Offset is outside the bounds of the DataView
  17. CGAL 4.11 官方文档 软件包概述 ——多边形类
  18. 万邦淘宝/天猫按关键字搜索淘宝商品 API 返回值
  19. pytorch学习(二):mnist手写数字数据集训练和测试(一)mnist数据集分析
  20. 基于DSP的注塑机运动控制器和算法设计

热门文章

  1. 将Qt工程文件转成VC工程文件的小工具
  2. 利用python快速搭建一个ftp文件服务器
  3. golang文件操作:打开关闭文件,带缓冲区的读文件
  4. k8s设置pod privileged权限(特权):securityContext.privileged=true
  5. 【实战】数据可视化系统后端开发环境搭建
  6. CDH HUE集成yarn
  7. hdfs集群数据迁移:使用distcp命令
  8. HDFS EditsLog和FsImage日志机制
  9. linux centos/debian下hadoop2.6.5单机伪分布式安装
  10. scala中的构造方法和伴生对象