From patchwork Wed Aug 27 09:07:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 24241 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 4D249C332A for ; Wed, 27 Aug 2025 09:08:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C50DB692F3; Wed, 27 Aug 2025 11:07:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Ya7X111c"; dkim-atps=neutral Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0B01D613C0 for ; Wed, 27 Aug 2025 11:07:47 +0200 (CEST) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-45a1b001f55so35020055e9.0 for ; Wed, 27 Aug 2025 02:07:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1756285666; x=1756890466; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/ukKij3qlWIWS1fgolUGyGco5PZGZyPfImO0OUOmtR4=; b=Ya7X111c6RbEUsnLV9ZOk0M2xLnOnEonj10WToCED+pLK1I7OlXpV4gokEL99Ou8WP qmyP7R66sxGnzXs2nBZqGiiFD56IoveTMRL8suFC58LRzScWNJtN8Bzj+jSZAJbsiirL xS7/4wJ0Ve+bKtEP8yd8T8jWHFuepPPX1c00hqe1+3+1H2UezZxz3sos685gATqUGszu hN3zHxW1E3Sek7AJ8ttYuJ0Ieid2V/dVTm447U0ry0fZKXmg63HyJ5Flny5zRWpSn+oV ZNU5k3VMG2K+q4m8FqrUNRl7l/Fb4TmwiljkIEf+flLZm9wyobfZmzDYf9VUipa12aks Yrfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756285666; x=1756890466; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/ukKij3qlWIWS1fgolUGyGco5PZGZyPfImO0OUOmtR4=; b=fkZJxcTjAC7eERTIWh49aWzSX2CqNfyib6/raPa+Msy+qqT4LOx/yH4mjqPUr4AX7I 8ilTDVEDwgHAsvBln2QfdXUN7OaTNBfVTVdr/sWLTCD0DVFHHgGJis8USb2YYYjJCmph N7CWWxYaRriE9z83s9QRUzUN7nAEqMoPgAzDXx8kOaR3yIjopZjzOP3VyxvgTkdaKxLu NU3wqRg5U3p22WFpzqY1Y9/IHWB6+p5J4VRNZY6a2cfx02u3t4tvnRsveNynMd13NLRK h5M1UCvkB86jq4YBdiYW2J6uGOxae5VNqmKcrty/HBvBeKmDfFPsAOAXtk8yRtqWPOku CD2Q== X-Gm-Message-State: AOJu0YzAFpRquJ0bDbtQ1UES6vSg8lDQm7Zr3q9iE+oGG7jOx5nXmaLY MLMlz+wzqXaSofUYszLejAD7CVqgVJyGJYeRdG8ex/rrKtxPT0EIDZkIEkfvc2eVCoIHk1XW82O pIkbl X-Gm-Gg: ASbGnctrlAhPL/dD4oMs9OH4iwvH8rItbFa+CNTy+MtdWzMSbygal+HEiOOz2+zw1gO IaITkDn7NinM2AJ15DEUS57x8+C2BUU0Hs0I138VNl7WE5LVYeui2gX+2JaUCy9WwpQgyzn+dvC Z8N/VpFeQpeDXozmgI7SYTKF4XYdPlDF50JkmaLRMPlBGPaE1gZTO+hdq6VKCQfTKWz6rOqMmku SfcFvanUi5URq9nysGgrHRMpUu0AOHPIPAiihYENkRdXdFc6KnCuCsskpDGyJmx6XyTkp/q7RVR vTOyU28lpHmzLfVV9OPArbhP7iGlH5pN4inS1uH5HwXR0EHMgEwBcLN8dacq7DPcWSi90YvlKlu sjerdGU7u1tpkEX7f2wwoNOP8Bj9QqUFOeRWT33xdF0jP/1n4x4kf/gpCvckntkX8UnwEOBW9fo 0KpzYV3x/gGRAE0hy6qTjhAdQFyjP1dGNFTK8TS7Y= X-Google-Smtp-Source: AGHT+IFrqXtYWNNI7kOxZhQTXaKo14u4GDX8IVvUK40u5qGFL1Ef2b5jL/CX5GjZzsQF71Hya3XR/w== X-Received: by 2002:a05:600c:4f4d:b0:456:1b6f:c888 with SMTP id 5b1f17b1804b1-45b62586a5dmr80714365e9.23.1756285666057; Wed, 27 Aug 2025 02:07:46 -0700 (PDT) Received: from raspberrypi.pitowers.org ([2a00:1098:3142:1f:ffc9:aff6:7f7f:893b]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45b6f30fe02sm21498675e9.18.2025.08.27.02.07.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Aug 2025 02:07:45 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: David Plowman Subject: [RFC PATCH 04/12] libcamera: Add a direction (input or output) to the stream configuration Date: Wed, 27 Aug 2025 10:07:31 +0100 Message-Id: <20250827090739.86955-5-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250827090739.86955-1-david.plowman@raspberrypi.com> References: <20250827090739.86955-1-david.plowman@raspberrypi.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" We are now going to support input streams as well as output streams, for example for passing in the Bayer image for raw re-processing. Signed-off-by: David Plowman --- include/libcamera/stream.h | 10 ++++++++++ src/libcamera/stream.cpp | 7 +++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index b5e8f0a9..39fed302 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -37,6 +37,11 @@ private: std::map> formats_; }; +enum class StreamDirection { + Input, + Output +}; + struct StreamConfiguration { StreamConfiguration(); StreamConfiguration(const StreamFormats &formats); @@ -46,6 +51,8 @@ struct StreamConfiguration { unsigned int stride; unsigned int frameSize; + StreamDirection direction; + unsigned int bufferCount; std::optional colorSpace; @@ -53,6 +60,8 @@ struct StreamConfiguration { Stream *stream() const { return stream_; } void setStream(Stream *stream) { stream_ = stream; } const StreamFormats &formats() const { return formats_; } + bool isOutput() const { return direction == StreamDirection::Output; } + bool isInput() const { return direction == StreamDirection::Input; } std::string toString() const; @@ -68,6 +77,7 @@ enum class StreamRole { StillCapture, VideoRecording, Viewfinder, + RawInput }; std::ostream &operator<<(std::ostream &out, StreamRole role); diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index f091487c..e970c8e5 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -280,8 +280,8 @@ SizeRange StreamFormats::range(const PixelFormat &pixelformat) const * handlers provide StreamFormats. */ StreamConfiguration::StreamConfiguration() - : pixelFormat(0), stride(0), frameSize(0), bufferCount(0), - stream_(nullptr) + : pixelFormat(0), stride(0), frameSize(0), + direction(StreamDirection::Output), bufferCount(0), stream_(nullptr) { } @@ -409,6 +409,9 @@ std::ostream &operator<<(std::ostream &out, const StreamConfiguration &cfg) { out << cfg.size << "-" << cfg.pixelFormat << "/" << ColorSpace::toString(cfg.colorSpace); + if (cfg.direction == StreamDirection::Input) + out << "/" + << "in"; return out; }