summaryrefslogtreecommitdiffstats
path: root/libcamera/SecCameraHWInterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcamera/SecCameraHWInterface.cpp')
-rwxr-xr-xlibcamera/SecCameraHWInterface.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/libcamera/SecCameraHWInterface.cpp b/libcamera/SecCameraHWInterface.cpp
index ca82669..87c2b96 100755
--- a/libcamera/SecCameraHWInterface.cpp
+++ b/libcamera/SecCameraHWInterface.cpp
@@ -21,6 +21,8 @@
#include <utils/Log.h>
#include "SecCameraHWInterface.h"
+#include "SecCameraUtils.h"
+
#include <utils/threads.h>
#include <fcntl.h>
#include <sys/mman.h>
@@ -282,6 +284,10 @@ void CameraHardwareSec::initDefaultParameters(int cameraId)
p.set(CameraParameters::KEY_PREVIEW_FPS_RANGE, "15000,30000");
p.set(CameraParameters::KEY_FOCAL_LENGTH, "3.43");
+
+ // touch focus
+ p.set(CameraParameters::KEY_MAX_NUM_FOCUS_AREAS, "1");
+ p.set(CameraParameters::KEY_FOCUS_AREAS, "(0,0,0,0,0)");
} else {
p.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FPS_RANGE, "(7500,30000)");
p.set(CameraParameters::KEY_PREVIEW_FPS_RANGE, "7500,30000");
@@ -1950,6 +1956,29 @@ status_t CameraHardwareSec::setParameters(const CameraParameters& params)
mParameters.set(CameraParameters::KEY_SCENE_MODE, new_scene_mode_str);
}
}
+
+ // touch to focus
+ const char *new_focus_area = params.get(CameraParameters::KEY_FOCUS_AREAS);
+ if (new_focus_area != NULL) {
+ LOGI("focus area: %s", new_focus_area);
+ SecCameraArea area(new_focus_area);
+
+ if (!area.isDummy()) {
+ int width, height, frame_size;
+ mSecCamera->getPreviewSize(&width, &height, &frame_size);
+
+ int x = area.getX(width);
+ int y = area.getY(height);
+
+ LOGI("area=%s, x=%i, y=%i", area.toString8().string(), x, y);
+ if (mSecCamera->setObjectPosition(x, y) < 0) {
+ LOGE("ERR(%s):Fail on mSecCamera->setObjectPosition(%s)", __func__, new_focus_area);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ int val = area.isDummy() ? 0 : 1;
+ }
} else {
if (!isSupportedParameter(new_focus_mode_str,
mParameters.get(CameraParameters::KEY_SUPPORTED_FOCUS_MODES))) {