系统: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
--- a/frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp
+++ b/frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp
@@ -, +, @@ 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, );
if (orientation == -) return BAD_VALUE; if (mOrientation != orientation) {

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

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

orientation = getOrientation(arg1, mCameraFacing != CAMERA_FACING_FRONT);
05-18 18:31