{"id":16107,"url":"https://patchwork.libcamera.org/api/covers/16107/?format=json","web_url":"https://patchwork.libcamera.org/cover/16107/","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":"<20220530142722.57618-1-tomi.valkeinen@ideasonboard.com>","date":"2022-05-30T14:27:06","name":"[libcamera-devel,v4,00/16] More misc Python patches","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/16107/mbox/","series":[{"id":3149,"url":"https://patchwork.libcamera.org/api/series/3149/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3149","date":"2022-05-30T14:27:06","name":"More misc Python patches","version":4,"mbox":"https://patchwork.libcamera.org/series/3149/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/16107/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 1FC7EBD161\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 30 May 2022 14:27:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DBB2D65636;\n\tMon, 30 May 2022 16:27:40 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 787DC60411\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 May 2022 16:27:39 +0200 (CEST)","from deskari.lan (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A2E796BD;\n\tMon, 30 May 2022 16:27:38 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653920860;\n\tbh=E1zCkiTpFdAZNbHvcBCJYLdkY3Kf0Gzhi5GdzQkTGbk=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=FlG4vV42WdEml9KOPjQlg/Ex4KT+jjPvTr0oo/PeAueFROujObfJhxVWNBwusfq+f\n\tD+Jn7EuRV6dZiENsUUcLVBndCW3IkZrGzg9VVkPkL5f43OnLjRXlSkDjyJV27kAz2V\n\tK6t5dPQuNq4CTmHXh5atEApfZMUmvnM7fBkNO9h0gwF6uEq9iyMbK9HtAAhTkX0EBh\n\t2H1aktVdE67DweW+5se42rC762rRLWYwb+dUZJ8qfr776290aGJv71brG1VbwStdLt\n\t6kBn/RB/rvVdgW340IlQM59VlkAzVxFI5An8UHdMuQPZfU3G4Ht48jD0Tk6tE04ttc\n\t6My3xdbfA7hNA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653920859;\n\tbh=E1zCkiTpFdAZNbHvcBCJYLdkY3Kf0Gzhi5GdzQkTGbk=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=EbI1tVycx4VwQOkzLDJlyVO/P8VOxesZXUZTSIq3P7M/WuQ7NeAZnsOFa8NbfyLNI\n\tX1nzFFtN6dmeROGBIz4HZLwa6FwoFEH9TbcRX339l5Z5Krpm0dB53xm92T0ynIyCvN\n\tVQ716o+VItpB+33Ami5jVdmzt0KzEtAxZfRxLWSA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"EbI1tVyc\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org,\n\tDavid Plowman <david.plowman@raspberrypi.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tJacopo Mondi <jacopo@jmondi.org>","Date":"Mon, 30 May 2022 17:27:06 +0300","Message-Id":"<20220530142722.57618-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/16] More misc Python patches","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\nA bunch of the patches in v3 have been merged, and this contains the\nunmerged ones with the comments addressed. There's one new patch, \"py:\nmerge read_event() and get_ready_requests()\".\n\nThe doc has been moved under Documentation/ and converted to rst.\n\nI think everything up to the examples are ready for merging (after\nreview).\n\nThe simple-capture and simple-continuous-capture examples have been\nchanged quite a bit. They are WIP, so not for merging, but I wanted to\nsend these as it seems we don't quite know what kind of examples we\nwant. And for review, I'm more looking for review of the concept than\nspecific lines of code.\n\nThe main change to simple-capture.py is that it now captures 30 frames,\nso it shows how to requeue requests. I dropped the mmapping to simplify\nit further. I think it is, in its current form, quite usable example: if\nyou want to capture a certain number of frames from a single camera,\nthis is the way I would recommend doing it.\n\nsimple-continuous-capture.py has more changes. The main diff in v3\nbetween simple-capture.py and simple-continuous-capture.py was that the\nlatter used selector on the fds (stdin and libcamera). That difference\nis still true, but simple-continuous-capture.py now captures from all\navailable cameras at the same time. It is also structured a bit more\nlike a real application could be structured.\n\nWhile writing this I realized that \"simple-continuous-capture\" name no\nlonger works, but as I said, the examples are still WIP.\n\nSo, to summarize the examples:\n\n- One to showcase capturing from a single camera in a very\n  straightforward manner in a single function. Something you would do in\n  a script when you just want to get that single job done.\n\n- One to showcase a more complete application with event handling, stdin\n  handling and multiple cameras. It would be nice to extend this to\n  display the frames with Qt/KMS, but that would increase the size quite\n  considerably, and we would then be moving to the cam.py-territory.\n\n Tomi\n\nTomi Valkeinen (16):\n  py: unittests: Fix test_sleep()\n  py: unittests: Fix test_select()\n  py: cam: Move conversion funcs to helpers.py\n  py: cam: Drop PIL dependency\n  py: Add Request.__str__()\n  py: Add FrameMetadataPlane\n  py: Implement FrameBufferPlane\n  py: MappedFrameBuffer: Support non-contextmanager use\n  py: MappedFrameBuffer: Add 'fb' property\n  py: cam: cam_qt: mmap the fbs only once\n  py: merge read_event() and get_ready_requests()\n  Documentation: Add python-bindings.rst\n  py: examples: Add simple-capture.py\n  py: examples: Add simple-continuous-capture.py\n  py: examples: Add itest.py\n  py: examples: Add simple-cam.py\n\n Documentation/index.rst                      |   1 +\n Documentation/meson.build                    |   1 +\n Documentation/python-bindings.rst            |  70 ++++\n src/py/cam/cam.py                            |   5 +-\n src/py/cam/cam_kms.py                        |   6 +-\n src/py/cam/cam_qt.py                         | 216 +++---------\n src/py/cam/cam_qtgl.py                       |   2 +-\n src/py/cam/{cam_qt.py => helpers.py}         | 154 +-------\n src/py/examples/itest.py                     | 195 +++++++++++\n src/py/examples/simple-cam.py                | 350 +++++++++++++++++++\n src/py/examples/simple-capture.py            | 162 +++++++++\n src/py/examples/simple-continuous-capture.py | 189 ++++++++++\n src/py/libcamera/py_main.cpp                 |  68 ++--\n src/py/libcamera/utils/MappedFrameBuffer.py  |  44 ++-\n test/py/unittests.py                         |  16 +-\n 15 files changed, 1095 insertions(+), 384 deletions(-)\n create mode 100644 Documentation/python-bindings.rst\n copy src/py/cam/{cam_qt.py => helpers.py} (55%)\n create mode 100755 src/py/examples/itest.py\n create mode 100755 src/py/examples/simple-cam.py\n create mode 100755 src/py/examples/simple-capture.py\n create mode 100755 src/py/examples/simple-continuous-capture.py"}