{"id":747,"url":"https://patchwork.libcamera.org/api/patches/747/?format=json","web_url":"https://patchwork.libcamera.org/patch/747/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190320163055.22056-2-jacopo@jmondi.org>","date":"2019-03-20T16:30:25","name":"[libcamera-devel,v4,01/31] libcamera: formats: Add toString() methods","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"a452473cd92f589b2e58841fa4fe8358bc37b595","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/747/mbox/","series":[{"id":214,"url":"https://patchwork.libcamera.org/api/series/214/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=214","date":"2019-03-20T16:30:24","name":"libcamera: ipu3: Add ImgU support + multiple streams","version":4,"mbox":"https://patchwork.libcamera.org/series/214/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/747/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/747/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 98D6461111\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Mar 2019 17:30:28 +0100 (CET)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id E907C20001C;\n\tWed, 20 Mar 2019 16:30:27 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 20 Mar 2019 17:30:25 +0100","Message-Id":"<20190320163055.22056-2-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190320163055.22056-1-jacopo@jmondi.org>","References":"<20190320163055.22056-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 01/31] libcamera: formats: Add\n\ttoString() methods","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 20 Mar 2019 16:30:29 -0000"},"content":"Add toString() helpers to pretty print out a V4L2Device or V4L2Subdevice\nformat.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/include/v4l2_device.h    |  2 ++\n src/libcamera/include/v4l2_subdevice.h |  2 ++\n src/libcamera/v4l2_device.cpp          | 18 ++++++++++++++++++\n src/libcamera/v4l2_subdevice.cpp       | 18 ++++++++++++++++++\n 4 files changed, 40 insertions(+)","diff":"diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\nindex 5c379fac66dc..258deee8d461 100644\n--- a/src/libcamera/include/v4l2_device.h\n+++ b/src/libcamera/include/v4l2_device.h\n@@ -100,6 +100,8 @@ public:\n \t\tuint32_t bpl;\n \t} planes[3];\n \tunsigned int planesCount;\n+\n+\tconst std::string toString() const;\n };\n \n class V4L2Device : protected Loggable\ndiff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\nindex 1cc0fab73103..700e66bcddac 100644\n--- a/src/libcamera/include/v4l2_subdevice.h\n+++ b/src/libcamera/include/v4l2_subdevice.h\n@@ -21,6 +21,8 @@ struct V4L2SubdeviceFormat {\n \tuint32_t mbus_code;\n \tuint32_t width;\n \tuint32_t height;\n+\n+\tconst std::string toString() const;\n };\n \n class V4L2Subdevice : protected Loggable\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 889c63b3fb63..97dc05288806 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -6,6 +6,8 @@\n  */\n \n #include <fcntl.h>\n+#include <iomanip>\n+#include <sstream>\n #include <string.h>\n #include <sys/ioctl.h>\n #include <sys/mman.h>\n@@ -223,6 +225,22 @@ LOG_DEFINE_CATEGORY(V4L2)\n  * \\brief The number of valid data planes\n  */\n \n+/**\n+ * \\brief Assemble and return a string describing the format\n+ *\n+ * \\return A string describing the V4L2DeviceFormat\n+ */\n+const std::string V4L2DeviceFormat::toString() const\n+{\n+\tstd::stringstream ss;\n+\n+\tss.fill(0);\n+\tss << width << \"x\" << height << \"- 0x\" << std::hex\n+\t   << std::setw(8) << fourcc;\n+\n+\treturn ss.str();\n+}\n+\n /**\n  * \\class V4L2Device\n  * \\brief V4L2Device object and API\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 5f58904bf9e6..11d22da25728 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -6,6 +6,8 @@\n  */\n \n #include <fcntl.h>\n+#include <iomanip>\n+#include <sstream>\n #include <string.h>\n #include <sys/ioctl.h>\n #include <unistd.h>\n@@ -69,6 +71,22 @@ LOG_DEFINE_CATEGORY(V4L2Subdev)\n  * \\brief The image height in pixels\n  */\n \n+/**\n+ * \\brief Assemble and return a string describing the format\n+ *\n+ * \\return A string describing the V4L2SubdeviceFormat\n+ */\n+const std::string V4L2SubdeviceFormat::toString() const\n+{\n+\tstd::stringstream ss;\n+\n+\tss.fill(0);\n+\tss << width << \"x\" << height << \"- 0x\" << std::hex\n+\t   << std::setw(4) << mbus_code;\n+\n+\treturn ss.str();\n+}\n+\n /**\n  * \\class V4L2Subdevice\n  * \\brief A V4L2 subdevice as exposed by the Linux kernel\n","prefixes":["libcamera-devel","v4","01/31"]}