mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-23 00:25:07 +03:00
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:
parent
20d5640ca4
commit
b9bf9514eb
6 changed files with 45 additions and 0 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <libcamera/controls.h>
|
||||||
#include <libcamera/request.h>
|
#include <libcamera/request.h>
|
||||||
#include <libcamera/signal.h>
|
#include <libcamera/signal.h>
|
||||||
#include <libcamera/stream.h>
|
#include <libcamera/stream.h>
|
||||||
|
@ -83,6 +84,8 @@ public:
|
||||||
int acquire();
|
int acquire();
|
||||||
int release();
|
int release();
|
||||||
|
|
||||||
|
const ControlInfoMap &controls();
|
||||||
|
|
||||||
const std::set<Stream *> &streams() const;
|
const std::set<Stream *> &streams() const;
|
||||||
std::unique_ptr<CameraConfiguration> generateConfiguration(const StreamRoles &roles);
|
std::unique_ptr<CameraConfiguration> generateConfiguration(const StreamRoles &roles);
|
||||||
int configure(CameraConfiguration *config);
|
int configure(CameraConfiguration *config);
|
||||||
|
|
|
@ -99,6 +99,8 @@ static inline bool operator!=(const ControlInfo &lhs, const ControlId &rhs)
|
||||||
return !(lhs == rhs);
|
return !(lhs == rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using ControlInfoMap = std::unordered_map<ControlId, ControlInfo>;
|
||||||
|
|
||||||
class ControlList
|
class ControlList
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -548,6 +548,18 @@ int Camera::release()
|
||||||
return 0;
|
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
|
* \brief Retrieve all the camera's stream information
|
||||||
*
|
*
|
||||||
|
|
|
@ -325,6 +325,11 @@ bool operator==(const ControlInfo &lhs, const ControlId &rhs)
|
||||||
return lhs.id() == rhs;
|
return lhs.id() == rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \typedef ControlInfoMap
|
||||||
|
* \brief A map of ControlId to ControlInfo
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class ControlList
|
* \class ControlList
|
||||||
* \brief Associate a list of ControlId with their values for a camera
|
* \brief Associate a list of ControlId with their values for a camera
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <libcamera/controls.h>
|
||||||
#include <libcamera/stream.h>
|
#include <libcamera/stream.h>
|
||||||
|
|
||||||
namespace libcamera {
|
namespace libcamera {
|
||||||
|
@ -41,6 +42,7 @@ public:
|
||||||
Camera *camera_;
|
Camera *camera_;
|
||||||
PipelineHandler *pipe_;
|
PipelineHandler *pipe_;
|
||||||
std::list<Request *> queuedRequests_;
|
std::list<Request *> queuedRequests_;
|
||||||
|
ControlInfoMap controlInfo_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CameraData(const CameraData &) = delete;
|
CameraData(const CameraData &) = delete;
|
||||||
|
@ -60,6 +62,8 @@ public:
|
||||||
bool lock();
|
bool lock();
|
||||||
void unlock();
|
void unlock();
|
||||||
|
|
||||||
|
const ControlInfoMap &controls(Camera *camera);
|
||||||
|
|
||||||
virtual CameraConfiguration *generateConfiguration(Camera *camera,
|
virtual CameraConfiguration *generateConfiguration(Camera *camera,
|
||||||
const StreamRoles &roles) = 0;
|
const StreamRoles &roles) = 0;
|
||||||
virtual int configure(Camera *camera, CameraConfiguration *config) = 0;
|
virtual int configure(Camera *camera, CameraConfiguration *config) = 0;
|
||||||
|
|
|
@ -88,6 +88,14 @@ LOG_DEFINE_CATEGORY(Pipeline)
|
||||||
* PipelineHandler::completeRequest()
|
* 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
|
* \class PipelineHandler
|
||||||
* \brief Create and manage cameras based on a set of media devices
|
* \brief Create and manage cameras based on a set of media devices
|
||||||
|
@ -217,6 +225,17 @@ void PipelineHandler::unlock()
|
||||||
media->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()
|
* \fn PipelineHandler::generateConfiguration()
|
||||||
* \brief Generate a camera configuration for a specified camera
|
* \brief Generate a camera configuration for a specified camera
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue