[PATCH 8/8] [DNI] apps: cam: Use Camera::metadataAvailable signal
Jacopo Mondi
jacopo.mondi at ideasonboard.com
Fri Dec 6 17:07:46 CET 2024
Handle the Camera::metadataAvailable signal and print the metadata
list.
Use the --metadata option of cam to validate that the metadata list
in Request::metadata() matches the accumulated results.
Signed-off-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>
---
src/apps/cam/camera_session.cpp | 17 +++++++++++++++++
src/apps/cam/camera_session.h | 2 ++
2 files changed, 19 insertions(+)
diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp
index 6e9890ccfda1..422874ae74ea 100644
--- a/src/apps/cam/camera_session.cpp
+++ b/src/apps/cam/camera_session.cpp
@@ -246,6 +246,7 @@ int CameraSession::start()
+ "-stream" + std::to_string(index);
}
+ camera_->metadataAvailable.connect(this, &CameraSession::metadataAvailable);
camera_->requestCompleted.connect(this, &CameraSession::requestComplete);
#ifdef HAVE_KMS
@@ -407,6 +408,22 @@ int CameraSession::queueRequest(Request *request)
return camera_->queueRequest(request);
}
+void CameraSession::metadataAvailable(Request *request,
+ std::unordered_set<const ControlId *> ids)
+{
+ const ControlList &metadata = request->metadata();
+
+ std::cerr << "EARLY METADATA COMPLETION FOR REQUEST: "
+ << request->sequence() << std::endl;
+
+ for (const auto id : ids) {
+ const ControlValue &value = metadata.get(id->id());
+
+ std::cout << "\t" << id->name() << " = "
+ << value.toString() << std::endl;
+ }
+}
+
void CameraSession::requestComplete(Request *request)
{
if (request->status() == Request::RequestCancelled)
diff --git a/src/apps/cam/camera_session.h b/src/apps/cam/camera_session.h
index 4442fd9b1a6a..0539f759a65a 100644
--- a/src/apps/cam/camera_session.h
+++ b/src/apps/cam/camera_session.h
@@ -53,6 +53,8 @@ private:
int startCapture();
int queueRequest(libcamera::Request *request);
+ void metadataAvailable(libcamera::Request *request,
+ std::unordered_set<const libcamera::ControlId *> ids);
void requestComplete(libcamera::Request *request);
void processRequest(libcamera::Request *request);
void sinkRelease(libcamera::Request *request);
--
2.47.1
More information about the libcamera-devel
mailing list