Patch Detail
Show a patch.
GET /api/1.1/patches/18600/?format=api
{ "id": 18600, "url": "https://patchwork.libcamera.org/api/1.1/patches/18600/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18600/", "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": "<20230503124725.200550-2-pobrn@protonmail.com>", "date": "2023-05-03T12:47:34", "name": "[libcamera-devel,RFC,v2,2/2] libcamera: Remove `StreamRoles` alias", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "767e9c8c4f0533892cf2578bb1bccc75688fe3db", "submitter": { "id": 133, "url": "https://patchwork.libcamera.org/api/1.1/people/133/?format=api", "name": "Pőcze Barnabás", "email": "pobrn@protonmail.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18600/mbox/", "series": [ { "id": 3864, "url": "https://patchwork.libcamera.org/api/1.1/series/3864/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3864", "date": "2023-05-03T12:47:28", "name": "[libcamera-devel,RFC,v2,1/2] libcamera: camera: Take span of StreamRole instead of vector", "version": 2, "mbox": "https://patchwork.libcamera.org/series/3864/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18600/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18600/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 39DBAC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 3 May 2023 12:47:50 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E9965633A8;\n\tWed, 3 May 2023 14:47:49 +0200 (CEST)", "from mail-40134.protonmail.ch (mail-40134.protonmail.ch\n\t[185.70.40.134])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E69E2627DE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 3 May 2023 14:47:47 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1683118069;\n\tbh=muMmIr3pG6Bpf1aB1ZYXkNTCMMxDFYKnSZlVQaVwvR0=;\n\th=Date:To:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=gceUnlNkoJdsPYP3GG4id4A7fooyfFBV09W8OoEef9jZNzwVrSj3fjYXORLqBMcyT\n\t1deQ5HLbgcJt32MlmDQHLVcWN3LHR9H5xBG6f233nSkMPK2kB6/klk2GiIkcX20/pS\n\tdkE2d2SzEYu1nkjtAXLCuzzpmhOKkVH5YRWWSk6JqeU3xamz2m6tFTAUnRFqnUpBl7\n\tYqWSrAMNcICNLMfvYqBvdDHQAh97jKWGOJkRNwdRQCcyTwQsMLr+fTpQqBS4e5ChGP\n\tZfj6gI4dgV5UhrQ9fIeVSReT+82yn1/73E4wPglpiLgycDcQ4p30J7s94MLFo0t7b7\n\t/6uuWgvatl42w==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail3; t=1683118066; x=1683377266;\n\tbh=QvnxbmHOT4DMMa5+YSlhrUKT9DyTFBq4cP41MvtJMMU=;\n\th=Date:To:From:Subject:Message-ID:In-Reply-To:References:\n\tFeedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:\n\tMessage-ID:BIMI-Selector;\n\tb=nRj7g2Q2JsKqdvSuG7jRbMnP0sVXcMkkUtIcF5zPEnh7tRmY2A/CgQ+FZnT403+hY\n\tx+Ej2b8OobVsBpiClGlKiefiSPTGPZMMozwHnFJhNJ2t1/7++Y+EyHWeu/UTZYGktV\n\tQC+s8vBLETVWPmflXuxFaHvOE1rQ+MxX8Q7EPMrWsbEY24ya1O7lfJGrU2tonWFqd0\n\tpM5EHkFew60ttPYGza/vIT4uSdLxynEfuTY6yddfZ5x+GkHCOskdj+zVynbzcQvEp7\n\tvA0s3g9+2gbS2pnoWBKbf5WB7yVkFfSfjgXJyegCWFDXnRmh+3R753Csy+Hakmra2U\n\tDQDz86Cot2aBQ==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=protonmail.com\n\theader.i=@protonmail.com\n\theader.b=\"nRj7g2Q2\"; dkim-atps=neutral", "Date": "Wed, 03 May 2023 12:47:34 +0000", "To": "libcamera-devel@lists.libcamera.org", "Message-ID": "<20230503124725.200550-2-pobrn@protonmail.com>", "In-Reply-To": "<20230503124725.200550-1-pobrn@protonmail.com>", "References": "<20230503124725.200550-1-pobrn@protonmail.com>", "Feedback-ID": "20568564:user:proton", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=utf-8", "Content-Transfer-Encoding": "quoted-printable", "Subject": "[libcamera-devel] [RFC PATCH v2 2/2] libcamera: Remove\n\t`StreamRoles` alias", "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>", "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze_via_libcamera-devel?=\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Now that `Camera::generateConfiguration()` takes a `libcamera::Span`\nof `StreamRole`, remove the `StreamRoles` type, which was an alias\nto `std::vector<libcamera::StreamRole>`.\n\nThe removal has two reasons:\n - it is no longer strictly necessary,\n - its presence may suggest that that is the preferred (or correct)\n way to build/pass a list of `StreamRole`.\n\nSigned-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n---\n include/libcamera/stream.h | 2 --\n src/apps/cam/camera_session.cpp | 2 +-\n src/apps/common/stream_options.cpp | 4 ++--\n src/apps/common/stream_options.h | 2 +-\n src/apps/qcam/main_window.cpp | 2 +-\n src/gstreamer/gstlibcameraprovider.cpp | 5 ++---\n src/gstreamer/gstlibcamerasrc.cpp | 2 +-\n src/libcamera/stream.cpp | 5 -----\n 8 files changed, 8 insertions(+), 16 deletions(-)\n\n--\n2.40.1", "diff": "diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\nindex 29235ddf..4e94187d 100644\n--- a/include/libcamera/stream.h\n+++ b/include/libcamera/stream.h\n@@ -69,8 +69,6 @@ enum class StreamRole {\n \tViewfinder,\n };\n\n-using StreamRoles = std::vector<StreamRole>;\n-\n std::ostream &operator<<(std::ostream &out, StreamRole role);\n\n class Stream\ndiff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp\nindex 8fcec630..ecca2a97 100644\n--- a/src/apps/cam/camera_session.cpp\n+++ b/src/apps/cam/camera_session.cpp\n@@ -55,7 +55,7 @@ CameraSession::CameraSession(CameraManager *cm,\n \t\treturn;\n \t}\n\n-\tStreamRoles roles = StreamKeyValueParser::roles(options_[OptStream]);\n+\tauto roles = StreamKeyValueParser::roles(options_[OptStream]);\n\n \tstd::unique_ptr<CameraConfiguration> config =\n \t\tcamera_->generateConfiguration(roles);\ndiff --git a/src/apps/common/stream_options.cpp b/src/apps/common/stream_options.cpp\nindex 19dfe051..663b979a 100644\n--- a/src/apps/common/stream_options.cpp\n+++ b/src/apps/common/stream_options.cpp\n@@ -40,7 +40,7 @@ KeyValueParser::Options StreamKeyValueParser::parse(const char *arguments)\n \treturn options;\n }\n\n-StreamRoles StreamKeyValueParser::roles(const OptionValue &values)\n+std::vector<StreamRole> StreamKeyValueParser::roles(const OptionValue &values)\n {\n \t/* If no configuration values to examine default to viewfinder. */\n \tif (values.empty())\n@@ -48,7 +48,7 @@ StreamRoles StreamKeyValueParser::roles(const OptionValue &values)\n\n \tconst std::vector<OptionValue> &streamParameters = values.toArray();\n\n-\tStreamRoles roles;\n+\tstd::vector<StreamRole> roles;\n \tfor (auto const &value : streamParameters) {\n \t\t/* If a role is invalid default it to viewfinder. */\n \t\troles.push_back(parseRole(value.toKeyValues()).value_or(StreamRole::Viewfinder));\ndiff --git a/src/apps/common/stream_options.h b/src/apps/common/stream_options.h\nindex fe298c84..a5f3bde0 100644\n--- a/src/apps/common/stream_options.h\n+++ b/src/apps/common/stream_options.h\n@@ -20,7 +20,7 @@ public:\n\n \tKeyValueParser::Options parse(const char *arguments) override;\n\n-\tstatic libcamera::StreamRoles roles(const OptionValue &values);\n+\tstatic std::vector<libcamera::StreamRole> roles(const OptionValue &values);\n \tstatic int updateConfiguration(libcamera::CameraConfiguration *config,\n \t\t\t\t const OptionValue &values);\n\ndiff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp\nindex 680668df..0b123d40 100644\n--- a/src/apps/qcam/main_window.cpp\n+++ b/src/apps/qcam/main_window.cpp\n@@ -362,7 +362,7 @@ void MainWindow::toggleCapture(bool start)\n */\n int MainWindow::startCapture()\n {\n-\tStreamRoles roles = StreamKeyValueParser::roles(options_[OptStream]);\n+\tauto roles = StreamKeyValueParser::roles(options_[OptStream]);\n \tint ret;\n\n \t/* Verify roles are supported. */\ndiff --git a/src/gstreamer/gstlibcameraprovider.cpp b/src/gstreamer/gstlibcameraprovider.cpp\nindex 6eb0a0eb..332837e4 100644\n--- a/src/gstreamer/gstlibcameraprovider.cpp\n+++ b/src/gstreamer/gstlibcameraprovider.cpp\n@@ -126,13 +126,12 @@ gst_libcamera_device_class_init(GstLibcameraDeviceClass *klass)\n static GstDevice *\n gst_libcamera_device_new(const std::shared_ptr<Camera> &camera)\n {\n+\tstatic const StreamRole roles[] = { StreamRole::VideoRecording };\n \tg_autoptr(GstCaps) caps = gst_caps_new_empty();\n \tconst gchar *name = camera->id().c_str();\n-\tStreamRoles roles;\n\n-\troles.push_back(StreamRole::VideoRecording);\n \tstd::unique_ptr<CameraConfiguration> config = camera->generateConfiguration(roles);\n-\tif (!config || config->size() != roles.size()) {\n+\tif (!config || config->size() != std::size(roles)) {\n \t\tGST_ERROR(\"Failed to generate a default configuration for %s\", name);\n \t\treturn nullptr;\n \t}\ndiff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nindex a10cbd4f..46a5400e 100644\n--- a/src/gstreamer/gstlibcamerasrc.cpp\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -468,7 +468,7 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread,\n \tGST_DEBUG_OBJECT(self, \"Streaming thread has started\");\n\n \tgint stream_id_num = 0;\n-\tStreamRoles roles;\n+\tstd::vector<StreamRole> roles;\n \tfor (GstPad *srcpad : state->srcpads_) {\n \t\t/* Create stream-id and push stream-start. */\n \t\tg_autofree gchar *stream_id_intermediate = g_strdup_printf(\"%i%i\", state->group_id_, stream_id_num++);\ndiff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\nindex 67f30815..272222b7 100644\n--- a/src/libcamera/stream.cpp\n+++ b/src/libcamera/stream.cpp\n@@ -436,11 +436,6 @@ std::ostream &operator<<(std::ostream &out, StreamRole role)\n \treturn out;\n }\n\n-/**\n- * \\typedef StreamRoles\n- * \\brief A vector of StreamRole\n- */\n-\n /**\n * \\class Stream\n * \\brief Video stream for a camera\n", "prefixes": [ "libcamera-devel", "RFC", "v2", "2/2" ] }