Patch Detail
Show a patch.
GET /api/patches/2051/?format=api
{ "id": 2051, "url": "https://patchwork.libcamera.org/api/patches/2051/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2051/", "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": "<20190928152238.23752-10-laurent.pinchart@ideasonboard.com>", "date": "2019-09-28T15:22:35", "name": "[libcamera-devel,09/12] libcamera: v4l2_controls: Use the ControlRange class for control info", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "9d2f1b783fbf27d4d5f99fa2d476444ab2f539f5", "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/2051/mbox/", "series": [ { "id": 511, "url": "https://patchwork.libcamera.org/api/series/511/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=511", "date": "2019-09-28T15:22:26", "name": "Improve the application-facing controls API", "version": 1, "mbox": "https://patchwork.libcamera.org/series/511/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2051/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2051/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 CCB1060BE6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 28 Sep 2019 17:22:59 +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 11B30593\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 28 Sep 2019 17:22:58 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1569684179;\n\tbh=ZHDcMZQA4XqWdOjNd4BVedwtCUViQQpiSx4ggbGB0Ys=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=M39zW+8ayNyZ8qK+SlwTiRWfnyxgpNCp3I5ddK4sXAuCf8J58B+qbFdkXp7s5nW7s\n\tYOhwMhiDg6tT0HxXcjgG1rDrIf3q9xeMBM8yknjf0mSk+bLqgfCayKk4r2mhh+YJJa\n\tDW5uAZ3UgwByJl5C62DsqRpvYUjSnClSTFrmUTag=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 28 Sep 2019 18:22:35 +0300", "Message-Id": "<20190928152238.23752-10-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190928152238.23752-1-laurent.pinchart@ideasonboard.com>", "References": "<20190928152238.23752-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 09/12] libcamera: v4l2_controls: Use the\n\tControlRange class for control info", "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": "Sat, 28 Sep 2019 15:23:00 -0000" }, "content": "Use the ControlRange class to express the range of a V4L2 control,\nreplacing the open-coded minimum and maximum fields in the\nV4L2ControlInfo class.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/include/v4l2_controls.h | 6 ++----\n src/libcamera/pipeline/uvcvideo.cpp | 2 +-\n src/libcamera/pipeline/vimc.cpp | 2 +-\n src/libcamera/v4l2_controls.cpp | 21 ++++++++++-----------\n 4 files changed, 14 insertions(+), 17 deletions(-)", "diff": "diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h\nindex f2b67c5d44e1..b39370b2e90e 100644\n--- a/src/libcamera/include/v4l2_controls.h\n+++ b/src/libcamera/include/v4l2_controls.h\n@@ -30,8 +30,7 @@ public:\n \tsize_t size() const { return size_; }\n \tconst std::string &name() const { return name_; }\n \n-\tint64_t min() const { return min_; }\n-\tint64_t max() const { return max_; }\n+\tconst ControlRange &range() const { return range_; }\n \n private:\n \tunsigned int id_;\n@@ -39,8 +38,7 @@ private:\n \tsize_t size_;\n \tstd::string name_;\n \n-\tint64_t min_;\n-\tint64_t max_;\n+\tControlRange range_;\n };\n \n using V4L2ControlInfoMap = std::map<unsigned int, V4L2ControlInfo>;\ndiff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex a80f8a43a116..17bbbad15838 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -364,7 +364,7 @@ int UVCCameraData::init(MediaEntity *entity)\n \n \t\tcontrolInfo_.emplace(std::piecewise_construct,\n \t\t\t\t std::forward_as_tuple(id),\n-\t\t\t\t std::forward_as_tuple(info.min(), info.max()));\n+\t\t\t\t std::forward_as_tuple(info.range()));\n \t}\n \n \treturn 0;\ndiff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex 5d6909f58cf9..f9a7feb6571a 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -437,7 +437,7 @@ int VimcCameraData::init(MediaDevice *media)\n \n \t\tcontrolInfo_.emplace(std::piecewise_construct,\n \t\t\t\t std::forward_as_tuple(id),\n-\t\t\t\t std::forward_as_tuple(info.min(), info.max()));\n+\t\t\t\t std::forward_as_tuple(info.range()));\n \t}\n \n \treturn 0;\ndiff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp\nindex 64f0555fff7c..6f5f1578b139 100644\n--- a/src/libcamera/v4l2_controls.cpp\n+++ b/src/libcamera/v4l2_controls.cpp\n@@ -74,8 +74,13 @@ V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl)\n \ttype_ = ctrl.type;\n \tname_ = static_cast<const char *>(ctrl.name);\n \tsize_ = ctrl.elem_size * ctrl.elems;\n-\tmin_ = ctrl.minimum;\n-\tmax_ = ctrl.maximum;\n+\n+\tif (ctrl.type == V4L2_CTRL_TYPE_INTEGER64)\n+\t\trange_ = ControlRange(static_cast<int64_t>(ctrl.minimum),\n+\t\t\t\t static_cast<int64_t>(ctrl.maximum));\n+\telse\n+\t\trange_ = ControlRange(static_cast<int32_t>(ctrl.minimum),\n+\t\t\t\t static_cast<int32_t>(ctrl.maximum));\n }\n \n /**\n@@ -103,15 +108,9 @@ V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl)\n */\n \n /**\n- * \\fn V4L2ControlInfo::min()\n- * \\brief Retrieve the control minimum value\n- * \\return The V4L2 control minimum value\n- */\n-\n-/**\n- * \\fn V4L2ControlInfo::max()\n- * \\brief Retrieve the control maximum value\n- * \\return The V4L2 control maximum value\n+ * \\fn V4L2ControlInfo::range()\n+ * \\brief Retrieve the control value range\n+ * \\return The V4L2 control value range\n */\n \n /**\n", "prefixes": [ "libcamera-devel", "09/12" ] }