diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-04-29 04:31:48 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-05-04 14:11:31 +0300 |
commit | d5d6dbe85cf270aee7c956429a5a692feca3900f (patch) | |
tree | 05a91c081e0c5685f76984ca45f3ff833e64eff9 /src/libcamera/v4l2_videodevice.cpp | |
parent | 08d613311371ef26da7b6c226d1e35d12be0ca32 (diff) |
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>
Diffstat (limited to 'src/libcamera/v4l2_videodevice.cpp')
-rw-r--r-- | src/libcamera/v4l2_videodevice.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 5ba866ad..5b4637b1 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -433,11 +433,25 @@ 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 * |