libcamera v0.5.1
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
camera_lens.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2021, Google Inc.
4 *
5 * A camera lens controller
6 */
7#pragma once
8
9#include <memory>
10#include <stdint.h>
11#include <string>
12
14#include <libcamera/base/log.h>
15
16#include <libcamera/controls.h>
17
18namespace libcamera {
19
20class MediaEntity;
21class V4L2Subdevice;
22
23class CameraLens : protected Loggable
24{
25public:
26 explicit CameraLens(const MediaEntity *entity);
28
29 int init();
30 int setFocusPosition(int32_t position);
31
32 const std::string &model() const { return model_; }
33
34 const ControlInfoMap &controls() const;
35
36protected:
37 std::string logPrefix() const override;
38
39private:
41
42 int validateLensDriver();
43
44 const MediaEntity *entity_;
45 std::unique_ptr<V4L2Subdevice> subdev_;
46
47 std::string model_;
48};
49
50} /* namespace libcamera */
Utilities to help constructing class interfaces.
#define LIBCAMERA_DISABLE_COPY_AND_MOVE(klass)
Disable copy and move construction and assignment of the klass.
Definition class.h:29
A camera lens based on V4L2 subdevices.
Definition camera_lens.h:24
CameraLens(const MediaEntity *entity)
Construct a CameraLens.
Definition camera_lens.cpp:38
const std::string & model() const
Retrieve the lens model name.
Definition camera_lens.h:32
int setFocusPosition(int32_t position)
This function sets the focal point of the lens to a specific position.
Definition camera_lens.cpp:87
std::string logPrefix() const override
Retrieve a string to be prefixed to the log message.
Definition camera_lens.cpp:137
int init()
Initialize the camera lens instance.
Definition camera_lens.cpp:56
~CameraLens()
Destroy a CameraLens.
const ControlInfoMap & controls() const
Retrieve the V4L2 controls of the lens' subdev.
Definition camera_lens.cpp:148
A map of ControlId to ControlInfo.
Definition controls.h:367
Base class to support log message extensions.
Definition log.h:92
The MediaEntity represents an entity in the media graph.
Definition media_object.h:97
A V4L2 subdevice as exposed by the Linux kernel.
Definition v4l2_subdevice.h:75
Framework to manage controls related to an object.
Logging infrastructure.
Top-level libcamera namespace.
Definition backtrace.h:17