summaryrefslogtreecommitdiff
path: root/src/libcamera/stream.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-04-18 18:32:32 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-04-19 13:38:14 +0300
commit0af0fb9ca9eae903cc533a05e2282ec36cc3ce55 (patch)
tree77b34c0012dbb70722a2e6217787317234e5593d /src/libcamera/stream.cpp
parent8cf52e378d60cbd255a20eb51827e17814264073 (diff)
libcamera: stream: Add and use toString() method to StreamConfiguration
Add a toString() method to the StreamConfiguration class, and replace all manually coded implementations through the source code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/stream.cpp')
-rw-r--r--src/libcamera/stream.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
index d4ef506c..1668b67d 100644
--- a/src/libcamera/stream.cpp
+++ b/src/libcamera/stream.cpp
@@ -5,6 +5,9 @@
* stream.cpp - Video stream for a Camera
*/
+#include <iomanip>
+#include <sstream>
+
#include <libcamera/stream.h>
/**
@@ -61,6 +64,22 @@ namespace libcamera {
*/
/**
+ * \brief Assemble and return a string describing the configuration
+ *
+ * \return A string describing the StreamConfiguration
+ */
+std::string StreamConfiguration::toString() const
+{
+ std::stringstream ss;
+
+ ss.fill(0);
+ ss << width << "x" << height << "-0x" << std::hex
+ << std::setw(8) << pixelFormat;
+
+ return ss.str();
+}
+
+/**
* \class StreamUsage
* \brief Stream usage information
*