[{"id":22150,"web_url":"https://patchwork.libcamera.org/comment/22150/","msgid":"<164433056221.3278188.9000402297728205926@Monstersaurus>","date":"2022-02-08T14:29:22","subject":"Re: [libcamera-devel] [PATCH v4 2/5] HACK: libcamera: Request:\n\texpose Camera from Request","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Tomi Valkeinen (2022-02-04 13:38:11)\n> Request has Camera as a private member. Expose this so that users can\n> more easily associate a received Request to a Camera.\n\nI still don't think this is a hack. I've wanted this in the past [0].\n\n  [0] https://patchwork.libcamera.org/patch/9328/\n\n\nI'm still fighting myself if shared ptr is appropriate here, as I don't\nthink we want to convey that the camera here could be stored or kept -\nit should only be used as a convenience to check the camera while\ndealing with the request - but I don't think that's really going to be\nan issue ... so\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n> ---\n>  include/libcamera/request.h | 2 ++\n>  src/libcamera/request.cpp   | 5 +++++\n>  2 files changed, 7 insertions(+)\n> \n> diff --git a/include/libcamera/request.h b/include/libcamera/request.h\n> index 1eb537e9..29da397c 100644\n> --- a/include/libcamera/request.h\n> +++ b/include/libcamera/request.h\n> @@ -64,6 +64,8 @@ public:\n>  \n>         std::string toString() const;\n>  \n> +       std::shared_ptr<Camera> camera() const;\n> +\n>  private:\n>         LIBCAMERA_DISABLE_COPY(Request)\n>  \n> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\n> index 9c8da6ca..de3c1f80 100644\n> --- a/src/libcamera/request.cpp\n> +++ b/src/libcamera/request.cpp\n> @@ -513,6 +513,11 @@ FrameBuffer *Request::findBuffer(const Stream *stream) const\n>         return it->second;\n>  }\n>  \n> +std::shared_ptr<Camera> Request::camera() const\n> +{\n> +       return _d()->camera()->shared_from_this();\n> +}\n> +\n>  /**\n>   * \\fn Request::metadata()\n>   * \\brief Retrieve the request's metadata\n> -- \n> 2.25.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 D2C57BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  8 Feb 2022 14:29:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 01047610AD;\n\tTue,  8 Feb 2022 15:29:27 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BBDA160E58\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Feb 2022 15:29:24 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4D2D7A04;\n\tTue,  8 Feb 2022 15:29:24 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"tgZ0Up2P\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1644330564;\n\tbh=zLjsNQOkyg78xn89DVNtcXQ9gwUWFRdcIyRUxUpSiyM=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=tgZ0Up2PMdp29pzSCCXAG/TgV8xBjQRVNg77mLFldAkoroc1nLweh+ojPieiqCkZg\n\tVI2Er0k50QDafnx7V/5chAduykGV5MwSiTnlJHOLcH3WYWVlyLyM8xsDQ1g8K44Cyu\n\tXMWywJfsGOfWNgaH/6kDvIuRcAlQlJoK4/iTeijE=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20220204133814.303217-3-tomi.valkeinen@ideasonboard.com>","References":"<20220204133814.303217-1-tomi.valkeinen@ideasonboard.com>\n\t<20220204133814.303217-3-tomi.valkeinen@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tTomi Valkeinen <tomi.valkeinen@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 08 Feb 2022 14:29:22 +0000","Message-ID":"<164433056221.3278188.9000402297728205926@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v4 2/5] HACK: libcamera: Request:\n\texpose Camera from Request","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22152,"web_url":"https://patchwork.libcamera.org/comment/22152/","msgid":"<b8f253b7-b3ac-c1df-911e-de24c6283e52@ideasonboard.com>","date":"2022-02-09T07:49:22","subject":"Re: [libcamera-devel] [PATCH v4 2/5] HACK: libcamera: Request:\n\texpose Camera from Request","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"content":"On 08/02/2022 16:29, Kieran Bingham wrote:\n> Quoting Tomi Valkeinen (2022-02-04 13:38:11)\n>> Request has Camera as a private member. Expose this so that users can\n>> more easily associate a received Request to a Camera.\n> \n> I still don't think this is a hack. I've wanted this in the past [0].\n> \n>    [0] https://patchwork.libcamera.org/patch/9328/\n\nAnd Laurent wants to get rid of the Camera field =)\n\n> I'm still fighting myself if shared ptr is appropriate here, as I don't\n> think we want to convey that the camera here could be stored or kept -\n> it should only be used as a convenience to check the camera while\n> dealing with the request - but I don't think that's really going to be\n> an issue ... so\n\nPlain pointers are a bit tricky wrt. Python. If the pointer means that \nthe ownership is given to the caller, it's fine, Python then owns the \nobject. But if the pointer means that the caller does not own the \nobject, and can only use the pointer temporarily, it's a problem as we \ncan't guarantee such (use only temporarily) thing on the Python side.\n\nCameras are handled with shared_ptrs in libcamera, so I don't quite see \nwhy you wouldn't use shared_ptr<Camera> everywhere.\n\n  Tomi","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 7CA98BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  9 Feb 2022 07:49:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D4A55610DA;\n\tWed,  9 Feb 2022 08:49:27 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CB2CA60E66\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  9 Feb 2022 08:49:25 +0100 (CET)","from [192.168.1.111] (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CD74448E;\n\tWed,  9 Feb 2022 08:49:24 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"kJV3Dwfn\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1644392965;\n\tbh=1HUJDxx13/Tq9WIIK/ycsAd0KVjW5H2XkL7w8TJWHR8=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=kJV3DwfnGpfmx6DtwJbflgWqsmmw+tpcDSSEwEZQs0dMKEim7ZjVri4yAWK7Cbzee\n\t/ag7qHyv691XG7ytqFMmwUItu68pHHWpxIZmrUvadkaoVuqzG9zaR3XkXDmYsqnv6S\n\tyqBa8qbuB+2b3BfMQqbdRdpc/bOghcxU83v3kwpM=","Message-ID":"<b8f253b7-b3ac-c1df-911e-de24c6283e52@ideasonboard.com>","Date":"Wed, 9 Feb 2022 09:49:22 +0200","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.5.0","Content-Language":"en-US","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tDavid Plowman <david.plowman@raspberrypi.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20220204133814.303217-1-tomi.valkeinen@ideasonboard.com>\n\t<20220204133814.303217-3-tomi.valkeinen@ideasonboard.com>\n\t<164433056221.3278188.9000402297728205926@Monstersaurus>","From":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","In-Reply-To":"<164433056221.3278188.9000402297728205926@Monstersaurus>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v4 2/5] HACK: libcamera: Request:\n\texpose Camera from Request","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]