From patchwork Fri Feb 4 13:38:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 15327 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 3BCFDBDCBF for ; Fri, 4 Feb 2022 13:38:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 83693609F6; Fri, 4 Feb 2022 14:38:43 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Yri9bPU4"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6B1E56020C for ; Fri, 4 Feb 2022 14:38:42 +0100 (CET) Received: from deskari.lan (91-156-85-209.elisa-laajakaista.fi [91.156.85.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A45D0472; Fri, 4 Feb 2022 14:38:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1643981922; bh=n69/mWY540t5Tiu7OD36mU8FzcChVTaHIzHUvJQavFI=; h=From:To:Cc:Subject:Date:From; b=Yri9bPU4rmC9/X2s+ZceLN6+X0wJb8bF6GW8yXDwK4n0jl+fsxiJkhlvaQWWKVYGF 07VRyhmcWivvOiO66+QdYhx2tjLnHdROkMgnXUh4FZrT7KWS8LQpKWr9zvfKmRMIRz wzXhaBdNg+85IWamt2B1ukW3ZSheCbMSbTVfz6uI= From: Tomi Valkeinen To: libcamera-devel@lists.libcamera.org, David Plowman , Kieran Bingham , Laurent Pinchart Date: Fri, 4 Feb 2022 15:38:09 +0200 Message-Id: <20220204133814.303217-1-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 0/5] Python bindings 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, v4 of the RFC. I'm still not calling this "PATCH" due to the two hacks in the series. I have not had too much time to work on this, but I wanted to fix the easy ones. Changes in this version: - Add unittests.py - Move cam.py files under a separate dir - Rename the python module to "libcamera" - Support array controls - Rename StreamConfiguration.fmt to pixelFormat - Cosmetic changes all around - Rebased to latest master (and fixed the issues) The two major issues not solved are related to the two HACK patches in the series. I don't have a good solution for the Camera destructor issue, although I did add a link to a pybind11 pull request which does fix it. The other issue, exposing Camera from Request, should be fixable, but needs a real amount of work. I have tested this only on my PC. Unfortunately I wasn't able to run libcamera on RPi anymore. I guess I need a custom built kernel now? Tomi Tomi Valkeinen (5): HACK: libcamera: Camera public destructor HACK: libcamera: Request: expose Camera from Request Add Python bindings py: add unittests.py py: Add cam.py include/libcamera/camera.h | 2 +- include/libcamera/request.h | 2 + meson.build | 1 + meson_options.txt | 5 + src/libcamera/request.cpp | 5 + src/meson.build | 1 + src/py/cam/cam.py | 461 +++++++++++++++++++++++++++++++++++ src/py/cam/cam_kms.py | 183 ++++++++++++++ src/py/cam/cam_null.py | 46 ++++ src/py/cam/cam_qt.py | 355 +++++++++++++++++++++++++++ src/py/cam/cam_qtgl.py | 386 +++++++++++++++++++++++++++++ src/py/cam/gl_helpers.py | 67 +++++ src/py/libcamera/__init__.py | 10 + src/py/libcamera/meson.build | 41 ++++ src/py/libcamera/pymain.cpp | 440 +++++++++++++++++++++++++++++++++ src/py/meson.build | 1 + src/py/test/unittests.py | 366 +++++++++++++++++++++++++++ subprojects/.gitignore | 3 +- subprojects/pybind11.wrap | 12 + 19 files changed, 2385 insertions(+), 2 deletions(-) create mode 100755 src/py/cam/cam.py create mode 100644 src/py/cam/cam_kms.py create mode 100644 src/py/cam/cam_null.py create mode 100644 src/py/cam/cam_qt.py create mode 100644 src/py/cam/cam_qtgl.py create mode 100644 src/py/cam/gl_helpers.py create mode 100644 src/py/libcamera/__init__.py create mode 100644 src/py/libcamera/meson.build create mode 100644 src/py/libcamera/pymain.cpp create mode 100644 src/py/meson.build create mode 100755 src/py/test/unittests.py create mode 100644 subprojects/pybind11.wrap