From patchwork Wed Aug 10 15:03:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17074 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 E8806C3272 for ; Wed, 10 Aug 2022 15:04:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A4E9D63330; Wed, 10 Aug 2022 17:04:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660143856; bh=Gissg3Kolnsi/wJV5FavEAiRINqNVr57p7i3yoAwTvg=; 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=0j/kmbjag4yzKg5CDcofYgNjuV62lNZJIICtT/89vxf02i/DdiT3xmWgmOtorTXig oJsqaiP/yVT3oO8Ob3S+UJXGaHyOPG9m0hjsR887IKEEyFtkGSnAxPJSYO0qG5naoL SlOhiJoGiwEx9I59BGTldFhjeulrsoECqwuj+fllAq8CnbPvJ6byOrlV+9TDOlF/pq kK2R0NVZSxOMw40TiORRXC8yHdX+YRUatJ0b2eXhijSHMp/EOlNvywNGSnWr4M+Hh8 ZXiNOuQ5mSN8RGp6+TFp+YyLGPP9+pCxQ6UA/dsxBpREPnk34Htp/H1fssqf7ZLgah ypFf7A8TaroOQ== Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 58B3663342 for ; Wed, 10 Aug 2022 17:04:14 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="R87G+CFl"; dkim-atps=neutral Received: by mail-pl1-x630.google.com with SMTP id m2so14497411pls.4 for ; Wed, 10 Aug 2022 08:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=JJ6VsRgjEyvXjTIL05vJUEogvTNW4TalPItR7UT8ois=; b=R87G+CFloViHwgUMYWPd20mpy7gf7auhi8dLdSYcyS+HCu0FAMbQ7LH9vaQjfLsp5q +1A6fTKOUJvzXk2cW+aMY8hD+fRzc7osrMX/IoeClTNsr4UWS3jNyE/EfpQ/wkwNk3rk dnfhupwWtw5q3FTXP5P01nyfmVHvUSmu04fyVsjQYvBcJGlP73Eh2GI/ieQkggRXZGWV FG67meb8u42gzZTdUR4rri6uF/CD1LtXR8/vI48BwlsVn2qD8VGsJfoGfcA5Rv2/R6E2 oVkbkveuUHZ4nfQmdzVwNYiSKsNuR7yUYyBq9qRznxb47Jl6if0IZqSb+A2APhCxnYfL 3Ukw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=JJ6VsRgjEyvXjTIL05vJUEogvTNW4TalPItR7UT8ois=; b=ZP7N1mJMhdjLn/jeoxwaxMNtGaWJdzZIng841DxgcMAIf+9IrUNwJrx0YjXqZwC9Xi gToLTmQ+LNadgX2FuLPa4lODI6R4+noapxU9GJp77fDxumqBEL5itbhoyUNNCUoLQO4L Ih2QMrjUwWGKTFAqyTT4hiknX3outlJ+pJ+cD+BHDTArgUZ/xAwMXcPQj+eFNyenjIYI f7pWr8hHoxaOz7MKE07HSmmG8bgdugDJKWsLVBkua3CvYvKcmZMn0lOYMvnN3tac/nmL +L1G0gIu/mqip/JbYo4Ts30flsCzCZ2d/gDkxLGFAsfdH0zph1pSg7Vc3lkSTQMUQgxc n4aA== X-Gm-Message-State: ACgBeo0AzrIZTv1RJPZATEhnJSawgYzZmpgVBjw1Jd8WSdWwIA5b4X3p fjQoX/cfyzeSvLh21U2gCuFLkjjKQwk= X-Google-Smtp-Source: AA6agR7BILm1lOVHvCp5q3aCGd3xYo3e70KiBF/+V1vbC0jcj3GZur9gUeD8/2w4Sa3GljVAzELkUg== X-Received: by 2002:a17:903:40ca:b0:170:5b7a:a7c4 with SMTP id t10-20020a17090340ca00b001705b7aa7c4mr22675879pld.108.1660143852762; Wed, 10 Aug 2022 08:04:12 -0700 (PDT) Received: from localhost.localdomain ([2404:bd00:3:d2bc:2a55:4cae:bf8f:f4ed]) by smtp.gmail.com with ESMTPSA id b3-20020a1709027e0300b0016f1319d2a7sm12882624plm.297.2022.08.10.08.04.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:04:12 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 10 Aug 2022 20:33:49 +0530 Message-Id: <20220810150349.414043-9-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220810150349.414043-1-utkarsh02t@gmail.com> References: <20220810150349.414043-1-utkarsh02t@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v8 8/8] 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, display an critical error QMessageBox and close the application. Signed-off-by: Utkarsh Tiwari --- Difference from v7: 1. Moved firstCameraSelect_ to 3/8 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 753e1af9..ce70cc02 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -147,6 +147,9 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options) cm_->cameraAdded.connect(this, &MainWindow::addCamera); cm_->cameraRemoved.connect(this, &MainWindow::removeCamera); + if (options_.isSet(OptCaptureScript)) + scriptPath_ = options_[OptCaptureScript].toString(); + /* Open the camera and start capture. */ ret = openCamera(); if (ret < 0) { @@ -325,6 +328,13 @@ void MainWindow::loadCaptureScript() QMessageBox::critical(this, "Invalid Script", "Couldn't load the capture script"); + /* + * Close the camera if started by command line and its the first capture + * script. + */ + if (firstCameraSelect_ && options_.isSet(OptCaptureScript)) + quit(); + } else cameraSelectorDialog_->informScriptRunning(scriptPath_); diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 10994b67..c7cba5e9 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -45,6 +45,7 @@ enum { OptRenderer = 'r', OptStream = 's', OptVerbose = 'v', + OptCaptureScript = 256, }; class MainWindow : public QMainWindow