From 4740deddfa4cb5717058c8eba48077e0a1da83e9 Mon Sep 17 00:00:00 2001 From: jt1134 Date: Mon, 17 Sep 2012 01:06:37 -0500 Subject: libcamera: allow changing of ISO modes Patch-set2: make code not suck as much Patch-set3: add BOARD_CAMERA_HAVE_ISO Patch-set4: actually include BoardConfig change Change-Id: Id452c079c7dbb7ece4a68f27aa82c14463b5db2e --- BoardConfigCommon.mk | 1 + libcamera/SecCameraHWInterface.cpp | 39 +++++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk index f3992d8..30058de 100644 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -50,6 +50,7 @@ USE_CAMERA_STUB := false ifeq ($(USE_CAMERA_STUB),false) BOARD_CAMERA_LIBRARIES := libcamera endif +BOARD_CAMERA_HAVE_ISO := true # Bluetooth BOARD_HAVE_BLUETOOTH := true diff --git a/libcamera/SecCameraHWInterface.cpp b/libcamera/SecCameraHWInterface.cpp index 161daf0..d66f12f 100755 --- a/libcamera/SecCameraHWInterface.cpp +++ b/libcamera/SecCameraHWInterface.cpp @@ -339,7 +339,6 @@ void CameraHardwareSec::initDefaultParameters(int cameraId) ip.set("sharpness", SHARPNESS_DEFAULT); ip.set("contrast", CONTRAST_DEFAULT); ip.set("saturation", SATURATION_DEFAULT); - ip.set("iso", "auto"); ip.set("metering", "center"); ip.set("wdr", 0); @@ -349,6 +348,9 @@ void CameraHardwareSec::initDefaultParameters(int cameraId) ip.set("blur", 0); } + p.set("iso-values", "auto,ISO50,ISO100,ISO200,ISO400,ISO800,ISO1600"); + p.set("iso", "auto"); + p.set(CameraParameters::KEY_HORIZONTAL_VIEW_ANGLE, "51.2"); p.set(CameraParameters::KEY_VERTICAL_VIEW_ANGLE, "39.4"); @@ -1562,6 +1564,41 @@ status_t CameraHardwareSec::setParameters(const CameraParameters& params) } } + // ISO + const char *new_iso_str = params.get("iso"); + ALOGV("%s : new_iso_str %s", __func__, new_iso_str); + if (new_iso_str != NULL) { + int new_iso = -1; + + if (!strcmp(new_iso_str, "auto")) { + new_iso = ISO_AUTO; + } else if (!strcmp(new_iso_str, "ISO50")) { + new_iso = ISO_50; + } else if (!strcmp(new_iso_str, "ISO100")) { + new_iso = ISO_100; + } else if (!strcmp(new_iso_str, "ISO200")) { + new_iso = ISO_200; + } else if (!strcmp(new_iso_str, "ISO400")) { + new_iso = ISO_400; + } else if (!strcmp(new_iso_str, "ISO800")) { + new_iso = ISO_800; + } else if (!strcmp(new_iso_str, "ISO1600")) { + new_iso = ISO_1600; + } else { + ALOGE("ERR(%s):Invalid iso value(%s)", __func__, new_iso_str); + ret = UNKNOWN_ERROR; + } + + if (0 <= new_iso) { + if (mSecCamera->setISO(new_iso) < 0) { + ALOGE("ERR(%s):Fail on mSecCamera->setISO(new_iso(%d))", __func__, new_iso); + ret = UNKNOWN_ERROR; + } else { + mParameters.set("iso", new_iso_str); + } + } + } + // whitebalance const char *new_white_str = params.get(CameraParameters::KEY_WHITE_BALANCE); ALOGV("%s : new_white_str %s", __func__, new_white_str); -- cgit v1.1