From patchwork Fri Dec 6 10:13:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22202 X-Patchwork-Delegate: paul.elder@ideasonboard.com 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 6A3F7BF415 for ; Fri, 6 Dec 2024 10:14:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9AE6366152; Fri, 6 Dec 2024 11:14:21 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="lIuSWZqN"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4512266150 for ; Fri, 6 Dec 2024 11:14:17 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:3543:aebe:e043:ef86]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E37BF74C; Fri, 6 Dec 2024 11:13:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733480028; bh=beaQDYwQKgfEBs+qNtBHHojP0XeZnjdVWoLcfmAqrfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lIuSWZqNLUgTl0vRdfy+yEtW+y9IcLn0f7D4SjQpwoPxuOA0nqoLV/0qfW4yoshW7 Zk2S4VEMKAOb8oMXZPubAdbszgjcCKp3Y7syGZHCDKNHyjzje0VeYtHlO78QckEAWp MzBt54kcX9/lTlrFwd0LiJsPF5PoU/LT7gQCjnQo= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Jacopo Mondi Subject: [PATCH v3 10/17] libcamera: stream: Add operator<<(StreamConfiguration) Date: Fri, 6 Dec 2024 11:13:32 +0100 Message-ID: <20241206101344.767170-11-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241206101344.767170-1-stefan.klug@ideasonboard.com> References: <20241206101344.767170-1-stefan.klug@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" From: Jacopo Mondi The StreamConfiguration class only implmenets toString() but doesn't offer an overload of operator<<() which is 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(+) 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