From patchwork Tue Sep 30 12:26:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 24517 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 D08ECC324C for ; Tue, 30 Sep 2025 13:11:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0195B69367; Tue, 30 Sep 2025 15:11:00 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="d9BLLIo/"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E202362C35 for ; Tue, 30 Sep 2025 15:10:57 +0200 (CEST) Received: from ideasonboard.com (unknown [94.31.94.171]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 92E05BB; Tue, 30 Sep 2025 15:09:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1759237769; bh=R98BKcwzCyJIp3s8sEmNrjCk4iXFa/wrxpA4wKiYe7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d9BLLIo/eXLYxbY/euM/v+OA8+YRU2poWpVKKv+B9ncSMWmt2EQfD/68eUeJPAxwk hrP9W6tLXi8DiXAp73L2+d0HmkLJxQUCpkwukwIEauPYO8+Z3FEj9QqjmfJ0wIuzZX DOu0tUlZ36aKmS4uGN073/7pdtUo7Yv4JcdFz8Fc= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1 18/33] libcamera: converter: converter_v4l2_m2m: Add makeStream() function Date: Tue, 30 Sep 2025 14:26:39 +0200 Message-ID: <20250930122726.1837524-19-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250930122726.1837524-1-stefan.klug@ideasonboard.com> References: <20250930122726.1837524-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 makeStream() function that is called by the converter to create a corresponding stream. This can be overwritten by subclasses to be able to implement a custom stream type. Signed-off-by: Stefan Klug --- include/libcamera/internal/converter/converter_v4l2_m2m.h | 2 ++ src/libcamera/converter/converter_v4l2_m2m.cpp | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h index 615369c1a167..033c4ba42292 100644 --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h @@ -127,6 +127,8 @@ protected: Size adjustSizes(const Size &size, const std::vector &ranges, Alignment align); + virtual std::unique_ptr makeStream(const Stream *stream); + std::unique_ptr m2m_; std::map> streams_; diff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp index 43379b31881d..d6b95fbe9105 100644 --- a/src/libcamera/converter/converter_v4l2_m2m.cpp +++ b/src/libcamera/converter/converter_v4l2_m2m.cpp @@ -548,8 +548,7 @@ int V4L2M2MConverter::configure(const StreamConfiguration &inputCfg, for (unsigned int i = 0; i < outputCfgs.size(); ++i) { const StreamConfiguration &cfg = outputCfgs[i]; - std::unique_ptr stream = - std::make_unique(this, cfg.stream()); + std::unique_ptr stream = makeStream(cfg.stream()); if (!stream->isValid()) { LOG(Converter, Error) @@ -796,6 +795,11 @@ bool V4L2M2MConverter::supportsRequests() return ret; } +std::unique_ptr V4L2M2MConverter::makeStream(const Stream *stream) +{ + return std::make_unique(this, stream); +} + /* * \todo This should be extended to include Feature::Flag to denote * what each converter supports feature-wise.