From patchwork Wed Jun 22 13:16:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16320 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 85217BD808 for ; Wed, 22 Jun 2022 13:17:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3C1FA65640; Wed, 22 Jun 2022 15:17:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655903856; bh=Hw0bTFcArbGH3QjhfHrHCqlJeBV4ipe2g8lAthiGb1k=; 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=DpUI/uFuRljRoF7tbjGw2XYsnhRWRCKj3NWZlenwG4Lh5nCbL5X8jnK2REFLJ2yVD KrNytZs/fKecA/WYJWPxnSORAjrdfGvyW7aLP9oZeOcP4lxkYIiRrqvLcY+uc8vZE/ iLVxPjEoQeJOr9uQhNFJJjFgxJie8K15cWcljfH8oQgG6dx2BARhUMPbJX4DzuCQX/ qsDb0v+D8QYPHtVX8GvhiwVeVsssJgXQxWHnW2B2YZNh9d4zEyl0Al+znKMLkNAPgi rm/0vxAhnCEzAel+Je+qz7QBduB3bSXElbFA57zR+HyWqlptM3rkBn5s5GyRNEQQmk 6w408YrtgVAYg== Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A8B9465639 for ; Wed, 22 Jun 2022 15:17:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="hzSLmeCA"; dkim-atps=neutral Received: by mail-pj1-x1036.google.com with SMTP id p5so10189317pjt.2 for ; Wed, 22 Jun 2022 06:17:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=38Yvl/pHFg1W9hkWxfTar39nZsC/yR/GGyBTgoF+ELU=; b=hzSLmeCAptINCXF9zdMnqgywQrFegP5kIR0fJ3bzddbrG4wDQchNGSAGca6wuL/0zk 4FZnxWsJ32if4LBF/iHHpYSE8iv//SD6u7Dsn28DtWZjtutLtEprBEpGhULv27uRyiDD XEiJQv3DzdrUpQHUF1yh8qHFRBQ6Of2xJDWoP2N7Al6NyPfr6F772zpw6D+lIbEMtYo/ MSEHrLYijR65TJ28o8mcSs2VubVOtvTyUJ3orQTzJqvzZeb8gOjfy3JOvUAhAERfL+8W DAo8oD5XxVHBXDI69yI+fRvNQBhitGLv5cL597G6Be5YAYAOrOVmFtyEeRHzqKv2G9z5 ej3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=38Yvl/pHFg1W9hkWxfTar39nZsC/yR/GGyBTgoF+ELU=; b=YTeUHhm2Qdx3pQcgALjpswzmjL/XRvqgKpYZuhHc51V6IVXjRB23HyttVyhBXSqjFd mwa0Eo2An2/53SQaD7z5qzrVflW1n3kKtGVxOuW3pZa23zGDLBG8h/k000rEFwP8kGgH iKcCKhOoHEjjU/cNX5NSWiqgDVtBAoaxAZnSwn2bZDLumRRyCGVZ/NXyfJv51lgVHdCv Fcu/fh44XLz6lUAKbEtK+9Ice7jGUFIOvC+rWCz8McRYb3DtP53MG6J5BwD7t11b3/1g lClg3u1IhtMWvq9Cyr4GtJlFfHG+TejR/P8h0rdibjBcBDk6Uw5iATIzycOplxqe2ulo Kg5g== X-Gm-Message-State: AJIora8JqufRAwBPCIP7e9o6IPaHOfEQObjAj+6V/SyrvFXWUqr4wQPR ZT5dYMHvL9PRRDrEi933ScHII4JCsYM= X-Google-Smtp-Source: AGRyM1vyL8wfemJG+u8QRY76RaOikAmLP63AOMBAGC5htslmWtld3UEvhDNcG2BXUDOWt1P+I9Rdew== X-Received: by 2002:a17:90a:430a:b0:1ea:e7f4:9f59 with SMTP id q10-20020a17090a430a00b001eae7f49f59mr3704238pjg.75.1655903853067; Wed, 22 Jun 2022 06:17:33 -0700 (PDT) Received: from localhost.localdomain ([2406:3003:2005:1f6b:fd12:eca1:fe45:bbdb]) by smtp.gmail.com with ESMTPSA id x82-20020a627c55000000b0052089e1b88esm7124540pfc.192.2022.06.22.06.17.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jun 2022 06:17:30 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 22 Jun 2022 21:16:38 +0800 Message-Id: <20220622131638.79122-4-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220622131638.79122-1-utkarsh02t@gmail.com> References: <20220622131638.79122-1-utkarsh02t@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/3] qcam: Add --script to load capture script 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: Utkarsh Tiwari via libcamera-devel From: Utkarsh Tiwari Reply-To: Utkarsh Tiwari Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add --script as an individual option to load capture scripts. Load the capture script before starting the capture. Signed-off-by: Utkarsh Tiwari Reviewed-by: Kieran Bingham --- src/qcam/main.cpp | 3 +++ src/qcam/main_window.cpp | 10 ++++++++++ src/qcam/main_window.h | 1 + 3 files changed, 14 insertions(+) diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp index d3f01a85..91166be5 100644 --- a/src/qcam/main.cpp +++ b/src/qcam/main.cpp @@ -43,6 +43,9 @@ OptionsParser::Options parseOptions(int argc, char *argv[]) "Set configuration of a camera stream", "stream", true); parser.addOption(OptVerbose, OptionNone, "Print verbose log messages", "verbose"); + parser.addOption(OptCaptureScript, OptionString, + "Load a capture session configuration script from a file", + "script", ArgumentRequired, "script"); OptionsParser::Options options = parser.parse(argc, argv); if (options.isSet(OptHelp)) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 29da3947..17cc3185 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -151,6 +151,16 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options) return; } + if (options_.isSet(OptCaptureScript)) { + std::string scriptName = options_[OptCaptureScript].toString(); + script_ = std::make_unique(camera_, scriptName); + if (!script_->valid()) { + QMessageBox::critical(this, "Invalid Script", + "Couldn't load the capture script"); + script_.reset(); + } + } + startStopAction_->setChecked(true); } diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 58df4e15..1b4a4fd6 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -42,6 +42,7 @@ enum { OptRenderer = 'r', OptStream = 's', OptVerbose = 'v', + OptCaptureScript = 256, }; class MainWindow : public QMainWindow