libcamera: Add operator<<() for V4L2 format classes

Implement the stream output operator<<() for the V4L2DeviceFormat and
V4L2SubdeviceFormat 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-05-04 14:11:31 +03:00
parent 08d6133113
commit d5d6dbe85c
4 changed files with 45 additions and 11 deletions
+15 -1
View File
@@ -433,10 +433,24 @@ bool V4L2BufferCache::Entry::operator==(const FrameBuffer &buffer) const
const std::string V4L2DeviceFormat::toString() const
{
std::stringstream ss;
ss << size << "-" << fourcc.toString();
ss << *this;
return ss.str();
}
/**
* \brief Insert a text representation of a V4L2DeviceFormat into an output
* stream
* \param[in] out The output stream
* \param[in] f The V4L2DeviceFormat
* \return The output stream \a out
*/
std::ostream &operator<<(std::ostream &out, const V4L2DeviceFormat &f)
{
out << f.size << "-" << f.fourcc;
return out;
}
/**
* \class V4L2VideoDevice
* \brief V4L2VideoDevice object and API