Show a patch.

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

{
    "id": 1547,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/1547/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1547/",
    "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": "<20190630233817.10130-6-laurent.pinchart@ideasonboard.com>",
    "date": "2019-06-30T23:38:08",
    "name": "[libcamera-devel,v3,05/14] libcamera: camera: Provide a list of ControlInfo",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "b879f5578542f49c29e4be8edfbbd8eec2c241b2",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/1547/mbox/",
    "series": [
        {
            "id": 384,
            "url": "https://patchwork.libcamera.org/api/1.1/series/384/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=384",
            "date": "2019-06-30T23:38:03",
            "name": "libcamera Controls",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/384/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1547/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1547/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 44A6961F3A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Jul 2019 01:38:44 +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 E5AB4255\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Jul 2019 01:38:43 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1561937924;\n\tbh=yxJZTBRxCfBHP2nhsXl7xFteIyrhQl2XKqPevUtBHfo=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=N/isg78xEbAcTAsagcT3qyRFgx0Z7Z5VMnzqRtAsaC1O/vIvcQhJUr0BzzLfXmQ7b\n\tarGtCCpVmxcmVFJUQrpwTp3RYFJ8kYRztHDpA8Jj/r153XEBBgClnj+Wl4Lz7B9p9d\n\tYSrblj9rp54ebPdx+ubEnNF1FQZCc0r4tVTiybqE=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon,  1 Jul 2019 02:38:08 +0300",
        "Message-Id": "<20190630233817.10130-6-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190630233817.10130-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20190630233817.10130-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 05/14] libcamera: camera: Provide a\n\tlist of ControlInfo",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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, 30 Jun 2019 23:38:45 -0000"
    },
    "content": "From: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nExtend the Camera class to expose the controls it supports. Each\npipeline should generate a list of controls supported by each camera it\ncreates. These are represented by a ControlInfoMap, and an associated\nControlList of default values.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/camera.h               |  3 +++\n include/libcamera/controls.h             |  2 ++\n src/libcamera/camera.cpp                 | 12 ++++++++++++\n src/libcamera/controls.cpp               |  5 +++++\n src/libcamera/include/pipeline_handler.h |  4 ++++\n src/libcamera/pipeline_handler.cpp       | 19 +++++++++++++++++++\n 6 files changed, 45 insertions(+)",
    "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex fb2f7ba3423c..6d693d9a6c7a 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -12,6 +12,7 @@\n #include <set>\n #include <string>\n \n+#include <libcamera/controls.h>\n #include <libcamera/request.h>\n #include <libcamera/signal.h>\n #include <libcamera/stream.h>\n@@ -83,6 +84,8 @@ public:\n \tint acquire();\n \tint release();\n \n+\tconst ControlInfoMap &controls();\n+\n \tconst std::set<Stream *> &streams() const;\n \tstd::unique_ptr<CameraConfiguration> generateConfiguration(const StreamRoles &roles);\n \tint configure(CameraConfiguration *config);\ndiff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex ad2d49d522c5..9b37dfb16b89 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -99,6 +99,8 @@ static inline bool operator!=(const ControlInfo &lhs, const ControlId &rhs)\n \treturn !(lhs == rhs);\n }\n \n+using ControlInfoMap = std::unordered_map<ControlId, ControlInfo>;\n+\n class ControlList\n {\n private:\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 617ea99cdf71..592dfd39eacc 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -548,6 +548,18 @@ int Camera::release()\n \treturn 0;\n }\n \n+/**\n+ * \\brief Retrieve the list of controls supported by the camera\n+ *\n+ * Camera controls remain constant through the lifetime of the camera.\n+ *\n+ * \\return A ControlInfoMap listing the controls supported by the camera\n+ */\n+const ControlInfoMap &Camera::controls()\n+{\n+\treturn pipe_->controls(this);\n+}\n+\n /**\n  * \\brief Retrieve all the camera's stream information\n  *\ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex 22db2b93eff2..e4c41b97a354 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -315,6 +315,11 @@ bool operator==(const ControlInfo &lhs, const ControlId &rhs)\n \treturn lhs.id() == rhs;\n }\n \n+/**\n+ * \\typedef ControlInfoMap\n+ * \\brief A map of ControlId to ControlInfo\n+ */\n+\n /**\n  * \\class ControlList\n  * \\brief Associates a list of ControlIds with their values for a Camera.\ndiff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h\nindex a4cbc593a179..f836d5d1a600 100644\n--- a/src/libcamera/include/pipeline_handler.h\n+++ b/src/libcamera/include/pipeline_handler.h\n@@ -14,6 +14,7 @@\n #include <string>\n #include <vector>\n \n+#include <libcamera/controls.h>\n #include <libcamera/stream.h>\n \n namespace libcamera {\n@@ -41,6 +42,7 @@ public:\n \tCamera *camera_;\n \tPipelineHandler *pipe_;\n \tstd::list<Request *> queuedRequests_;\n+\tControlInfoMap controlInfo_;\n \n private:\n \tCameraData(const CameraData &) = delete;\n@@ -60,6 +62,8 @@ public:\n \tbool lock();\n \tvoid unlock();\n \n+\tconst ControlInfoMap &controls(Camera *camera);\n+\n \tvirtual CameraConfiguration *generateConfiguration(Camera *camera,\n \t\tconst StreamRoles &roles) = 0;\n \tvirtual int configure(Camera *camera, CameraConfiguration *config) = 0;\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex c91ef2f7d336..0283e4e5ad51 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -88,6 +88,14 @@ LOG_DEFINE_CATEGORY(Pipeline)\n  * PipelineHandler::completeRequest()\n  */\n \n+/**\n+ * \\var CameraData::controlInfo_\n+ * \\brief The set of controls supported by the camera\n+ *\n+ * The control information shall be initialised by the pipeline handler when\n+ * creating the camera, and shall not be modified afterwards.\n+ */\n+\n /**\n  * \\class PipelineHandler\n  * \\brief Create and manage cameras based on a set of media devices\n@@ -217,6 +225,17 @@ void PipelineHandler::unlock()\n \t\tmedia->unlock();\n }\n \n+/**\n+ * \\brief Retrieve the list of controls for a camera\n+ * \\param[in] camera The camera\n+ * \\return A ControlInfoMap listing the controls support by \\a camera\n+ */\n+const ControlInfoMap &PipelineHandler::controls(Camera *camera)\n+{\n+\tCameraData *data = cameraData(camera);\n+\treturn data->controlInfo_;\n+}\n+\n /**\n  * \\fn PipelineHandler::generateConfiguration()\n  * \\brief Generate a camera configuration for a specified camera\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "05/14"
    ]
}