From patchwork Mon Dec 16 15:40:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22355 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 494C5C32FB for ; Mon, 16 Dec 2024 15:42:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C75BC67F8A; Mon, 16 Dec 2024 16:42:13 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="CN2/oJLJ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A04DF67F81 for ; Mon, 16 Dec 2024 16:42:11 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:bfdf:3a3c:e45:66e3]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F3D6E82A; Mon, 16 Dec 2024 16:41:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1734363695; bh=WLz7itERtgpZabbFOsaQnEE+iI6KY8pZaV0GPVV/gv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CN2/oJLJZxRgcVTlGHpSSH8sUcqu45TJn1PMH1diJeTuV9fYaQdH9tjtGvSiyuKY3 URPqocdYl5hIJmM4wKlr30rIpNOyE4xdgS68ldLrqyZpRG9sftu7YGiqYjb9TxtWIb vVMX+oyrfBPvDjAA9drdafItZHWwY7otl8mcI5mg= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v4 09/20] libcamera: converter: Add function to check if a stream was configured Date: Mon, 16 Dec 2024 16:40:49 +0100 Message-ID: <20241216154124.203650-10-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241216154124.203650-1-stefan.klug@ideasonboard.com> References: <20241216154124.203650-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a isConfigured() function to be able to check if a given stream was configured in the converter. This is useful in pipelines to either query device or stream specific crop bounds depending on whether the stream is configured or not. Signed-off-by: Stefan Klug Reviewed-by: Jacopo Mondi Reviewed-by: Paul Elder --- Changes in v4: - Added this patch --- include/libcamera/internal/converter.h | 1 + include/libcamera/internal/converter/converter_v4l2_m2m.h | 1 + src/libcamera/converter.cpp | 7 +++++++ src/libcamera/converter/converter_v4l2_m2m.cpp | 8 ++++++++ 4 files changed, 17 insertions(+) diff --git a/include/libcamera/internal/converter.h b/include/libcamera/internal/converter.h index 04187a2a96e8..afea4624041b 100644 --- a/include/libcamera/internal/converter.h +++ b/include/libcamera/internal/converter.h @@ -56,6 +56,7 @@ public: virtual int configure(const StreamConfiguration &inputCfg, const std::vector> &outputCfgs) = 0; + virtual bool isConfigured(const Stream *stream) const = 0; virtual int exportBuffers(const Stream *stream, unsigned int count, std::vector> *buffers) = 0; diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h index 402a803959b9..1ccbfc7c2d4e 100644 --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h @@ -50,6 +50,7 @@ public: int configure(const StreamConfiguration &inputCfg, const std::vector> &outputCfg) override; + bool isConfigured(const Stream *stream) const override; int exportBuffers(const Stream *stream, unsigned int count, std::vector> *buffers) override; diff --git a/src/libcamera/converter.cpp b/src/libcamera/converter.cpp index 73c02fdcf4bb..09ebf4f57d12 100644 --- a/src/libcamera/converter.cpp +++ b/src/libcamera/converter.cpp @@ -126,6 +126,13 @@ Converter::~Converter() * \return 0 on success or a negative error code otherwise */ +/** + * \fn Converter::isConfigured() + * \brief Check if a given stream is configured + * \param[in] stream The output stream + * \return True if the \a stream is configured or false otherwise + */ + /** * \fn Converter::exportBuffers() * \brief Export buffers from the converter device diff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp index 342aa32dab52..83daca15b37e 100644 --- a/src/libcamera/converter/converter_v4l2_m2m.cpp +++ b/src/libcamera/converter/converter_v4l2_m2m.cpp @@ -437,6 +437,14 @@ int V4L2M2MConverter::configure(const StreamConfiguration &inputCfg, return 0; } +/** + * \copydoc libcamera::Converter::isConfigured + */ +bool V4L2M2MConverter::isConfigured(const Stream *stream) const +{ + return streams_.find(stream) != streams_.end(); +} + /** * \copydoc libcamera::Converter::exportBuffers */