From patchwork Wed May 18 17:19:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 15979 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id C6763C326D for ; Wed, 18 May 2022 17:19:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6996A6565F; Wed, 18 May 2022 19:19:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1652894378; bh=wrUsBZ8CUJThDMA1C4NdibKePhHSga/f40FFTebgHQ8=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=JrPAkh1sd0MNchGY6RiTBncpmRV6i+MMdx17XVxOC9eOUZVC2Hom2VLrmZaIoRFTe XAiImy1QVTDjTSbux23X7U2FyPl9JNsHIfTYjEsOeNSdaDfJjm4WOm3f6BLPpPaNxO pUqDerLITVrZUjQM06lDwGkEjCgWcmQn5XctueKYhSjCxvt8GqB7Zt2taVUXEqNaws GplgSFzrtGRHrQtXDTkq47MkuJxBjSGdYxpKtDfZX2M38atgdv/wB0ovvp3rK9lky+ wMr2uw9a5b+g1OJ0R29s5nxz1grP+UQG/cU6LtfA3UwtvBtYFqmgkIsia7ZD0tR8Sw tqvQw29D0Q8iA== Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6565A6565D for ; Wed, 18 May 2022 19:19:32 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id DBF34240002; Wed, 18 May 2022 17:19:31 +0000 (UTC) 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add to the CameraSession class a script parser instance, created conditionally to the OptCaptureScript option. If the script parser has been created, use it at queueRequest time to retrieve the list of controls that has to be associated with a Request, and populate Request::controls() with it before queueing it to the Camera. Signed-off-by: Jacopo Mondi --- src/cam/camera_session.cpp | 10 ++++++++++ src/cam/camera_session.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/cam/camera_session.cpp b/src/cam/camera_session.cpp index a1b447235009..74c2acd79499 100644 --- a/src/cam/camera_session.cpp +++ b/src/cam/camera_session.cpp @@ -94,6 +94,13 @@ CameraSession::CameraSession(CameraManager *cm, } #endif + if (options_.isSet(OptCaptureScript)) { + script_ = std::make_unique(camera_, + options_[OptCaptureScript].toString()); + if (!script_->valid()) + return; + } + switch (config->validate()) { case CameraConfiguration::Valid: break; @@ -327,6 +334,9 @@ int CameraSession::startCapture() int CameraSession::queueRequest(Request *request) { + if (script_) + request->controls() = script_->frameControls(queueCount_); + queueCount_++; return camera_->queueRequest(request); diff --git a/src/cam/camera_session.h b/src/cam/camera_session.h index bf966bd15ab0..2cca92df0079 100644 --- a/src/cam/camera_session.h +++ b/src/cam/camera_session.h @@ -21,6 +21,7 @@ #include #include +#include "capture_script.h" #include "options.h" class FrameSink; @@ -60,6 +61,8 @@ private: std::shared_ptr camera_; std::unique_ptr config_; + std::unique_ptr script_; + std::map streamNames_; std::unique_ptr sink_; unsigned int cameraIndex_;