From patchwork Fri May 27 14:44:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 16071 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 D15CEBD161 for ; Fri, 27 May 2022 14:45:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EADB765635; Fri, 27 May 2022 16:45:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1653662707; bh=UdfGxcTC66zKnh/iR0ZLmCOCPQ5KYci6a7XFvvdpYYA=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=b3ob+lLfQ+drJleUPUsXdPJ/4WdYyCL3ISvQjV/jRrI2yjcpzXe/2z4Y3fT4MXOiZ qsRdFHviQoYcctOQQ0rWLmzcHd7MVVxMd2vLilUc43n1pVySiCo1nXrQL1Ba/pLIKw ra5LH+SaY1/OrKXtC95axycyZqu/BUCkbiwq5rEKaYCSbjCoo/Fbxc3GTTef7sk9m8 mobha0DPQcfiYKuZPRYoQPcjsDDQmuSEFwN5WNVKDArkNhS7fydRyWtMQvxNr4TFHP FxN3XIE2TbHD8XcoUoM4Hs50tTxSuAa2Zw2Kpf/5OfJt6/uT2wgbniQUuYWE2DaC7S srUbgdCUqyp/g== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 06EB4633A2 for ; Fri, 27 May 2022 16:45:05 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="XlgMSYq/"; dkim-atps=neutral Received: from deskari.lan (91-156-85-209.elisa-laajakaista.fi [91.156.85.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EFA3A32A; Fri, 27 May 2022 16:45:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1653662704; bh=UdfGxcTC66zKnh/iR0ZLmCOCPQ5KYci6a7XFvvdpYYA=; h=From:To:Cc:Subject:Date:From; b=XlgMSYq/8b30penSPDKvXaWbXFrKbspvsGyaIilAfLnZF7XFjf92PVXgjFoKp6WwL 8gG/dnR1dHtQG7/dPjucnGH/A3XUa2ohmY7A288pe7xDAIyiVs4tqQmoludf38PZjO j9fpDcCt5k13m+3PjUj06m9R8e2xZJnN46bMH/ug= To: libcamera-devel@lists.libcamera.org, David Plowman , Kieran Bingham , Laurent Pinchart , Jacopo Mondi Date: Fri, 27 May 2022 17:44:17 +0300 Message-Id: <20220527144447.94891-1-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 00/30] More misc Python patches 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: , X-Patchwork-Original-From: Tomi Valkeinen via libcamera-devel From: Tomi Valkeinen Reply-To: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi, This series just seems to grow... Main changes to v2: - Fixed, I hope, all the comments from Laurent - --mode option for gen-py-controls.py - Fixed the missing call to init_py_properties_generated() - Added a bunch of new patches I've moved the examples on top of all the other patches. I added simple-cam.py, which is a copy of the .cpp version. I still like the simple-capture.py and simple-continuous-capture.py, though. simple-capture.py is very simple, but it does all the work in a single main function, and should be a good way to get familiar with the concepts even if it's perhaps not useful in the real life. simple-continuous-capture.py takes it further and makes it more realistic, but also more complex as it adds a few functions, also handles keyboard input, adds a class to store the context, etc. simple-continuous-capture.py and simple-cam.py are somewhat different, as the simple-cam.py follows the .cpp version as strictly as it can, whereas in simple-continuous-capture.py we use the nice extra stuff from Python. I didn't really touch itest.py much. We can leave that out for the time being, although I find myself using it often. Tomi Tomi Valkeinen (30): py: Generate pixel formats list py: cam_qt: Use libcamera.formats py: cam: Cleanups py: Fix SceneFlicker enum values py: Fix None value in ControlType enum py: Add CameraManager.read_event() py: Move MappedFrameBuffer to libcamera.utils py: MappedFrameBuffer: Add type hints & docs py: cam: Drop WA_ShowWithoutActivating py: cam: Convert ctx and state to classes py: Add README.md py: Re-implement controls geneneration py: Re-structure the controls API py: Rename 'efd' to 'event_fd' py: Generate bindings for properties py: Use ln --relative to create symlinks py: unittests: Fix test_sleep() py: unittests: Fix test_select() py: cam: Move conversion funcs to helpers.py py: cam: Drop PIL dependency py: Add Request.__str__() py: Add FrameMetadataPlane py: Implement FrameBufferPlane py: MappedFrameBuffer: Support non-contextmanager use py: MappedFrameBuffer: Add 'fb' property py: cam: cam_qt: mmap the fbs only once py: examples: Add simple-capture.py py: examples: Add simple-continuous-capture.py py: examples: Add itest.py py: examples: Add simple-cam.py src/py/README.md | 60 ++ src/py/cam/cam.py | 583 +++++++++--------- src/py/cam/cam_kms.py | 20 +- src/py/cam/cam_null.py | 10 +- src/py/cam/cam_qt.py | 259 ++------ src/py/cam/cam_qtgl.py | 34 +- src/py/cam/{cam_qt.py => helpers.py} | 178 +----- src/py/examples/itest.py | 197 ++++++ src/py/examples/simple-cam.py | 352 +++++++++++ src/py/examples/simple-capture.py | 159 +++++ src/py/examples/simple-continuous-capture.py | 201 ++++++ src/py/libcamera/__init__.py | 80 --- ...py-control-enums.py => gen-py-controls.py} | 46 +- src/py/libcamera/gen-py-formats.py | 56 ++ src/py/libcamera/meson.build | 46 +- ...ed.cpp.in => py_controls_generated.cpp.in} | 17 +- src/py/libcamera/py_enums.cpp | 2 +- ...ted.cpp.in => py_formats_generated.cpp.in} | 14 +- src/py/libcamera/py_main.cpp | 184 +++--- .../libcamera/py_properties_generated.cpp.in | 30 + .../MappedFrameBuffer.py} | 61 +- src/py/libcamera/utils/__init__.py | 4 + test/py/unittests.py | 21 +- 23 files changed, 1691 insertions(+), 923 deletions(-) create mode 100644 src/py/README.md copy src/py/cam/{cam_qt.py => helpers.py} (51%) create mode 100755 src/py/examples/itest.py create mode 100755 src/py/examples/simple-cam.py create mode 100755 src/py/examples/simple-capture.py create mode 100755 src/py/examples/simple-continuous-capture.py rename src/py/libcamera/{gen-py-control-enums.py => gen-py-controls.py} (60%) create mode 100755 src/py/libcamera/gen-py-formats.py copy src/py/libcamera/{py_control_enums_generated.cpp.in => py_controls_generated.cpp.in} (50%) rename src/py/libcamera/{py_control_enums_generated.cpp.in => py_formats_generated.cpp.in} (56%) create mode 100644 src/py/libcamera/py_properties_generated.cpp.in copy src/py/libcamera/{__init__.py => utils/MappedFrameBuffer.py} (56%) create mode 100644 src/py/libcamera/utils/__init__.py