[{"id":24674,"web_url":"https://patchwork.libcamera.org/comment/24674/","msgid":"<20220818155330.eztpzzmaqthlc453@uno.localdomain>","date":"2022-08-18T15:53:30","subject":"Re: [libcamera-devel] [PATCH v3 16/17] py: simple-cam.py: Use new\n\tevents support","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Tomi\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n   j\nOn Fri, Jul 01, 2022 at 11:45:20AM +0300, Tomi Valkeinen wrote:\n> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n> ---\n>  src/py/examples/simple-cam.py | 17 +++++++++--------\n>  1 file changed, 9 insertions(+), 8 deletions(-)\n>\n> diff --git a/src/py/examples/simple-cam.py b/src/py/examples/simple-cam.py\n> index 1cd1019d..2dcf962a 100755\n> --- a/src/py/examples/simple-cam.py\n> +++ b/src/py/examples/simple-cam.py\n> @@ -19,16 +19,17 @@ TIMEOUT_SEC = 3\n>\n>\n>  def handle_camera_event(cm):\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 = cm.get_ready_requests()\n> +    for ev in 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> -        process_request(req)\n> +        # Process the captured frames\n> +        process_request(ev.request)\n>\n>\n>  def process_request(request):\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 9C04EBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Aug 2022 15:53:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 531D761FC0;\n\tThu, 18 Aug 2022 17:53:35 +0200 (CEST)","from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A443E61FA7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Aug 2022 17:53:34 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 0CD74C0004;\n\tThu, 18 Aug 2022 15:53:32 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660838015;\n\tbh=8R4flelkc3vHGpPuEOR8jbq6GeqLvTw3R4ruObObdr0=;\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=WlwBb5UWeNKW2OE+jtRw/AdO77DQZinBlb9NPKD1AEElY2kBckZD3n+mpNi23oE8U\n\tMgOg7AvNWHPYhFzudTfAyXkQRDjtEBd6vwY5HJkx0hHGQQ8NUIxI7LNVYbJBrXrtFn\n\tafh26nUpjy0RRElfDr9ZSY/0rr0DfFdaTgctcM5T9/W7lIYSD/mqRfd4/8fF3N45iH\n\t3GNFZzTcl35zob8N2W1sI7X1N5QhPutVee7lQ4rSOuyA8vv4ThnYbfyqCFBtRmLZ5J\n\tXZC3ZAtKzhawqKs2lVMW7uEOR9p+/AMfNy6nruw//8XfFWGua5do/lrokXFz55jHlc\n\tcKlEhfNnE7ZsQ==","Date":"Thu, 18 Aug 2022 17:53:30 +0200","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<20220818155330.eztpzzmaqthlc453@uno.localdomain>","References":"<20220701084521.31831-1-tomi.valkeinen@ideasonboard.com>\n\t<20220701084521.31831-17-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220701084521.31831-17-tomi.valkeinen@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 16/17] py: simple-cam.py: Use new\n\tevents 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":24691,"web_url":"https://patchwork.libcamera.org/comment/24691/","msgid":"<Yv6poWdDDZW9MUV6@pendragon.ideasonboard.com>","date":"2022-08-18T21:05:37","subject":"Re: [libcamera-devel] [PATCH v3 16/17] py: simple-cam.py: Use new\n\tevents 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:20AM +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-cam.py | 17 +++++++++--------\n>  1 file changed, 9 insertions(+), 8 deletions(-)\n> \n> diff --git a/src/py/examples/simple-cam.py b/src/py/examples/simple-cam.py\n> index 1cd1019d..2dcf962a 100755\n> --- a/src/py/examples/simple-cam.py\n> +++ b/src/py/examples/simple-cam.py\n> @@ -19,16 +19,17 @@ TIMEOUT_SEC = 3\n>  \n>  \n>  def handle_camera_event(cm):\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 = cm.get_ready_requests()\n> +    for ev in 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> -        process_request(req)\n> +        # Process the captured frames\n> +        process_request(ev.request)\n>  \n>  \n>  def process_request(request):","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 6F7BEBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Aug 2022 21:05:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 39CF761FC0;\n\tThu, 18 Aug 2022 23:05:42 +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 1121461FA7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Aug 2022 23:05:41 +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 A62C38B;\n\tThu, 18 Aug 2022 23:05:40 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660856742;\n\tbh=C14LTy2Nzhq2q5c7qRjuKL0NOYwmtimDm1rVvrucoNU=;\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=ii+/HZFLW90evVLmZyOwY6fZpI9e7vBqtLvitHx6twLaSJQUSKav6wWJYQ42ZNluV\n\tIEB0mUjC44BPmezi+rTmmI7C2nkHOGGNSzoQzH/8JnJTeVY5gOuPXbcbe28j4jcDsl\n\trIrLW2PIyrZR3k6oYICODGW/TNkK9MIxhS0hKhwIuAMX1StQEmWUwoi4957TQeYPPs\n\tRTUtH5x4ZtunnAhKOD8ksjaOJiyux32/9aUQ4lcXbWLYdkv9frmrfNl5iUuoMvAkKD\n\tA9TB7SIbbEkWoKUVntTBGTrMJ1N7gW1XI6xZl/Cr9YThU4/5sSHXaZINdlldpbf9h1\n\twYRzU90OjGr8A==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1660856740;\n\tbh=C14LTy2Nzhq2q5c7qRjuKL0NOYwmtimDm1rVvrucoNU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=GE+wjQxyr5bQTGQtcICrRj/kTQY5k0br5WXL6Q/7RavSOH83gwFS+D6g+kuVLIUtk\n\t0ohgL9J7U1IEIC65typST/6nAPRbMatPiul0SHoBT7/GAAflHpkGEbaPvMQKzLdbJr\n\tM25hQd0AyNMD96bwIVGqVdzcN1bLtZEk3KV53Ilk="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"GE+wjQxy\"; dkim-atps=neutral","Date":"Fri, 19 Aug 2022 00:05:37 +0300","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<Yv6poWdDDZW9MUV6@pendragon.ideasonboard.com>","References":"<20220701084521.31831-1-tomi.valkeinen@ideasonboard.com>\n\t<20220701084521.31831-17-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220701084521.31831-17-tomi.valkeinen@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 16/17] py: simple-cam.py: Use new\n\tevents 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>"}}]