diff options
author | Zhijun He <zhijunhe@google.com> | 2013-09-25 10:14:30 -0700 |
---|---|---|
committer | Zhijun He <zhijunhe@google.com> | 2013-09-25 15:36:07 -0700 |
commit | 2b59be89dc245b6e2475d9e8b0c5f2392370e71e (patch) | |
tree | 85564dae05e9343c75e9a5d1f54f7efee4b349f7 /services | |
parent | d2ac3144e201398340cc5b9bb36e5efe39edd9eb (diff) | |
download | frameworks_av-2b59be89dc245b6e2475d9e8b0c5f2392370e71e.zip frameworks_av-2b59be89dc245b6e2475d9e8b0c5f2392370e71e.tar.gz frameworks_av-2b59be89dc245b6e2475d9e8b0c5f2392370e71e.tar.bz2 |
Camera: Implement getCameraCharacteristics
Bug: 10904541
Bug: 10360518
Change-Id: Ie9ca6b3b0b5f2fe529e6b0decc193096e770a017
Diffstat (limited to 'services')
-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, |