{"id":23741,"url":"https://patchwork.libcamera.org/api/patches/23741/?format=json","web_url":"https://patchwork.libcamera.org/patch/23741/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20250704053424.23718-1-uajain@igalia.com>","date":"2025-07-04T05:34:24","name":"[v3] libcamerasrc: Report camera properties as device properties","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"c20fb5616d5168c8599b80e5121eb8d9ff67bde8","submitter":{"id":232,"url":"https://patchwork.libcamera.org/api/people/232/?format=json","name":"Umang Jain","email":"uajain@igalia.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23741/mbox/","series":[{"id":5270,"url":"https://patchwork.libcamera.org/api/series/5270/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5270","date":"2025-07-04T05:34:24","name":"[v3] libcamerasrc: Report camera properties as device properties","version":3,"mbox":"https://patchwork.libcamera.org/series/5270/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23741/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23741/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 314F0C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  4 Jul 2025 05:34:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 358D968E47;\n\tFri,  4 Jul 2025 07:34:26 +0200 (CEST)","from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2EEA66151C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  4 Jul 2025 07:34:24 +0200 (CEST)","from [49.36.71.127] (helo=uajain)\n\tby fanzine2.igalia.com with esmtpsa \n\t(Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)\n\t(Exim) id 1uXZ41-00CDsS-2H; Fri, 04 Jul 2025 07:34:21 +0200"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=igalia.com header.i=@igalia.com\n\theader.b=\"XLDUPbQn\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com;\n\ts=20170329;\n\th=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:\n\tCc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tIn-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:\n\tList-Post:List-Owner:List-Archive;\n\tbh=OYF8FL3liXDl5wol0af1erJAgzqVxbLUSGw06co+Yhg=;\n\tb=XLDUPbQnfjuObK/5dd/KolbBpW\n\tn+Xv9AKy/XhnhQthDJPOwmfQSMX+LBItQQoFcIN3uJ/vS/YHhk8HGC2C/HmYrn+GuSzeIzuw/LkNU\n\tQYNFCqo+qyZniytfUrjVDOw9oAhtq57LVhOBv7cGTunRAkdc0Pq23XvelUHAYXRFy5KlHB93cg5Wd\n\tUluHRHv69wLF1eWyZNIgRxg08Wj6yZicwX91xrBFUU7vlvnVPTL/ujBDq8wbfFYs7Tp4k+odvbrMN\n\tYBIppzIWGLA+wYt4Eb5RQQWmk3TcoBpMX+BRZc/I2LJcP8XIxCc80iiKHOLEUm+8qNFuPLGsE22P5\n\t/A9HAAuw==;","From":"Umang Jain <uajain@igalia.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Giacomo Cappellini <giacomo.cappellini.87@gmail.com>,\n\tNicolas Dufresne <nicolas@ndufresne.ca>, Umang Jain <uajain@igalia.com>","Subject":"[PATCH v3] libcamerasrc: Report camera properties as device\n\tproperties","Date":"Fri,  4 Jul 2025 11:04:24 +0530","Message-ID":"<20250704053424.23718-1-uajain@igalia.com>","X-Mailer":"git-send-email 2.50.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Iterate over all libcamera camera properties and report them as\ndevice properties. The values are reported as strings, including the ones\nwhich enum types, for better readability.\n\nSigned-off-by: Umang Jain <uajain@igalia.com>\n---\nChanges in v3:\n- Iterate over all camera properties and report everything.\n---\n src/gstreamer/gstlibcameraprovider.cpp | 24 ++++++++++++++++++++++++\n 1 file changed, 24 insertions(+)","diff":"diff --git a/src/gstreamer/gstlibcameraprovider.cpp b/src/gstreamer/gstlibcameraprovider.cpp\nindex 5da96ea3..237baeb2 100644\n--- a/src/gstreamer/gstlibcameraprovider.cpp\n+++ b/src/gstreamer/gstlibcameraprovider.cpp\n@@ -12,6 +12,7 @@\n \n #include <libcamera/camera.h>\n #include <libcamera/camera_manager.h>\n+#include <libcamera/property_ids.h>\n \n #include \"gstlibcamerasrc.h\"\n #include \"gstlibcamera-utils.h\"\n@@ -130,6 +131,7 @@ 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+\tg_autoptr(GstStructure) props = gst_structure_new_empty(\"camera-properties\");\n \tconst gchar *name = camera->id().c_str();\n \n \tstd::unique_ptr<CameraConfiguration> config = camera->generateConfiguration(roles);\n@@ -144,12 +146,34 @@ gst_libcamera_device_new(const std::shared_ptr<Camera> &camera)\n \t\t\tgst_caps_append(caps, sub_caps);\n \t}\n \n+\tfor (const auto &[key, value] : camera->properties()) {\n+\t\tconst ControlId *id = properties::properties.at(key);\n+\n+\t\tg_autoptr(GString) prop_str = g_string_new(\"api.libcamera.\");\n+\t\tg_string_append(prop_str, id->name().c_str());\n+\n+\t\t/* Use string names for enum values for better readability */\n+\t\tif (value.type() == ControlTypeInteger32) {\n+\t\t\tint32_t val = value.get<int32_t>();\n+\t\t\tconst auto &it = id->enumerators().find(val);\n+\t\t\tif (it != id->enumerators().end()) {\n+\t\t\t\tgst_structure_set(props, prop_str->str, G_TYPE_STRING,\n+\t\t\t\t\t\t  it->second.c_str(), nullptr);\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t}\n+\n+\t\tgst_structure_set(props, prop_str->str, G_TYPE_STRING,\n+\t\t\t\t  value.toString().c_str(), nullptr);\n+\t}\n+\n \treturn GST_DEVICE(g_object_new(GST_TYPE_LIBCAMERA_DEVICE,\n \t\t\t\t       /* \\todo Use a unique identifier instead of camera name. */\n \t\t\t\t       \"name\", name,\n \t\t\t\t       \"display-name\", name,\n \t\t\t\t       \"caps\", caps,\n \t\t\t\t       \"device-class\", \"Source/Video\",\n+\t\t\t\t       \"properties\", props,\n \t\t\t\t       nullptr));\n }\n \n","prefixes":["v3"]}