[{"id":32778,"web_url":"https://patchwork.libcamera.org/comment/32778/","msgid":"<37yn75js4umzyisxnnpyjxgqq5v7v4gjgjhtjzkp6ooigyzl63@vjdic5lcuh23>","date":"2024-12-16T18:08:46","subject":"Re: [PATCH v4 09/20] libcamera: converter: Add function to check if\n\ta stream was configured","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Stefan\n\nOn Mon, Dec 16, 2024 at 04:40:49PM +0100, Stefan Klug wrote:\n> Add a isConfigured() function to be able to check if a given stream was\n> configured in the converter. This is useful in pipelines to either query\n> device or stream specific crop bounds depending on whether the stream is\n> configured or not.\n>\n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nThanks\n  j\n\n>\n> ---\n>\n> Changes in v4:\n> - Added this patch\n> ---\n>  include/libcamera/internal/converter.h                    | 1 +\n>  include/libcamera/internal/converter/converter_v4l2_m2m.h | 1 +\n>  src/libcamera/converter.cpp                               | 7 +++++++\n>  src/libcamera/converter/converter_v4l2_m2m.cpp            | 8 ++++++++\n>  4 files changed, 17 insertions(+)\n>\n> diff --git a/include/libcamera/internal/converter.h b/include/libcamera/internal/converter.h\n> index 04187a2a96e8..afea4624041b 100644\n> --- a/include/libcamera/internal/converter.h\n> +++ b/include/libcamera/internal/converter.h\n> @@ -56,6 +56,7 @@ public:\n>\n>  \tvirtual int configure(const StreamConfiguration &inputCfg,\n>  \t\t\t      const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs) = 0;\n> +\tvirtual bool isConfigured(const Stream *stream) const = 0;\n>  \tvirtual int exportBuffers(const Stream *stream, unsigned int count,\n>  \t\t\t\t  std::vector<std::unique_ptr<FrameBuffer>> *buffers) = 0;\n>\n> diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h\n> index 402a803959b9..1ccbfc7c2d4e 100644\n> --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h\n> +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h\n> @@ -50,6 +50,7 @@ public:\n>  \tint configure(const StreamConfiguration &inputCfg,\n>  \t\t      const std::vector<std::reference_wrapper<StreamConfiguration>>\n>  \t\t      &outputCfg) override;\n> +\tbool isConfigured(const Stream *stream) const override;\n>  \tint exportBuffers(const Stream *stream, unsigned int count,\n>  \t\t\t  std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;\n>\n> diff --git a/src/libcamera/converter.cpp b/src/libcamera/converter.cpp\n> index 73c02fdcf4bb..09ebf4f57d12 100644\n> --- a/src/libcamera/converter.cpp\n> +++ b/src/libcamera/converter.cpp\n> @@ -126,6 +126,13 @@ Converter::~Converter()\n>   * \\return 0 on success or a negative error code otherwise\n>   */\n>\n> +/**\n> + * \\fn Converter::isConfigured()\n> + * \\brief Check if a given stream is configured\n> + * \\param[in] stream The output stream\n> + * \\return True if the \\a stream is configured or false otherwise\n> + */\n> +\n>  /**\n>   * \\fn Converter::exportBuffers()\n>   * \\brief Export buffers from the converter device\n> diff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp\n> index 342aa32dab52..83daca15b37e 100644\n> --- a/src/libcamera/converter/converter_v4l2_m2m.cpp\n> +++ b/src/libcamera/converter/converter_v4l2_m2m.cpp\n> @@ -437,6 +437,14 @@ int V4L2M2MConverter::configure(const StreamConfiguration &inputCfg,\n>  \treturn 0;\n>  }\n>\n> +/**\n> + * \\copydoc libcamera::Converter::isConfigured\n> + */\n> +bool V4L2M2MConverter::isConfigured(const Stream *stream) const\n> +{\n> +\treturn streams_.find(stream) != streams_.end();\n> +}\n> +\n>  /**\n>   * \\copydoc libcamera::Converter::exportBuffers\n>   */\n> --\n> 2.43.0\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 A87BCC326C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Dec 2024 18:08:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6858967F98;\n\tMon, 16 Dec 2024 19:08:50 +0100 (CET)","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 EF14367F7F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Dec 2024 19:08:48 +0100 (CET)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4B34B160;\n\tMon, 16 Dec 2024 19:08:12 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"KurBKWyn\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734372492;\n\tbh=So8SCC9v0MFiUcxjUFhLdYxRYuH+z00RD1kM3A3S1sI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=KurBKWynXMZbgTqoZybDFtjxgHLgyTnFJChz9KSdK2O8sOedfaUUk4VixP3YlsXAw\n\tZ55rhjkvZWZm1ONiOEipU/g1VoCvPw2+2OivJkxxZrGNt8P3o7kO1Kolcrs8/Wl5hj\n\t26w63C2iTryn7f1ln4/ehAAHcaOZxtGsJiWweqLM=","Date":"Mon, 16 Dec 2024 19:08:46 +0100","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v4 09/20] libcamera: converter: Add function to check if\n\ta stream was configured","Message-ID":"<37yn75js4umzyisxnnpyjxgqq5v7v4gjgjhtjzkp6ooigyzl63@vjdic5lcuh23>","References":"<20241216154124.203650-1-stefan.klug@ideasonboard.com>\n\t<20241216154124.203650-10-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241216154124.203650-10-stefan.klug@ideasonboard.com>","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":32797,"web_url":"https://patchwork.libcamera.org/comment/32797/","msgid":"<Z2DzZK_ZSw8lmh6F@pyrite.rasen.tech>","date":"2024-12-17T03:43:32","subject":"Re: [PATCH v4 09/20] libcamera: converter: Add function to check if\n\ta stream was configured","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Mon, Dec 16, 2024 at 04:40:49PM +0100, Stefan Klug wrote:\n> Add a isConfigured() function to be able to check if a given stream was\n> configured in the converter. This is useful in pipelines to either query\n> device or stream specific crop bounds depending on whether the stream is\n> configured or not.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> \n> ---\n> \n> Changes in v4:\n> - Added this patch\n> ---\n>  include/libcamera/internal/converter.h                    | 1 +\n>  include/libcamera/internal/converter/converter_v4l2_m2m.h | 1 +\n>  src/libcamera/converter.cpp                               | 7 +++++++\n>  src/libcamera/converter/converter_v4l2_m2m.cpp            | 8 ++++++++\n>  4 files changed, 17 insertions(+)\n> \n> diff --git a/include/libcamera/internal/converter.h b/include/libcamera/internal/converter.h\n> index 04187a2a96e8..afea4624041b 100644\n> --- a/include/libcamera/internal/converter.h\n> +++ b/include/libcamera/internal/converter.h\n> @@ -56,6 +56,7 @@ public:\n>  \n>  \tvirtual int configure(const StreamConfiguration &inputCfg,\n>  \t\t\t      const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs) = 0;\n> +\tvirtual bool isConfigured(const Stream *stream) const = 0;\n>  \tvirtual int exportBuffers(const Stream *stream, unsigned int count,\n>  \t\t\t\t  std::vector<std::unique_ptr<FrameBuffer>> *buffers) = 0;\n>  \n> diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h\n> index 402a803959b9..1ccbfc7c2d4e 100644\n> --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h\n> +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h\n> @@ -50,6 +50,7 @@ public:\n>  \tint configure(const StreamConfiguration &inputCfg,\n>  \t\t      const std::vector<std::reference_wrapper<StreamConfiguration>>\n>  \t\t      &outputCfg) override;\n> +\tbool isConfigured(const Stream *stream) const override;\n>  \tint exportBuffers(const Stream *stream, unsigned int count,\n>  \t\t\t  std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;\n>  \n> diff --git a/src/libcamera/converter.cpp b/src/libcamera/converter.cpp\n> index 73c02fdcf4bb..09ebf4f57d12 100644\n> --- a/src/libcamera/converter.cpp\n> +++ b/src/libcamera/converter.cpp\n> @@ -126,6 +126,13 @@ Converter::~Converter()\n>   * \\return 0 on success or a negative error code otherwise\n>   */\n>  \n> +/**\n> + * \\fn Converter::isConfigured()\n> + * \\brief Check if a given stream is configured\n> + * \\param[in] stream The output stream\n> + * \\return True if the \\a stream is configured or false otherwise\n> + */\n> +\n>  /**\n>   * \\fn Converter::exportBuffers()\n>   * \\brief Export buffers from the converter device\n> diff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp\n> index 342aa32dab52..83daca15b37e 100644\n> --- a/src/libcamera/converter/converter_v4l2_m2m.cpp\n> +++ b/src/libcamera/converter/converter_v4l2_m2m.cpp\n> @@ -437,6 +437,14 @@ int V4L2M2MConverter::configure(const StreamConfiguration &inputCfg,\n>  \treturn 0;\n>  }\n>  \n> +/**\n> + * \\copydoc libcamera::Converter::isConfigured\n> + */\n> +bool V4L2M2MConverter::isConfigured(const Stream *stream) const\n> +{\n> +\treturn streams_.find(stream) != streams_.end();\n> +}\n> +\n>  /**\n>   * \\copydoc libcamera::Converter::exportBuffers\n>   */\n> -- \n> 2.43.0\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 3EB33C32F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Dec 2024 03:43:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A2E9061899;\n\tTue, 17 Dec 2024 04:43:41 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BCCA561899\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Dec 2024 04:43:39 +0100 (CET)","from pyrite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:1a78:c005:412c:c675])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CA6393E;\n\tTue, 17 Dec 2024 04:43:01 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ItKKoCwH\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734406982;\n\tbh=l6gCKAgRUkiW9r/Jc0aOgExVubnCOauZL+iZdiLMB+Q=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ItKKoCwHNNC8t6rm0FY+stO4E2LJUq4Dpo/OaRjTA3xNk6f0yGm6sy5e8I+Y7KZgu\n\tECF0HfGldnFeGW/Cdf/pxXZxUpj1Cgm3chLjCeV8pmR+BZ2DwqUY01kXf25DRIdju/\n\tyw23lE0U2sB3kx+baJd/RUq6QN49Mr5RxBuEoIog=","Date":"Tue, 17 Dec 2024 12:43:32 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v4 09/20] libcamera: converter: Add function to check if\n\ta stream was configured","Message-ID":"<Z2DzZK_ZSw8lmh6F@pyrite.rasen.tech>","References":"<20241216154124.203650-1-stefan.klug@ideasonboard.com>\n\t<20241216154124.203650-10-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20241216154124.203650-10-stefan.klug@ideasonboard.com>","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>"}}]