diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-10-13 22:22:04 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-10-15 16:49:55 +0300 |
commit | f391048a7b987a149d0ba5421846b9b5ab916338 (patch) | |
tree | de82297ab5c83cc530d51bd9e76040f6d0b909f3 /src/libcamera/stream.cpp | |
parent | ce739e616c42105e5c6f22bf4df5dc19b5e8c8f9 (diff) |
libcamera: utils: Add hex stream output helper
Add a utils::hex() function that simplifies writing hexadecimal values
to an ostream. The function handles the '0x' prefix, the field width and
the fill character automatically. Use it through the libcamera code
base, and add a test.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/stream.cpp')
-rw-r--r-- | src/libcamera/stream.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index c28b4cd6..610920d1 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -16,6 +16,7 @@ #include <libcamera/request.h> #include "log.h" +#include "utils.h" /** * \file stream.h @@ -367,11 +368,7 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats) std::string StreamConfiguration::toString() const { std::stringstream ss; - - ss.fill(0); - ss << size.toString() << "-0x" << std::hex << std::setw(8) - << pixelFormat; - + ss << size.toString() << "-" << utils::hex(pixelFormat); return ss.str(); } |