{"id":2415,"url":"https://patchwork.libcamera.org/api/1.1/patches/2415/?format=json","web_url":"https://patchwork.libcamera.org/patch/2415/","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":"<20191209163446.32381-5-jacopo@jmondi.org>","date":"2019-12-09T16:34:40","name":"[libcamera-devel,v3,04/10] libcamera: controls: Add default to ControlRange","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"0661188a73a36acf3328f1322f51686dacbc4381","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2415/mbox/","series":[{"id":586,"url":"https://patchwork.libcamera.org/api/1.1/series/586/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=586","date":"2019-12-09T16:34:36","name":"Introduce libcamera properties","version":3,"mbox":"https://patchwork.libcamera.org/series/586/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2415/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2415/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 09CFA61D48\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Dec 2019 17:32:43 +0100 (CET)","from uno.lan (93-34-114-233.ip49.fastwebnet.it [93.34.114.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 4DEB81C0007;\n\tMon,  9 Dec 2019 16:32:42 +0000 (UTC)"],"X-Originating-IP":"93.34.114.233","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  9 Dec 2019 17:34:40 +0100","Message-Id":"<20191209163446.32381-5-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.24.0","In-Reply-To":"<20191209163446.32381-1-jacopo@jmondi.org>","References":"<20191209163446.32381-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 04/10] libcamera: controls: Add default\n\tto ControlRange","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, 09 Dec 2019 16:32:43 -0000"},"content":"Augment the the ControlRange class to store the control default value.\n\nThis is particularly relevant for v4l2 controls used to create\nCamera properties, which are constructed using immutable video device\nproperties, whose value won't change at runtime.\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/controls.h |  5 ++++-\n src/libcamera/controls.cpp   | 17 +++++++++++++++--\n 2 files changed, 19 insertions(+), 3 deletions(-)","diff":"diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex b1b73367e874..458b84e8fa8c 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -114,10 +114,12 @@ class ControlRange\n {\n public:\n \texplicit ControlRange(const ControlValue &min = 0,\n-\t\t\t      const ControlValue &max = 0);\n+\t\t\t      const ControlValue &max = 0,\n+\t\t\t      const ControlValue &def = 0);\n \n \tconst ControlValue &min() const { return min_; }\n \tconst ControlValue &max() const { return max_; }\n+\tconst ControlValue &def() const { return def_; }\n \n \tstd::string toString() const;\n \n@@ -134,6 +136,7 @@ public:\n private:\n \tControlValue min_;\n \tControlValue max_;\n+\tControlValue def_;\n };\n \n using ControlIdMap = std::unordered_map<unsigned int, const ControlId *>;\ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex 7d8a0e97ee3a..1678d3cba4f3 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -353,14 +353,21 @@ Control<int64_t>::Control(unsigned int id, const char *name)\n  * pipeline handlers to describe the controls they support.\n  */\n \n+/**\n+ * \\var ControlRange::def_\n+ * \\brief The control default value\n+ */\n+\n /**\n  * \\brief Construct a ControlRange with minimum and maximum range parameters\n  * \\param[in] min The control minimum value\n  * \\param[in] max The control maximum value\n+ * \\param[in] def The control default value\n  */\n ControlRange::ControlRange(const ControlValue &min,\n-\t\t\t   const ControlValue &max)\n-\t: min_(min), max_(max)\n+\t\t\t   const ControlValue &max,\n+\t\t\t   const ControlValue &def)\n+\t: min_(min), max_(max), def_(def)\n {\n }\n \n@@ -376,6 +383,12 @@ ControlRange::ControlRange(const ControlValue &min,\n  * \\return A ControlValue with the maximum value for the control\n  */\n \n+/**\n+ * \\fn ControlRange::def()\n+ * \\brief Retrieve the default value of the control\n+ * \\return A ControlValue with the default value for the control\n+ */\n+\n /**\n  * \\brief Provide a string representation of the ControlRange\n  */\n","prefixes":["libcamera-devel","v3","04/10"]}