{"id":8496,"url":"https://patchwork.libcamera.org/api/1.1/patches/8496/?format=json","web_url":"https://patchwork.libcamera.org/patch/8496/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20200629115328.16273-2-jacopo@jmondi.org>","date":"2020-06-29T11:53:26","name":"[libcamera-devel,v3,2/4] libcamera: v4l2_subdevice: Provide Formats type alias","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"a7259f821ab9c697f9ab44a40104067897f447b4","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":{"id":15,"url":"https://patchwork.libcamera.org/api/1.1/users/15/?format=json","username":"jmondi","first_name":"Jacopo","last_name":"Mondi","email":"jacopo@jmondi.org"},"mbox":"https://patchwork.libcamera.org/patch/8496/mbox/","series":[{"id":1055,"url":"https://patchwork.libcamera.org/api/1.1/series/1055/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1055","date":"2020-06-29T10:50:33","name":"ImageFormat rework","version":3,"mbox":"https://patchwork.libcamera.org/series/1055/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8496/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8496/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 3D1EEBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Jun 2020 11:50:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F171960AF1;\n\tMon, 29 Jun 2020 13:50:13 +0200 (CEST)","from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4D723609D6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2020 13:50:12 +0200 (CEST)","from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 8877310000E;\n\tMon, 29 Jun 2020 11:50:11 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 29 Jun 2020 13:53:26 +0200","Message-Id":"<20200629115328.16273-2-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200629115328.16273-1-jacopo@jmondi.org>","References":"<20200629105037.14706-1-jacopo@jmondi.org>\n\t<20200629115328.16273-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 2/4] libcamera: v4l2_subdevice: Provide\n\tFormats type alias","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Provide a type definition for ImageFormats<uint32_t> to allow\nusers of V4L2Subdevice to refer to it as V4L2Subdevice::Formats.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/internal/camera_sensor.h  |  6 ++----\n include/libcamera/internal/v4l2_subdevice.h |  4 +++-\n src/libcamera/v4l2_subdevice.cpp            | 10 ++++++++--\n test/v4l2_subdevice/list_formats.cpp        |  2 +-\n 4 files changed, 14 insertions(+), 8 deletions(-)\n\n--\n2.27.0","diff":"diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex d5814a26a121..06c8292ca301 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -16,13 +16,11 @@\n\n #include \"libcamera/internal/formats.h\"\n #include \"libcamera/internal/log.h\"\n+#include \"libcamera/internal/v4l2_subdevice.h\"\n\n namespace libcamera {\n\n class MediaEntity;\n-class V4L2Subdevice;\n-\n-struct V4L2SubdeviceFormat;\n\n struct CameraSensorInfo {\n \tstd::string model;\n@@ -75,7 +73,7 @@ private:\n\n \tstd::string model_;\n\n-\tImageFormats<uint32_t> formats_;\n+\tV4L2Subdevice::Formats formats_;\n \tSize resolution_;\n \tstd::vector<unsigned int> mbusCodes_;\n \tstd::vector<Size> sizes_;\ndiff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\nindex f811d316dada..c678fc87e80f 100644\n--- a/include/libcamera/internal/v4l2_subdevice.h\n+++ b/include/libcamera/internal/v4l2_subdevice.h\n@@ -32,6 +32,8 @@ struct V4L2SubdeviceFormat {\n class V4L2Subdevice : public V4L2Device\n {\n public:\n+\tusing Formats = ImageFormats<uint32_t>;\n+\n \tenum Whence {\n \t\tActiveFormat,\n \t\tTryFormat,\n@@ -51,7 +53,7 @@ public:\n \tint setSelection(unsigned int pad, unsigned int target,\n \t\t\t Rectangle *rect);\n\n-\tImageFormats<uint32_t> formats(unsigned int pad);\n+\tFormats formats(unsigned int pad);\n\n \tint getFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n \t\t      Whence whence = ActiveFormat);\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 231473ba3d06..372283cbdeb6 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -217,6 +217,12 @@ uint8_t V4L2SubdeviceFormat::bitsPerPixel() const\n  * any device left open will be closed, and any resources released.\n  */\n\n+/**\n+ * \\typedef V4L2Subdevice::Formats\n+ * \\brief An ImageFormats specialization mapping uint32_t media bus codes to\n+ * image resolutions\n+ */\n+\n /**\n  * \\enum V4L2Subdevice::Whence\n  * \\brief Specify the type of format for getFormat() and setFormat() operations\n@@ -340,9 +346,9 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n  *\n  * \\return A list of the supported device formats\n  */\n-ImageFormats<uint32_t> V4L2Subdevice::formats(unsigned int pad)\n+V4L2Subdevice::Formats V4L2Subdevice::formats(unsigned int pad)\n {\n-\tImageFormats<uint32_t> formats;\n+\tFormats formats;\n\n \tif (pad >= entity_->pads().size()) {\n \t\tLOG(V4L2, Error) << \"Invalid pad: \" << pad;\ndiff --git a/test/v4l2_subdevice/list_formats.cpp b/test/v4l2_subdevice/list_formats.cpp\nindex 3e8d4cdba045..7f0b3333f617 100644\n--- a/test/v4l2_subdevice/list_formats.cpp\n+++ b/test/v4l2_subdevice/list_formats.cpp\n@@ -47,7 +47,7 @@ void ListFormatsTest::printFormats(unsigned int pad,\n int ListFormatsTest::run()\n {\n \t/* List all formats available on existing \"Scaler\" pads. */\n-\tImageFormats<uint32_t> formats;\n+\tV4L2Subdevice::Formats formats;\n\n \tformats = scaler_->formats(0);\n \tif (formats.isEmpty()) {\n","prefixes":["libcamera-devel","v3","2/4"]}