[libcamera-devel] [PATCH v3 1/2] libcamera: camera: Create a CameraControlValidator
Kieran Bingham
kieran.bingham at ideasonboard.com
Wed Oct 20 15:33:52 CEST 2021
Create a Camera specific CameraControlValidator for the Camera instance.
This will allow requests to use a single validor instance without having
to construct their own.
Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
v3:
- Use a unique_ptr instead of deriving from the _o/O_PTRs
v2:
- Use LIBCAMERA_O_PTR() instead of _o<Public>()
---
include/libcamera/internal/camera.h | 6 ++++++
src/libcamera/camera.cpp | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/include/libcamera/internal/camera.h b/include/libcamera/internal/camera.h
index 1a08da0cedc4..f0baaea07bdc 100644
--- a/include/libcamera/internal/camera.h
+++ b/include/libcamera/internal/camera.h
@@ -17,6 +17,8 @@
#include <libcamera/camera.h>
+#include "libcamera/internal/camera_controls.h"
+
namespace libcamera {
class PipelineHandler;
@@ -38,6 +40,8 @@ public:
uint32_t requestSequence_;
+ const CameraControlValidator *validator() const { return validator_.get(); }
+
private:
enum State {
CameraAvailable,
@@ -64,6 +68,8 @@ private:
bool disconnected_;
std::atomic<State> state_;
+
+ std::unique_ptr<CameraControlValidator> validator_;
};
} /* namespace libcamera */
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index 71809bcd36a3..f84cdc522d0d 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -366,6 +366,12 @@ Camera::Private::~Private()
* \return The pipeline handler that created this camera
*/
+/**
+ * \fn Camera::Private::validator()
+ * \brief Retrieve the control validator related to this camera
+ * \return The control validator associated with this camera
+ */
+
/**
* \var Camera::Private::queuedRequests_
* \brief The list of queued and not yet completed requests
@@ -665,6 +671,7 @@ Camera::Camera(std::unique_ptr<Private> d, const std::string &id,
{
_d()->id_ = id;
_d()->streams_ = streams;
+ _d()->validator_ = std::make_unique<CameraControlValidator>(this);
}
Camera::~Camera()
--
2.30.2
More information about the libcamera-devel
mailing list