From patchwork Mon Jun 27 03:01:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16374 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 F3DA3BD808 for ; Mon, 27 Jun 2022 03:02:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 97DAF6563D; Mon, 27 Jun 2022 05:02:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656298938; bh=nJwrVPR4ZAlnfmWMTSQFRPq2klsrAV5yBzQQtDaVMjE=; 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=Wlw5aTfQcFyrO8yH9jAF+TycTZZLy/wbjX3vNNdGNWrsVTa7lB/f6c9ZYKNb1k4lS umRI+MFibFv0x14vB1sG/NT4VcBEdvU4rs8Jj+gqRaRNOuOBLorMB5zB1UNNhv3tZZ eksn4vOTXQoUJ24ARThrZRtYzmi5HxKk9gNp+epC+7Mj2w6Yka7ocYn5VJFKLrHySt 7cM1v0Ls2w4XSdbAlJz5Rxo2wOZ40cIZGherYdAefVM3Rv4LAphVrktJtM1hxZPh2J AE1ESx2i45K0eq0htJe6IBXZhS19/BaCWZry2TDs1geysihlAFeYO4T/iWAaj02Dfb BZTBDlTiXChxQ== Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8096D65641 for ; Mon, 27 Jun 2022 05:02:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JSTdbL0A"; dkim-atps=neutral Received: by mail-pj1-x1029.google.com with SMTP id g10-20020a17090a708a00b001ea8aadd42bso8133264pjk.0 for ; Sun, 26 Jun 2022 20:02:17 -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=wiQrIUZLI0w8Ss0m5XfMh2KHeapw8RY7kWyrjafNGrs=; b=JSTdbL0A/MJbgBjSXoOlohzqDJzrH9AIDJIjMVDsu2Ilxz1ebYrhGpBq50rMSIsk8q BoofUQJk0IW+Hg9tmJhZk0g9vFWhRnzOgL6O25JTJV1x6IODaOUvf+zh6oXRjR3Acy2g EDiIDqyZlwObt9s7MII4MFQ0vuTQ1fx/ZCofec/dWJs/r5mgS8Q6ePAfEHxKHp6qO4jn W4UQf/pOY0z4r5hTBd6DW1saBLz1f2qKF0NuqvjtSUlNuIjuzAEQxMUXLbXLeoo1axye YgXgjHujOtXyVoMoaQhNUELyhSxmLumpT0UOsxuPDB8b/z/TMJV5rvKOzhbfWq3RpOGe BpBw== 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=wiQrIUZLI0w8Ss0m5XfMh2KHeapw8RY7kWyrjafNGrs=; b=UA6lbclqx5uuAXjeJqI7lRpjv6eY7xRUZl0Rfloena3U24Z87xUQs4Fk5aw3ReyFHU B/JWpvDe1tMl6MOKPyA58Px8Q496XrwsXUf40dPYC8SLB4uzEgCpesIwGmXnO76UutI7 1oagXiAIrRn9viaaRs6C0fJ2C6ey8rVMgBw/SIeOw5er4hGELEI/wn9csNq9c9tGEfg5 rxUqf6p2jgkuo9QQJXsQznM2HlHE1wXhj3K56PfVNxt3ECX03l1regjoBduOP5mXhzRw XgucfVYlWGgWDP+/xED5kfjp7EN6QXv7xyoo9jXvfak9KO5xHzyj6GosiSGSI4r4sUJp +/YQ== X-Gm-Message-State: AJIora97CBVCoeajS0JqBIiByr6EaC6TiEn/nHTRHwSxFM5axomr1E6c U9urobZJPt7MfKozQZ7e7MR8yUO1TjrUFg== X-Google-Smtp-Source: AGRyM1vAFKloXMmH18K9g1uaFokSkfzk3hdSCwZdKF4cMNsJSIqbq2SvTGu1Tu29mHKvr2VI9OFvAw== X-Received: by 2002:a17:90b:895:b0:1ec:827c:ef0f with SMTP id bj21-20020a17090b089500b001ec827cef0fmr18040743pjb.10.1656298935770; Sun, 26 Jun 2022 20:02:15 -0700 (PDT) Received: from localhost.localdomain ([2406:3003:2005:1c27:cf57:31af:7925:f9e6]) by smtp.gmail.com with ESMTPSA id s7-20020aa78d47000000b0051bba89c2bcsm5899378pfe.58.2022.06.26.20.02.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jun 2022 20:02:14 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 27 Jun 2022 11:01:59 +0800 Message-Id: <20220627030159.30730-4-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627030159.30730-1-utkarsh02t@gmail.com> References: <20220627030159.30730-1-utkarsh02t@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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. If an invalid capture script has been given, show error but start the capture without the script. Signed-off-by: Utkarsh Tiwari Reviewed-by: Kieran Bingham --- src/qcam/main.cpp | 3 +++ src/qcam/main_window.cpp | 14 ++++++++++++++ src/qcam/main_window.h | 1 + 3 files changed, 18 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 e133b618..8e6bde32 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -151,6 +151,20 @@ 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(); + } + + /* Show stopping availability. */ + scriptExecAction_->setIcon(QIcon(":x-square.svg")); + scriptExecAction_->setText("Stop Script execution"); + } + startStopAction_->setChecked(true); } diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 2cdf7169..4d19ab64 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