From patchwork Sun Aug 7 20:32: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: 17022 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 8D55BBE173 for ; Sun, 7 Aug 2022 20:32:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 45E7463336; Sun, 7 Aug 2022 22:32:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1659904349; bh=k4GIaMoB7l5a+5j5zmU+WTsJMR1CqBU9pK40vIr6+Ps=; 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=fn5HRKWo8T6Lk0jenH0YVkMJtlt8QOqRl5vlJqsQKxeQ1sE9NlP2d3dVm2/ttzdk3 49tZwk/KrFNE42kJuDsSqeQkqoXz+EhvflzHONZpamDql4jHZfVvCu1w+zTxUBsJ51 5cGjeBQZdmF6nj9p1IKmgbxB9P3cQCwlZVlBPz4FCxj8tO98NeF5mdI8XNI1FVFyVS tgn/lonwy7ud+znofcLYqo8njwqUULDY1l7CUR8It+oKehr6eKnUweo8oA2c1np5EI q5jlL5hYfc/HrLbAaAlniFvWPbN/sGKnuaEaPOoINS7au/FaUsKZtipRPztPAzvMuj w6eJPU0BZCTRw== Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6990063327 for ; Sun, 7 Aug 2022 22:32:28 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="bTP0kbPs"; dkim-atps=neutral Received: by mail-pj1-x102a.google.com with SMTP id b4so7082311pji.4 for ; Sun, 07 Aug 2022 13:32:28 -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=OFhf8uHWyTxzs9/ji3mmENRnTkopYCwLKyaZSOgDTG4=; b=bTP0kbPsMT9Qn1qLO+qPRveqtplevHN/NTDMYdoEQA+XI136tfv9JEDl3Nb1ZH7ZQd 7sIeqFWx8+pdw/R1uO6wqjrSs6SdMDZde2vC1kgzER6lCVjVCiHWLWTqBmcI+/MNTNzs 2d0MqJ+qpUY1cbXtB56715i9hZtqOpp+bZRIrXBH7oP6BtELmnP1sepP3iEZ95oWgUcd L4fKbHKVnC6lr7o1hUyRif+rM5HKp+xgmyaAFJnLq5/lFTNtqusPfvePL6PBPQEWszdp BHBIEnLKAPiZeW9SsMQTl7w6kX2VMnRAsNCJ5iT/n6ZLefV+AXKv0mw7SX8YVvLaL2sc gyMw== 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=OFhf8uHWyTxzs9/ji3mmENRnTkopYCwLKyaZSOgDTG4=; b=dvR1zd0J7m3WIzr7ITzGXCtgQxyKUFIbCCN0z804u+xIZymWc8aNjoXzGtjf+xOMFv FdK9LXSXAcfEFeSSeury3+gFkNFCkxAYoKbkbEeQSlqBjMKoVTUZaRaDmpz8SSFcxB7y BrVX9+1XBWaanFkLAuNguvS1C9dAAO47ASHa/xX7DOiSGEsN4XMKAK68es3ryZ3yfFqw tkOGs6eVKbnrvcFyhcEYVr5rBRcKyQSBKMn7wD2D198RgEkPtO5lFURLrQTQ4NohRpiN 37MyPxPT3Ntc2OHdj0YQNdlA3uAcn9ixKCuRCYXxfLoV1cxtEg7P3ZL9W4i8CVViLEIK Dwwg== X-Gm-Message-State: ACgBeo0OQ/nAY2K+P5PU0/GYN9dY/nXkMuq/dlT/13PD94iFBRmbtqIL VvyiCoFQyw3TlyxkkmU80hdRJeFCqJ0= X-Google-Smtp-Source: AA6agR5FWWMcERP+vtqsYN+lRzS41wBg1s6CCIED9lQMG9zHDY3PnWWUfu8pTZwuaWwQbzMOc3bIig== X-Received: by 2002:a17:902:e952:b0:16d:2552:f2eb with SMTP id b18-20020a170902e95200b0016d2552f2ebmr15788985pll.76.1659904346791; Sun, 07 Aug 2022 13:32:26 -0700 (PDT) Received: from localhost.localdomain ([2404:bd00:3:d2bc:8eec:115d:8ea8:b700]) by smtp.gmail.com with ESMTPSA id x29-20020aa7941d000000b0052d194a6602sm7006334pfo.102.2022.08.07.13.32.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Aug 2022 13:32:26 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 8 Aug 2022 02:02:04 +0530 Message-Id: <20220807203204.152358-5-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220807203204.152358-1-utkarsh02t@gmail.com> References: <20220807203204.152358-1-utkarsh02t@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 4/4] 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, quit the application. Signed-off-by: Utkarsh Tiwari --- src/qcam/main.cpp | 3 +++ src/qcam/main_window.cpp | 6 ++++++ src/qcam/main_window.h | 1 + 3 files changed, 10 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 e354ba10..51088658 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -146,6 +146,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) { @@ -320,6 +323,9 @@ void MainWindow::loadCaptureScript() if (!script_->valid()) { script_.reset(); + if (options_.isSet(OptCaptureScript)) + quit(); + QMessageBox::critical(this, "Invalid Script", "Couldn't load the capture script"); } diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 01466e28..fe4dba8d 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -46,6 +46,7 @@ enum { OptRenderer = 'r', OptStream = 's', OptVerbose = 'v', + OptCaptureScript = 256, }; class MainWindow : public QMainWindow