[PATCH v3 10/17] libcamera: stream: Add operator<<(StreamConfiguration)
Stefan Klug
stefan.klug at ideasonboard.com
Wed Dec 11 17:59:05 CET 2024
Hi Jacopo,
Thank you for the patch.
As it is already on mainline, no need to review it again...
Best regards,
Stefan
On Fri, Dec 06, 2024 at 11:13:32AM +0100, Stefan Klug wrote:
> From: Jacopo Mondi <jacopo.mondi at ideasonboard.com>
>
> 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 <jacopo.mondi at ideasonboard.com>
> ---
> 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
> --
> 2.43.0
>
More information about the libcamera-devel
mailing list