summaryrefslogtreecommitdiff
path: root/src/libcamera/include
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-10-14 02:08:44 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-10-15 22:33:33 +0300
commit319d6ae8e3ad1a47a674e85015de9ea811e84564 (patch)
tree7d1ccddf9997bb58be692e51bf217d49d8000622 /src/libcamera/include
parentc957c8580a30d5940f0d4893497f38e05c7f8e92 (diff)
libcamera: controls: Merge ControlInfoMap and V4L2ControlInfoMap
The ControlInfoMap and V4L2ControlInfoMap classes are very similar, with the latter adding convenience accessors based on numerical IDs for the former, as well as a cached idmap. Both features can be useful for ControlInfoMap in the context of serialisation, and merging the two classes will further simplify the IPA API. Import all the features of V4L2ControlInfoMap into ControlInfoMap, turning the latter into a real class. A few new constructors and assignment operators are added for completeness. 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>
Diffstat (limited to 'src/libcamera/include')
-rw-r--r--src/libcamera/include/camera_sensor.h4
-rw-r--r--src/libcamera/include/v4l2_controls.h36
-rw-r--r--src/libcamera/include/v4l2_device.h4
3 files changed, 5 insertions, 39 deletions
diff --git a/src/libcamera/include/camera_sensor.h b/src/libcamera/include/camera_sensor.h
index f426e29b..1fb36a4f 100644
--- a/src/libcamera/include/camera_sensor.h
+++ b/src/libcamera/include/camera_sensor.h
@@ -16,9 +16,9 @@
namespace libcamera {
+class ControlInfoMap;
class ControlList;
class MediaEntity;
-class V4L2ControlInfoMap;
class V4L2Subdevice;
struct V4L2SubdeviceFormat;
@@ -43,7 +43,7 @@ public:
const Size &size) const;
int setFormat(V4L2SubdeviceFormat *format);
- const V4L2ControlInfoMap &controls() const;
+ const ControlInfoMap &controls() const;
int getControls(ControlList *ctrls);
int setControls(ControlList *ctrls);
diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h
index c427b845..e16c4957 100644
--- a/src/libcamera/include/v4l2_controls.h
+++ b/src/libcamera/include/v4l2_controls.h
@@ -31,44 +31,10 @@ public:
V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl);
};
-class V4L2ControlInfoMap : private ControlInfoMap
-{
-public:
- V4L2ControlInfoMap &operator=(ControlInfoMap &&info);
-
- using ControlInfoMap::key_type;
- using ControlInfoMap::mapped_type;
- using ControlInfoMap::value_type;
- using ControlInfoMap::size_type;
- using ControlInfoMap::iterator;
- using ControlInfoMap::const_iterator;
-
- using ControlInfoMap::begin;
- using ControlInfoMap::cbegin;
- using ControlInfoMap::end;
- using ControlInfoMap::cend;
- using ControlInfoMap::at;
- using ControlInfoMap::empty;
- using ControlInfoMap::size;
- using ControlInfoMap::count;
- using ControlInfoMap::find;
-
- mapped_type &at(unsigned int key);
- const mapped_type &at(unsigned int key) const;
- size_type count(unsigned int key) const;
- iterator find(unsigned int key);
- const_iterator find(unsigned int key) const;
-
- const ControlIdMap &idmap() const { return idmap_; }
-
-private:
- ControlIdMap idmap_;
-};
-
class V4L2ControlList : public ControlList
{
public:
- V4L2ControlList(const V4L2ControlInfoMap &info)
+ V4L2ControlList(const ControlInfoMap &info)
: ControlList(info.idmap())
{
}
diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h
index f30b1c2c..6bfddefe 100644
--- a/src/libcamera/include/v4l2_device.h
+++ b/src/libcamera/include/v4l2_device.h
@@ -24,7 +24,7 @@ public:
void close();
bool isOpen() const { return fd_ != -1; }
- const V4L2ControlInfoMap &controls() const { return controls_; }
+ const ControlInfoMap &controls() const { return controls_; }
int getControls(ControlList *ctrls);
int setControls(ControlList *ctrls);
@@ -49,7 +49,7 @@ private:
unsigned int count);
std::vector<std::unique_ptr<V4L2ControlId>> controlIds_;
- V4L2ControlInfoMap controls_;
+ ControlInfoMap controls_;
std::string deviceNode_;
int fd_;
};