{"id":16811,"url":"https://patchwork.libcamera.org/api/patches/16811/?format=json","web_url":"https://patchwork.libcamera.org/patch/16811/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20220726194123.170208-3-utkarsh02t@gmail.com>","date":"2022-07-26T19:41:23","name":"[libcamera-devel,v5,3/3] qcam: Add --script to load capture script","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"17ada89b4b8a3574d0ad19f87d4952409bc5479c","submitter":{"id":114,"url":"https://patchwork.libcamera.org/api/people/114/?format=json","name":"Utkarsh Tiwari","email":"utkarsh02t@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16811/mbox/","series":[{"id":3330,"url":"https://patchwork.libcamera.org/api/series/3330/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3330","date":"2022-07-26T19:38:56","name":"Introduce capture scripts to qcam","version":5,"mbox":"https://patchwork.libcamera.org/series/3330/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16811/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16811/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 556F5C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Jul 2022 19:41:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1EA0963317;\n\tTue, 26 Jul 2022 21:41:52 +0200 (CEST)","from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com\n\t[IPv6:2607:f8b0:4864:20::62c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2BE5C60487\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jul 2022 21:41:51 +0200 (CEST)","by mail-pl1-x62c.google.com with SMTP id z3so14274504plb.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jul 2022 12:41:51 -0700 (PDT)","from localhost.localdomain ([2404:bd00:3:d6bf:24ea:3f52:4c78:7bd8])\n\tby smtp.gmail.com with ESMTPSA id\n\ta5-20020aa794a5000000b0052ac1af926fsm12017782pfl.20.2022.07.26.12.41.48\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 26 Jul 2022 12:41:49 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658864512;\n\tbh=zqUukScYu10qMuBjWoarzIHgUagwY2WlG1g02kH8NWs=;\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=dfRrer3PlnxLeZPTmebAFd6x6ltqHFKtwQ+NHjMYgyYr6dPvyHuVAC3a0Tix1w3SK\n\tbwcgktRwH+4xyLPXGI5NuTdCXFrAc7f7sux6fezmYClPN4PEWzEIujneXs8VJNN2EI\n\ti3/Gug/YedrA0Co8+OzTtmX3wuNiYP/rgp3Eyblzw2hB5Tsi1wrgvYa2u9WXelqH+T\n\tDMaJ/8TTY6BKczH29tRvuIS8iQUqAv1weBejaT4+933h7a6sZzu/UzHsT2HzUNPVoI\n\tBb2Jo1W785Wy1qdGq82TKUrT0CIKLhNAsAqhlev5dYXashEk8ICabrFK621h4clC9u\n\tuKQWZ9fLJQaRA==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=C9Qz3WEv8GHqsyhmoNi2/XFeD1co4638A+i8dJzm75o=;\n\tb=U7wQwO+ZsSJhl/O+08tUK2csulTtq8+YKvlHSXDKFf+GR22CNffvLn8tKNTF0qwrzk\n\tJGsuZudH1aTAJ1CdSvME6vbYUw9LYyfm9/s20C0skDpui8Ecs75kmH9F1aCI3jwz3JoJ\n\tvZJf1dzL/4kjq03My+9N61UTuj07lX2f12ONgifCDkynh9NEzluUrHQQtr+TRDbikDFw\n\tz/Q7bdMPFQjcT70Y+saz1cmdjRfyvdEeU5sOhtejsz4FGA0yIeWtmgFzORzU0zJbGn67\n\tDPDr4+axzq5c1uZYTAgL/WHzfJtlGJBuUXsS9Np+C8PZ2Gsdoo5KbRh2MZbCpgdFZ1U1\n\t9X1A=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"U7wQwO+Z\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=C9Qz3WEv8GHqsyhmoNi2/XFeD1co4638A+i8dJzm75o=;\n\tb=wqDqhp6R5/WvzTAwmcjINf0BzOsAW9HDkM2Aki1IndjWZedGR89UpLqIU6j4a9QaZm\n\t3rW+yQa69RDz7JMRHSVLFFrMPhouBE5W2OhYrbjLrrqmiOeVb4uoyKVsVvcYmpbBUC3P\n\t2D48hkOaDZ1H1fiPBmqCbQ4IeoYpXpIURwcgHZ0J10B2z94JzI8EtQxETZMGkXFFHvSP\n\tXEeIXkhtGao/lYHOogRUJ2EOFshKOErHUyy0sLsldgJ5uAhK06/jpBiEIpuWVNYhVWFZ\n\tJ/bsp9lghOF0R4xsT6nDic7ia20gbi5QUkWnwjQ/VKi1k4Kc6YxVaZEAhx6K+IuL6t98\n\tJ/WA==","X-Gm-Message-State":"AJIora/jWjXALSyjf/xX5mHos5ySt+9avR6cuB8Q2eh9JQhwRmL7tqq3\n\tZAidD+ebQeqN8BQVGKl4UjSMCNPaAUo=","X-Google-Smtp-Source":"AGRyM1vQrnGzlFbjN+GjjqF/0pStL4/3hH0KVpFYMzOEmW6wv6f5w6xviPj9+2ilq8XvGAwtMnGJqA==","X-Received":"by 2002:a17:902:8693:b0:16c:db86:1c86 with SMTP id\n\tg19-20020a170902869300b0016cdb861c86mr17803564plo.9.1658864509478; \n\tTue, 26 Jul 2022 12:41:49 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 27 Jul 2022 01:11:23 +0530","Message-Id":"<20220726194123.170208-3-utkarsh02t@gmail.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220726194123.170208-1-utkarsh02t@gmail.com>","References":"<20220726194123.170208-1-utkarsh02t@gmail.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 3/3] qcam: Add --script to load capture\n\tscript","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":"Utkarsh Tiwari via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Utkarsh Tiwari <utkarsh02t@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add --script as an individual option to load capture scripts.\nLoad the capture script before starting the capture.\n\nIf an invalid capture script has been given, display a QMessageBox and\nprint it on the console informing that the script is invalid. Do not\nstart the capture.\n\nSigned-off-by: Utkarsh Tiwari <utkarsh02t@gmail.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n Changes from v4\n\t- Now when we have an invalid script we quit and don't start the\n\t  capture.\n src/qcam/main.cpp        |  3 +++\n src/qcam/main_window.cpp | 20 ++++++++++++++++++++\n src/qcam/main_window.h   |  1 +\n 3 files changed, 24 insertions(+)","diff":"diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp\nindex d3f01a85..91166be5 100644\n--- a/src/qcam/main.cpp\n+++ b/src/qcam/main.cpp\n@@ -43,6 +43,9 @@ OptionsParser::Options parseOptions(int argc, char *argv[])\n \t\t\t \"Set configuration of a camera stream\", \"stream\", true);\n \tparser.addOption(OptVerbose, OptionNone,\n \t\t\t \"Print verbose log messages\", \"verbose\");\n+\tparser.addOption(OptCaptureScript, OptionString,\n+\t\t\t \"Load a capture session configuration script from a file\",\n+\t\t\t \"script\", ArgumentRequired, \"script\");\n \n \tOptionsParser::Options options = parser.parse(argc, argv);\n \tif (options.isSet(OptHelp))\ndiff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 9dc96fbb..7b2bc84b 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -152,6 +152,26 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\n \t\treturn;\n \t}\n \n+\tif (options_.isSet(OptCaptureScript)) {\n+\t\tstd::string scriptName = options_[OptCaptureScript].toString();\n+\t\tscript_ = std::make_unique<CaptureScript>(camera_, scriptName);\n+\t\tif (!script_->valid()) {\n+\t\t\tQMessageBox::critical(this, \"Invalid Script\",\n+\t\t\t\t\t      \"Couldn't load the capture script\");\n+\t\t\tqInfo() << \"Invalid Capture Script\";\n+\n+\t\t\tscript_.reset();\n+\n+\t\t\t/* Do not start capture if invalid script. */\n+\t\t\tquit();\n+\t\t\treturn;\n+\t\t}\n+\n+\t\t/* Show stopping availability. */\n+\t\tscriptExecAction_->setIcon(QIcon(\":x-square.svg\"));\n+\t\tscriptExecAction_->setText(\"Stop Script execution\");\n+\t}\n+\n \tstartStopAction_->setChecked(true);\n }\n \ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex eb398c1d..59e50b5e 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -43,6 +43,7 @@ enum {\n \tOptRenderer = 'r',\n \tOptStream = 's',\n \tOptVerbose = 'v',\n+\tOptCaptureScript = 256,\n };\n \n class MainWindow : public QMainWindow\n","prefixes":["libcamera-devel","v5","3/3"]}