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 <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Laurent Pinchart
2022-04-29 04:31:48 +03:00
parent e8f35e5f33
commit 2efd8ab36a
4 changed files with 31 additions and 0 deletions

View File

@@ -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 */