{"id":18361,"url":"https://patchwork.libcamera.org/api/covers/18361/?format=json","web_url":"https://patchwork.libcamera.org/cover/18361/","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":"<20230309142601.70556-1-tomi.valkeinen@ideasonboard.com>","date":"2023-03-09T14:25:46","name":"[libcamera-devel,v4,00/15] py: New python bindings event handling","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/?format=json","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/cover/18361/mbox/","series":[{"id":3796,"url":"https://patchwork.libcamera.org/api/series/3796/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3796","date":"2023-03-09T14:25:46","name":"py: New python bindings event handling","version":4,"mbox":"https://patchwork.libcamera.org/series/3796/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/18361/comments/","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 1D861BDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  9 Mar 2023 14:26:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BB868626D9;\n\tThu,  9 Mar 2023 15:26:17 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 572EB61ED7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  9 Mar 2023 15:26:16 +0100 (CET)","from desky.lan (91-154-32-225.elisa-laajakaista.fi [91.154.32.225])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C3CAD589;\n\tThu,  9 Mar 2023 15:26:15 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1678371977;\n\tbh=r/9svRpZCV5oNpOpCHa+gjKbiDmbgttK0xpLggiSp8c=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=knvM0MKcYU8jSFD8WLt77bqwi4VGdvpbzwCkPHRt9vefPBgfD0/aCtK5hc/sG89TG\n\tm/y/i20YywjxyLAgvAnYTNQFldckbNvtQe2e4DMYf5rEJ9pAAxz7QPlC10/5d04CeH\n\tykqhV59jQarAH5EotSuU8IXZOA8IFP8Jan7GG8SEBrJM8NM8HcQ9kwwb0or6v/FvOI\n\t42hmrFf11C7LzvaHfwndKtDoB0q1/BlXL7mZQ61rqCTYUcd8MmOf1Jo687EHih+UyF\n\tR8GwqdzixST5KRdGzHHJqB848Nc/9mj0MgcpS9QtleG/Y5Jxd/kc0HaacBFcXNh+T4\n\tbeHb15dZwIzDA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1678371976;\n\tbh=r/9svRpZCV5oNpOpCHa+gjKbiDmbgttK0xpLggiSp8c=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=fqB0DI60qecGXt9XhJGIYqREpANf1wfRNh+h20A355ZGCn4FYzfYk8/KCktpApbxL\n\t/sI1MtQxnf4MEL/cdw4ygWX243FfrRug7AxNaNKiTi2CZ+64aujIsSzoJqX6JFsCGc\n\tesoxlu0wZiaeVfnKqOWYcGHHtctFnM/iX30P8DQw="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"fqB0DI60\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  9 Mar 2023 16:25:46 +0200","Message-Id":"<20230309142601.70556-1-tomi.valkeinen@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 00/15] py: New python bindings event\n\thandling","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":"Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Hi,\n\nI sent the v3 of the series (\"[PATCH v3 00/17] Python bindings event\nhandling\") more than half a year ago. I've addressed the review comments\nwhich I think make sense and are more or less obvious. In fact, I\nmade those changes quite soon after receiving them, again over half a\nyear ago. I also added some additional patches on top (the unittest\nimprovements).\n\nBut then I never had time to work on the biggest question, how to handle\nthe events, and so I never sent the v4. And then recently I added even\nmore patches on top. So I tought I'll just do a bit of work on the\nseries to introduce another way to manage the events, just as a hackish\nRFC, and send the series. Perhaps there are more people interested in\nthe py bindings now, and we will get more discussion and ideas. I don't\nwant us to totally forget this series =).\n\nSo, here it is. The \"py: New event handling\" patch adds the events as in\nv3. But in the topmost patch, \"py: Hack for different event enable\nmechanism\" I draft another way we might handle the enabling and\ndisabling of the events.\n\nOne thing I didn't change was Laurent's comment that camera.stop()\nshould not return the disconnect events, only the request and buffer\ncompleted events. I'm still not sure about that, but I think if we go\nwith the method I introduce in the topmost patch, it probably makes\nsense to leave the disconnect events alone in camera.stop().\n\nAnd, for those not familiar with the series: This changes the Python API\nin a breaking manner. Changes to scripts using the Python bindings are\nneeded (see the \"Use new events support\" patches):\n\n- Many methods throw exceptions now, instead of returning an error value\n- The handling of events has changed. Previously it was all about\n  request completed, and no other events. Now we support all the events.\n\n Tomi\n\nTomi Valkeinen (15):\n  py: Use exceptions instead of returning error codes\n  py: New event handling\n  py: cam.py: Use new events support\n  py: unittests.py: Use new events support\n  py: simple-capture.py: Use new events support\n  py: simple-continuous-capture.py: Use new events support\n  py: simple-cam.py: Use new events support\n  py: Drop get_ready_requests()\n  py: Add hotplug-monitor.py\n  py: unittests.py: Add weakref helpers and use del\n  py: unittests.py: Add test for refs & keep-alives\n  py: unittests.py: Fix type checker warnings\n  py: Move Color Space and Transform classes to separate files\n  py: Improve stub type generation for PyCameraEvent\n  py: Hack for different event enable mechanism\n\n src/py/cam/cam.py                            |  44 +--\n src/py/examples/hotplug-monitor.py           |  39 +++\n src/py/examples/simple-cam.py                |  34 +--\n src/py/examples/simple-capture.py            |  36 ++-\n src/py/examples/simple-continuous-capture.py |  38 +--\n src/py/libcamera/meson.build                 |   2 +\n src/py/libcamera/py_camera_manager.cpp       | 180 +++++++++--\n src/py/libcamera/py_camera_manager.h         |  68 ++++-\n src/py/libcamera/py_color_space.cpp          |  71 +++++\n src/py/libcamera/py_main.cpp                 | 303 +++++++++++--------\n src/py/libcamera/py_transform.cpp            |  81 +++++\n test/py/unittests.py                         | 280 ++++++++++++-----\n 12 files changed, 853 insertions(+), 323 deletions(-)\n create mode 100644 src/py/examples/hotplug-monitor.py\n create mode 100644 src/py/libcamera/py_color_space.cpp\n create mode 100644 src/py/libcamera/py_transform.cpp"}