From patchwork Mon Sep 25 17:09:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 19088 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 38CA6BD808 for ; Mon, 25 Sep 2023 17:09:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8F0EC62944; Mon, 25 Sep 2023 19:09:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1695661773; bh=mOAhWaYS94aJWI+MYiMnRTt8MBKEteFTUQSCqRi7Qx8=; 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=vqbEZOI20jlWPtwZJSGkAeOcwd3kfp6uaJb0FqiOsLNaP1xNO+XxRNrS9Vk50HTRI Pjda2fY7yc9JlcJikkfuNBSGOgaHL9MUavRX+BURL47NYuORTMcNT/QnCWXpTi3i0Z a2JhWFtXRdzz4Un18vNgk+/RkoDm+irQXfAxjTntWXVni6kUtRfdpEbl9VVi8/C65M t59lVI1fbYDmuuY3Ao9go0Q9kPv89F+KMSMY1Pg/+GtPhsdq10VUdE2EUyce8bIQau eUsPPSPfAPHoG4Q/tecdyWtx59hKo1uXWOALiwLmk1JuQnXNOIITWd/G6qYbSRjR+Y 0vbb3WDP6/KgA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 255EA628FA for ; Mon, 25 Sep 2023 19:09:32 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="WOZyQP6U"; dkim-atps=neutral Received: from Monstersaurus.local (aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net [82.37.23.78]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id ADF9A13C5; Mon, 25 Sep 2023 19:07:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1695661671; bh=mOAhWaYS94aJWI+MYiMnRTt8MBKEteFTUQSCqRi7Qx8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WOZyQP6U5xGMibNAi9df1CmKLrdGwBdf4aMC9+6o+RUjdcO9g27HpyO06gAoOdYr1 JnmBQ/AOnbM4zZIKl6jl203/HWevQR45WSXa+z5j6SgT2AA979/WaJhLiHKhXDNE5q Mg10LXBt0o6zb7yWRXR7/S/czJ6aKT8CaCm+1Xwk= To: libcamera devel Date: Mon, 25 Sep 2023 18:09:19 +0100 Message-Id: <20230925170919.301540-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230921165550.50956-1-jacopo.mondi@ideasonboard.com> References: <20230921165550.50956-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 14/13] apps: qcam: Add option to configure sensor 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: Kieran Bingham via libcamera-devel From: Kieran Bingham Reply-To: Kieran Bingham Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a '-f|--sensor_format' option to qcam to allow forcing a sensor configuration from the command line. As an example: qcam -f width=3840,height=2160,bitDepth=10 Signed-off-by: Kieran Bingham --- Extending Jacopo's implementation for cam to qcam Helpful for testing with visual display of the selected modes. src/apps/qcam/main.cpp | 3 +++ src/apps/qcam/main_window.cpp | 7 +++++++ src/apps/qcam/main_window.h | 1 + 3 files changed, 11 insertions(+) diff --git a/src/apps/qcam/main.cpp b/src/apps/qcam/main.cpp index 36cb93a53701..7e3f252e9f09 100644 --- a/src/apps/qcam/main.cpp +++ b/src/apps/qcam/main.cpp @@ -30,6 +30,7 @@ void signalHandler([[maybe_unused]] int signal) OptionsParser::Options parseOptions(int argc, char *argv[]) { StreamKeyValueParser streamKeyValue; + SensorKeyValueParser sensorKeyValue; OptionsParser parser; parser.addOption(OptCamera, OptionString, @@ -42,6 +43,8 @@ OptionsParser::Options parseOptions(int argc, char *argv[]) "renderer", ArgumentRequired, "renderer"); parser.addOption(OptStream, &streamKeyValue, "Set configuration of a camera stream", "stream", true); + parser.addOption(OptSensorFmt, &sensorKeyValue, + "Apply a format to the sensor", "sensor_format", true); parser.addOption(OptVerbose, OptionNone, "Print verbose log messages", "verbose"); diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp index 0f16c038d516..e7511b4c7aa4 100644 --- a/src/apps/qcam/main_window.cpp +++ b/src/apps/qcam/main_window.cpp @@ -414,6 +414,13 @@ int MainWindow::startCapture() return -EINVAL; } + /* Apply a sensor configuration if requested. */ + if (SensorKeyValueParser::updateConfiguration(config_.get(), + options_[OptSensorFmt])) { + qWarning() << "Failed to apply sensor configuration"; + return -EINVAL; + } + CameraConfiguration::Status validation = config_->validate(); if (validation == CameraConfiguration::Invalid) { qWarning() << "Failed to create valid camera configuration"; diff --git a/src/apps/qcam/main_window.h b/src/apps/qcam/main_window.h index 2e3e1b5c83c2..44646a87cfbf 100644 --- a/src/apps/qcam/main_window.h +++ b/src/apps/qcam/main_window.h @@ -42,6 +42,7 @@ enum { OptHelp = 'h', OptRenderer = 'r', OptStream = 's', + OptSensorFmt = 'f', OptVerbose = 'v', };