Patch Detail
Show a patch.
GET /api/patches/2189/?format=api
{ "id": 2189, "url": "https://patchwork.libcamera.org/api/patches/2189/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2189/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20191013232755.3292-8-laurent.pinchart@ideasonboard.com>", "date": "2019-10-13T23:27:53", "name": "[libcamera-devel,07/10] libcamera: v4l2_controls: Store a ControlRange in V4L2ControlInfoMap", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "e201a04ebf369205ef4ecb2defbb7d9e2299575d", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/2189/mbox/", "series": [ { "id": 534, "url": "https://patchwork.libcamera.org/api/series/534/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=534", "date": "2019-10-13T23:27:46", "name": "Merge V4L2ControlInfoMap and ControlInfoMap", "version": 1, "mbox": "https://patchwork.libcamera.org/series/534/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2189/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2189/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 29BF161975\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Oct 2019 01:28:05 +0200 (CEST)", "from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C045533A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Oct 2019 01:28:04 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1571009284;\n\tbh=Lhpf6CquKnki7wmWt03nVOJCygOR7YB7fRmQ+ZfIox8=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=El34xbXksxGUcM47xOTQWPon6JMcrpgEdHgu1N+q8kyuJGjakrVN48uBjlWxAzldy\n\tHXnZ5lbNEZfF68RK0VBzJxljQkaUXBOEwNdWRUPeQqF0oyuMyBY5iyp78inhRp0u9k\n\t/YDaKKnAeZepn7wDQvOZNsombVKQKU2nDFzFTTog=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 14 Oct 2019 02:27:53 +0300", "Message-Id": "<20191013232755.3292-8-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20191013232755.3292-1-laurent.pinchart@ideasonboard.com>", "References": "<20191013232755.3292-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 07/10] libcamera: v4l2_controls: Store a\n\tControlRange in V4L2ControlInfoMap", "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": "Sun, 13 Oct 2019 23:28:06 -0000" }, "content": "V4L2ControlRange only offers a convenience constructor for a\nControlRange. Store the ControlRange instead of V4L2ControlRange in\nV4L2ControlInfoMap to make the map less dependent on V4L2 types.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/include/v4l2_controls.h | 34 +++++++++++++--------------\n src/libcamera/pipeline/uvcvideo.cpp | 2 +-\n src/libcamera/pipeline/vimc.cpp | 2 +-\n src/libcamera/v4l2_controls.cpp | 6 ++---\n src/libcamera/v4l2_device.cpp | 6 ++---\n test/v4l2_videodevice/controls.cpp | 6 ++---\n 6 files changed, 27 insertions(+), 29 deletions(-)", "diff": "diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h\nindex 741569824b68..7d3528b07f94 100644\n--- a/src/libcamera/include/v4l2_controls.h\n+++ b/src/libcamera/include/v4l2_controls.h\n@@ -31,27 +31,27 @@ public:\n \tV4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl);\n };\n \n-class V4L2ControlInfoMap : private std::map<const ControlId *, V4L2ControlRange>\n+class V4L2ControlInfoMap : private std::map<const ControlId *, ControlRange>\n {\n public:\n-\tV4L2ControlInfoMap &operator=(std::map<const ControlId *, V4L2ControlRange> &&info);\n+\tV4L2ControlInfoMap &operator=(std::map<const ControlId *, ControlRange> &&info);\n \n-\tusing std::map<const ControlId *, V4L2ControlRange>::key_type;\n-\tusing std::map<const ControlId *, V4L2ControlRange>::mapped_type;\n-\tusing std::map<const ControlId *, V4L2ControlRange>::value_type;\n-\tusing std::map<const ControlId *, V4L2ControlRange>::size_type;\n-\tusing std::map<const ControlId *, V4L2ControlRange>::iterator;\n-\tusing std::map<const ControlId *, V4L2ControlRange>::const_iterator;\n+\tusing std::map<const ControlId *, ControlRange>::key_type;\n+\tusing std::map<const ControlId *, ControlRange>::mapped_type;\n+\tusing std::map<const ControlId *, ControlRange>::value_type;\n+\tusing std::map<const ControlId *, ControlRange>::size_type;\n+\tusing std::map<const ControlId *, ControlRange>::iterator;\n+\tusing std::map<const ControlId *, ControlRange>::const_iterator;\n \n-\tusing std::map<const ControlId *, V4L2ControlRange>::begin;\n-\tusing std::map<const ControlId *, V4L2ControlRange>::cbegin;\n-\tusing std::map<const ControlId *, V4L2ControlRange>::end;\n-\tusing std::map<const ControlId *, V4L2ControlRange>::cend;\n-\tusing std::map<const ControlId *, V4L2ControlRange>::at;\n-\tusing std::map<const ControlId *, V4L2ControlRange>::empty;\n-\tusing std::map<const ControlId *, V4L2ControlRange>::size;\n-\tusing std::map<const ControlId *, V4L2ControlRange>::count;\n-\tusing std::map<const ControlId *, V4L2ControlRange>::find;\n+\tusing std::map<const ControlId *, ControlRange>::begin;\n+\tusing std::map<const ControlId *, ControlRange>::cbegin;\n+\tusing std::map<const ControlId *, ControlRange>::end;\n+\tusing std::map<const ControlId *, ControlRange>::cend;\n+\tusing std::map<const ControlId *, ControlRange>::at;\n+\tusing std::map<const ControlId *, ControlRange>::empty;\n+\tusing std::map<const ControlId *, ControlRange>::size;\n+\tusing std::map<const ControlId *, ControlRange>::count;\n+\tusing std::map<const ControlId *, ControlRange>::find;\n \n \tmapped_type &at(unsigned int key);\n \tconst mapped_type &at(unsigned int key) const;\ndiff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex 7356585b982e..018c7691d263 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -337,7 +337,7 @@ int UVCCameraData::init(MediaEntity *entity)\n \t/* Initialise the supported controls. */\n \tconst V4L2ControlInfoMap &controls = video_->controls();\n \tfor (const auto &ctrl : controls) {\n-\t\tconst V4L2ControlRange &range = ctrl.second;\n+\t\tconst ControlRange &range = ctrl.second;\n \t\tconst ControlId *id;\n \n \t\tswitch (ctrl.first->id()) {\ndiff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex 87e7e54e964f..f7f82edc6530 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -413,7 +413,7 @@ int VimcCameraData::init(MediaDevice *media)\n \t/* Initialise the supported controls. */\n \tconst V4L2ControlInfoMap &controls = sensor_->controls();\n \tfor (const auto &ctrl : controls) {\n-\t\tconst V4L2ControlRange &range = ctrl.second;\n+\t\tconst ControlRange &range = ctrl.second;\n \t\tconst ControlId *id;\n \n \t\tswitch (ctrl.first->id()) {\ndiff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp\nindex 4aab34b9a2b4..e27c70eeec87 100644\n--- a/src/libcamera/v4l2_controls.cpp\n+++ b/src/libcamera/v4l2_controls.cpp\n@@ -136,7 +136,7 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)\n \n /**\n * \\class V4L2ControlInfoMap\n- * \\brief A map of controlID to V4L2ControlRange\n+ * \\brief A map of controlID to ControlRange for V4L2 controls\n */\n \n /**\n@@ -150,9 +150,9 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)\n *\n * \\return The populated V4L2ControlInfoMap\n */\n-V4L2ControlInfoMap &V4L2ControlInfoMap::operator=(std::map<const ControlId *, V4L2ControlRange> &&info)\n+V4L2ControlInfoMap &V4L2ControlInfoMap::operator=(std::map<const ControlId *, ControlRange> &&info)\n {\n-\tstd::map<const ControlId *, V4L2ControlRange>::operator=(std::move(info));\n+\tstd::map<const ControlId *, ControlRange>::operator=(std::move(info));\n \n \tidmap_.clear();\n \tfor (const auto &ctrl : *this)\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 133f8abc8f13..47999e70073c 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -342,7 +342,7 @@ int V4L2Device::ioctl(unsigned long request, void *argp)\n */\n void V4L2Device::listControls()\n {\n-\tstd::map<const ControlId *, V4L2ControlRange> ctrls;\n+\tstd::map<const ControlId *, ControlRange> ctrls;\n \tstruct v4l2_query_ext_ctrl ctrl = {};\n \n \t/* \\todo Add support for menu and compound controls. */\n@@ -380,9 +380,7 @@ void V4L2Device::listControls()\n \t\t}\n \n \t\tcontrolIds_.emplace_back(utils::make_unique<V4L2ControlId>(ctrl));\n-\t\tctrls.emplace(std::piecewise_construct,\n-\t\t\t std::forward_as_tuple(controlIds_.back().get()),\n-\t\t\t std::forward_as_tuple(ctrl));\n+\t\tctrls.emplace(controlIds_.back().get(), V4L2ControlRange(ctrl));\n \t}\n \n \tcontrols_ = std::move(ctrls);\ndiff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp\nindex d4b7588eb362..182228f3a5b1 100644\n--- a/test/v4l2_videodevice/controls.cpp\n+++ b/test/v4l2_videodevice/controls.cpp\n@@ -41,9 +41,9 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n-\t\tconst V4L2ControlRange &brightness = info.find(V4L2_CID_BRIGHTNESS)->second;\n-\t\tconst V4L2ControlRange &contrast = info.find(V4L2_CID_CONTRAST)->second;\n-\t\tconst V4L2ControlRange &saturation = info.find(V4L2_CID_SATURATION)->second;\n+\t\tconst ControlRange &brightness = info.find(V4L2_CID_BRIGHTNESS)->second;\n+\t\tconst ControlRange &contrast = info.find(V4L2_CID_CONTRAST)->second;\n+\t\tconst ControlRange &saturation = info.find(V4L2_CID_SATURATION)->second;\n \n \t\t/* Test getting controls. */\n \t\tV4L2ControlList ctrls(info);\n", "prefixes": [ "libcamera-devel", "07/10" ] }