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/v4l2_pixelformat.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/libcamera/v4l2_pixelformat.cpp') diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index 0e0da3f0..1dd93baa 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -316,4 +316,17 @@ V4L2PixelFormat V4L2PixelFormat::fromPixelFormat(const PixelFormat &pixelFormat, return multiplanar ? info.v4l2Formats.multi : info.v4l2Formats.single; } +/** + * \brief Insert a text representation of a V4L2PixelFormat into an output + * stream + * \param[in] out The output stream + * \param[in] f The V4L2PixelFormat + * \return The output stream \a out + */ +std::ostream &operator<<(std::ostream &out, const V4L2PixelFormat &f) +{ + out << f.toString(); + return out; +} + } /* namespace libcamera */ -- cgit v1.2.1