[{"id":23112,"web_url":"https://patchwork.libcamera.org/comment/23112/","msgid":"<Yods6g+qZmisYqAV@pendragon.ideasonboard.com>","date":"2022-05-20T10:26:50","subject":"Re: [libcamera-devel] [PATCH 5/5] cam: Use script parser to set\n\tcontrols","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Wed, May 18, 2022 at 07:19:21PM +0200, Jacopo Mondi via libcamera-devel wrote:\n> Add to the CameraSession class a script parser instance, created\n> conditionally to the OptCaptureScript option.\n> \n> If the script parser has been created, use it at queueRequest time to\n> retrieve the list of controls that has to be associated with a Request,\n> and populate Request::controls() with it before queueing it to the\n> Camera.\n> \n> Signed-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(+)\n> \n> diff --git a/src/cam/camera_session.cpp b/src/cam/camera_session.cpp\n> index 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\nAn error message would be nice here.\n\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);\n> diff --git a/src/cam/camera_session.h b/src/cam/camera_session.h\n> index 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\nYou can forward-declare the class in this header and move the include to\nthe .cpp file.\n\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_;","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 F034EC0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 20 May 2022 10:26:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 54C6965660;\n\tFri, 20 May 2022 12:26:59 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 89DE160440\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 May 2022 12:26:57 +0200 (CEST)","from pendragon.ideasonboard.com (unknown [45.131.31.124])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C91B83E4;\n\tFri, 20 May 2022 12:26:56 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653042419;\n\tbh=VHZPo/2d1elr96biVKUQD6drMRpMtJuD++n7yNluncA=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=iJzJwl/nKtnQyxp0Rr2xidVZIZhpOrW0bk4y7VniFpGTYtu+QfHszmYV8vNnJaCw2\n\tsm7FBBZBaRZMYAE/NxjQDecQ26ylD86ux0fgC0tCWbLz2rn21Ec/NjGooV04MkHIPc\n\tFLJDOiOf5TPqD4Gfou5dRFziW1Cr5T430zazggQury/zyG2pvtXaOFpa0i1G4t+f71\n\tdxaMHmiiTKasBxeYaqpJ1o+fVahqvMRT6AfLK4wRooQ3RpLff2dur3pvR/6nMVxQqv\n\tROIKuwInehYbr6wElJNAf1YeAc0NUwHz0pIBKGtc/4vjw1B+4yB3pMy8bgeKv4I28p\n\t9l6TwAMAFa9fQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653042417;\n\tbh=VHZPo/2d1elr96biVKUQD6drMRpMtJuD++n7yNluncA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=FeIN5yLWxISaTiJUX7+HeDIKJ1AKDL7sKnQuwk/ubRy/4A8IlGpfyMzWgKzqoMgOl\n\tuUkhRJxQ9pGqoo5asKfgEHX+CBxYepA0T5otCDvUxyjfgATePY1bs91wwQ6hFzNLj/\n\t1amYIRzxjA/JkykvnZ/xzzbzmE9KgsoE6Y8E91Ag="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"FeIN5yLW\"; dkim-atps=neutral","Date":"Fri, 20 May 2022 13:26:50 +0300","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<Yods6g+qZmisYqAV@pendragon.ideasonboard.com>","References":"<20220518171921.244168-1-jacopo@jmondi.org>\n\t<20220518171921.244168-6-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220518171921.244168-6-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 5/5] cam: Use script parser to set\n\tcontrols","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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]