[{"id":37500,"web_url":"https://patchwork.libcamera.org/comment/37500/","msgid":"<176771503284.112111.18253207335446865@isaac-ThinkPad-T16-Gen-2>","date":"2026-01-06T15:57:12","subject":"Re: [PATCH 02/11] libcamera: Add a direction (input or output) to\n\tthe stream configuration","submitter":{"id":215,"url":"https://patchwork.libcamera.org/api/people/215/","name":"Isaac Scott","email":"isaac.scott@ideasonboard.com"},"content":"Hi David,\n\nQuoting David Plowman (2025-12-10 16:15:17)\n> We are now going to support input streams as well as output streams, for\n> example for passing in a Bayer image for raw re-processing.\n> \n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> ---\n>  include/libcamera/stream.h | 10 ++++++++++\n>  src/libcamera/stream.cpp   |  6 ++++--\n>  2 files changed, 14 insertions(+), 2 deletions(-)\n> \n> diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\n> index b5e8f0a9..39fed302 100644\n> --- a/include/libcamera/stream.h\n> +++ b/include/libcamera/stream.h\n> @@ -37,6 +37,11 @@ private:\n>         std::map<PixelFormat, std::vector<SizeRange>> formats_;\n>  };\n>  \n> +enum class StreamDirection {\n> +       Input,\n> +       Output\n> +};\n> +\n>  struct StreamConfiguration {\n>         StreamConfiguration();\n>         StreamConfiguration(const StreamFormats &formats);\n> @@ -46,6 +51,8 @@ struct StreamConfiguration {\n>         unsigned int stride;\n>         unsigned int frameSize;\n>  \n> +       StreamDirection direction;\n> +\n>         unsigned int bufferCount;\n>  \n>         std::optional<ColorSpace> colorSpace;\n> @@ -53,6 +60,8 @@ struct StreamConfiguration {\n>         Stream *stream() const { return stream_; }\n>         void setStream(Stream *stream) { stream_ = stream; }\n>         const StreamFormats &formats() const { return formats_; }\n> +       bool isOutput() const { return direction == StreamDirection::Output; }\n> +       bool isInput() const { return direction == StreamDirection::Input; }\n>  \n>         std::string toString() const;\n>  \n> @@ -68,6 +77,7 @@ enum class StreamRole {\n>         StillCapture,\n>         VideoRecording,\n>         Viewfinder,\n> +       RawInput\n>  };\n>  \n>  std::ostream &operator<<(std::ostream &out, StreamRole role);\n> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\n> index f091487c..439c61c4 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> -       : pixelFormat(0), stride(0), frameSize(0), bufferCount(0),\n> -         stream_(nullptr)\n> +       : pixelFormat(0), stride(0), frameSize(0),\n> +         direction(StreamDirection::Output), bufferCount(0), stream_(nullptr)\n\nReviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>\n\n>  {\n>  }\n>  \n> @@ -409,6 +409,8 @@ std::ostream &operator<<(std::ostream &out, const StreamConfiguration &cfg)\n>  {\n>         out << cfg.size << \"-\" << cfg.pixelFormat << \"/\"\n>             << ColorSpace::toString(cfg.colorSpace);\n> +       if (cfg.direction == StreamDirection::Input)\n> +               out << \"/in\";\n>         return out;\n>  }\n>  \n> -- \n> 2.47.3\n>","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 9111ABDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  6 Jan 2026 15:57:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4B9BC61FBC;\n\tTue,  6 Jan 2026 16:57:17 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8DCB561F9F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  6 Jan 2026 16:57:16 +0100 (CET)","from thinkpad.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8399078E;\n\tTue,  6 Jan 2026 16:56:55 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"SRi6Zjn1\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1767715015;\n\tbh=/Ua3bQhl4aJQw98TaG8vudUxuINUCpiAEK/MB/zFl5A=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=SRi6Zjn1pswWPz6TeK6DqD4ejCWIDSMzn+fpaCktqCBjOnXmXJA3YmIJan/tdDvUC\n\tC3+TV2RjCJASLZO+aCzVsOpzPTslGxgj/TXIYcvRXMos80J3RXrOIyKfLloNLrAsEU\n\t1YoNOx0zF31uj+yZ7c7wxDqHCsmO6T79ts9S7Efg=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251210164055.17856-3-david.plowman@raspberrypi.com>","References":"<20251210164055.17856-1-david.plowman@raspberrypi.com>\n\t<20251210164055.17856-3-david.plowman@raspberrypi.com>","Subject":"Re: [PATCH 02/11] libcamera: Add a direction (input or output) to\n\tthe stream configuration","From":"Isaac Scott <isaac.scott@ideasonboard.com>","Cc":"David Plowman <david.plowman@raspberrypi.com>","To":"David Plowman <david.plowman@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 06 Jan 2026 15:57:12 +0000","Message-ID":"<176771503284.112111.18253207335446865@isaac-ThinkPad-T16-Gen-2>","User-Agent":"alot/0.10","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>"}}]