From patchwork Mon Aug 5 09:28:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaslo Ziska X-Patchwork-Id: 20766 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 612B1C323E for ; Mon, 5 Aug 2024 10:01:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 02EE663381; Mon, 5 Aug 2024 12:01:28 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ziska.de header.i=@ziska.de header.b="oRdu1bpQ"; dkim=permerror (0-bit key) header.d=ziska.de header.i=@ziska.de header.b="3YkZL12b"; dkim-atps=neutral Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [81.169.146.220]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0A26D6195D for ; Mon, 5 Aug 2024 12:01:25 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; t=1722852085; cv=none; d=strato.com; s=strato-dkim-0002; b=b+5CmOBwXQSyhTGBXWaVwYgI3kCtZ/ucjf9X96VAI5oIrt4qrpepUu8CoYve7rKRQx hGNi3N0pV5J6QFpyqOclun2ca76XoZLM96gX67JkQRY3ch+S7+OO4vfHrHdH6KCD0jNp GYZ2HL+Aun3+0hu/nzALcP1z/IwUgrvxTSavYIH/O6IN2p7QPuD/HGLXtzpuB5yfCnTL pRIez7VBXnR6j8JQiAinV5iPskqp8LgZ3VgoUxzo1XmJvfcmLyoS4uHWZFX5GWEyDCp/ qSA6hiF08IX5QZ4eeRwBMp3EIej89His0JM58TCJJp07YdtaQ4BDFxEaIxM6lIK/WAbe z/AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1722852085; s=strato-dkim-0002; d=strato.com; h=Message-ID:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=24DLTWZXo9MM+0T8TFbDm12aSRixjW86qmFpVnU+fiA=; b=e/Ii7FznGI5vZqNPttvXCryQlF93tZIXs4ab+Awx8B7zDAU5FSNzs7M1I1CxGsuSmN e/l8U1mvb5hyK05V/NEavXMaRt6IVwlKygdRMcI9AgzyXWsajhT4WujhaCtWDk14mUZj pBdeUPpOUO+nMDx98y30hJO6i0kp8X019ELobLveRfreDt6izr6Cuy2At+E+lGuhInFN AYiL1pQpBnnhcBBgMHLTpmeNyznmit6U4n5ly6+vuKKFFMltFU3wW9ck64IyNI0qhDOv fj99PEIvA5zDrSin8829kXpZpEtEVbnZMmD67Sl6Tg29EMzPEcHVH0WhKXlPs9KWNHfE V1jg== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1722852085; s=strato-dkim-0002; d=ziska.de; h=Message-ID:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=24DLTWZXo9MM+0T8TFbDm12aSRixjW86qmFpVnU+fiA=; b=oRdu1bpQmXZB1qFOPbzV6Lk91GEvf04bX767Nw6LLesNSxUOtWI344YnLjlTUn0iS8 ffVtFyeyincy11oI1eX8GMZwXzJPmBz5yhQcQP/ZaDQ6WDMI3RjFF1ZgFZYJ0LJchS7Z hPzZ4Y/Or2CPD5L5dOL3TlhTIc6igpHiUSFMofQZ5vGn/uHII+nwiWEMC8Hqp+m/9aE1 718GjmAcUOCl35G0tMi8qdD9prY38c8LnXrzi2dpQNXTey5ZPQUyYkyGQ0aLgPE+t8No nHVLVyu+LyG5x0HdRh83o9+oQDMTqlimpg0iXSpElRiwhREF2AkE55nw8VhZ1W8iwlPk IUtQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1722852085; s=strato-dkim-0003; d=ziska.de; h=Message-ID:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=24DLTWZXo9MM+0T8TFbDm12aSRixjW86qmFpVnU+fiA=; b=3YkZL12blxs7eQM0sxbGj5h4ddUHtD4+Tx4nVfJiS7zICA9syLD10KRyHAc47BRqVJ koJXTObPVrMKuVpYRABQ== X-RZG-AUTH: ":Jm0XeU+IYfb0x77LHmrjN5Wlb7TBwusDqIM6Hizy8VdfzvKi4yoFC9cCg4qxBvJaP2L5sFjJoIK+3CsR3+pCW/FVb/tK" Received: from archlinux.fritz.box by smtp.strato.de (RZmta 51.1.0 AUTH) with ESMTPSA id zb9f0a075A1Pvk8 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 5 Aug 2024 12:01:25 +0200 (CEST) From: Jaslo Ziska To: libcamera-devel@lists.libcamera.org Cc: Jaslo Ziska Subject: [PATCH 0/3] gstreamer: Generate controls from control_ids_*.yaml files Date: Mon, 5 Aug 2024 11:28:35 +0200 Message-ID: <20240805100038.11972-1-jaslo@ziska.de> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi everyone, in this patchset I implemented libcamerasrc properties which are generated from the control_ids_*.yaml files. The first commit removes the auto-focus-mode property which was already implemented (it is added again in the next commit). The second commit adds a Python script to generate C++ code capable of interacting with the controls and adds the controls to libcamerasrc. The third commit is just a small fix for the missing closing "greater than" symbol in the author string I noticed. The gstlibcamera-controls.h file is taken from Nicolas' branch with the change that I removed the enum with the control names from the class. Instead the enum variants from libcamera::controls:: are now used directly. The structure of the gstlibcamera-controls.cpp.in file is also taken from Nicolas. The only change is that its content now gets generated by gen-gst-controls.py The boilerplate of gen-gst-controls.py is mostly copied from gen-controls.py. This is also where I have some questions: The definition of the ControlEnum and Control Python classes (and some helper functions) is now duplicate code. Should this be handled differently somehow to avoid the code duplication? I haven't added a copyright to gen-gst-controls.py yet as I am not sure because I copied much of it from gen-controls.py. Another small issue is that I haven't implemented the Rectangle type yet and thus the controls using it won't show up. The reason for this is that there is the AfWindows control which is an array of Rectangles. As the gstreamer properties can only be glib types I wasn't sure what to do here: For a single Rectangle you could use an array and make the entries (x, y, w, h) but what about an array of Rectangles? Should it use an array with 4 * N entries, so (x, y, w, h) for each value? At the moment the gstreamer properties all have zero (or the first enum value) as a default and the minimum and maximum numeric values as minimum and maximum values for numbers. Also all controls are defined as readable and writeable. Because of this (maybe as a discussion) I have a small wish list of things I'd like to see added in the control_ids_*.yaml files which would greatly improve the gstreamer properties: For enum and bool controls: the default value if available. For numeric controls: the minimum, maximum and default value. And for all controls: whether it is read-only, write-only or read-write. Best regards, Jaslo Jaslo Ziska (3): gstreamer: Remove auto-focus-mode property gstreamer: Generate controls from control_ids_*.yaml files gstreamer: Fix missing "greater than" symbol in author string src/gstreamer/gstlibcamera-controls.cpp.in | 46 +++ src/gstreamer/gstlibcamera-controls.h | 36 ++ src/gstreamer/gstlibcamerasrc.cpp | 47 +-- src/gstreamer/meson.build | 14 + utils/gen-gst-controls.py | 398 +++++++++++++++++++++ utils/meson.build | 1 + 6 files changed, 510 insertions(+), 32 deletions(-) create mode 100644 src/gstreamer/gstlibcamera-controls.cpp.in create mode 100644 src/gstreamer/gstlibcamera-controls.h create mode 100755 utils/gen-gst-controls.py --- 2.46.0