{"id":12033,"url":"https://patchwork.libcamera.org/api/patches/12033/?format=json","web_url":"https://patchwork.libcamera.org/patch/12033/","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":"<20210421160319.42251-2-jacopo@jmondi.org>","date":"2021-04-21T16:03:04","name":"[libcamera-devel,v3,01/16] libcamera: controls: Add a function to merge two control lists","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"3b3f7e1c950a7a8dbf7c66cd1aa9448d135faacf","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/12033/mbox/","series":[{"id":1957,"url":"https://patchwork.libcamera.org/api/series/1957/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1957","date":"2021-04-21T16:03:03","name":"Support SensorTimestamp metadata","version":3,"mbox":"https://patchwork.libcamera.org/series/1957/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12033/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12033/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 EBA93BDB17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Apr 2021 16:02:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B876868854;\n\tWed, 21 Apr 2021 18:02:45 +0200 (CEST)","from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 62B626884C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Apr 2021 18:02:43 +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 relay10.mail.gandi.net (Postfix) with ESMTPSA id 3C86124000D;\n\tWed, 21 Apr 2021 16:02:42 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 21 Apr 2021 18:03:04 +0200","Message-Id":"<20210421160319.42251-2-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20210421160319.42251-1-jacopo@jmondi.org>","References":"<20210421160319.42251-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 01/16] libcamera: controls: Add a\n\tfunction to merge two control lists","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=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nAdd a new ControlList::merge() function to merge two control lists. The\nsemantics is identical to std::unordered_map::merge(). This can be used\nby pipeline handlers to merge metadata they populate with metadata\nreceived from an IPA.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/controls.h |  2 ++\n src/libcamera/controls.cpp   | 20 ++++++++++++++++++++\n 2 files changed, 22 insertions(+)","diff":"diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 1a5690a5ccbe..16726ce9b1ed 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -363,7 +363,9 @@ public:\n \n \tbool empty() const { return controls_.empty(); }\n \tstd::size_t size() const { return controls_.size(); }\n+\n \tvoid clear() { controls_.clear(); }\n+\tvoid merge(ControlList &source);\n \n \tbool contains(const ControlId &id) const;\n \tbool contains(unsigned int id) const;\ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex c58ed3946f3b..58555ea64c95 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -874,6 +874,26 @@ ControlList::ControlList(const ControlInfoMap &infoMap, ControlValidator *valida\n  * \\brief Removes all controls from the list\n  */\n \n+/**\n+ * \\brief Merge the \\a source into the ControlList\n+ * \\param[in] source The ControlList to merge into this object\n+ *\n+ * Merging two control lists extracts elements from the \\a source and insert\n+ * them in *this. If the \\a source contains elements whose key is already\n+ * present in *this, then those elements are not extracted. The semantics is\n+ * identical to std::unordered_map::merge() in that only internal pointers to\n+ * nodes are updated, without copying or moving the elements.\n+ *\n+ * Only control lists created from the same ControlIdMap or ControlInfoMap may\n+ * be merged. Attempting to do otherwise results in undefined behaviour.\n+ */\n+void ControlList::merge(ControlList &source)\n+{\n+\tASSERT(idmap_ == source.idmap_);\n+\n+\tcontrols_.merge(source.controls_);\n+}\n+\n /**\n  * \\brief Check if the list contains a control with the specified \\a id\n  * \\param[in] id The control ID\n","prefixes":["libcamera-devel","v3","01/16"]}