summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/v4l2_subdevice.cpp34
-rw-r--r--src/libcamera/v4l2_videodevice.cpp16
2 files changed, 39 insertions, 11 deletions
diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
index d5ae4605..b3d0ddad 100644
--- a/src/libcamera/v4l2_subdevice.cpp
+++ b/src/libcamera/v4l2_subdevice.cpp
@@ -190,17 +190,10 @@ const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {
*/
const std::string V4L2SubdeviceFormat::toString() const
{
- std::stringstream mbus;
- mbus << size << "-";
+ std::stringstream ss;
+ ss << *this;
- const auto it = formatInfoMap.find(mbus_code);
-
- if (it == formatInfoMap.end())
- mbus << utils::hex(mbus_code, 4);
- else
- mbus << it->second.name;
-
- return mbus.str();
+ return ss.str();
}
/**
@@ -221,6 +214,27 @@ uint8_t V4L2SubdeviceFormat::bitsPerPixel() const
}
/**
+ * \brief Insert a text representation of a V4L2SubdeviceFormat into an output
+ * stream
+ * \param[in] out The output stream
+ * \param[in] f The V4L2SubdeviceFormat
+ * \return The output stream \a out
+ */
+std::ostream &operator<<(std::ostream &out, const V4L2SubdeviceFormat &f)
+{
+ out << f.size << "-";
+
+ const auto it = formatInfoMap.find(f.mbus_code);
+
+ if (it == formatInfoMap.end())
+ out << utils::hex(f.mbus_code, 4);
+ else
+ out << it->second.name;
+
+ return out;
+}
+
+/**
* \class V4L2Subdevice
* \brief A V4L2 subdevice as exposed by the Linux kernel
*
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
*