{"id":24241,"url":"https://patchwork.libcamera.org/api/1.1/patches/24241/?format=json","web_url":"https://patchwork.libcamera.org/patch/24241/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250827090739.86955-5-david.plowman@raspberrypi.com>","date":"2025-08-27T09:07:31","name":"[RFC,04/12] libcamera: Add a direction (input or output) to the stream configuration","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"a4b2d48aa640b1f07eec6a57b67ad91e719395f8","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/1.1/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24241/mbox/","series":[{"id":5407,"url":"https://patchwork.libcamera.org/api/1.1/series/5407/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5407","date":"2025-08-27T09:07:27","name":"Bayer Re-Processing","version":1,"mbox":"https://patchwork.libcamera.org/series/5407/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24241/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24241/checks/","tags":{},"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 4D249C332A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Aug 2025 09:08:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C50DB692F3;\n\tWed, 27 Aug 2025 11:07:56 +0200 (CEST)","from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com\n\t[IPv6:2a00:1450:4864:20::32f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0B01D613C0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Aug 2025 11:07:47 +0200 (CEST)","by mail-wm1-x32f.google.com with SMTP id\n\t5b1f17b1804b1-45a1b001f55so35020055e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Aug 2025 02:07:47 -0700 (PDT)","from raspberrypi.pitowers.org\n\t([2a00:1098:3142:1f:ffc9:aff6:7f7f:893b])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-45b6f30fe02sm21498675e9.18.2025.08.27.02.07.45\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 27 Aug 2025 02:07:45 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"Ya7X111c\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1756285666; x=1756890466;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=/ukKij3qlWIWS1fgolUGyGco5PZGZyPfImO0OUOmtR4=;\n\tb=Ya7X111c6RbEUsnLV9ZOk0M2xLnOnEonj10WToCED+pLK1I7OlXpV4gokEL99Ou8WP\n\tqmyP7R66sxGnzXs2nBZqGiiFD56IoveTMRL8suFC58LRzScWNJtN8Bzj+jSZAJbsiirL\n\txS7/4wJ0Ve+bKtEP8yd8T8jWHFuepPPX1c00hqe1+3+1H2UezZxz3sos685gATqUGszu\n\thN3zHxW1E3Sek7AJ8ttYuJ0Ieid2V/dVTm447U0ry0fZKXmg63HyJ5Flny5zRWpSn+oV\n\tZNU5k3VMG2K+q4m8FqrUNRl7l/Fb4TmwiljkIEf+flLZm9wyobfZmzDYf9VUipa12aks\n\tYrfg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1756285666; x=1756890466;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=/ukKij3qlWIWS1fgolUGyGco5PZGZyPfImO0OUOmtR4=;\n\tb=fkZJxcTjAC7eERTIWh49aWzSX2CqNfyib6/raPa+Msy+qqT4LOx/yH4mjqPUr4AX7I\n\t8ilTDVEDwgHAsvBln2QfdXUN7OaTNBfVTVdr/sWLTCD0DVFHHgGJis8USb2YYYjJCmph\n\tN7CWWxYaRriE9z83s9QRUzUN7nAEqMoPgAzDXx8kOaR3yIjopZjzOP3VyxvgTkdaKxLu\n\tNU3wqRg5U3p22WFpzqY1Y9/IHWB6+p5J4VRNZY6a2cfx02u3t4tvnRsveNynMd13NLRK\n\th5M1UCvkB86jq4YBdiYW2J6uGOxae5VNqmKcrty/HBvBeKmDfFPsAOAXtk8yRtqWPOku\n\tCD2Q==","X-Gm-Message-State":"AOJu0YzAFpRquJ0bDbtQ1UES6vSg8lDQm7Zr3q9iE+oGG7jOx5nXmaLY\n\tMLMlz+wzqXaSofUYszLejAD7CVqgVJyGJYeRdG8ex/rrKtxPT0EIDZkIEkfvc2eVCoIHk1XW82O\n\tpIkbl","X-Gm-Gg":"ASbGnctrlAhPL/dD4oMs9OH4iwvH8rItbFa+CNTy+MtdWzMSbygal+HEiOOz2+zw1gO\n\tIaITkDn7NinM2AJ15DEUS57x8+C2BUU0Hs0I138VNl7WE5LVYeui2gX+2JaUCy9WwpQgyzn+dvC\n\tZ8N/VpFeQpeDXozmgI7SYTKF4XYdPlDF50JkmaLRMPlBGPaE1gZTO+hdq6VKCQfTKWz6rOqMmku\n\tSfcFvanUi5URq9nysGgrHRMpUu0AOHPIPAiihYENkRdXdFc6KnCuCsskpDGyJmx6XyTkp/q7RVR\n\tvTOyU28lpHmzLfVV9OPArbhP7iGlH5pN4inS1uH5HwXR0EHMgEwBcLN8dacq7DPcWSi90YvlKlu\n\tsjerdGU7u1tpkEX7f2wwoNOP8Bj9QqUFOeRWT33xdF0jP/1n4x4kf/gpCvckntkX8UnwEOBW9fo\n\t0KpzYV3x/gGRAE0hy6qTjhAdQFyjP1dGNFTK8TS7Y=","X-Google-Smtp-Source":"AGHT+IFrqXtYWNNI7kOxZhQTXaKo14u4GDX8IVvUK40u5qGFL1Ef2b5jL/CX5GjZzsQF71Hya3XR/w==","X-Received":"by 2002:a05:600c:4f4d:b0:456:1b6f:c888 with SMTP id\n\t5b1f17b1804b1-45b62586a5dmr80714365e9.23.1756285666057; \n\tWed, 27 Aug 2025 02:07:46 -0700 (PDT)","From":"David Plowman <david.plowman@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"David Plowman <david.plowman@raspberrypi.com>","Subject":"[RFC PATCH 04/12] libcamera: Add a direction (input or output) to\n\tthe 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","Content-Transfer-Encoding":"8bit","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>"},"content":"We are now going to support input streams as well as output streams, for\nexample for passing in the Bayer image for raw re-processing.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/stream.h | 10 ++++++++++\n src/libcamera/stream.cpp   |  7 +++++--\n 2 files changed, 15 insertions(+), 2 deletions(-)","diff":"diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\nindex b5e8f0a9..39fed302 100644\n--- a/include/libcamera/stream.h\n+++ b/include/libcamera/stream.h\n@@ -37,6 +37,11 @@ private:\n \tstd::map<PixelFormat, std::vector<SizeRange>> formats_;\n };\n \n+enum class StreamDirection {\n+\tInput,\n+\tOutput\n+};\n+\n struct StreamConfiguration {\n \tStreamConfiguration();\n \tStreamConfiguration(const StreamFormats &formats);\n@@ -46,6 +51,8 @@ struct StreamConfiguration {\n \tunsigned int stride;\n \tunsigned int frameSize;\n \n+\tStreamDirection direction;\n+\n \tunsigned int bufferCount;\n \n \tstd::optional<ColorSpace> colorSpace;\n@@ -53,6 +60,8 @@ struct StreamConfiguration {\n \tStream *stream() const { return stream_; }\n \tvoid setStream(Stream *stream) { stream_ = stream; }\n \tconst StreamFormats &formats() const { return formats_; }\n+\tbool isOutput() const { return direction == StreamDirection::Output; }\n+\tbool isInput() const { return direction == StreamDirection::Input; }\n \n \tstd::string toString() const;\n \n@@ -68,6 +77,7 @@ enum class StreamRole {\n \tStillCapture,\n \tVideoRecording,\n \tViewfinder,\n+\tRawInput\n };\n \n std::ostream &operator<<(std::ostream &out, StreamRole role);\ndiff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\nindex f091487c..e970c8e5 100644\n--- a/src/libcamera/stream.cpp\n+++ b/src/libcamera/stream.cpp\n@@ -280,8 +280,8 @@ SizeRange StreamFormats::range(const PixelFormat &pixelformat) const\n  * handlers provide StreamFormats.\n  */\n StreamConfiguration::StreamConfiguration()\n-\t: pixelFormat(0), stride(0), frameSize(0), bufferCount(0),\n-\t  stream_(nullptr)\n+\t: pixelFormat(0), stride(0), frameSize(0),\n+\t  direction(StreamDirection::Output), bufferCount(0), stream_(nullptr)\n {\n }\n \n@@ -409,6 +409,9 @@ std::ostream &operator<<(std::ostream &out, const StreamConfiguration &cfg)\n {\n \tout << cfg.size << \"-\" << cfg.pixelFormat << \"/\"\n \t    << ColorSpace::toString(cfg.colorSpace);\n+\tif (cfg.direction == StreamDirection::Input)\n+\t\tout << \"/\"\n+\t\t    << \"in\";\n \treturn out;\n }\n \n","prefixes":["RFC","04/12"]}