summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2019-06-27 15:33:04 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-07-02 16:59:28 +0300
commitb9bf9514eb7b08220763d7d72c3b1b83bdfe6ab0 (patch)
treececfe4629242b616c0ce16e5e3461d122156d247 /src
parent20d5640ca49c76c89be5bebcc00981942c7a9c19 (diff)
libcamera: camera: Provide a list of ControlInfo
Extend the Camera class to expose the controls it supports. Each pipeline should generate a list of controls supported by each camera it creates. These are represented by a ControlInfoMap, and an associated ControlList of default values. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/camera.cpp12
-rw-r--r--src/libcamera/controls.cpp5
-rw-r--r--src/libcamera/include/pipeline_handler.h4
-rw-r--r--src/libcamera/pipeline_handler.cpp19
4 files changed, 40 insertions, 0 deletions
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index 617ea99c..592dfd39 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -549,6 +549,18 @@ int Camera::release()
}
/**
+ * \brief Retrieve the list of controls supported by the camera
+ *
+ * Camera controls remain constant through the lifetime of the camera.
+ *
+ * \return A ControlInfoMap listing the controls supported by the camera
+ */
+const ControlInfoMap &Camera::controls()
+{
+ return pipe_->controls(this);
+}
+
+/**
* \brief Retrieve all the camera's stream information
*
* Retrieve all of the camera's static stream information. The static
diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp
index 7fac1169..cd2cf337 100644
--- a/src/libcamera/controls.cpp
+++ b/src/libcamera/controls.cpp
@@ -326,6 +326,11 @@ bool operator==(const ControlInfo &lhs, const ControlId &rhs)
}
/**
+ * \typedef ControlInfoMap
+ * \brief A map of ControlId to ControlInfo
+ */
+
+/**
* \class ControlList
* \brief Associate a list of ControlId with their values for a camera
*
diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h
index a4cbc593..f836d5d1 100644
--- a/src/libcamera/include/pipeline_handler.h
+++ b/src/libcamera/include/pipeline_handler.h
@@ -14,6 +14,7 @@
#include <string>
#include <vector>
+#include <libcamera/controls.h>
#include <libcamera/stream.h>
namespace libcamera {
@@ -41,6 +42,7 @@ public:
Camera *camera_;
PipelineHandler *pipe_;
std::list<Request *> queuedRequests_;
+ ControlInfoMap controlInfo_;
private:
CameraData(const CameraData &) = delete;
@@ -60,6 +62,8 @@ public:
bool lock();
void unlock();
+ const ControlInfoMap &controls(Camera *camera);
+
virtual CameraConfiguration *generateConfiguration(Camera *camera,
const StreamRoles &roles) = 0;
virtual int configure(Camera *camera, CameraConfiguration *config) = 0;
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index c91ef2f7..0283e4e5 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -89,6 +89,14 @@ LOG_DEFINE_CATEGORY(Pipeline)
*/
/**
+ * \var CameraData::controlInfo_
+ * \brief The set of controls supported by the camera
+ *
+ * The control information shall be initialised by the pipeline handler when
+ * creating the camera, and shall not be modified afterwards.
+ */
+
+/**
* \class PipelineHandler
* \brief Create and manage cameras based on a set of media devices
*
@@ -218,6 +226,17 @@ void PipelineHandler::unlock()
}
/**
+ * \brief Retrieve the list of controls for a camera
+ * \param[in] camera The camera
+ * \return A ControlInfoMap listing the controls support by \a camera
+ */
+const ControlInfoMap &PipelineHandler::controls(Camera *camera)
+{
+ CameraData *data = cameraData(camera);
+ return data->controlInfo_;
+}
+
+/**
* \fn PipelineHandler::generateConfiguration()
* \brief Generate a camera configuration for a specified camera
* \param[in] camera The camera to generate a default configuration for