libcamera: v4l2_controls: Remove V4L2ControlInfo type field

The V4L2ControlInfo type field stores the V4L2 control type. It partly
duplicates the V4L2ControlInfo id().type() that stores the corresponding
libcamera control type. The two fields are not strictly identical, but
having two types doesn't provide us with any extra value. As this is
confusing, remove the V4L2ControlInfo type field.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart 2019-10-07 22:23:21 +03:00
parent c0dc218eb8
commit 90d0f193eb
3 changed files with 4 additions and 13 deletions

View file

@ -32,14 +32,12 @@ public:
V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl); V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl);
const ControlId &id() const { return id_; } const ControlId &id() const { return id_; }
unsigned int type() const { return type_; }
size_t size() const { return size_; } size_t size() const { return size_; }
const ControlRange &range() const { return range_; } const ControlRange &range() const { return range_; }
private: private:
V4L2ControlId id_; V4L2ControlId id_;
unsigned int type_;
size_t size_; size_t size_;
ControlRange range_; ControlRange range_;

View file

@ -127,7 +127,6 @@ V4L2ControlId::V4L2ControlId(const struct v4l2_query_ext_ctrl &ctrl)
V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl) V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl)
: id_(ctrl) : id_(ctrl)
{ {
type_ = ctrl.type;
size_ = ctrl.elem_size * ctrl.elems; size_ = ctrl.elem_size * ctrl.elems;
if (ctrl.type == V4L2_CTRL_TYPE_INTEGER64) if (ctrl.type == V4L2_CTRL_TYPE_INTEGER64)
@ -144,12 +143,6 @@ V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl)
* \return The V4L2 control ID * \return The V4L2 control ID
*/ */
/**
* \fn V4L2ControlInfo::type()
* \brief Retrieve the control type as defined by V4L2_CTRL_TYPE_*
* \return The V4L2 control type
*/
/** /**
* \fn V4L2ControlInfo::size() * \fn V4L2ControlInfo::size()
* \brief Retrieve the control value data size (in bytes) * \brief Retrieve the control value data size (in bytes)

View file

@ -262,8 +262,8 @@ int V4L2Device::setControls(V4L2ControlList *ctrls)
v4l2Ctrls[i].id = ctrl->id(); v4l2Ctrls[i].id = ctrl->id();
/* Set the v4l2_ext_control value for the write operation. */ /* Set the v4l2_ext_control value for the write operation. */
switch (info->type()) { switch (info->id().type()) {
case V4L2_CTRL_TYPE_INTEGER64: case ControlTypeInteger64:
v4l2Ctrls[i].value64 = ctrl->value().get<int64_t>(); v4l2Ctrls[i].value64 = ctrl->value().get<int64_t>();
break; break;
default: default:
@ -392,8 +392,8 @@ void V4L2Device::updateControls(V4L2ControlList *ctrls,
const V4L2ControlInfo *info = controlInfo[i]; const V4L2ControlInfo *info = controlInfo[i];
V4L2Control *ctrl = ctrls->getByIndex(i); V4L2Control *ctrl = ctrls->getByIndex(i);
switch (info->type()) { switch (info->id().type()) {
case V4L2_CTRL_TYPE_INTEGER64: case ControlTypeInteger64:
ctrl->value().set<int64_t>(v4l2Ctrl->value64); ctrl->value().set<int64_t>(v4l2Ctrl->value64);
break; break;
default: default: