From patchwork Mon Jun 13 06:03:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16206 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 7E585C3274 for ; Mon, 13 Jun 2022 06:04:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B489E6563E; Mon, 13 Jun 2022 08:04:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655100247; bh=BR26+Qfh/haE7n/DaiYRKsM8haJxNwEqkfCNlDDuOZw=; 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=EngU3zCFdaTv3dA9XCUEOtSaQc7ew4a3rtgkC5Fsh6iDqdZFogjcC/jjJenCW4gIm GD4BX3JuVEAYfCt2tHjit2UbSKkEnrsrVJ1ScbDfO7CVRqZRtJFXiWyTY5/IdGCczJ weE3lWYGrjgId3LykpImJsEwpIuwlvYE8qhDupXeoGiEZPXbeMy72ayvtm7+E14jaU gyXZI7WzorRTuXX0UOUKXwbQK2BiO5mN3EPA5R0//xz1dG0Ll3VD0X3kCpzFA5ukH7 FDonoK+87U1qps5R695v+s7AsoA784Zfaq6t3pif549f5fIHQj9bhCiAYXB4bBlW6k m2KVDi5FWkm1w== Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3F7466563E for ; Mon, 13 Jun 2022 08:04:06 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="d1i+p0Ht"; dkim-atps=neutral Received: by mail-pg1-x52d.google.com with SMTP id 184so4647069pga.12 for ; Sun, 12 Jun 2022 23:04:06 -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=ON1TEMaclXDPe4+rXHPXrcEfPxpF3oTltgaPHX1Y9nw=; b=d1i+p0HtYW6ogTLqxqqddx7q4VHF8FF7LzOc3rgT18aliYwfEQj1AK4sOzLKJkzUNT 4Ul52pVG88FnzOw0nkvWDi3ENISBuWulHsFS5G0wsyNi3rLUNDg1l7X5AZFm+HeUcZDx LBkJiOkGzzEPNBL7iVmNIiv9CPLJsBZWpii0NIXEx/HhJ3DCf0oriT0QgEl/AGEXtCtp dc9DoPQrfSLVKcBtlzcS7LSfNiRB4Q5BxJBAsoL30fAUSgAVksZoAPz/f2CfNTay3T35 0yWXOWH9FYCeZjhL7SRPkoemcfGiO3m/UtbbYHf6fSN2JYE12T0Miy0tehDuUzxDtUxL kvBA== 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=ON1TEMaclXDPe4+rXHPXrcEfPxpF3oTltgaPHX1Y9nw=; b=o8McUAKfJay/QquxhKCseptUX181tBEU2zB6TPqqqEtpDocWCBOLojtLASx7LGQ/4q B0R5HJG2sm3O33KvgnHaKzyFHQsxbaGaW3Yw8G9uL3/nG4c1IEVhSwFFwwB/wHqIUOlv x0R+u8FqU5zYindcIjxd2Ya90gBSOwkdM5eZQ8PnUaBHu5jcP8i7uSMfHM3P5t1W/kP3 NKTEKU7HVcy2sEvIGfbGrdTmKV5bfvetsB41ONpNWNqzfo9LY8KlsirG/H+S7tSxFeIp V6TGgYYv0mqgT3MCw9Ei1r0tQ22DC7k8GLqc6fxo+y3B2Gm6AfqsRbgxyBv56ezFsjaQ TbcA== X-Gm-Message-State: AOAM530AD4O3zZKrVUQ+nOwLSkIzeb/U9U2HOlnuFQOcvg/Y2Nr6aWor avWV77yKtARvC6D1ljoaS7Ej/yVpGb8= X-Google-Smtp-Source: ABdhPJy9ic6OQs3E2P/FQjTvtjGTmxZ4PIqlW/NXPvjmmPljr20D/HuvFT+wTJ1wShs619RKI4qlXQ== X-Received: by 2002:a63:d202:0:b0:3fe:4c06:ca76 with SMTP id a2-20020a63d202000000b003fe4c06ca76mr20471335pgg.227.1655100244566; Sun, 12 Jun 2022 23:04:04 -0700 (PDT) Received: from localhost.localdomain ([2404:bd00:3:d6be:8959:67fc:32d7:74a0]) by smtp.gmail.com with ESMTPSA id x14-20020a170902a38e00b00161478027f5sm4087908pla.150.2022.06.12.23.04.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jun 2022 23:04:04 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 13 Jun 2022 11:33:45 +0530 Message-Id: <20220613060345.229191-4-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220613060345.229191-1-utkarsh02t@gmail.com> References: <20220613060345.229191-1-utkarsh02t@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 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 --- src/qcam/main.cpp | 3 +++ src/qcam/main_window.cpp | 9 +++++++++ src/qcam/main_window.h | 1 + 3 files changed, 13 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 7cdb1238..b9bf5b04 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -151,6 +151,15 @@ 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, tr("Invalid Script"), tr("Couldn't execute the capture script")); + script_.reset(); + } + } + startStopAction_->setChecked(true); } diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index cde5842f..45069b0e 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