From patchwork Fri Jun 27 07:42:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 23667 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 9309BC3237 for ; Fri, 27 Jun 2025 07:42:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 59A6962C43; Fri, 27 Jun 2025 09:42:12 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="liNtOi6A"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 69FCC62C43 for ; Fri, 27 Jun 2025 09:42:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=mvvFNaw2jdZFCCB1PiMsn7ihVU387wE6bEAWhFktXJ8=; b=liNtOi6AYwVlDmyaRvyiODLFls i8NqrfwP+kK4/Qzxg9hVzlAJlCQXbI1NtVmsM6lLvhu51C7HiU61AvI2f84l59d7v/8JV50tQaKEB QIG+v5gbWqqtg0P46JcFtuDX8M2jSLcU3koyr7+gcXRmG59qdKaWJiCcq2wf4/C6NoIdeFdoezmIP Ho+ibFhFMahsG+MJS5IxFIT8nElbpKuubeWb5C8DJzuX7TDX0PpipbAJHUfFjZRS+VspryDK7xNZy u78wY5UKlAWJDsaAdSAqCEYIuFJh48lKsXAg8ToSRseEgECQnettYfmguuqx87CBRZQNb567TZePi uOo93SaA==; Received: from [49.36.69.141] (helo=uajain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1uV3ip-009IWh-1Q; Fri, 27 Jun 2025 09:42:07 +0200 From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Giacomo Cappellini , Nicolas Dufresne , Umang Jain Subject: [PATCH 1/2] libcamera: orientation: Provide a orientationToString() helper Date: Fri, 27 Jun 2025 13:12:07 +0530 Message-ID: <20250627074208.49872-2-uajain@igalia.com> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250627074208.49872-1-uajain@igalia.com> References: <20250627074208.49872-1-uajain@igalia.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" Provide a orientationToString() helper to convert Orientation enum to a std::string. Signed-off-by: Umang Jain --- include/libcamera/orientation.h | 1 + src/libcamera/orientation.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/libcamera/orientation.h b/include/libcamera/orientation.h index a3b40e63..f0ef8f1c 100644 --- a/include/libcamera/orientation.h +++ b/include/libcamera/orientation.h @@ -24,6 +24,7 @@ enum class Orientation { }; Orientation orientationFromRotation(int angle, bool *success = nullptr); +std::string orientationToString(const Orientation &orientation); std::ostream &operator<<(std::ostream &out, const Orientation &orientation); diff --git a/src/libcamera/orientation.cpp b/src/libcamera/orientation.cpp index 7d7d21ae..f5493673 100644 --- a/src/libcamera/orientation.cpp +++ b/src/libcamera/orientation.cpp @@ -8,6 +8,7 @@ #include #include +#include /** * \file orientation.h @@ -91,6 +92,19 @@ Orientation orientationFromRotation(int angle, bool *success) return Orientation::Rotate0; } +/** + * \brief Generate a string representation of \a orientation item + * \param[in] orientation The Orientation item + * \return A std::string representation for \a orientation + */ +std::string orientationToString(const Orientation &orientation) +{ + std::stringstream ss; + ss << orientation; + + return ss.str(); +} + /** * \brief Prints human-friendly names for Orientation items * \param[in] out The output stream