diff options
author | Chih-Chung Chang <chihchung@google.com> | 2010-01-22 17:49:48 -0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2010-01-26 11:07:07 -0800 |
commit | f091e833d339d344fbc4815bcc87ce97d8535cd8 (patch) | |
tree | abf06e2d345aa1d73348c8380194633973dff6b6 /camera | |
parent | fafd2adbaac51b801af6503a7fc80d1cc2dc3794 (diff) | |
download | frameworks_native-f091e833d339d344fbc4815bcc87ce97d8535cd8.zip frameworks_native-f091e833d339d344fbc4815bcc87ce97d8535cd8.tar.gz frameworks_native-f091e833d339d344fbc4815bcc87ce97d8535cd8.tar.bz2 |
Add support for setting camera display orientation.
Diffstat (limited to 'camera')
-rw-r--r-- | camera/libcameraservice/CameraService.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index a8e217e..81d60dc 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -1191,14 +1191,6 @@ status_t CameraService::Client::setParameters(const String8& params) CameraParameters p(params); - // The orientation parameter is actually for CameraService, not for the camera driver. - if (p.getOrientation() == CameraParameters::CAMERA_ORIENTATION_PORTRAIT) { - LOGV("portrait mode"); - mOrientation = ISurface::BufferHeap::ROT_90; - } else { - mOrientation = 0; - } - return mHardware->setParameters(p); } @@ -1224,6 +1216,30 @@ status_t CameraService::Client::sendCommand(int32_t cmd, int32_t arg1, int32_t a status_t result = checkPid(); if (result != NO_ERROR) return result; + if (cmd == CAMERA_CMD_SET_DISPLAY_ORIENTATION) { + // The orientation cannot be set during preview. + if (mHardware->previewEnabled()) { + return INVALID_OPERATION; + } + switch (arg1) { + case 0: + mOrientation = ISurface::BufferHeap::ROT_0; + break; + case 90: + mOrientation = ISurface::BufferHeap::ROT_90; + break; + case 180: + mOrientation = ISurface::BufferHeap::ROT_180; + break; + case 270: + mOrientation = ISurface::BufferHeap::ROT_270; + break; + default: + return BAD_VALUE; + } + return OK; + } + if (mHardware == 0) { LOGE("mHardware is NULL, returning."); return INVALID_OPERATION; |