RK3288 摄像头左右镜像

系统:Android 5.1

 

设置摄像头左右镜像

diff --git a/frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp b/frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp
index 070be2d..0250f92 100755
--- a/frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp
+++ b/frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp
@@ -654,8 +654,8 @@ status_t CameraClient::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) {
 
     if (cmd == CAMERA_CMD_SET_DISPLAY_ORIENTATION) {
         // Mirror the preview if the camera is front-facing.
-        orientation = getOrientation(arg1, mCameraFacing == CAMERA_FACING_FRONT);
+        //orientation = getOrientation(arg1, mCameraFacing == CAMERA_FACING_FRONT);
+        orientation = getOrientation(arg1, 1);
         if (orientation == -1) return BAD_VALUE;
 
         if (mOrientation != orientation) {

 

代码原意是如果摄像头是前置摄像头,就左右镜像;如果是后置摄像头,就不用左右镜像。

修改的本质是切换前后摄像头,所以也可更改如下:

orientation = getOrientation(arg1, mCameraFacing != CAMERA_FACING_FRONT);

 

posted @ 2018-06-12 16:23  LeeAaron  阅读(3708)  评论(0编辑  收藏  举报