{"id":11994,"url":"https://patchwork.libcamera.org/api/1.1/patches/11994/?format=json","web_url":"https://patchwork.libcamera.org/patch/11994/","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":"<20210419131433.22920-13-jacopo@jmondi.org>","date":"2021-04-19T13:14:32","name":"[libcamera-devel,12/13] cam: Implement OptMetadata","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"c648c90d2df646549ca3e924cb5abdf8c7fd61c7","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":{"id":15,"url":"https://patchwork.libcamera.org/api/1.1/users/15/?format=json","username":"jmondi","first_name":"Jacopo","last_name":"Mondi","email":"jacopo@jmondi.org"},"mbox":"https://patchwork.libcamera.org/patch/11994/mbox/","series":[{"id":1948,"url":"https://patchwork.libcamera.org/api/1.1/series/1948/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1948","date":"2021-04-19T13:14:20","name":"Support SensorTimestamp metadata","version":1,"mbox":"https://patchwork.libcamera.org/series/1948/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11994/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11994/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 0808EBD814\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 19 Apr 2021 13:14:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B13246883F;\n\tMon, 19 Apr 2021 15:14:31 +0200 (CEST)","from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8250468842\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Apr 2021 15:14:24 +0200 (CEST)","from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 20141100005;\n\tMon, 19 Apr 2021 13:14:23 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 19 Apr 2021 15:14:32 +0200","Message-Id":"<20210419131433.22920-13-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20210419131433.22920-1-jacopo@jmondi.org>","References":"<20210419131433.22920-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 12/13] 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=\"us-ascii\"","Content-Transfer-Encoding":"7bit","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\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..7213abd934ec 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","12/13"]}