From patchwork Mon Jun 13 06:03:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16204 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 EDCF4BD161 for ; Mon, 13 Jun 2022 06:04:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8952765639; Mon, 13 Jun 2022 08:04:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655100243; bh=I1/n3GkDGO5FHN+zYKCrKE3Vnc46aAt+/rUZhkTu/so=; 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=zJqIeJfJqox1LGEOkBFlu70gwLu5iewZ6gOnOnhoaDn9R+oM/gGn9R15hudaAexoz 4nwtOnSS6hy7LdQpDP/mgzx1bi0M4tp+aKrXQoeNbNCqXkt/1rEpAvDbP41Gru1ySm mUnpywZ4jDgfZJkjpauqMlPQuUNHQax10q+BxoG8H9c4bDZQ+ofMrLkfYUQ7+hzbZ7 SZOM/yOVab1wezSQPA8vs2ugJbOaShYRfhrKBMJQNPv48KkvR5auDBQj9zJI7dtLg8 nYRMNGnPNaIXeeCPEvqy0FWm+7tQ35pgqBanvhZVhAGTnEGgNtOCUnAXOSTss1ht3W 4YfbPr+PhnYdQ== Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AE417600F0 for ; Mon, 13 Jun 2022 08:04:01 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="e8F4caBM"; dkim-atps=neutral Received: by mail-pf1-x430.google.com with SMTP id w21so4921199pfc.0 for ; Sun, 12 Jun 2022 23:04:01 -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=NnK+9RyOaqMX10qXFF7tBZgLxoOzFpkS6kLy2BPVVO4=; b=e8F4caBMf5c1EGh7cnYUXt85h9SnpPH4e2bFT5ae0RdB79MVI54tsgZNARdIa5ZZFe Jk/9Qg3F5R26RylXHNreuUmA6CcNLEaZ4gqoVD6/dEgPzlw/jZNFy68L31STjpT8P6uY XzZsIb0abEHDeDDeRteD7BvGMN1XMvGbzM00rZmIMMuQOtYEj9b4U20iMWaWwo8UkQE/ aXeA6zuT99XBW6lU+V5k+pcfr/z0Ny8jMKMpa7tCsRZsy+JkrJyWuhyF4rSAQbGQrmsH BF8oAdVr7VAeR5HKcbs6X/v2K27e+LEfEAYmeCISQeY/hsWlmlG+9HxIasMJKZ+lR6EM qxFg== 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=NnK+9RyOaqMX10qXFF7tBZgLxoOzFpkS6kLy2BPVVO4=; b=hq+hMbFEfoQqyLy18SnPfKJHvOsfC9u1ZzLdrEUkSq3TODNX/+3083MEWtsZFlQG5Z PxgjBFzlV9XhkDWESxpmMxZIEsezE/ZDvikRMbhFXf0ICutFag3uTxQvSBUsFy2Ogqao NNK2vveT3Y4+Y9HYUdyEE26o5Wu4/tcYOhv4MCtTMkeg3bUDXZH4+zNhAQJCs8NOS4PU BOrZAqDN7nDUD4p4aHEUp21D6A9jOJVGIolu/iMTKuc3nWP5GI30nAeXDb8z+E7DPR2g ZRZqgD6EgmaC4JWY5l4M4z958lMAgopES4fkH8noLT9IDa7+YuIzqgs00Mn6bqYz5ozA Rb/Q== X-Gm-Message-State: AOAM532D/DXgMCJbr2yXzEwu994ciTXl2F9ypMnnkhndIr1ooiG2an6o 1vSs/OEOoUhjSbwUkn2mW++FU/FRPD8= X-Google-Smtp-Source: ABdhPJw+XasmsP2H6rmpjndndFPR9THK9bP/bBaGRqT0nICL8ltMr0/7mHA5sz64sDiUB08huh7oaw== X-Received: by 2002:a05:6a00:338e:b0:51b:c452:4210 with SMTP id cm14-20020a056a00338e00b0051bc4524210mr57607177pfb.69.1655100240146; Sun, 12 Jun 2022 23:04:00 -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.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jun 2022 23:03:59 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 13 Jun 2022 11:33:43 +0530 Message-Id: <20220613060345.229191-2-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 1/3] qcam: Queue requests only through MainWindow::queueRequest() 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" Currently whenever we want to queue a request we use the camera directly Centralize all the queuing to a single function Signed-off-by: Utkarsh Tiwari --- src/qcam/main_window.cpp | 14 +++++++++----- src/qcam/main_window.h | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index dd0e51f5..5ac31d9a 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -119,14 +119,14 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options) if (renderType == "qt") { ViewFinderQt *viewfinder = new ViewFinderQt(this); connect(viewfinder, &ViewFinderQt::renderComplete, - this, &MainWindow::queueRequest); + this, &MainWindow::refillRequest); viewfinder_ = viewfinder; setCentralWidget(viewfinder); #ifndef QT_NO_OPENGL } else if (renderType == "gles") { ViewFinderGL *viewfinder = new ViewFinderGL(this); connect(viewfinder, &ViewFinderGL::renderComplete, - this, &MainWindow::queueRequest); + this, &MainWindow::refillRequest); viewfinder_ = viewfinder; setCentralWidget(viewfinder); #endif @@ -521,7 +521,7 @@ int MainWindow::startCapture() /* Queue all requests. */ for (std::unique_ptr &request : requests_) { - ret = camera_->queueRequest(request.get()); + ret = queueRequest(request.get()); if (ret < 0) { qWarning() << "Can't queue request"; goto error_disconnect; @@ -755,7 +755,7 @@ void MainWindow::processViewfinder(FrameBuffer *buffer) viewfinder_->render(buffer, mappedBuffers_[buffer].get()); } -void MainWindow::queueRequest(FrameBuffer *buffer) +void MainWindow::refillRequest(FrameBuffer *buffer) { Request *request; { @@ -784,6 +784,10 @@ void MainWindow::queueRequest(FrameBuffer *buffer) qWarning() << "No free buffer available for RAW capture"; } } + queueRequest(request); +} - camera_->queueRequest(request); +int MainWindow::queueRequest(Request *request) +{ + return camera_->queueRequest(request); } diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 3fbe872c..251b8335 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -66,7 +66,7 @@ private Q_SLOTS: void processRaw(libcamera::FrameBuffer *buffer, const libcamera::ControlList &metadata); - void queueRequest(libcamera::FrameBuffer *buffer); + void refillRequest(libcamera::FrameBuffer *buffer); private: int createToolbars(); @@ -80,6 +80,7 @@ private: void addCamera(std::shared_ptr camera); void removeCamera(std::shared_ptr camera); + int queueRequest(libcamera::Request* request); void requestComplete(libcamera::Request *request); void processCapture(); void processHotplug(HotplugEvent *e); From patchwork Mon Jun 13 06:03:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16205 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 C6854C3273 for ; Mon, 13 Jun 2022 06:04:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1B91365638; Mon, 13 Jun 2022 08:04:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655100246; bh=S272PG9khK2UdLsS/+qtNUrA8EW2d0ahIV16iv7o/oA=; 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=Aasko7P4FavVZSkZb81+wLfuDCu9id6OVlegHIhugXk8W9AhM+wqaEb+32W7xJOGe q/F7MHxGAkFv5k8mXMpqQ2b2QHMG8id0DzwHH/2KHqmzH97H2yfoAo/UhkkJAHl1dh czlFHk44NvoZvgmfBEruza75XeuIte1WTYvyyaB2mVr3kg42BpHps9e2WfFpsC3QI1 +Z8qobVNXf5B732/kD6EAZgfHavmsSh6Z6bhE4n0KYgrjtTvSSPOTuhvMjCAFSgZtY ItN3DkW5SARvaF29dUYl+Jasc5EJJ5fNaUtC66zZpKOtPPpXu+fwdY4X/oEjnPKAAL RX4lI/aq1sOpg== Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0CAE865631 for ; Mon, 13 Jun 2022 08:04:03 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="gDVgpKVi"; dkim-atps=neutral Received: by mail-pf1-x42a.google.com with SMTP id e11so4871005pfj.5 for ; Sun, 12 Jun 2022 23:04:02 -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=wWnX22DgtmEKWHKuXNpIM1KRw7Bkk844LDOVXAf7urQ=; b=gDVgpKVi01ZOggbwltQ1JoJVNGKDqfz1r5moVG+wEq0rQ4jpbGvu8oPwIlMs9K9Wt/ iiQbdhHv4O6VXy4W1iz7OIRGn2DFlnsi2IEd+nmB2Lly0R8oIU7AjR24XgLJ4UJ5ZbRK 9bj42cEWZLnMFtOuFQ4Z9ZU0RPEr5IzKxt225yY/B3f+i+P6fvwLXpRJFUthhgG70iyW ubSt0TI1TnyXb3QYN4kyKoSd2MUryjgvxOPcnyj1w2Z7JJsUx3dSLyByFk00QkZbWqJo taHDZkRRwo4EqUZk0iXZaNtdD2VXCNrYK+zLIzEx6TjhJg2lOWgZmSG0e9yC81MNnB87 E4Zw== 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=wWnX22DgtmEKWHKuXNpIM1KRw7Bkk844LDOVXAf7urQ=; b=kTGqgGiEG9smhfOnkb/7xEpl9QAaF01xF5xLo09qZD0xTHm0qSGy6X6WOW7osHVOLP 9w06TfSpq5HYkxfibEAgHoIey7WSykh8cYDEzf5LNOylNNuukxBAURvhlMD0lxxKNSdN iCNuAAOZKfpfNrNbsAM8Dw6AFU27j1qRvEK+kDoyt0GWRXlHmU4giAjN6NxNuE7i7LB7 x/ElUMdyWIzmEK3b9vLaerSApD3yRCb4GfvvaMRXBd31j3EHNoP7mTP41ygJmqbKVgSb qU87sMRnIdCPAgEJUfPV5cRWzVyZeT4ShyfIqvrU6EeH+IBAYEGzR0G4dV46ngEmyoao 0O9w== X-Gm-Message-State: AOAM530Fo+an7l9KAWUVJve22AdIk3UMR/27l+FHhIrUrwHxq6fvYez6 mnndupOvoQQBjDCJZjFwYItCTYkxExM= X-Google-Smtp-Source: ABdhPJz2klRjpGNY6wNHUQIDZyAGjEtC02p4eZ9fQ4V6VK+Hk4e1JAie6FtQeSTRqrW1L5B+SqmVUg== X-Received: by 2002:a05:6a00:1307:b0:50d:b02e:11df with SMTP id j7-20020a056a00130700b0050db02e11dfmr59124477pfu.4.1655100242337; Sun, 12 Jun 2022 23:04:02 -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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jun 2022 23:04:02 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 13 Jun 2022 11:33:44 +0530 Message-Id: <20220613060345.229191-3-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 2/3] qcam: Add a GUI way to use 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" Implement an Open Capture Script button which would allow the user to open a Capture Script (*.yaml). When clicked present them with a QFileDialog to allow them to select a single file. Introduce a queueCount_ to keep track of the requests queued. Initialize a Script Parser instance when the user selects a valid capture script. At queueRequest() time if script parser has been initialized, then populate the Request::controls() with it at queueRequest time providing the queueCount_. The queueCount_ is incremented after the getting controls from the parser, so the first request is for frame 0. Signed-off-by: Utkarsh Tiwari --- src/qcam/assets/feathericons/feathericons.qrc | 1 + src/qcam/main_window.cpp | 38 +++++++++++++++++++ src/qcam/main_window.h | 5 +++ src/qcam/meson.build | 2 + 4 files changed, 46 insertions(+) diff --git a/src/qcam/assets/feathericons/feathericons.qrc b/src/qcam/assets/feathericons/feathericons.qrc index c5302040..f0d1e3d0 100644 --- a/src/qcam/assets/feathericons/feathericons.qrc +++ b/src/qcam/assets/feathericons/feathericons.qrc @@ -3,6 +3,7 @@ aperture.svg camera-off.svg + file.svg play-circle.svg save.svg stop-circle.svg diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 5ac31d9a..7cdb1238 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -232,6 +233,12 @@ int MainWindow::createToolbars() saveRaw_ = action; #endif + /* Open Script... action. */ + action = toolbar_->addAction(QIcon::fromTheme("document-open", + QIcon(":file.svg")), + "Open Capture Script"); + connect(action, &QAction::triggered, this, &MainWindow::chooseScript); + return 0; } @@ -255,6 +262,31 @@ void MainWindow::updateTitle() setWindowTitle(title_ + " : " + QString::number(fps, 'f', 2) + " fps"); } +/** + * \brief Load a capture script for handling the capture session. + * + * If already capturing, it would restart the capture. + */ +void MainWindow::chooseScript() +{ + QString scriptFile = QFileDialog::getOpenFileName(this, tr("Open Capture Script"), QDir::currentPath(), + tr("Capture Script (*.yaml)")); + if (scriptFile.isEmpty()) + return; + script_ = std::make_unique(camera_, scriptFile.toStdString()); + if (!script_->valid()) { + script_.reset(); + QMessageBox::critical(this, tr("Invalid Script"), tr("Couldn't execute the capture script")); + return; + } + + //Restart the capture so we can reset every counter + if (isCapturing_) { + toggleCapture(false); + toggleCapture(true); + } +} + /* ----------------------------------------------------------------------------- * Camera Selection */ @@ -510,6 +542,7 @@ int MainWindow::startCapture() previousFrames_ = 0; framesCaptured_ = 0; lastBufferTime_ = 0; + queueCount_ = 0; ret = camera_->start(); if (ret) { @@ -789,5 +822,10 @@ void MainWindow::refillRequest(FrameBuffer *buffer) int MainWindow::queueRequest(Request *request) { + if (script_) + request->controls() = script_->frameControls(queueCount_); + + queueCount_++; + return camera_->queueRequest(request); } diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 251b8335..cde5842f 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -26,6 +26,7 @@ #include #include +#include "../cam/capture_script.h" #include "../cam/stream_options.h" #include "viewfinder.h" @@ -86,6 +87,8 @@ private: void processHotplug(HotplugEvent *e); void processViewfinder(libcamera::FrameBuffer *buffer); + void chooseScript(); + /* UI elements */ QToolBar *toolbar_; QAction *startStopAction_; @@ -124,6 +127,8 @@ private: QElapsedTimer frameRateInterval_; uint32_t previousFrames_; uint32_t framesCaptured_; + uint32_t queueCount_; std::vector> requests_; + std::unique_ptr script_; }; diff --git a/src/qcam/meson.build b/src/qcam/meson.build index c46f4631..67074252 100644 --- a/src/qcam/meson.build +++ b/src/qcam/meson.build @@ -15,6 +15,7 @@ endif qcam_enabled = true qcam_sources = files([ + '../cam/capture_script.cpp', '../cam/image.cpp', '../cam/options.cpp', '../cam/stream_options.cpp', @@ -37,6 +38,7 @@ qcam_resources = files([ qcam_deps = [ libatomic, libcamera_public, + libyaml, qt5_dep, ] 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