Patch Detail
Show a patch.
GET /api/1.1/patches/928/?format=api
{ "id": 928, "url": "https://patchwork.libcamera.org/api/1.1/patches/928/?format=api", "web_url": "https://patchwork.libcamera.org/patch/928/", "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": "<20190405235842.27884-6-niklas.soderlund@ragnatech.se>", "date": "2019-04-05T23:58:39", "name": "[libcamera-devel,v3,5/8] libcamera: stream: Add basic stream usages", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "f0e3f56ec462cc04a98011fae16f13b2b6a4c4b8", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/928/mbox/", "series": [ { "id": 242, "url": "https://patchwork.libcamera.org/api/1.1/series/242/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=242", "date": "2019-04-05T23:58:34", "name": "libcamera: stream: Add basic stream usages", "version": 3, "mbox": "https://patchwork.libcamera.org/series/242/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/928/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/928/checks/", "tags": {}, "headers": { "Return-Path": "<niklas.soderlund@ragnatech.se>", "Received": [ "from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 324A3610C5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 6 Apr 2019 01:59:22 +0200 (CEST)", "from bismarck.berto.se (unknown [89.233.230.99])\n\tby bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid d3b31c62-57fe-11e9-8144-0050569116f7;\n\tSat, 06 Apr 2019 01:59:19 +0200 (CEST)" ], "X-Halon-ID": "d3b31c62-57fe-11e9-8144-0050569116f7", "Authorized-sender": "niklas@soderlund.pp.se", "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 6 Apr 2019 01:58:39 +0200", "Message-Id": "<20190405235842.27884-6-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190405235842.27884-1-niklas.soderlund@ragnatech.se>", "References": "<20190405235842.27884-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 5/8] libcamera: stream: Add basic\n\tstream usages", "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": "Fri, 05 Apr 2019 23:59:22 -0000" }, "content": "In preparation of reworking how a default configuration is retrieved\nfrom a camera add stream usages. The usages will be used by applications\nto describe how they intend to use a camera and replace the Stream IDs\nwhen retrieving default configuration from the camera using\nstreamConfiguration().\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/stream.h | 40 +++++++++++++++++\n src/libcamera/stream.cpp | 92 ++++++++++++++++++++++++++++++++++++++\n 2 files changed, 132 insertions(+)", "diff": "diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\nindex 970c479627fab064..d0f7b0e124851f10 100644\n--- a/include/libcamera/stream.h\n+++ b/include/libcamera/stream.h\n@@ -8,6 +8,7 @@\n #define __LIBCAMERA_STREAM_H__\n \n #include <libcamera/buffer.h>\n+#include <libcamera/geometry.h>\n \n namespace libcamera {\n \n@@ -21,9 +22,48 @@ struct StreamConfiguration {\n \tunsigned int bufferCount;\n };\n \n+class StreamUsage\n+{\n+public:\n+\tenum Role {\n+\t\tStillCapture,\n+\t\tVideoRecording,\n+\t\tViewfinder,\n+\t};\n+\n+\tRole role() const { return role_; }\n+\tconst Size &size() const { return size_; }\n+\n+protected:\n+\texplicit StreamUsage(Role role);\n+\tStreamUsage(Role role, int width, int height);\n+\n+private:\n+\tRole role_;\n+\tSize size_;\n+};\n+\n class Stream final\n {\n public:\n+\tclass StillCapture : public StreamUsage\n+\t{\n+\tpublic:\n+\t\tStillCapture();\n+\t};\n+\n+\tclass VideoRecording : public StreamUsage\n+\t{\n+\tpublic:\n+\t\tVideoRecording();\n+\t};\n+\n+\tclass Viewfinder : public StreamUsage\n+\t{\n+\tpublic:\n+\t\tViewfinder(int width, int height);\n+\t};\n+\n \tStream();\n \tBufferPool &bufferPool() { return bufferPool_; }\n \tconst StreamConfiguration &configuration() const { return configuration_; }\ndiff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\nindex c4943c91b2e6ce13..85cd5256ee2f0aa4 100644\n--- a/src/libcamera/stream.cpp\n+++ b/src/libcamera/stream.cpp\n@@ -60,6 +60,65 @@ namespace libcamera {\n * \\brief Requested number of buffers to allocate for the stream\n */\n \n+/**\n+ * \\class StreamUsage\n+ * \\brief Stream usage information\n+ *\n+ * The StreamUsage class describes how an application intends to use a stream.\n+ * Usages are specified by applications and passed to cameras, that then select\n+ * the most appropriate streams and their default configurations.\n+ */\n+\n+/**\n+ * \\enum StreamUsage::Role\n+ * \\brief Identify the role a stream is intended to play\n+ * \\var StreamUsage::StillCapture\n+ * The stream is intended to capture high-resolution, high-quality still images\n+ * with low frame rate. The captured frames may be exposed with flash.\n+ * \\var StreamUsage::VideoRecording\n+ * The stream is intended to capture video for the purpose of recording or\n+ * streaming. The video stream may produce a high frame rate and may be\n+ * enhanced with video stabilization.\n+ * \\var StreamUsage::Viewfinder\n+ * The stream is intended to capture video for the purpose of display on the\n+ * local screen. The StreamUsage includes the desired resolution. Trade-offs\n+ * between quality and usage of system resources are acceptable.\n+ */\n+\n+/**\n+ * \\fn StreamUsage::role()\n+ * \\brief Retrieve the stream role\n+ *\n+ * \\return The stream role\n+ */\n+\n+/**\n+ * \\fn StreamUsage::size()\n+ * \\brief Retrieve desired size\n+ *\n+ * \\return The desired size\n+ */\n+\n+/**\n+ * \\brief Create a stream usage\n+ * \\param[in] role Stream role\n+ */\n+StreamUsage::StreamUsage(Role role)\n+\t: role_(role)\n+{\n+}\n+\n+/**\n+ * \\brief Create a stream usage with a desired size\n+ * \\param[in] role Stream role\n+ * \\param[in] width The desired width\n+ * \\param[in] height The desired height\n+ */\n+StreamUsage::StreamUsage(Role role, int width, int height)\n+\t: role_(role), size_(Size(width, height))\n+{\n+}\n+\n /**\n * \\class Stream\n * \\brief Video stream for a camera\n@@ -78,6 +137,39 @@ namespace libcamera {\n * optimal stream for the task.\n */\n \n+/**\n+ * \\class Stream::StillCapture\n+ * \\brief Describe a still capture usage\n+ */\n+Stream::StillCapture::StillCapture()\n+\t: StreamUsage(Role::StillCapture)\n+{\n+}\n+\n+/**\n+ * \\class Stream::VideoRecording\n+ * \\brief Describe a video recording usage\n+ */\n+Stream::VideoRecording::VideoRecording()\n+\t: StreamUsage(Role::VideoRecording)\n+{\n+}\n+\n+/**\n+ * \\class Stream::Viewfinder\n+ * \\brief Describe a viewfinder usage\n+ */\n+\n+/**\n+ * \\brief Create a viewfinder usage with a desired dimension\n+ * \\param[in] width The desired viewfinder width\n+ * \\param[in] height The desired viewfinder height\n+ */\n+Stream::Viewfinder::Viewfinder(int width, int height)\n+\t: StreamUsage(Role::Viewfinder, width, height)\n+{\n+}\n+\n /**\n * \\brief Construct a stream with default parameters\n */\n", "prefixes": [ "libcamera-devel", "v3", "5/8" ] }