From 0af0fb9ca9eae903cc533a05e2282ec36cc3ce55 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 18 Apr 2019 18:32:32 +0300 Subject: 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 Reviewed-by: Jacopo Mondi --- src/libcamera/stream.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/libcamera/stream.cpp') 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 +#include + #include /** @@ -60,6 +63,22 @@ namespace libcamera { * \brief Requested number of buffers to allocate for the stream */ +/** + * \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 -- cgit v1.2.1