diff options
author | Han-Lin Chen <hanlinchen@chromium.org> | 2021-12-03 17:44:24 +0800 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2021-12-03 10:23:26 +0000 |
commit | 6e80c1bcf410cca4b0c028dd337a749a50f9bb7a (patch) | |
tree | 9f35ddd9acd3a09d7a7174202fec7b60496699b7 /include | |
parent | 5d2aad02e86d456f77ca2bab5025ff7044f10125 (diff) |
libcamera: camera_lens: Add a new class to model a camera lens
The CameraLens class abstracts camera lens and provides helper
functions to ease interactions with them.
Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/internal/camera_lens.h | 45 | ||||
-rw-r--r-- | include/libcamera/internal/meson.build | 1 |
2 files changed, 46 insertions, 0 deletions
diff --git a/include/libcamera/internal/camera_lens.h b/include/libcamera/internal/camera_lens.h new file mode 100644 index 00000000..6f2ea1bc --- /dev/null +++ b/include/libcamera/internal/camera_lens.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2021, Google Inc. + * + * camera_lens.h - A camera lens controller + */ +#pragma once + +#include <memory> +#include <string> + +#include <libcamera/base/class.h> +#include <libcamera/base/log.h> + +namespace libcamera { + +class MediaEntity; +class V4L2Subdevice; + +class CameraLens : protected Loggable +{ +public: + explicit CameraLens(const MediaEntity *entity); + ~CameraLens(); + + int init(); + int setFocusPostion(int32_t position); + + const std::string &model() const { return model_; } + +protected: + std::string logPrefix() const override; + +private: + LIBCAMERA_DISABLE_COPY_AND_MOVE(CameraLens) + + int validateLensDriver(); + + const MediaEntity *entity_; + std::unique_ptr<V4L2Subdevice> subdev_; + + std::string model_; +}; + +} /* namespace libcamera */ diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build index 665fd6de..a96bbb95 100644 --- a/include/libcamera/internal/meson.build +++ b/include/libcamera/internal/meson.build @@ -14,6 +14,7 @@ libcamera_internal_headers = files([ 'byte_stream_buffer.h', 'camera.h', 'camera_controls.h', + 'camera_lens.h', 'camera_sensor.h', 'camera_sensor_properties.h', 'control_serializer.h', |