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>
This commit is contained in:
Kieran Bingham
2019-06-27 15:33:04 +01:00
committed by Laurent Pinchart
parent 20d5640ca4
commit b9bf9514eb
6 changed files with 45 additions and 0 deletions
+12
View File
@@ -548,6 +548,18 @@ int Camera::release()
return 0;
}
/**
* \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
*
+5
View File
@@ -325,6 +325,11 @@ bool operator==(const ControlInfo &lhs, const ControlId &rhs)
return lhs.id() == rhs;
}
/**
* \typedef ControlInfoMap
* \brief A map of ControlId to ControlInfo
*/
/**
* \class ControlList
* \brief Associate a list of ControlId with their values for a camera
+4
View File
@@ -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;
+19
View File
@@ -88,6 +88,14 @@ LOG_DEFINE_CATEGORY(Pipeline)
* PipelineHandler::completeRequest()
*/
/**
* \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
@@ -217,6 +225,17 @@ void PipelineHandler::unlock()
media->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