[{"id":24673,"web_url":"https://patchwork.libcamera.org/comment/24673/","msgid":"<20220818155259.y7jsmgcwemdfp7ed@uno.localdomain>","date":"2022-08-18T15:52:59","subject":"Re: [libcamera-devel] [PATCH v3 15/17] py:\n\tsimple-continuous-capture.py: Use new events support","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Tomi\n\nditto\n\nOn Fri, Jul 01, 2022 at 11:45:19AM +0300, Tomi Valkeinen wrote:\n> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n> ---\n>  src/py/examples/simple-continuous-capture.py | 17 +++++++++--------\n>  1 file changed, 9 insertions(+), 8 deletions(-)\n>\n> diff --git a/src/py/examples/simple-continuous-capture.py b/src/py/examples/simple-continuous-capture.py\n> index e1cb931e..7bc9df10 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 return a single RequestCompleted event, but in some\n> +        # cases there could be multiple or none.\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> --\n> 2.34.1\n>","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 0F543BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Aug 2022 15:53:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BCDC461FC0;\n\tThu, 18 Aug 2022 17:53:04 +0200 (CEST)","from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0F96B61FA7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Aug 2022 17:53:03 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 6352E100003;\n\tThu, 18 Aug 2022 15:53:01 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660837984;\n\tbh=LSKkoqMRmCCtv9uL2Ovwuj5OO6sX+q0dlqcBK4Dq22U=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=YgzobRCjZuCkfpHh4Ka6iGhWKJnJMpxOutdORyLu5dnqbthtIL59KPsnSXVQFS0Sq\n\tV6Jqq9NQW7EuoITrRXZXRgwSH0DTI89C2cEdN2zYOm5UI7lFzeY3Llltx6su07AYqQ\n\tNoYthbM6YKI/xMPITAySj0JX/z8LjbIOZwBEY7I5ynKcAjRB3+5J2Uc1ghNb3uiGnK\n\tMB/2lbuv1HKGlnUIFVUDvUFHWWqzlDRj2anKacdgMyqfL5/qgpee6u6Uudaf9UkEE9\n\tvhvMZaioOQUftq7A4+CTqNT2Ox0ESNQtOnLbiVdMa296Nk58HicKqnsbARJz3L5WFm\n\tFvbY6Our+YXqQ==","Date":"Thu, 18 Aug 2022 17:52:59 +0200","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<20220818155259.y7jsmgcwemdfp7ed@uno.localdomain>","References":"<20220701084521.31831-1-tomi.valkeinen@ideasonboard.com>\n\t<20220701084521.31831-16-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220701084521.31831-16-tomi.valkeinen@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 15/17] 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":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":24690,"web_url":"https://patchwork.libcamera.org/comment/24690/","msgid":"<Yv6pehur3aEDar3O@pendragon.ideasonboard.com>","date":"2022-08-18T21:04:58","subject":"Re: [libcamera-devel] [PATCH v3 15/17] py:\n\tsimple-continuous-capture.py: Use new events support","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Tomi,\n\nThank you for the patch.\n\nOn Fri, Jul 01, 2022 at 11:45:19AM +0300, Tomi Valkeinen wrote:\n\nWith the comments on 14/17 addressed here too,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n> ---\n>  src/py/examples/simple-continuous-capture.py | 17 +++++++++--------\n>  1 file changed, 9 insertions(+), 8 deletions(-)\n> \n> diff --git a/src/py/examples/simple-continuous-capture.py b/src/py/examples/simple-continuous-capture.py\n> index e1cb931e..7bc9df10 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 return a single RequestCompleted event, but in some\n> +        # cases there could be multiple or none.\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>","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 2398FBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Aug 2022 21:05:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B5C5561FC0;\n\tThu, 18 Aug 2022 23:05:02 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 84ABD61FA7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Aug 2022 23:05:01 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1EDEC8B;\n\tThu, 18 Aug 2022 23:05:01 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660856702;\n\tbh=OpZo2p7ribdtKY90IV+TRn5Ffq7cOvmVEv8zuUJVxp8=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=LUKkZKB3PmfNZOm05GMvbAX1NErZOuU/f5MeGjxTtNBiTM8SjDqA/0yFIYtxPcNmh\n\tgv27CEA3Wq+9HJisMHzjdSXVTO4PWVVOId8Isc7mdzaoIpTLAlC73dpkLt+q+Xe9ls\n\tbJbaIa0+cbFwtGRwcI8Iyd+0efv9rqrXr7aqOuMBRgIlw5IjYz6SbOiZG6CKWzL8+4\n\tbBCn5MTFDUxEJ5XvOOON2tKhxV7ytINpr8Fgk4fLWMdMqAmZmg9exgWE5JGUvQlnj+\n\tVgfg+zfHWcYFP3QynCpYEt8IUraz/bFeg0z+vlv3vouM0xFsHdnUyHtY+SCmXtU+Ds\n\t1PvvSvfUm5ksQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1660856701;\n\tbh=OpZo2p7ribdtKY90IV+TRn5Ffq7cOvmVEv8zuUJVxp8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=q8r70elLxeASQmCDHOBz5+QZ6tdnA6p8e4AZsQEaGwXNbs61J/ZpdZD6vwjmaRhL5\n\tQ+Yhf3AgEiZ8TzYXahoUJNp8g62RTprmDpWFYE0QJj+TqL/FfocoaMoUR+1gF1MxD6\n\tMFCSbnlr1MF6/k4RrgmINw7l7+C2nk8FNHvC5jUs="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"q8r70elL\"; dkim-atps=neutral","Date":"Fri, 19 Aug 2022 00:04:58 +0300","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<Yv6pehur3aEDar3O@pendragon.ideasonboard.com>","References":"<20220701084521.31831-1-tomi.valkeinen@ideasonboard.com>\n\t<20220701084521.31831-16-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220701084521.31831-16-tomi.valkeinen@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 15/17] 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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]