From patchwork Thu May 1 14:16:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 23332 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 864E3C327D for ; Thu, 1 May 2025 14:16:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CCA5A68B29; Thu, 1 May 2025 16:16:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="IDkZkDoH"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 064C2617D7 for ; Thu, 1 May 2025 16:16:14 +0200 (CEST) Received: from Monstersaurus.lgs-net.com (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E757D886; Thu, 1 May 2025 16:16:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1746108967; bh=claqm905y/FT/D6Lf9qaKl2LB1Wjqb7c6PX2UpdCMC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IDkZkDoHryVIaybtqAFnOkbZBpPFXgq7rGdFIafiVw2/6+mhMISIdXIOemeU0Lno/ AtowqTWRhtmUEmOgBjmcavtxfGHvuHHXRACTacdVz3MnxFPLrPsKhbWmLCi9AIK6dh 1oK1ZkswsOfAVbD84lZPQsMKU9/GhQcRfRws8gAc= From: Kieran Bingham To: libcamera devel Cc: Kieran Bingham Subject: [PATCH 3/3] apps: cam: Support full orientation options Date: Thu, 1 May 2025 15:16:09 +0100 Message-ID: <20250501141609.717148-4-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250501141609.717148-1-kieran.bingham@ideasonboard.com> References: <20250501141609.717148-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The Orientation control was implemented in commit 7e5f1e1cedf5 "apps: cam: Add option to set stream orientation" but did not fully add all of the supported Orientation types. The upcoming dewarp support on RkISP1 will provide full rotation implementation options, including previously difficult '90' degree rotations. Extend the cam application to support setting any of the valid options. The existing 'mirror' and 'flip' options are not consistent with the rest of the option definitions, but maintain them as useful aliases to their corresponding type. Fixes: 7e5f1e1cedf5 ("apps: cam: Add option to set stream orientation") Signed-off-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- It might be debatable if this really is a 'Fixes' as the existing commit wasn't broken - just not fully implemented - however the full set of Orientation types were there at the time the patch was merged. src/apps/cam/camera_session.cpp | 9 +++++++++ src/apps/cam/main.cpp | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp index f63fcb228519..43188133d9cb 100644 --- a/src/apps/cam/camera_session.cpp +++ b/src/apps/cam/camera_session.cpp @@ -97,7 +97,16 @@ CameraSession::CameraSession(CameraManager *cm, std::string orientOpt = options_[OptOrientation].toString(); static const std::map orientations{ { "rot0", libcamera::Orientation::Rotate0 }, + { "rot90", libcamera::Orientation::Rotate90 }, { "rot180", libcamera::Orientation::Rotate180 }, + { "rot270", libcamera::Orientation::Rotate270 }, + + { "rot0mirror", libcamera::Orientation::Rotate0Mirror }, + { "rot90mirror", libcamera::Orientation::Rotate90Mirror }, + { "rot180mirror", libcamera::Orientation::Rotate180Mirror }, + { "rot270mirror", libcamera::Orientation::Rotate270Mirror }, + + /* Helpful aliases */ { "mirror", libcamera::Orientation::Rotate0Mirror }, { "flip", libcamera::Orientation::Rotate180Mirror }, }; diff --git a/src/apps/cam/main.cpp b/src/apps/cam/main.cpp index fa266eca6d30..f1495a2db465 100644 --- a/src/apps/cam/main.cpp +++ b/src/apps/cam/main.cpp @@ -136,7 +136,10 @@ int CamApp::parseOptions(int argc, char *argv[]) OptCamera); parser.addOption(OptOrientation, OptionString, - "Desired image orientation (rot0, rot180, mirror, flip)", + "Desired image orientation. Supported values:\n" + "- rot0, rot90, rot180, rot270,\n" + "- rot0mirror, rot90mirror, rot180mirror, rot270mirror,\n" + "- mirror (alias for rot0mirror), flip (alias for rot180mirror)", "orientation", ArgumentRequired, "orientation", false, OptCamera); #ifdef HAVE_KMS