summaryrefslogtreecommitdiff
path: root/src/libcamera/v4l2_device.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-03-11 16:32:06 +0100
committerJacopo Mondi <jacopo@jmondi.org>2019-04-02 11:02:38 +0200
commitee8127523879b2573893545f35c0f94b7d9f5deb (patch)
tree49dd69f85b446d0350e4519f51257f08a4df29d3 /src/libcamera/v4l2_device.cpp
parent97e8b3a2eb321884fe1e15fb584f41a38cc33d51 (diff)
libcamera: formats: Add toString() methods
Add toString() helpers to pretty print out a V4L2Device or V4L2Subdevice format. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/v4l2_device.cpp')
-rw-r--r--src/libcamera/v4l2_device.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index 889c63b3..93d81517 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -6,6 +6,8 @@
*/
#include <fcntl.h>
+#include <iomanip>
+#include <sstream>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
@@ -224,6 +226,22 @@ LOG_DEFINE_CATEGORY(V4L2)
*/
/**
+ * \brief Assemble and return a string describing the format
+ *
+ * \return A string describing the V4L2DeviceFormat
+ */
+const std::string V4L2DeviceFormat::toString() const
+{
+ std::stringstream ss;
+
+ ss.fill(0);
+ ss << width << "x" << height << "-0x" << std::hex
+ << std::setw(8) << fourcc;
+
+ return ss.str();
+}
+
+/**
* \class V4L2Device
* \brief V4L2Device object and API
*