From patchwork Sun Jul 3 04:37:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16523 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 65B87BD808 for ; Sun, 3 Jul 2022 04:37:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 24C536564F; Sun, 3 Jul 2022 06:37:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656823041; bh=FEkCk9Mw+xcHC9gOxznTZzuYzbYKnZ7km1FsOOFVeiQ=; 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=T3xlXafp3YVDW2xoNp2f2934iu0HBel9eANWz/eismiK3wKvEFmStmVSsP7uJ0a9i 8DW2TASy3yPV75Dw8qgMCLU0bw+fwc0hIaz7judM2RBPMtHoACVkWoTapdp0tTo0o6 z0fd4yzTXWlrLnqX4ziPBpW7mDGGyDMN13w+58rd0TRergUyg/6iTVbQMLw1PmqXJz Dl7ZPVDyn8OE30AJ7bHjHFYlCMgpFkJMUPx0jRX9S0dOoUz0R66ONS30xfILnEg7WV 02qmZ5VHetk6v88Xlm82fL7ADQUjxFIxqw8TZiieYCE8BSJw3Yu6QJNPFbufKAY/5t c/8Pm5RphZ3xA== Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 87DE66564A for ; Sun, 3 Jul 2022 06:37:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="E4hSxFaC"; dkim-atps=neutral Received: by mail-pj1-x1031.google.com with SMTP id go6so6400771pjb.0 for ; Sat, 02 Jul 2022 21:37: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=SojkkV1KgZHtRwZYehZcIeNN0EHB8sfznzvDHI1YuLw=; b=E4hSxFaCHwRas0sZ+2PPjfHzUb5m0Zlha038lP1C3/nmq/Pyj+zOoE51fXCZL7oKO8 BnpzSeG+wEITyamufE7Ic+xpfxZ4aGyvbxvPX6qsRZLxwAAa4V7Z+PfsZituVd3BYdGZ DfL2WmbrSI8b9nUc/GQK8aDuFoSyVFFcR3YLf/M8D8+O9FgkG5qLnIqKENjboP6vwgvI Gvbl97PxT0dRpKNVqtWIDLW8MDFW9L5pqt7r8aSdty8HARoqZQasujpMa1Fut9OCfEyj 6V7urtl5wphOF+L7iWXeq2w+/9FV3q79z9LQVBp6Xs1fwgtlnLgDfzF56/r+m5GBqIP1 faLA== 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=SojkkV1KgZHtRwZYehZcIeNN0EHB8sfznzvDHI1YuLw=; b=avFCRBncy5hWKXB2Q8lH7fki23l9cs/vdcxjiftGI1egWqKguK+25t8pQwI1Wy3pSA SUMYftZFSc6hegVBQbK+AnqyFJ4XUcdkShwFdTspld6Iqufc7EZjFqMdF6dnfqCrk2B5 XdVYGfb79KfvfXSrAT0r35bNuXJCUQMbZR+Ljy+wuGQIJgx057za5kMujC7nx3OyfXTe Bz7/+QLe3A3mwXjVH8hXx9HWl4xutEfqUay5TCQ8Y7s4/KRsI0g2Rhq0oU7gIG7s/dW9 /D5LcpBoafv1oZJoFTMA7+0DlM0DNVDod/sD69gAmUnJDBzVDC0QtIXpNJXF+NpPB2tB YeRw== X-Gm-Message-State: AJIora8om+VottFDD+5rOjiw3KsXjc970tNKvzuABnUeK6uLb1RH12Av U+TisZheQdIDUAtRoAFA7z3JArI11lzUcA== X-Google-Smtp-Source: AGRyM1tjwyyN7+qasJmlN9rhbLsJsAee2J77T0gURl8Bug9nfSXX5SYrwXKoIHtHpKJE9fe+gKmquQ== X-Received: by 2002:a17:902:f68f:b0:16a:7a95:466c with SMTP id l15-20020a170902f68f00b0016a7a95466cmr28187165plg.86.1656823035921; Sat, 02 Jul 2022 21:37:15 -0700 (PDT) Received: from localhost.localdomain ([2406:3003:2005:1c27:2dd0:3b05:f874:d165]) by smtp.gmail.com with ESMTPSA id me3-20020a17090b17c300b001ec84b0f199sm12122299pjb.1.2022.07.02.21.37.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Jul 2022 21:37:15 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Sun, 3 Jul 2022 12:37:04 +0800 Message-Id: <20220703043704.296872-4-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220703043704.296872-1-utkarsh02t@gmail.com> References: <20220703043704.296872-1-utkarsh02t@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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 4fbaeccc..7ec53a7c 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