Patch Detail
Show a patch.
GET /api/1.1/patches/17670/?format=api
{ "id": 17670, "url": "https://patchwork.libcamera.org/api/1.1/patches/17670/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17670/", "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": "<20221024000356.29521-8-laurent.pinchart@ideasonboard.com>", "date": "2022-10-24T00:03:50", "name": "[libcamera-devel,v3,07/13] libcamera: stream: Turn StreamRole into scoped enumeration", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "805da2aa693c24e8b7e6b12740fcbdb5462f317a", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/17670/mbox/", "series": [ { "id": 3574, "url": "https://patchwork.libcamera.org/api/1.1/series/3574/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3574", "date": "2022-10-24T00:03:43", "name": "Add Bayer format support for RkISP1", "version": 3, "mbox": "https://patchwork.libcamera.org/series/3574/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17670/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17670/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 E51F1C3288\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Oct 2022 00:04:36 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 428DF62EFB;\n\tMon, 24 Oct 2022 02:04:36 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2486862ED2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Oct 2022 02:04:31 +0200 (CEST)", "from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AD78688F;\n\tMon, 24 Oct 2022 02:04:30 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1666569876;\n\tbh=k92pDEMlNvueNxJ8zWmi/V9ZAkb7fwWyqiJALyBlU/A=;\n\th=To:Date: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=P1GF471sa4HehrPlYudma2RPzxh11tSDZZKBOnjaPazFN7q6Qlm7T6lcii8odDe9L\n\tw3a8d4jKZIuR+F0eJqaDq3q4mfvQ5MUoQBONZbvJLMEZ+TR/sWDazKGFAgojp4GRTq\n\tQ8arz7lfTLAB1jI8NcVu2IGLJoN0oSXlsC2vHQUI11KDVDWpJPe6Hsn0pF83nZWYLa\n\tVAQRILkv0IhmQOvZBSgrUi2BHfFrb/r6KAwpyNhnCkLWOMWIh7Mru0xkNwwnbRSpGe\n\tjQhilTXRpxgXM6xoX6cQbmt83eXcPPqXArjL1rsNSoicSp8ZRItU9ySbzocpGgSRCn\n\tQDjCLi5fdc3TA==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1666569870;\n\tbh=k92pDEMlNvueNxJ8zWmi/V9ZAkb7fwWyqiJALyBlU/A=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=fiFW0fhNZEW+GFkfCITCNr/kiKOrAFin6i/h2mLJ1NfKnFnIhL3bE5byEyooWKGAE\n\tzlWh8Ya8v+F4QUGBDNRhUmZ8psmIOLZL4zuV8thQreMgWO4T8JPhx6UFTIxJlr67sl\n\tvp9/fgLQFhn1FJPJM03CiJyt1d82FIesJ7FNfg2k=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"fiFW0fhN\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 24 Oct 2022 03:03:50 +0300", "Message-Id": "<20221024000356.29521-8-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.37.4", "In-Reply-To": "<20221024000356.29521-1-laurent.pinchart@ideasonboard.com>", "References": "<20221024000356.29521-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 07/13] libcamera: stream: Turn\n\tStreamRole into scoped enumeration", "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": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The StreamRole enum has enumerators such as 'Raw' that are too generic\nto be in the global libcamera namespace. Turn it into a scoped enum to\navoid namespace clashes, and update users accordingly.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/stream.h | 2 +-\n src/apps/lc-compliance/capture_test.cpp | 17 ++++++++++++-----\n src/gstreamer/gstlibcamerapad.cpp | 20 +++++++++++++++-----\n 3 files changed, 28 insertions(+), 11 deletions(-)", "diff": "diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\nindex efec695ad317..29235ddf0d8a 100644\n--- a/include/libcamera/stream.h\n+++ b/include/libcamera/stream.h\n@@ -62,7 +62,7 @@ private:\n \tStreamFormats formats_;\n };\n \n-enum StreamRole {\n+enum class StreamRole {\n \tRaw,\n \tStillCapture,\n \tVideoRecording,\ndiff --git a/src/apps/lc-compliance/capture_test.cpp b/src/apps/lc-compliance/capture_test.cpp\nindex 52578207c11f..1dcfcf92fc8c 100644\n--- a/src/apps/lc-compliance/capture_test.cpp\n+++ b/src/apps/lc-compliance/capture_test.cpp\n@@ -16,7 +16,12 @@\n using namespace libcamera;\n \n const std::vector<int> NUMREQUESTS = { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 };\n-const std::vector<StreamRole> ROLES = { Raw, StillCapture, VideoRecording, Viewfinder };\n+const std::vector<StreamRole> ROLES = {\n+\tStreamRole::Raw,\n+\tStreamRole::StillCapture,\n+\tStreamRole::VideoRecording,\n+\tStreamRole::Viewfinder\n+};\n \n class SingleStream : public testing::TestWithParam<std::tuple<StreamRole, int>>\n {\n@@ -54,10 +59,12 @@ void SingleStream::TearDown()\n \n std::string SingleStream::nameParameters(const testing::TestParamInfo<SingleStream::ParamType> &info)\n {\n-\tstd::map<StreamRole, std::string> rolesMap = { { Raw, \"Raw\" },\n-\t\t\t\t\t\t { StillCapture, \"StillCapture\" },\n-\t\t\t\t\t\t { VideoRecording, \"VideoRecording\" },\n-\t\t\t\t\t\t { Viewfinder, \"Viewfinder\" } };\n+\tstd::map<StreamRole, std::string> rolesMap = {\n+\t\t{ StreamRole::Raw, \"Raw\" },\n+\t\t{ StreamRole::StillCapture, \"StillCapture\" },\n+\t\t{ StreamRole::VideoRecording, \"VideoRecording\" },\n+\t\t{ StreamRole::Viewfinder, \"Viewfinder\" }\n+\t};\n \n \tstd::string roleName = rolesMap[std::get<0>(info.param)];\n \tstd::string numRequestsName = std::to_string(std::get<1>(info.param));\ndiff --git a/src/gstreamer/gstlibcamerapad.cpp b/src/gstreamer/gstlibcamerapad.cpp\nindex 87b4057ac101..9e710a479368 100644\n--- a/src/gstreamer/gstlibcamerapad.cpp\n+++ b/src/gstreamer/gstlibcamerapad.cpp\n@@ -54,7 +54,7 @@ gst_libcamera_pad_get_property(GObject *object, guint prop_id, GValue *value,\n \n \tswitch (prop_id) {\n \tcase PROP_STREAM_ROLE:\n-\t\tg_value_set_enum(value, self->role);\n+\t\tg_value_set_enum(value, static_cast<gint>(self->role));\n \t\tbreak;\n \tdefault:\n \t\tG_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);\n@@ -87,9 +87,19 @@ gst_libcamera_stream_role_get_type()\n {\n \tstatic GType type = 0;\n \tstatic const GEnumValue values[] = {\n-\t\t{ StillCapture, \"libcamera::StillCapture\", \"still-capture\" },\n-\t\t{ VideoRecording, \"libcamera::VideoRecording\", \"video-recording\" },\n-\t\t{ Viewfinder, \"libcamera::Viewfinder\", \"view-finder\" },\n+\t\t{\n+\t\t\tstatic_cast<gint>(StreamRole::StillCapture),\n+\t\t\t\"libcamera::StillCapture\",\n+\t\t\t\"still-capture\",\n+\t\t}, {\n+\t\t\tstatic_cast<gint>(StreamRole::VideoRecording),\n+\t\t\t\"libcamera::VideoRecording\",\n+\t\t\t\"video-recording\",\n+\t\t}, {\n+\t\t\tstatic_cast<gint>(StreamRole::Viewfinder),\n+\t\t\t\"libcamera::Viewfinder\",\n+\t\t\t\"view-finder\",\n+\t\t},\n \t\t{ 0, NULL, NULL }\n \t};\n \n@@ -110,7 +120,7 @@ gst_libcamera_pad_class_init(GstLibcameraPadClass *klass)\n \tauto *spec = g_param_spec_enum(\"stream-role\", \"Stream Role\",\n \t\t\t\t \"The selected stream role\",\n \t\t\t\t gst_libcamera_stream_role_get_type(),\n-\t\t\t\t VideoRecording,\n+\t\t\t\t static_cast<gint>(StreamRole::VideoRecording),\n \t\t\t\t (GParamFlags)(GST_PARAM_MUTABLE_READY\n \t\t\t\t\t | G_PARAM_CONSTRUCT\n \t\t\t\t\t\t | G_PARAM_READWRITE\n", "prefixes": [ "libcamera-devel", "v3", "07/13" ] }