From 2efd8ab36ae3cde16d772a7f6285b592662e8630 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 29 Apr 2022 04:31:48 +0300 Subject: libcamera: Add operator<<() for pixel format classes Implement the stream output operator<<() for the PixelFormat and V4L2PixelFormat classes to simplify printing them. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/libcamera/pixel_format.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/libcamera/pixel_format.cpp') diff --git a/src/libcamera/pixel_format.cpp b/src/libcamera/pixel_format.cpp index 997aeb8a..80c22072 100644 --- a/src/libcamera/pixel_format.cpp +++ b/src/libcamera/pixel_format.cpp @@ -140,4 +140,16 @@ PixelFormat PixelFormat::fromString(const std::string &name) return PixelFormatInfo::info(name).format; } +/** + * \brief Insert a text representation of a PixelFormat into an output stream + * \param[in] out The output stream + * \param[in] f The PixelFormat + * \return The output stream \a out + */ +std::ostream &operator<<(std::ostream &out, const PixelFormat &f) +{ + out << f.toString(); + return out; +} + } /* namespace libcamera */ -- cgit v1.2.1