From patchwork Wed Dec 10 16:15:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 25467 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 29809C3257 for ; Wed, 10 Dec 2025 16:41:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C9607614C0; Wed, 10 Dec 2025 17:41:06 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="b0qhvtxE"; dkim-atps=neutral Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7879A6149B for ; Wed, 10 Dec 2025 17:41:01 +0100 (CET) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-477b198f4bcso61194715e9.3 for ; Wed, 10 Dec 2025 08:41:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1765384860; x=1765989660; 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=uWau+eh2Ecj16as7FhmAPsEXKhyf4sxG9O0J3vJHad8=; b=b0qhvtxEwV3tEPHOuaGqc4JCeg4COoT0mettg3lqiALvL4ntKLYoeyLPYgGBNWnzZl rBN8rHxgns66WbUd7l0hgnSfdQAMJ4DpvFJuPkmeMx8/aKaJrqPMtgk4ogsnv7whV/hX Kmxk/isFlF/jmGdluUj6qxbDG8QRo0FTEvBcfQk23TSJHL/Xn59JyPjPHDYik9lcUXIG MkIvTOkW5nODciBxHIhkaWAmWcOHxkD9dkilqMLJs7TryEUa80/HHMsVvvfJWZt5Xh7m 2clRzpyLiSy+AM53aAPdqh1w+UsPh0EJCAMHGMHJl2n/tdWtnjBArUlgxsOAN1q7QSEA IbdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765384860; x=1765989660; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=uWau+eh2Ecj16as7FhmAPsEXKhyf4sxG9O0J3vJHad8=; b=u4YXEetuHW0Hnbjs/TKOp6t0A+cQuDWufxBnPBmig10Pk8taxWbXld5ZRZ/wZg4YFi irCIdAElsbjoW4uZ0hXxqQxSc9OwDQPxZEbLuuMCfNYL94Uhmty0bXY98OFXUnqSIwZJ jaQl5rOGz0ck1cgOuUTB3mbbLuZv1dzoKOrMMN8WsfeVY2hF+hgtx/vym3M1J874jg1m j4aLSJ2Pjw7lAZuigw9X46y+Pw3IFhALBSUTMwNAzDbTakRCe0npwSLTZKT1/nXa4IcP eATLKvjzydVZMv9rwB6/5OPXiPHd9YV38HWI0UyVqnKDquh/0vPWhKP1irKFI0Ljyw/r Me4w== X-Gm-Message-State: AOJu0YyuaxDdOcsPJ0uGlv9E2fDwY0oQkvYC0YUiFxQdgQfA15WMCdzx IM9mwTtJpOiFVk1kfenOaU8XxeWq8AT4thLmstMu/6PXJJLfAlAxzDDnX8PG2QXbhYbFPSzIqyx i9b8n X-Gm-Gg: ASbGnctEa4+/J6oRjDV6ny6U4MMA8ZrxV4k/dQRb6JdiGXrZzGNDWqpprNp4EPspx1i 1jIIK+PjqZs9fZhr09HMMZ1/JB8rHKFFEebzDKQmlTdGtV5fRbB5q2gO0M40lILKm0g8pxNMO4Q 8ZDxBHQ01NIPIwJAUF25OGHQUGAx4II5zjnk7xYbnwhd4R48JS5VGrav4pMQP3vB6I+fRk1mKat 0KzOJhuZcX0AHhCIWkNq8jSH8hwFs8lx+WR2+9YKcEo9LW+K8xqDEw6w858Vyusp0uLJTU2oBkq X0aLKMofzUuhbm78HICR5jHipcpexJnT94XgMOXhvmW0wQKG6yJd06C10OB1sR6WkZC1t8f8XPL jToHqWBLyAOiMC5B+wHThKWRcyo+KkgxjoRL0XE0+mIU0hiIhclM/M/nIGUVU2tDZR6Pv+1CxdW bvb+pWv5VMxrlE3VD1zryCu0MukwGqK9QXxEixm7O+6aONnjcWSNjfkt5/FLaAx9n5H8j+QfbBN qcaZc1xjtQRTk5Yrgla+euaFSsxfg== X-Google-Smtp-Source: AGHT+IHIQwgYoQ13cFTStu76MMedA6pusDKtUegtSqJOxV5s0/BmYFX554HU5Xy5HuCFW3WYbuwmqQ== X-Received: by 2002:a05:600c:45cd:b0:471:672:3486 with SMTP id 5b1f17b1804b1-47a83759eb3mr29591035e9.15.1765384860432; Wed, 10 Dec 2025 08:41:00 -0800 (PST) Received: from davidp-pi5.pitowers.org ([2a00:1098:3142:1f:88ea:c658:5b20:5e46]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47a88371e13sm1270415e9.11.2025.12.10.08.40.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 08:40:59 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: David Plowman Subject: [PATCH 02/11] libcamera: Add a direction (input or output) to the stream configuration Date: Wed, 10 Dec 2025 16:15:17 +0000 Message-ID: <20251210164055.17856-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251210164055.17856-1-david.plowman@raspberrypi.com> References: <20251210164055.17856-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 a Bayer image for raw re-processing. Signed-off-by: David Plowman --- include/libcamera/stream.h | 10 ++++++++++ src/libcamera/stream.cpp | 6 ++++-- 2 files changed, 14 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..439c61c4 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,8 @@ 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; }