{"id":18367,"url":"https://patchwork.libcamera.org/api/patches/18367/?format=json","web_url":"https://patchwork.libcamera.org/patch/18367/","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-7-tomi.valkeinen@ideasonboard.com>","date":"2023-03-09T14:25:52","name":"[libcamera-devel,v4,06/15] py: simple-continuous-capture.py: Use new events support","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"804d281b9d6116b4dd0e50da7428866169b49a83","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/?format=json","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18367/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/patches/18367/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18367/checks/","tags":{},"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 2E2F2C329E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  9 Mar 2023 14:26:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CB5E3626E2;\n\tThu,  9 Mar 2023 15:26:24 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CD3B061ED7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  9 Mar 2023 15:26:18 +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 49E53589;\n\tThu,  9 Mar 2023 15:26:18 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1678371984;\n\tbh=ivMAMfY7LAj8Ihu/ud9j0ozVaB9QF6fEIVB/e9R5Ukw=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=XI9qZYP91nD7+pd+9a0+hGLt5QLitQHhESmdapajS8N8vh0wq9fc8z3nTy4vfmoRH\n\tb+KluvQpiwnQKx3E5/cSop/e302FAkX/+VxDvnmcc71p2VzF5MqhUeAJzVG/t1d6Dl\n\txwax5psiAZoR6VpFWsY3EnxE6RU5RLOWAxWmYrdoR8kDBpvHDJku/F61nbzxNmfwwj\n\tx4Bem8satuz5yFUVMjfKDX/rN5eZAd2MmjMDXrmeU5PvpJc7IW7MB2Y2FMoso6TZJU\n\tRRcBGwm8K49DHUfJXXl2OBg7mnqwjdPQ2P0WoF2aDf6Aclomvz3+Mzr0H5VmFQ+x/N\n\tfHl8O2jb7SJpw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1678371978;\n\tbh=ivMAMfY7LAj8Ihu/ud9j0ozVaB9QF6fEIVB/e9R5Ukw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=JBc+z+mTKQFlCZhG0571ggM3xCkOaunCsOSk9iUxFLc48i3/izl5mG80fblcPJFMk\n\tH8j6V9XqSXcJTKXMxRh0YLF4+6qx+3bCl1cm+8OO1JoduPA00bh5AO3n3N2TxnoKWw\n\tptoFnKDE4Y/KovCgycsJQMSzk3HrAmgjkRDBHTGA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"JBc+z+mT\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  9 Mar 2023 16:25:52 +0200","Message-Id":"<20230309142601.70556-7-tomi.valkeinen@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20230309142601.70556-1-tomi.valkeinen@ideasonboard.com>","References":"<20230309142601.70556-1-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 06/15] py:\n\tsimple-continuous-capture.py: Use new events support","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":"Update simple-continuous-capture.py to the new event model.\n\nSigned-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/py/examples/simple-continuous-capture.py | 17 +++++++++--------\n 1 file changed, 9 insertions(+), 8 deletions(-)","diff":"diff --git a/src/py/examples/simple-continuous-capture.py b/src/py/examples/simple-continuous-capture.py\nindex e1cb931e..37ca623c 100755\n--- a/src/py/examples/simple-continuous-capture.py\n+++ b/src/py/examples/simple-continuous-capture.py\n@@ -83,16 +83,17 @@ class CaptureContext:\n     camera_contexts: list[CameraCaptureContext] = []\n \n     def handle_camera_event(self):\n-        # cm.get_ready_requests() returns the ready requests, which in our case\n-        # should almost always return a single Request, but in some cases there\n-        # could be multiple or none.\n+        # cm.get_events() returns the ready events, which in our case should\n+        # almost always be a single RequestCompleted event, but in some cases\n+        # there could be multiple ones, other events, or no events at all.\n \n-        reqs = self.cm.get_ready_requests()\n+        for ev in self.cm.get_events():\n+            # We are only interested in RequestCompleted events\n+            if ev.type != libcam.Event.Type.RequestCompleted:\n+                continue\n \n-        # Process the captured frames\n-\n-        for req in reqs:\n-            self.handle_request(req)\n+            # Process the captured frames\n+            self.handle_request(ev.request)\n \n         return True\n \n","prefixes":["libcamera-devel","v4","06/15"]}