summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcamera/pipeline')
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp9
-rw-r--r--src/libcamera/pipeline/uvcvideo.cpp24
-rw-r--r--src/libcamera/pipeline/vimc.cpp25
3 files changed, 27 insertions, 31 deletions
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 827906d5..9776b36b 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -199,6 +199,7 @@ class PipelineHandlerIPU3 : public PipelineHandler
{
public:
static constexpr unsigned int V4L2_CID_IPU3_PIPE_MODE = 0x009819c1;
+
enum IPU3PipeModes {
IPU3PipeModeVideo = 0,
IPU3PipeModeStillCapture = 1,
@@ -603,10 +604,10 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)
return ret;
/* Apply the "pipe_mode" control to the ImgU subdevice. */
- V4L2ControlList ctrls;
- ctrls.add(V4L2_CID_IPU3_PIPE_MODE, vfStream->active_ ?
- IPU3PipeModeVideo :
- IPU3PipeModeStillCapture);
+ V4L2ControlList ctrls(imgu->imgu_->controls());
+ ctrls.set(V4L2_CID_IPU3_PIPE_MODE,
+ static_cast<int32_t>(vfStream->active_ ? IPU3PipeModeVideo :
+ IPU3PipeModeStillCapture));
ret = imgu->imgu_->setControls(&ctrls);
if (ret) {
LOG(IPU3, Error) << "Unable to set pipe_mode control";
diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
index 88f7fb9b..547ad5ca 100644
--- a/src/libcamera/pipeline/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo.cpp
@@ -228,31 +228,30 @@ void PipelineHandlerUVC::stop(Camera *camera)
int PipelineHandlerUVC::processControls(UVCCameraData *data, Request *request)
{
- V4L2ControlList controls;
+ V4L2ControlList controls(data->video_->controls());
for (auto it : request->controls()) {
const ControlId &id = *it.first;
ControlValue &value = it.second;
if (id == controls::Brightness) {
- controls.add(V4L2_CID_BRIGHTNESS, value.get<int32_t>());
+ controls.set(V4L2_CID_BRIGHTNESS, value);
} else if (id == controls::Contrast) {
- controls.add(V4L2_CID_CONTRAST, value.get<int32_t>());
+ controls.set(V4L2_CID_CONTRAST, value);
} else if (id == controls::Saturation) {
- controls.add(V4L2_CID_SATURATION, value.get<int32_t>());
+ controls.set(V4L2_CID_SATURATION, value);
} else if (id == controls::ManualExposure) {
- controls.add(V4L2_CID_EXPOSURE_AUTO, 1);
- controls.add(V4L2_CID_EXPOSURE_ABSOLUTE, value.get<int32_t>());
+ controls.set(V4L2_CID_EXPOSURE_AUTO, static_cast<int32_t>(1));
+ controls.set(V4L2_CID_EXPOSURE_ABSOLUTE, value);
} else if (id == controls::ManualGain) {
- controls.add(V4L2_CID_GAIN, value.get<int32_t>());
+ controls.set(V4L2_CID_GAIN, value);
}
}
- for (const V4L2Control &ctrl : controls)
+ for (const auto &ctrl : controls)
LOG(UVC, Debug)
- << "Setting control 0x"
- << std::hex << std::setw(8) << ctrl.id() << std::dec
- << " to " << ctrl.value().toString();
+ << "Setting control " << ctrl.first->name()
+ << " to " << ctrl.second.toString();
int ret = data->video_->setControls(&controls);
if (ret) {
@@ -338,11 +337,10 @@ int UVCCameraData::init(MediaEntity *entity)
/* Initialise the supported controls. */
const V4L2ControlInfoMap &controls = video_->controls();
for (const auto &ctrl : controls) {
- unsigned int v4l2Id = ctrl.first;
const V4L2ControlInfo &info = ctrl.second;
const ControlId *id;
- switch (v4l2Id) {
+ switch (info.id().id()) {
case V4L2_CID_BRIGHTNESS:
id = &controls::Brightness;
break;
diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp
index f1cfd0ed..53d00360 100644
--- a/src/libcamera/pipeline/vimc.cpp
+++ b/src/libcamera/pipeline/vimc.cpp
@@ -279,26 +279,24 @@ void PipelineHandlerVimc::stop(Camera *camera)
int PipelineHandlerVimc::processControls(VimcCameraData *data, Request *request)
{
- V4L2ControlList controls;
+ V4L2ControlList controls(data->sensor_->controls());
for (auto it : request->controls()) {
const ControlId &id = *it.first;
ControlValue &value = it.second;
- if (id == controls::Brightness) {
- controls.add(V4L2_CID_BRIGHTNESS, value.get<int32_t>());
- } else if (id == controls::Contrast) {
- controls.add(V4L2_CID_CONTRAST, value.get<int32_t>());
- } else if (id == controls::Saturation) {
- controls.add(V4L2_CID_SATURATION, value.get<int32_t>());
- }
+ if (id == controls::Brightness)
+ controls.set(V4L2_CID_BRIGHTNESS, value);
+ else if (id == controls::Contrast)
+ controls.set(V4L2_CID_CONTRAST, value);
+ else if (id == controls::Saturation)
+ controls.set(V4L2_CID_SATURATION, value);
}
- for (const V4L2Control &ctrl : controls)
+ for (const auto &ctrl : controls)
LOG(VIMC, Debug)
- << "Setting control 0x"
- << std::hex << std::setw(8) << ctrl.id() << std::dec
- << " to " << ctrl.value().toString();
+ << "Setting control " << ctrl.first->name()
+ << " to " << ctrl.second.toString();
int ret = data->sensor_->setControls(&controls);
if (ret) {
@@ -415,11 +413,10 @@ int VimcCameraData::init(MediaDevice *media)
/* Initialise the supported controls. */
const V4L2ControlInfoMap &controls = sensor_->controls();
for (const auto &ctrl : controls) {
- unsigned int v4l2Id = ctrl.first;
const V4L2ControlInfo &info = ctrl.second;
const ControlId *id;
- switch (v4l2Id) {
+ switch (info.id().id()) {
case V4L2_CID_BRIGHTNESS:
id = &controls::Brightness;
break;