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>
This commit is contained in:
@@ -43,7 +43,7 @@ public:
|
||||
virtual int init() = 0;
|
||||
|
||||
virtual void configure(const std::map<unsigned int, IPAStream> &streamConfig,
|
||||
const std::map<unsigned int, V4L2ControlInfoMap> &entityControls) = 0;
|
||||
const std::map<unsigned int, ControlInfoMap> &entityControls) = 0;
|
||||
|
||||
virtual void mapBuffers(const std::vector<IPABuffer> &buffers) = 0;
|
||||
virtual void unmapBuffers(const std::vector<unsigned int> &ids) = 0;
|
||||
|
||||
@@ -118,7 +118,50 @@ private:
|
||||
};
|
||||
|
||||
using ControlIdMap = std::unordered_map<unsigned int, const ControlId *>;
|
||||
using ControlInfoMap = std::unordered_map<const ControlId *, ControlRange>;
|
||||
|
||||
class ControlInfoMap : private std::unordered_map<const ControlId *, ControlRange>
|
||||
{
|
||||
public:
|
||||
using Map = std::unordered_map<const ControlId *, ControlRange>;
|
||||
|
||||
ControlInfoMap() = default;
|
||||
ControlInfoMap(const ControlInfoMap &other) = default;
|
||||
ControlInfoMap(std::initializer_list<Map::value_type> init);
|
||||
|
||||
ControlInfoMap &operator=(const ControlInfoMap &other) = default;
|
||||
ControlInfoMap &operator=(std::initializer_list<Map::value_type> init);
|
||||
ControlInfoMap &operator=(Map &&info);
|
||||
|
||||
using Map::key_type;
|
||||
using Map::mapped_type;
|
||||
using Map::value_type;
|
||||
using Map::size_type;
|
||||
using Map::iterator;
|
||||
using Map::const_iterator;
|
||||
|
||||
using Map::begin;
|
||||
using Map::cbegin;
|
||||
using Map::end;
|
||||
using Map::cend;
|
||||
using Map::at;
|
||||
using Map::empty;
|
||||
using Map::size;
|
||||
using Map::count;
|
||||
using Map::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:
|
||||
void generateIdmap();
|
||||
|
||||
ControlIdMap idmap_;
|
||||
};
|
||||
|
||||
class ControlList
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user