系統: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);