From patchwork Thu Dec 5 11:23:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 22181 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 544F6C323E for ; Thu, 5 Dec 2024 11:23:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 07B4C6610A; Thu, 5 Dec 2024 12:23:27 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="jiwQYx58"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AA49F660F0 for ; Thu, 5 Dec 2024 12:23:24 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2001:b07:6462:5de2:459e:1ee6:26ea:2d31]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EDCE22B3; Thu, 5 Dec 2024 12:22:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733397776; bh=hsn/3EkjUdCZ8EJo55JOiuMdpNRGXdtmWIBZohu8q6Y=; h=From:To:Cc:Subject:Date:From; b=jiwQYx58NAb7NGMKbAmAu1RamPqmDAkvUWXvqUYwV7/ihDE8PziwiBpNoTNWlOvhB X57KmIu0XupA/mu+Z2BSaLo5jhihR90LN5/F+zx1YgXXYWUZGWr1tQe0xaaFnkk1ZC YvlGIHQbLVhUDgcRwjIdi0jH+izoFGZBuOgBVUXA= From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Cc: Jacopo Mondi Subject: [PATCH] libcamera: stream: Add operator<<(StreamConfiguration) Date: Thu, 5 Dec 2024 12:23:13 +0100 Message-ID: <20241205112314.26296-1-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.47.0 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 StreamConfiguration class only implements toString() but doesn't offer an overload of operator<<() which is more convenient to use. Add an overload for operator<<(StreamConfiguration) which is based on the usage of StreamConfiguration::toString(). Signed-off-by: Jacopo Mondi --- include/libcamera/stream.h | 2 ++ src/libcamera/stream.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+) -- 2.47.0 diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index 071b71698acb..ea228aea7d56 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -61,6 +61,8 @@ private: StreamFormats formats_; }; +std::ostream &operator<<(std::ostream &out, StreamConfiguration cfg); + enum class StreamRole { Raw, StillCapture, diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index 1f75dbbc5b64..a093abf48c7c 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -395,6 +395,19 @@ std::string StreamConfiguration::toString() const return size.toString() + "-" + pixelFormat.toString(); } +/** + * \brief Insert a text representation of a StreamConfiguration into an output + * stream + * \param[in] out The output stream + * \param[in] cfg The StreamConfiguration + * \return The output stream \a out + */ +std::ostream &operator<<(std::ostream &out, StreamConfiguration cfg) +{ + out << cfg.toString(); + return out; +} + /** * \enum StreamRole * \brief Identify the role a stream is intended to play