summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-10-14 02:18:34 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-10-15 22:33:34 +0300
commitba9a62c836a84d2dbcdd2543f849c87b9278c9b0 (patch)
treed59b8134c04f904b6ff9f72d34a470c75db7e575
parent319d6ae8e3ad1a47a674e85015de9ea811e84564 (diff)
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>
-rw-r--r--include/libcamera/controls.h1
-rw-r--r--src/ipa/rkisp1/rkisp1.cpp2
-rw-r--r--src/libcamera/controls.cpp10
-rw-r--r--src/libcamera/include/v4l2_controls.h14
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp2
-rw-r--r--src/libcamera/pipeline/uvcvideo.cpp2
-rw-r--r--src/libcamera/pipeline/vimc.cpp2
-rw-r--r--src/libcamera/v4l2_controls.cpp20
-rw-r--r--test/v4l2_videodevice/controls.cpp2
9 files changed, 16 insertions, 39 deletions
diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
index 80414c6f..0d279d50 100644
--- a/include/libcamera/controls.h
+++ b/include/libcamera/controls.h
@@ -170,6 +170,7 @@ private:
public:
ControlList(const ControlIdMap &idmap, ControlValidator *validator = nullptr);
+ ControlList(const ControlInfoMap &info, ControlValidator *validator = nullptr);
using iterator = ControlListMap::iterator;
using const_iterator = ControlListMap::const_iterator;
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index bd703898..570145ce 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -212,7 +212,7 @@ void IPARkISP1::setControls(unsigned int frame)
IPAOperationData op;
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_ANALOGUE_GAIN, static_cast<int32_t>(gain_));
op.controls.push_back(ctrls);
diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp
index bf7634aa..93ad2fc6 100644
--- a/src/libcamera/controls.cpp
+++ b/src/libcamera/controls.cpp
@@ -562,6 +562,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
* \brief Iterator for the controls contained within the list
*/
diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h
index e16c4957..882546a8 100644
--- a/src/libcamera/include/v4l2_controls.h
+++ b/src/libcamera/include/v4l2_controls.h
@@ -8,11 +8,6 @@
#ifndef __LIBCAMERA_V4L2_CONTROLS_H__
#define __LIBCAMERA_V4L2_CONTROLS_H__
-#include <map>
-#include <stdint.h>
-#include <string>
-#include <vector>
-
#include <linux/videodev2.h>
#include <libcamera/controls.h>
@@ -31,15 +26,6 @@ public:
V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl);
};
-class V4L2ControlList : public ControlList
-{
-public:
- V4L2ControlList(const ControlInfoMap &info)
- : ControlList(info.idmap())
- {
- }
-};
-
} /* namespace libcamera */
#endif /* __LIBCAMERA_V4L2_CONTROLS_H__ */
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 9776b36b..8d3ad568 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -604,7 +604,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)
return ret;
/* 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,
static_cast<int32_t>(vfStream->active_ ? IPU3PipeModeVideo :
IPU3PipeModeStillCapture));
diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
index a64e1af4..fae0ffc4 100644
--- a/src/libcamera/pipeline/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo.cpp
@@ -228,7 +228,7 @@ void PipelineHandlerUVC::stop(Camera *camera)
int PipelineHandlerUVC::processControls(UVCCameraData *data, Request *request)
{
- V4L2ControlList controls(data->video_->controls());
+ ControlList controls(data->video_->controls());
for (auto it : request->controls()) {
const ControlId &id = *it.first;
diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp
index 6a424411..dcdaef12 100644
--- a/src/libcamera/pipeline/vimc.cpp
+++ b/src/libcamera/pipeline/vimc.cpp
@@ -279,7 +279,7 @@ void PipelineHandlerVimc::stop(Camera *camera)
int PipelineHandlerVimc::processControls(VimcCameraData *data, Request *request)
{
- V4L2ControlList controls(data->sensor_->controls());
+ ControlList controls(data->sensor_->controls());
for (auto it : request->controls()) {
const ControlId &id = *it.first;
diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp
index 37ff034e..2462c3e2 100644
--- a/src/libcamera/v4l2_controls.cpp
+++ b/src/libcamera/v4l2_controls.cpp
@@ -126,24 +126,4 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)
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 */
diff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp
index 31879b79..975c852b 100644
--- a/test/v4l2_videodevice/controls.cpp
+++ b/test/v4l2_videodevice/controls.cpp
@@ -46,7 +46,7 @@ protected:
const ControlRange &saturation = info.find(V4L2_CID_SATURATION)->second;
/* Test getting controls. */
- V4L2ControlList ctrls(info);
+ ControlList ctrls(info);
ctrls.set(V4L2_CID_BRIGHTNESS, -1);
ctrls.set(V4L2_CID_CONTRAST, -1);
ctrls.set(V4L2_CID_SATURATION, -1);