Show a patch.

GET /api/1.1/patches/2536/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2536,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/2536/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2536/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20200108163434.19530-5-jacopo@jmondi.org>",
    "date": "2020-01-08T16:34:28",
    "name": "[libcamera-devel,v4,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=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2536/mbox/",
    "series": [
        {
            "id": 610,
            "url": "https://patchwork.libcamera.org/api/1.1/series/610/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=610",
            "date": "2020-01-08T16:34:24",
            "name": "Camera properties",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/610/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2536/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2536/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[217.70.183.201])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1BA0A60678\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Jan 2020 17:32:20 +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 relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 75D081BF206;\n\tWed,  8 Jan 2020 16:32:19 +0000 (UTC)"
        ],
        "X-Originating-IP": "93.34.114.233",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed,  8 Jan 2020 17:34:28 +0100",
        "Message-Id": "<20200108163434.19530-5-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.24.0",
        "In-Reply-To": "<20200108163434.19530-1-jacopo@jmondi.org>",
        "References": "<20200108163434.19530-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 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": "Wed, 08 Jan 2020 16:32:20 -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",
        "v4",
        "04/10"
    ]
}