@@ -14,6 +14,7 @@
#include <linux/videodev2.h>
#include <libcamera/signal.h>
+#include <libcamera/span.h>
#include "libcamera/internal/log.h"
#include "libcamera/internal/v4l2_controls.h"
@@ -55,8 +56,7 @@ protected:
private:
void listControls();
void updateControls(ControlList *ctrls,
- const struct v4l2_ext_control *v4l2Ctrls,
- unsigned int count);
+ Span<const v4l2_ext_control> v4l2Ctrls);
void eventAvailable(EventNotifier *notifier);
@@ -246,7 +246,7 @@ ControlList V4L2Device::getControls(const std::vector<uint32_t> &ids)
v4l2Ctrls.resize(errorIdx);
}
- updateControls(&ctrls, v4l2Ctrls.data(), v4l2Ctrls.size());
+ updateControls(&ctrls, v4l2Ctrls);
return ctrls;
}
@@ -345,7 +345,7 @@ int V4L2Device::setControls(ControlList *ctrls)
ret = errorIdx;
}
- updateControls(ctrls, v4l2Ctrls.data(), v4l2Ctrls.size());
+ updateControls(ctrls, v4l2Ctrls);
return ret;
}
@@ -509,14 +509,11 @@ void V4L2Device::listControls()
* values in \a v4l2Ctrls
* \param[inout] ctrls List of V4L2 controls to update
* \param[in] v4l2Ctrls List of V4L2 extended controls as returned by the driver
- * \param[in] count The number of controls to update
*/
void V4L2Device::updateControls(ControlList *ctrls,
- const struct v4l2_ext_control *v4l2Ctrls,
- unsigned int count)
+ Span<const v4l2_ext_control> v4l2Ctrls)
{
- for (unsigned int i = 0; i < count; i++) {
- const struct v4l2_ext_control &v4l2Ctrl = v4l2Ctrls[i];
+ for (const v4l2_ext_control &v4l2Ctrl : v4l2Ctrls) {
const unsigned int id = v4l2Ctrl.id;
ControlValue value = ctrls->get(id);