Patch Detail
Show a patch.
GET /api/patches/873/?format=api
{ "id": 873, "url": "https://patchwork.libcamera.org/api/patches/873/?format=api", "web_url": "https://patchwork.libcamera.org/patch/873/", "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": "<20190403011221.12711-5-niklas.soderlund@ragnatech.se>", "date": "2019-04-03T01:12:20", "name": "[libcamera-devel,4/5] libcamera: stream: Add basic stream roles definitions", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "f34e0ab6a35768065c6ee064bfc7634f625d2bf8", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": { "id": 16, "url": "https://patchwork.libcamera.org/api/users/16/?format=api", "username": "neg", "first_name": "Niklas", "last_name": "Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "mbox": "https://patchwork.libcamera.org/patch/873/mbox/", "series": [ { "id": 232, "url": "https://patchwork.libcamera.org/api/series/232/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=232", "date": "2019-04-03T01:12:16", "name": "libcamera: camera: Add support for stream roles", "version": 1, "mbox": "https://patchwork.libcamera.org/series/232/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/873/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/873/checks/", "tags": {}, "headers": { "Return-Path": "<niklas.soderlund@ragnatech.se>", "Received": [ "from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6490B610B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 3 Apr 2019 03:12:29 +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 8afe69e1-55ad-11e9-8144-0050569116f7;\n\tWed, 03 Apr 2019 03:12:26 +0200 (CEST)" ], "X-Halon-ID": "8afe69e1-55ad-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": "Wed, 3 Apr 2019 03:12:20 +0200", "Message-Id": "<20190403011221.12711-5-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190403011221.12711-1-niklas.soderlund@ragnatech.se>", "References": "<20190403011221.12711-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 4/5] libcamera: stream: Add basic stream\n\troles definitions", "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": "Wed, 03 Apr 2019 01:12:30 -0000" }, "content": "In preparation of reworking how a default configuration is retrieved\nfrom a camera add stream roles. The roles will be used by applications\nto describe how it intends to use a camera and replace the Stream IDs\nrole when retrieving default configuration from the camera using\nstreamConfiguration().\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n include/libcamera/stream.h | 41 ++++++++++++++++++\n src/libcamera/stream.cpp | 88 ++++++++++++++++++++++++++++++++++++++\n 2 files changed, 129 insertions(+)", "diff": "diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\nindex 970c479627fab064..adcf20d336347dad 100644\n--- a/include/libcamera/stream.h\n+++ b/include/libcamera/stream.h\n@@ -21,9 +21,50 @@ struct StreamConfiguration {\n \tunsigned int bufferCount;\n };\n \n+class StreamRole\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+\tint width() const { return width_; }\n+\tint height() const { return height_; }\n+\n+protected:\n+\tStreamRole(Role role);\n+\tStreamRole(Role role, int width, int height);\n+\n+private:\n+\tRole role_;\n+\tint width_;\n+\tint height_;\n+};\n+\n class Stream final\n {\n public:\n+\tclass StillCapture : public StreamRole\n+\t{\n+\tpublic:\n+\t\tStillCapture();\n+\t};\n+\n+\tclass VideoRecording : public StreamRole\n+\t{\n+\tpublic:\n+\t\tVideoRecording();\n+\t};\n+\n+\tclass Viewfinder : public StreamRole\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..f4be5d265e872842 100644\n--- a/src/libcamera/stream.cpp\n+++ b/src/libcamera/stream.cpp\n@@ -60,6 +60,61 @@ namespace libcamera {\n * \\brief Requested number of buffers to allocate for the stream\n */\n \n+/**\n+ * \\class StreamRole\n+ * \\brief Stream role information\n+ *\n+ * The StreamRole class carries information about stream usage hints from the\n+ * application to the camera. The camera shall take the usage hints into account\n+ * when select which stream to use for the desired operation.\n+ */\n+\n+/**\n+ * \\enum StreamRole::Role\n+ * \\brief List of different stream roles\n+ */\n+\n+/**\n+ * \\fn StreamRole::role()\n+ * \\brief Retrieve the stream role\n+ *\n+ * \\return The stream role hint\n+ */\n+\n+/**\n+ * \\fn StreamRole::width()\n+ * \\brief Retrieve desired width\n+ *\n+ * \\return The desired width if defined, -1 otherwise\n+ */\n+\n+/**\n+ * \\fn StreamRole::height()\n+ * \\brief Retrieve desired height\n+ *\n+ * \\return The desired height if defined, -1 otherwise\n+ */\n+\n+/**\n+ * \\brief Create a stream role\n+ * \\param[in] role Stream role hint\n+ */\n+StreamRole::StreamRole(Role role)\n+\t: role_(role), width_(-1), height_(-1)\n+{\n+}\n+\n+/**\n+ * \\brief Create a stream role with dimension hints\n+ * \\param[in] role Stream role hint\n+ * \\param[in] width Desired width\n+ * \\param[in] height Desired height\n+ */\n+StreamRole::StreamRole(Role role, int width, int height)\n+\t: role_(role), width_(width), height_(height)\n+{\n+}\n+\n /**\n * \\class Stream\n * \\brief Video stream for a camera\n@@ -78,6 +133,39 @@ namespace libcamera {\n * optimal stream for the task.\n */\n \n+/**\n+ * \\class Stream::StillCapture\n+ * \\brief Describes a still capture role\n+ */\n+Stream::StillCapture::StillCapture()\n+\t: StreamRole(Role::StillCapture)\n+{\n+}\n+\n+/**\n+ * \\class Stream::VideoRecording\n+ * \\brief Describes a video recording role\n+ */\n+Stream::VideoRecording::VideoRecording()\n+\t: StreamRole(Role::VideoRecording)\n+{\n+}\n+\n+/**\n+ * \\class Stream::Viewfinder\n+ * \\brief Describes a viewfinder role\n+ */\n+\n+/**\n+ * \\brief Create a viewfinder role with dimension hints\n+ * \\param[in] width Desired viewfinder width\n+ * \\param[in] height Desired viewfinder height\n+ */\n+Stream::Viewfinder::Viewfinder(int width, int height)\n+\t: StreamRole(Role::Viewfinder, width, height)\n+{\n+}\n+\n /**\n * \\brief Construct a stream with default parameters\n */\n", "prefixes": [ "libcamera-devel", "4/5" ] }