{"id":18612,"url":"https://patchwork.libcamera.org/api/1.1/patches/18612/?format=json","web_url":"https://patchwork.libcamera.org/patch/18612/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230509231542.1123025-1-pobrn@protonmail.com>","date":"2023-05-09T23:15:43","name":"[libcamera-devel,RFC,v3,2/2] libcamera: Remove `StreamRoles` alias","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"7c913770ccd4c17ff18c1a2e843205a234df226b","submitter":{"id":133,"url":"https://patchwork.libcamera.org/api/1.1/people/133/?format=json","name":"Pőcze Barnabás","email":"pobrn@protonmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18612/mbox/","series":[{"id":3871,"url":"https://patchwork.libcamera.org/api/1.1/series/3871/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3871","date":"2023-05-09T23:07:57","name":"[libcamera-devel,RFC,v3,1/2] libcamera: camera: Take span of StreamRole instead of vector","version":3,"mbox":"https://patchwork.libcamera.org/series/3871/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18612/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18612/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 50B7EBE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 May 2023 23:15:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AC348627DE;\n\tWed, 10 May 2023 01:15:57 +0200 (CEST)","from mail-40133.protonmail.ch (mail-40133.protonmail.ch\n\t[185.70.40.133])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7F0CF6053A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 May 2023 01:15:56 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1683674157;\n\tbh=Q5SGRgEPhtMWN2SPPbGsIJpzESVn0Ubfddl+zGF/19Y=;\n\th=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=OrFdIu416QWvrW+6/Fz7cIPTf2nBKx0wTQirItudeuWgS0CygcpbinM+Gk+zngfUQ\n\t/MAD7G/wyIzLtCj2QXorKxZyI/BEey14uOvblmReg2EJgKChZKxslthxr67uEN6L9v\n\tu8CzNwc1c7umXSefnsKq4BN2CCcQNv0FvA8W145FJAAxPzOxoDFnpLLvQrfmbqZeqV\n\tEqsYYcpdQnLiaVLdijs3YhovaDpB1CUqmkCTxE134fn98Pls+m/eug78QCx2YRAbYb\n\tMbethrufyXkjESLpYQVr4XAp7xDbGmEz+UhSTRlaVGk45vWSp5EQluZtx2GtF/2wMr\n\to6EUc6uIj3UTw==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail3; t=1683674155; x=1683933355;\n\tbh=Q8buc6jb6m4PUQwor+bshXFw8BGEUrrnlQorTFHThwg=;\n\th=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date:\n\tSubject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector;\n\tb=kVgWAThewkxe+tTMOKzQqN4pMskxi6c8Be2beoR17nTaDKG6FnoalKdxbS0uhjGPv\n\tnKfv71x9+TnVGA+svxrA9kAa1pxIY9B5m4b7HMiDqbUQApuePMyGcKDIn6mNxhsJMt\n\tXJRQHSnpm1k3J+qfftbE0vw8ClYn3wO0h1zysnBQXpFrrJyKnkj7N5tWRMjp+s8U7r\n\tCUIf7kqZR+cohWhcfB8zKvuvgpnpH2gPPBNenzek1yYtCpnmuY7WW/yRH+keo5yWfv\n\tpuB9KzQj6Y3SK0zQDawjAjpGOaB/K1AoL5XBXI6dCUdQBYWnwMJFMT54cB08XqYzwv\n\t+X7Z/Xe4NK9aw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=protonmail.com\n\theader.i=@protonmail.com\n\theader.b=\"kVgWAThe\"; dkim-atps=neutral","Date":"Tue, 09 May 2023 23:15:43 +0000","To":"libcamera-devel@lists.libcamera.org","Message-ID":"<20230509231542.1123025-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 v3 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, 9 insertions(+), 15 deletions(-)","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..066e397b 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+\tstd::vector<StreamRole> 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..0f16c038 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+\tstd::vector<StreamRole> 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..494f778b 100644\n--- a/src/gstreamer/gstlibcameraprovider.cpp\n+++ b/src/gstreamer/gstlibcameraprovider.cpp\n@@ -6,6 +6,8 @@\n  * gstlibcameraprovider.c - GStreamer Device Provider\n  */\n \n+#include <array>\n+\n #include \"gstlibcameraprovider.h\"\n \n #include <libcamera/camera.h>\n@@ -126,11 +128,10 @@ 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 std::array 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 \t\tGST_ERROR(\"Failed to generate a default configuration for %s\", name);\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","v3","2/2"]}