{"id":12154,"url":"https://patchwork.libcamera.org/api/1.1/patches/12154/?format=json","web_url":"https://patchwork.libcamera.org/patch/12154/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210430160026.190724-16-jacopo@jmondi.org>","date":"2021-04-30T16:00:25","name":"[libcamera-devel,v4,15/16] cam: Implement OptMetadata","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"b3e0c0b42c4b99eb0bde842f44848cf726f34d45","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12154/mbox/","series":[{"id":1990,"url":"https://patchwork.libcamera.org/api/1.1/series/1990/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1990","date":"2021-04-30T16:00:10","name":"Support SensorTimestamp metadata","version":4,"mbox":"https://patchwork.libcamera.org/series/1990/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12154/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12154/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 10690BDE4C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 30 Apr 2021 16:00:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5845F68917;\n\tFri, 30 Apr 2021 18:00:12 +0200 (CEST)","from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A3FB96890E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 30 Apr 2021 18:00:04 +0200 (CEST)","from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay9-d.mail.gandi.net (Postfix) with ESMTPSA id CCD91FF804;\n\tFri, 30 Apr 2021 16:00:02 +0000 (UTC)"],"X-Originating-IP":"93.61.96.190","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 30 Apr 2021 18:00:25 +0200","Message-Id":"<20210430160026.190724-16-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20210430160026.190724-1-jacopo@jmondi.org>","References":"<20210430160026.190724-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v4 15/16] cam: Implement OptMetadata","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Implement support for the new '--metadata' option by printing the\nvalue of each metadata entry associated with a completed Request.\n\nAs sample of the output, running on raspberry pi, looks like the\nfollowing:\n\n3050.205672 (30.01 fps) stream0 seq: 000033 bytesused: 720000\n\tScalerCrop = (0x2)/3280x2460\n\tExposureTime = 13969\n\tAeLocked = true\n\tDigitalGain = 1.000721\n\tLux = 771.204224\n\tColourGains = [ 1.561101, 1.629698 ]\n\tColourTemperature = 4289\n\tSensorBlackLevels = [ 4096, 4096, 4096, 4096 ]\n\tColourCorrectionMatrix = [ 1.691066, -0.599756, -0.091317, -0.437452, 1.983766, -0.546314, -0.083429, -0.722407, 1.805836 ]\n\tAnalogueGain = 2.000000\n\tSensorTimestamp = 3050205672000\n3050.238999 (30.01 fps) stream0 seq: 000034 bytesused: 720000\n\tScalerCrop = (0x2)/3280x2460\n\tExposureTime = 13969\n\tAeLocked = true\n\tDigitalGain = 1.000709\n\tLux = 771.232422\n\tColourGains = [ 1.560868, 1.630029 ]\n\tColourTemperature = 4289\n\tSensorBlackLevels = [ 4096, 4096, 4096, 4096 ]\n\tColourCorrectionMatrix = [ 1.691081, -0.599726, -0.091362, -0.437497, 1.983627, -0.546130, -0.083420, -0.722523, 1.805943 ]\n\tAnalogueGain = 2.000000\n\tSensorTimestamp = 3050238999000\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/cam/capture.cpp | 15 ++++++++++++++-\n src/cam/capture.h   |  1 +\n 2 files changed, 15 insertions(+), 1 deletion(-)","diff":"diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp\nindex 7b55fc677022..3c3e3a53adf7 100644\n--- a/src/cam/capture.cpp\n+++ b/src/cam/capture.cpp\n@@ -10,6 +10,8 @@\n #include <limits.h>\n #include <sstream>\n \n+#include <libcamera/control_ids.h>\n+\n #include \"capture.h\"\n #include \"main.h\"\n \n@@ -18,7 +20,8 @@ using namespace libcamera;\n Capture::Capture(std::shared_ptr<Camera> camera, CameraConfiguration *config,\n \t\t EventLoop *loop)\n \t: camera_(camera), config_(config), writer_(nullptr), last_(0), loop_(loop),\n-\t  queueCount_(0), captureCount_(0), captureLimit_(0)\n+\t  queueCount_(0), captureCount_(0), captureLimit_(0),\n+\t  printMetadata_(false)\n {\n }\n \n@@ -29,6 +32,7 @@ int Capture::run(const OptionsParser::Options &options)\n \tqueueCount_ = 0;\n \tcaptureCount_ = 0;\n \tcaptureLimit_ = options[OptCapture].toInteger();\n+\tprintMetadata_ = options.isSet(OptMetadata);\n \n \tif (!camera_) {\n \t\tstd::cout << \"Can't capture without a camera\" << std::endl;\n@@ -217,6 +221,15 @@ void Capture::processRequest(Request *request)\n \n \tstd::cout << info.str() << std::endl;\n \n+\tif (printMetadata_) {\n+\t\tconst ControlList &requestMetadata = request->metadata();\n+\t\tfor (const auto &ctrl : requestMetadata) {\n+\t\t\tconst ControlId *id = controls::controls.at(ctrl.first);\n+\t\t\tstd::cout << \"\\t\" << id->name() << \" = \"\n+\t\t\t\t  << ctrl.second.toString() << std::endl;\n+\t\t}\n+\t}\n+\n \tcaptureCount_++;\n \tif (captureLimit_ && captureCount_ >= captureLimit_) {\n \t\tloop_->exit(0);\ndiff --git a/src/cam/capture.h b/src/cam/capture.h\nindex c7c9dc00d30f..59d138766b1e 100644\n--- a/src/cam/capture.h\n+++ b/src/cam/capture.h\n@@ -47,6 +47,7 @@ private:\n \tunsigned int queueCount_;\n \tunsigned int captureCount_;\n \tunsigned int captureLimit_;\n+\tbool printMetadata_;\n \n \tstd::vector<std::unique_ptr<libcamera::Request>> requests_;\n };\n","prefixes":["libcamera-devel","v4","15/16"]}