mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 07:19:45 +03:00
libcamera: v4l2_controls: Remove V4L2ControlList class
The V4L2ControlList class only provides a convenience constructor for the ControlList, which can easily be moved to the ControlList class and may benefit it later (to construct a ControlList from controls supported by a camera). Move the constructor and remove V4L2ControlList. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
319d6ae8e3
commit
ba9a62c836
9 changed files with 16 additions and 39 deletions
|
@ -170,6 +170,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ControlList(const ControlIdMap &idmap, ControlValidator *validator = nullptr);
|
ControlList(const ControlIdMap &idmap, ControlValidator *validator = nullptr);
|
||||||
|
ControlList(const ControlInfoMap &info, ControlValidator *validator = nullptr);
|
||||||
|
|
||||||
using iterator = ControlListMap::iterator;
|
using iterator = ControlListMap::iterator;
|
||||||
using const_iterator = ControlListMap::const_iterator;
|
using const_iterator = ControlListMap::const_iterator;
|
||||||
|
|
|
@ -212,7 +212,7 @@ void IPARkISP1::setControls(unsigned int frame)
|
||||||
IPAOperationData op;
|
IPAOperationData op;
|
||||||
op.operation = RKISP1_IPA_ACTION_V4L2_SET;
|
op.operation = RKISP1_IPA_ACTION_V4L2_SET;
|
||||||
|
|
||||||
V4L2ControlList ctrls(ctrls_);
|
ControlList ctrls(ctrls_);
|
||||||
ctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure_));
|
ctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure_));
|
||||||
ctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain_));
|
ctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain_));
|
||||||
op.controls.push_back(ctrls);
|
op.controls.push_back(ctrls);
|
||||||
|
|
|
@ -561,6 +561,16 @@ ControlList::ControlList(const ControlIdMap &idmap, ControlValidator *validator)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Construct a ControlList with the idmap of a control info map
|
||||||
|
* \param[in] info The ControlInfoMap for the control list target object
|
||||||
|
* \param[in] validator The validator (may be null)
|
||||||
|
*/
|
||||||
|
ControlList::ControlList(const ControlInfoMap &info, ControlValidator *validator)
|
||||||
|
: validator_(validator), idmap_(&info.idmap())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \typedef ControlList::iterator
|
* \typedef ControlList::iterator
|
||||||
* \brief Iterator for the controls contained within the list
|
* \brief Iterator for the controls contained within the list
|
||||||
|
|
|
@ -8,11 +8,6 @@
|
||||||
#ifndef __LIBCAMERA_V4L2_CONTROLS_H__
|
#ifndef __LIBCAMERA_V4L2_CONTROLS_H__
|
||||||
#define __LIBCAMERA_V4L2_CONTROLS_H__
|
#define __LIBCAMERA_V4L2_CONTROLS_H__
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <linux/videodev2.h>
|
#include <linux/videodev2.h>
|
||||||
|
|
||||||
#include <libcamera/controls.h>
|
#include <libcamera/controls.h>
|
||||||
|
@ -31,15 +26,6 @@ public:
|
||||||
V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl);
|
V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl);
|
||||||
};
|
};
|
||||||
|
|
||||||
class V4L2ControlList : public ControlList
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
V4L2ControlList(const ControlInfoMap &info)
|
|
||||||
: ControlList(info.idmap())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} /* namespace libcamera */
|
} /* namespace libcamera */
|
||||||
|
|
||||||
#endif /* __LIBCAMERA_V4L2_CONTROLS_H__ */
|
#endif /* __LIBCAMERA_V4L2_CONTROLS_H__ */
|
||||||
|
|
|
@ -604,7 +604,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* Apply the "pipe_mode" control to the ImgU subdevice. */
|
/* Apply the "pipe_mode" control to the ImgU subdevice. */
|
||||||
V4L2ControlList ctrls(imgu->imgu_->controls());
|
ControlList ctrls(imgu->imgu_->controls());
|
||||||
ctrls.set(V4L2_CID_IPU3_PIPE_MODE,
|
ctrls.set(V4L2_CID_IPU3_PIPE_MODE,
|
||||||
static_cast<int32_t>(vfStream->active_ ? IPU3PipeModeVideo :
|
static_cast<int32_t>(vfStream->active_ ? IPU3PipeModeVideo :
|
||||||
IPU3PipeModeStillCapture));
|
IPU3PipeModeStillCapture));
|
||||||
|
|
|
@ -228,7 +228,7 @@ void PipelineHandlerUVC::stop(Camera *camera)
|
||||||
|
|
||||||
int PipelineHandlerUVC::processControls(UVCCameraData *data, Request *request)
|
int PipelineHandlerUVC::processControls(UVCCameraData *data, Request *request)
|
||||||
{
|
{
|
||||||
V4L2ControlList controls(data->video_->controls());
|
ControlList controls(data->video_->controls());
|
||||||
|
|
||||||
for (auto it : request->controls()) {
|
for (auto it : request->controls()) {
|
||||||
const ControlId &id = *it.first;
|
const ControlId &id = *it.first;
|
||||||
|
|
|
@ -279,7 +279,7 @@ void PipelineHandlerVimc::stop(Camera *camera)
|
||||||
|
|
||||||
int PipelineHandlerVimc::processControls(VimcCameraData *data, Request *request)
|
int PipelineHandlerVimc::processControls(VimcCameraData *data, Request *request)
|
||||||
{
|
{
|
||||||
V4L2ControlList controls(data->sensor_->controls());
|
ControlList controls(data->sensor_->controls());
|
||||||
|
|
||||||
for (auto it : request->controls()) {
|
for (auto it : request->controls()) {
|
||||||
const ControlId &id = *it.first;
|
const ControlId &id = *it.first;
|
||||||
|
|
|
@ -126,24 +126,4 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)
|
||||||
static_cast<int32_t>(ctrl.maximum)));
|
static_cast<int32_t>(ctrl.maximum)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \class V4L2ControlList
|
|
||||||
* \brief A list of controls for a V4L2 device
|
|
||||||
*
|
|
||||||
* This class specialises the ControList class for use with V4L2 devices. It
|
|
||||||
* offers a convenience API to create a ControlList from a ControlInfoMap.
|
|
||||||
*
|
|
||||||
* V4L2ControlList allows easy construction of a ControlList containing V4L2
|
|
||||||
* controls for a device. It can be used to construct the list of controls
|
|
||||||
* passed to the V4L2Device::getControls() and V4L2Device::setControls()
|
|
||||||
* methods. The class should however not be used in place of ControlList in
|
|
||||||
* APIs.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \fn V4L2ControlList::V4L2ControlList(const ControlInfoMap &info)
|
|
||||||
* \brief Construct a V4L2ControlList associated with a V4L2 device
|
|
||||||
* \param[in] info The V4L2 device control info map
|
|
||||||
*/
|
|
||||||
|
|
||||||
} /* namespace libcamera */
|
} /* namespace libcamera */
|
||||||
|
|
|
@ -46,7 +46,7 @@ protected:
|
||||||
const ControlRange &saturation = info.find(V4L2_CID_SATURATION)->second;
|
const ControlRange &saturation = info.find(V4L2_CID_SATURATION)->second;
|
||||||
|
|
||||||
/* Test getting controls. */
|
/* Test getting controls. */
|
||||||
V4L2ControlList ctrls(info);
|
ControlList ctrls(info);
|
||||||
ctrls.set(V4L2_CID_BRIGHTNESS, -1);
|
ctrls.set(V4L2_CID_BRIGHTNESS, -1);
|
||||||
ctrls.set(V4L2_CID_CONTRAST, -1);
|
ctrls.set(V4L2_CID_CONTRAST, -1);
|
||||||
ctrls.set(V4L2_CID_SATURATION, -1);
|
ctrls.set(V4L2_CID_SATURATION, -1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue