{"id":796,"url":"https://patchwork.libcamera.org/api/patches/796/?format=json","web_url":"https://patchwork.libcamera.org/patch/796/","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":"<20190326083902.26121-2-jacopo@jmondi.org>","date":"2019-03-26T08:38:44","name":"[libcamera-devel,v5,01/19] libcamera: formats: Add toString() methods","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"b91f2fd15705ab6adc0459151920fbf3110ab4c1","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/796/mbox/","series":[{"id":219,"url":"https://patchwork.libcamera.org/api/series/219/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=219","date":"2019-03-26T08:38:43","name":"libcamera: ipu3: Add ImgU support","version":5,"mbox":"https://patchwork.libcamera.org/series/219/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/796/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/796/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 25E91610D5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Mar 2019 09:38:30 +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 relay10.mail.gandi.net (Postfix) with ESMTPSA id 452C724000D;\n\tTue, 26 Mar 2019 08:38:29 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 26 Mar 2019 09:38:44 +0100","Message-Id":"<20190326083902.26121-2-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190326083902.26121-1-jacopo@jmondi.org>","References":"<20190326083902.26121-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 01/19] 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":"Tue, 26 Mar 2019 08:38:30 -0000"},"content":"Add toString() helpers to pretty print out a V4L2Device or V4L2Subdevice\nformat.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\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..93d81517fedb 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..cf873487b22c 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","v5","01/19"]}