{"id":15979,"url":"https://patchwork.libcamera.org/api/1.1/patches/15979/?format=json","web_url":"https://patchwork.libcamera.org/patch/15979/","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":"<20220518171921.244168-6-jacopo@jmondi.org>","date":"2022-05-18T17:19:21","name":"[libcamera-devel,5/5] cam: Use script parser to set controls","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"9986d34a7f525229fe691a0a6c6780a1b22f2f52","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/15979/mbox/","series":[{"id":3125,"url":"https://patchwork.libcamera.org/api/1.1/series/3125/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3125","date":"2022-05-18T17:19:16","name":"cam: Add support for capture scripts","version":1,"mbox":"https://patchwork.libcamera.org/series/3125/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15979/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15979/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 C6763C326D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 18 May 2022 17:19:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6996A6565F;\n\tWed, 18 May 2022 19:19:38 +0200 (CEST)","from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net\n\t[217.70.183.193])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6565A6565D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 May 2022 19:19:32 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id DBF34240002;\n\tWed, 18 May 2022 17:19:31 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652894378;\n\tbh=wrUsBZ8CUJThDMA1C4NdibKePhHSga/f40FFTebgHQ8=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=JrPAkh1sd0MNchGY6RiTBncpmRV6i+MMdx17XVxOC9eOUZVC2Hom2VLrmZaIoRFTe\n\tXAiImy1QVTDjTSbux23X7U2FyPl9JNsHIfTYjEsOeNSdaDfJjm4WOm3f6BLPpPaNxO\n\tpUqDerLITVrZUjQM06lDwGkEjCgWcmQn5XctueKYhSjCxvt8GqB7Zt2taVUXEqNaws\n\tGplgSFzrtGRHrQtXDTkq47MkuJxBjSGdYxpKtDfZX2M38atgdv/wB0ovvp3rK9lky+\n\twMr2uw9a5b+g1OJ0R29s5nxz1grP+UQG/cU6LtfA3UwtvBtYFqmgkIsia7ZD0tR8Sw\n\ttqvQw29D0Q8iA==","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 18 May 2022 19:19:21 +0200","Message-Id":"<20220518171921.244168-6-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.35.1","In-Reply-To":"<20220518171921.244168-1-jacopo@jmondi.org>","References":"<20220518171921.244168-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 5/5] cam: Use script parser to set controls","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>","From":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add to the CameraSession class a script parser instance, created\nconditionally to the OptCaptureScript option.\n\nIf the script parser has been created, use it at queueRequest time to\nretrieve the list of controls that has to be associated with a Request,\nand populate Request::controls() with it before queueing it to the\nCamera.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/cam/camera_session.cpp | 10 ++++++++++\n src/cam/camera_session.h   |  3 +++\n 2 files changed, 13 insertions(+)","diff":"diff --git a/src/cam/camera_session.cpp b/src/cam/camera_session.cpp\nindex a1b447235009..74c2acd79499 100644\n--- a/src/cam/camera_session.cpp\n+++ b/src/cam/camera_session.cpp\n@@ -94,6 +94,13 @@ CameraSession::CameraSession(CameraManager *cm,\n \t}\n #endif\n \n+\tif (options_.isSet(OptCaptureScript)) {\n+\t\tscript_ = std::make_unique<CaptureScript>(camera_,\n+\t\t\t\t\t  options_[OptCaptureScript].toString());\n+\t\tif (!script_->valid())\n+\t\t\treturn;\n+\t}\n+\n \tswitch (config->validate()) {\n \tcase CameraConfiguration::Valid:\n \t\tbreak;\n@@ -327,6 +334,9 @@ int CameraSession::startCapture()\n \n int CameraSession::queueRequest(Request *request)\n {\n+\tif (script_)\n+\t\trequest->controls() = script_->frameControls(queueCount_);\n+\n \tqueueCount_++;\n \n \treturn camera_->queueRequest(request);\ndiff --git a/src/cam/camera_session.h b/src/cam/camera_session.h\nindex bf966bd15ab0..2cca92df0079 100644\n--- a/src/cam/camera_session.h\n+++ b/src/cam/camera_session.h\n@@ -21,6 +21,7 @@\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n \n+#include \"capture_script.h\"\n #include \"options.h\"\n \n class FrameSink;\n@@ -60,6 +61,8 @@ private:\n \tstd::shared_ptr<libcamera::Camera> camera_;\n \tstd::unique_ptr<libcamera::CameraConfiguration> config_;\n \n+\tstd::unique_ptr<CaptureScript> script_;\n+\n \tstd::map<const libcamera::Stream *, std::string> streamNames_;\n \tstd::unique_ptr<FrameSink> sink_;\n \tunsigned int cameraIndex_;\n","prefixes":["libcamera-devel","5/5"]}