diff options
author | Zhijun He <zhijunhe@google.com> | 2013-09-25 23:52:06 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-09-25 23:52:07 +0000 |
commit | 6914de6dd1d74fcf74e3247c89f9293fbf7bafe5 (patch) | |
tree | a112a276227b9c897fe2bd25a8ad70b51b7155e5 /services/camera/libcameraservice | |
parent | 1802399c7c4d8557922688f246df292703f417f1 (diff) | |
parent | 2b59be89dc245b6e2475d9e8b0c5f2392370e71e (diff) | |
download | frameworks_av-6914de6dd1d74fcf74e3247c89f9293fbf7bafe5.zip frameworks_av-6914de6dd1d74fcf74e3247c89f9293fbf7bafe5.tar.gz frameworks_av-6914de6dd1d74fcf74e3247c89f9293fbf7bafe5.tar.bz2 |
Merge "Camera: Implement getCameraCharacteristics" into klp-dev
Diffstat (limited to 'services/camera/libcameraservice')
-rw-r--r-- | services/camera/libcameraservice/CameraService.cpp | 37 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraService.h | 2 |
2 files changed, 39 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index fe16314..5e84aaf 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -225,6 +225,43 @@ status_t CameraService::getCameraInfo(int cameraId, return rc; } +status_t CameraService::getCameraCharacteristics(int cameraId, + CameraMetadata* cameraInfo) { + if (!cameraInfo) { + ALOGE("%s: cameraInfo is NULL", __FUNCTION__); + return BAD_VALUE; + } + + if (!mModule) { + ALOGE("%s: camera hardware module doesn't exist", __FUNCTION__); + return -ENODEV; + } + + if (mModule->common.module_api_version < CAMERA_MODULE_API_VERSION_2_0) { + // TODO: Remove this check once HAL1 shim is in place. + ALOGE("%s: Only HAL module version V2 or higher supports static metadata", __FUNCTION__); + return BAD_VALUE; + } + + if (cameraId < 0 || cameraId >= mNumberOfCameras) { + ALOGE("%s: Invalid camera id: %d", __FUNCTION__, cameraId); + return BAD_VALUE; + } + + int facing; + if (getDeviceVersion(cameraId, &facing) == CAMERA_DEVICE_API_VERSION_1_0) { + // TODO: Remove this check once HAL1 shim is in place. + ALOGE("%s: HAL1 doesn't support static metadata yet", __FUNCTION__); + return BAD_VALUE; + } + + struct camera_info info; + status_t ret = mModule->get_camera_info(cameraId, &info); + *cameraInfo = info.static_camera_characteristics; + + return ret; +} + int CameraService::getDeviceVersion(int cameraId, int* facing) { struct camera_info info; if (mModule->get_camera_info(cameraId, &info) != OK) { diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h index b34a0f6..ad6a582 100644 --- a/services/camera/libcameraservice/CameraService.h +++ b/services/camera/libcameraservice/CameraService.h @@ -71,6 +71,8 @@ public: virtual int32_t getNumberOfCameras(); virtual status_t getCameraInfo(int cameraId, struct CameraInfo* cameraInfo); + virtual status_t getCameraCharacteristics(int cameraId, + CameraMetadata* cameraInfo); virtual status_t connect(const sp<ICameraClient>& cameraClient, int cameraId, const String16& clientPackageName, int clientUid, |