{"id":3997,"url":"https://patchwork.libcamera.org/api/patches/3997/?format=json","web_url":"https://patchwork.libcamera.org/patch/3997/","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":"<20200608232844.10150-3-jacopo@jmondi.org>","date":"2020-06-08T23:28:40","name":"[libcamera-devel,v2,2/6] libcamera: v4l2_subdevice: Provide Formats typedef","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"c0c9a6e373b7f14e8bc331d098fc0562577c83d0","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":{"id":15,"url":"https://patchwork.libcamera.org/api/users/15/?format=json","username":"jmondi","first_name":"Jacopo","last_name":"Mondi","email":"jacopo@jmondi.org"},"mbox":"https://patchwork.libcamera.org/patch/3997/mbox/","series":[{"id":979,"url":"https://patchwork.libcamera.org/api/series/979/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=979","date":"2020-06-08T23:28:38","name":"ImageFormats, you again","version":2,"mbox":"https://patchwork.libcamera.org/series/979/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3997/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3997/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 07F5D63CBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Jun 2020 01:25:25 +0200 (CEST)","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 5501F240004;\n\tMon,  8 Jun 2020 23:25:25 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  9 Jun 2020 01:28:40 +0200","Message-Id":"<20200608232844.10150-3-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200608232844.10150-1-jacopo@jmondi.org>","References":"<20200608232844.10150-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 2/6] libcamera: v4l2_subdevice: Provide\n\tFormats typedef","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>","X-List-Received-Date":"Mon, 08 Jun 2020 23:25:26 -0000"},"content":"Provide a type definition for ImageFormats<uint32_t> to allow\nusers of V4L2Subdevice to refer to it as V4L2Subdevice::Formats.\n\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(-)","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 9fa20e84a904..de7d0c0db2b6 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -197,6 +197,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 Enumeration of uint32_t media bus codes associated to image\n+ * resolutions\n+ */\n+\n /**\n  * \\enum V4L2Subdevice::Whence\n  * \\brief Specify the type of format for getFormat() and setFormat() operations\n@@ -320,9 +326,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","v2","2/6"]}