summaryrefslogtreecommitdiff
path: root/src/cam
diff options
context:
space:
mode:
Diffstat (limited to 'src/cam')
-rw-r--r--src/cam/capture.cpp15
-rw-r--r--src/cam/capture.h1
2 files changed, 15 insertions, 1 deletions
diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp
index 7b55fc67..3c3e3a53 100644
--- a/src/cam/capture.cpp
+++ b/src/cam/capture.cpp
@@ -10,6 +10,8 @@
#include <limits.h>
#include <sstream>
+#include <libcamera/control_ids.h>
+
#include "capture.h"
#include "main.h"
@@ -18,7 +20,8 @@ using namespace libcamera;
Capture::Capture(std::shared_ptr<Camera> camera, CameraConfiguration *config,
EventLoop *loop)
: camera_(camera), config_(config), writer_(nullptr), last_(0), loop_(loop),
- queueCount_(0), captureCount_(0), captureLimit_(0)
+ queueCount_(0), captureCount_(0), captureLimit_(0),
+ printMetadata_(false)
{
}
@@ -29,6 +32,7 @@ int Capture::run(const OptionsParser::Options &options)
queueCount_ = 0;
captureCount_ = 0;
captureLimit_ = options[OptCapture].toInteger();
+ printMetadata_ = options.isSet(OptMetadata);
if (!camera_) {
std::cout << "Can't capture without a camera" << std::endl;
@@ -217,6 +221,15 @@ void Capture::processRequest(Request *request)
std::cout << info.str() << std::endl;
+ if (printMetadata_) {
+ const ControlList &requestMetadata = request->metadata();
+ for (const auto &ctrl : requestMetadata) {
+ const ControlId *id = controls::controls.at(ctrl.first);
+ std::cout << "\t" << id->name() << " = "
+ << ctrl.second.toString() << std::endl;
+ }
+ }
+
captureCount_++;
if (captureLimit_ && captureCount_ >= captureLimit_) {
loop_->exit(0);
diff --git a/src/cam/capture.h b/src/cam/capture.h
index c7c9dc00..59d13876 100644
--- a/src/cam/capture.h
+++ b/src/cam/capture.h
@@ -47,6 +47,7 @@ private:
unsigned int queueCount_;
unsigned int captureCount_;
unsigned int captureLimit_;
+ bool printMetadata_;
std::vector<std::unique_ptr<libcamera::Request>> requests_;
};