@@ -27,7 +27,7 @@ public:
DelayedControls(V4L2Device *device,
const std::unordered_map<uint32_t, ControlParams> &controlParams);
- void reset();
+ void reset(ControlList *controls = nullptr);
bool push(const ControlList &controls);
bool pushForFrame(uint32_t sequence, const ControlList &controls);
@@ -115,7 +115,7 @@ DelayedControls::DelayedControls(V4L2Device *device,
* Resets the state machine to a starting position based on control values
* retrieved from the device.
*/
-void DelayedControls::reset()
+void DelayedControls::reset(ControlList *ctrls)
{
queueIndex_ = 0;
/* Frames up to maxDelay_ will be based on sensor init values. */
@@ -126,6 +126,18 @@ void DelayedControls::reset()
for (auto const ¶m : controlParams_)
ids.push_back(param.first->id());
+ if (ctrls) {
+ device_->setControls(ctrls);
+
+ LOG(DelayedControls, Debug) << "reset:";
+ auto idMap = ctrls->idMap();
+ if (idMap) {
+ for (const auto &[id, value] : *ctrls) {
+ LOG(DelayedControls, Debug) << " " << idMap->at(id)->name() << " : " << value.toString();
+ }
+ }
+ }
+
ControlList controls = device_->getControls(ids);
/* Seed the control queue with the controls reported by the device. */
This makes it easier for the caller. There is often this pattern sensor_->setControls(controls); delayedControls_->reset(); which can then be reduced to delayedControls_->reset(controls); Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> --- include/libcamera/internal/delayed_controls.h | 2 +- src/libcamera/delayed_controls.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-)