@@ -1099,10 +1099,8 @@ void PipelineHandlerISI::bufferReady(FrameBuffer *buffer)
Request *request = buffer->request();
/* Record the sensor's timestamp in the request metadata. */
- ControlList &metadata = request->metadata();
- if (!metadata.contains(controls::SensorTimestamp.id()))
- metadata.set(controls::SensorTimestamp,
- buffer->metadata().timestamp);
+ metadataAvailable(request, controls::SensorTimestamp,
+ static_cast<int64_t>(buffer->metadata().timestamp));
completeBuffer(request, buffer);
if (request->hasPendingBuffers())
@@ -1245,7 +1245,7 @@ void IPU3CameraData::metadataReady(unsigned int id, const ControlList &metadata)
return;
Request *request = info->request;
- request->metadata().merge(metadata);
+ pipe()->metadataAvailable(request, metadata);
info->metadataProcessed = true;
if (frameInfos_.tryComplete(info))
@@ -1272,12 +1272,12 @@ void IPU3CameraData::imguOutputBufferReady(FrameBuffer *buffer)
pipe()->completeBuffer(request, buffer);
- request->metadata().set(controls::draft::PipelineDepth, 3);
+ pipe()->metadataAvailable(request, controls::draft::PipelineDepth, 3);
/* \todo Actually apply the scaler crop region to the ImgU. */
const auto &scalerCrop = request->controls().get(controls::ScalerCrop);
if (scalerCrop)
cropRegion_ = *scalerCrop;
- request->metadata().set(controls::ScalerCrop, cropRegion_);
+ pipe()->metadataAvailable(request, controls::ScalerCrop, cropRegion_);
if (frameInfos_.tryComplete(info))
pipe()->completeRequest(request);
@@ -1317,8 +1317,8 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)
* \todo The sensor timestamp should be better estimated by connecting
* to the V4L2Device::frameStart signal.
*/
- request->metadata().set(controls::SensorTimestamp,
- buffer->metadata().timestamp);
+ pipe()->metadataAvailable(request, controls::SensorTimestamp,
+ static_cast<int64_t>(buffer->metadata().timestamp));
info->effectiveSensorControls = delayedCtrls_->get(buffer->metadata().sequence);
@@ -1412,8 +1412,8 @@ void IPU3CameraData::frameStart(uint32_t sequence)
return;
}
- request->metadata().set(controls::draft::TestPatternMode,
- *testPatternMode);
+ pipe()->metadataAvailable(request, controls::draft::TestPatternMode,
+ *testPatternMode);
}
REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3, "ipu3")
@@ -431,7 +431,7 @@ void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &meta
if (!info)
return;
- info->request->metadata().merge(metadata);
+ pipe()->metadataAvailable(info->request, metadata);
info->metadataProcessed = true;
pipe()->tryCompleteRequest(info);
@@ -1414,8 +1414,8 @@ void PipelineHandlerRkISP1::imageBufferReady(FrameBuffer *buffer)
* \todo The sensor timestamp should be better estimated by connecting
* to the V4L2Device::frameStart signal.
*/
- request->metadata().set(controls::SensorTimestamp,
- metadata.timestamp);
+ metadataAvailable(request, controls::SensorTimestamp,
+ static_cast<int64_t>(metadata.timestamp));
if (isRaw_) {
const ControlList &ctrls =
@@ -1487,7 +1487,7 @@ void PipelineHandlerRkISP1::imageBufferReady(FrameBuffer *buffer)
LOG(RkISP1, Error) << "Cannot queue buffers to dewarper: "
<< strerror(-ret);
- request->metadata().set(controls::ScalerCrop, activeCrop_.value());
+ metadataAvailable(request, controls::ScalerCrop, activeCrop_.value());
}
void PipelineHandlerRkISP1::dewarpBufferReady(FrameBuffer *buffer)
@@ -1234,7 +1234,7 @@ void CameraData::metadataReady(const ControlList &metadata)
/* Add to the Request metadata buffer what the IPA has provided. */
/* Last thing to do is to fill up the request metadata. */
Request *request = requestQueue_.front();
- request->metadata().merge(metadata);
+ pipe()->metadataAvailable(request, metadata);
/*
* Inform the sensor of the latest colour gains if it has the
@@ -1507,8 +1507,8 @@ void CameraData::checkRequestCompleted()
void CameraData::fillRequestMetadata(const ControlList &bufferControls, Request *request)
{
- request->metadata().set(controls::SensorTimestamp,
- bufferControls.get(controls::SensorTimestamp).value_or(0));
+ pipe()->metadataAvailable(request, controls::SensorTimestamp,
+ static_cast<int64_t>(bufferControls.get(controls::SensorTimestamp).value_or(0)));
if (cropParams_.size()) {
std::vector<Rectangle> crops;
@@ -1516,10 +1516,10 @@ void CameraData::fillRequestMetadata(const ControlList &bufferControls, Request
for (auto const &[k, v] : cropParams_)
crops.push_back(scaleIspCrop(v.ispCrop));
- request->metadata().set(controls::ScalerCrop, crops[0]);
+ pipe()->metadataAvailable(request, controls::ScalerCrop, crops[0]);
if (crops.size() > 1) {
- request->metadata().set(controls::rpi::ScalerCrops,
- Span<const Rectangle>(crops.data(), crops.size()));
+ pipe()->metadataAvailable(request, controls::rpi::ScalerCrops,
+ Span<const Rectangle>(crops.data(), crops.size()));
}
}
}
@@ -844,8 +844,8 @@ void SimpleCameraData::imageBufferReady(FrameBuffer *buffer)
}
if (request)
- request->metadata().set(controls::SensorTimestamp,
- buffer->metadata().timestamp);
+ pipe->metadataAvailable(request, controls::SensorTimestamp,
+ static_cast<int64_t>(buffer->metadata().timestamp));
/*
* Queue the captured and the request buffer to the converter or Software
@@ -752,8 +752,8 @@ void UVCCameraData::imageBufferReady(FrameBuffer *buffer)
Request *request = buffer->request();
/* \todo Use the UVC metadata to calculate a more precise timestamp */
- request->metadata().set(controls::SensorTimestamp,
- buffer->metadata().timestamp);
+ pipe()->metadataAvailable(request, controls::SensorTimestamp,
+ static_cast<int64_t>(buffer->metadata().timestamp));
pipe()->completeBuffer(request, buffer);
pipe()->completeRequest(request);
@@ -615,8 +615,8 @@ void VimcCameraData::imageBufferReady(FrameBuffer *buffer)
}
/* Record the sensor's timestamp in the request metadata. */
- request->metadata().set(controls::SensorTimestamp,
- buffer->metadata().timestamp);
+ pipe->metadataAvailable(request, controls::SensorTimestamp,
+ static_cast<int64_t>(buffer->metadata().timestamp));
pipe->completeBuffer(request, buffer);
pipe->completeRequest(request);
@@ -317,7 +317,8 @@ int PipelineHandlerVirtual::queueRequestDevice([[maybe_unused]] Camera *camera,
ASSERT(found);
}
- request->metadata().set(controls::SensorTimestamp, currentTimestamp());
+ metadataAvailable(request, controls::SensorTimestamp,
+ static_cast<int64_t>(currentTimestamp()));
completeRequest(request);
return 0;
In order to prepare to restrict access to the Request::metadata_ list, use the new PipelineHandler::metadataAvailable() function to notify the availability of metadata and accumulate them in the Request::metadata_ list. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> --- src/libcamera/pipeline/imx8-isi/imx8-isi.cpp | 6 ++---- src/libcamera/pipeline/ipu3/ipu3.cpp | 14 +++++++------- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 8 ++++---- .../pipeline/rpi/common/pipeline_base.cpp | 12 ++++++------ src/libcamera/pipeline/simple/simple.cpp | 4 ++-- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 4 ++-- src/libcamera/pipeline/vimc/vimc.cpp | 4 ++-- src/libcamera/pipeline/virtual/virtual.cpp | 3 ++- 8 files changed, 27 insertions(+), 28 deletions(-)