Show a patch.

GET /api/patches/26590/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 26590,
    "url": "https://patchwork.libcamera.org/api/patches/26590/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26590/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20260501105137.439519-3-maxbretschneider@protonmail.com>",
    "date": "2026-05-01T10:52:09",
    "name": "[RFC,v1,2/3] libcamera: pipeline: virtual: Add raw_frames config parser support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "5f40972d1fb4d973de18d8e274cb5760795fbe6e",
    "submitter": {
        "id": 266,
        "url": "https://patchwork.libcamera.org/api/people/266/?format=api",
        "name": "Max Bretschneider",
        "email": "maxbretschneider@protonmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/26590/mbox/",
    "series": [
        {
            "id": 5892,
            "url": "https://patchwork.libcamera.org/api/series/5892/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5892",
            "date": "2026-05-01T10:52:02",
            "name": "libcamera: pipeline: virtual: Add raw Bayer frame support",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5892/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26590/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26590/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 2D03EBDCB5\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  1 May 2026 10:52:15 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C9B6263021;\n\tFri,  1 May 2026 12:52:14 +0200 (CEST)",
            "from mail-10699.protonmail.ch (mail-10699.protonmail.ch\n\t[79.135.106.99])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0825862FD3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  1 May 2026 12:52:14 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=protonmail.com header.i=@protonmail.com\n\theader.b=\"hcntd6rX\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail3; t=1777632733; x=1777891933;\n\tbh=iYQHAUY6USdU+wdz5n70UaFjuzvcs5UlQwruuIUMZLg=;\n\th=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:\n\tFeedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:\n\tMessage-ID:BIMI-Selector;\n\tb=hcntd6rXXMonUNqfHDG7CVPbRAYTRvgAAHoqD/G9Y+NniZ5xFcI4GruXjidFN6eL/\n\tScDWnSFnU8kq0TSQkTYfGvphzGKUjJECNXasz7ClimQNY0tuWBvi5vjHHaOApaoCM9\n\t1kpaIcbUhyzVUZcF4qmCNjaJYW+RopCOelo3OJA/9VJY1kmbChPA5/YPsoSasTK4oo\n\t8NdrC9OKA28YI1AxVlA6T8ZC6aTOnty9JzRl43ea/Hk+Kjbb427uXCMRa6tsBJfKyK\n\taZKbnw3iGrAvfOwyiSdYspIdrilKzKkwAV89LJ0W+E+5WjR0hjiJBo/gCDh2HuMr66\n\tlrpLvU9PyZvDQ==",
        "Date": "Fri, 01 May 2026 10:52:09 +0000",
        "To": "libcamera-devel@lists.libcamera.org",
        "From": "Max Bretschneider <maxbretschneider@protonmail.com>",
        "Cc": "Max Bretschneider <maxbretschneider@protonmail.com>",
        "Subject": "[RFC PATCH v1 2/3] libcamera: pipeline: virtual: Add raw_frames\n\tconfig parser support",
        "Message-ID": "<20260501105137.439519-3-maxbretschneider@protonmail.com>",
        "In-Reply-To": "<20260501105137.439519-1-maxbretschneider@protonmail.com>",
        "References": "<20260501105137.439519-1-maxbretschneider@protonmail.com>",
        "Feedback-ID": "122687743:user:proton",
        "X-Pm-Message-ID": "8124651386b37c98f5f4c49914ace05c35876a7d",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=utf-8",
        "Content-Transfer-Encoding": "quoted-printable",
        "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": "Extend parseFrameGenerator() to handle the new raw_frames YAML key\nalongside the existing test_pattern and frames keys. File collection\nlogic (e.g. either single file or directory with natural sorting)\nfollows the existing frames path handling. This raw_frames block\naccepts:\n- path (single file or directory)\n- bayer_order (RGGB, BGGR, GRBG, GBRG)\n- bit_depth (8, 10, 12, 14, 16), in accordance to libcamera/formats.yaml\n\nSigned-off-by: Max Bretschneider <maxbretschneider@protonmail.com>\n---\n .../pipeline/virtual/config_parser.cpp        | 100 ++++++++++++++++--\n 1 file changed, 94 insertions(+), 6 deletions(-)\n\n--\n2.43.0",
    "diff": "diff --git a/src/libcamera/pipeline/virtual/config_parser.cpp b/src/libcamera/pipeline/virtual/config_parser.cpp\nindex 5169fd39..fcce70c8 100644\n--- a/src/libcamera/pipeline/virtual/config_parser.cpp\n+++ b/src/libcamera/pipeline/virtual/config_parser.cpp\n@@ -156,13 +156,20 @@ int ConfigParser::parseFrameGenerator(const ValueNode &cameraConfigData, Virtual\n {\n \tconst std::string testPatternKey = \"test_pattern\";\n \tconst std::string framesKey = \"frames\";\n-\tif (cameraConfigData.contains(testPatternKey)) {\n-\t\tif (cameraConfigData.contains(framesKey)) {\n-\t\t\tLOG(Virtual, Error) << \"A camera should use either \"\n-\t\t\t\t\t    << testPatternKey << \" or \" << framesKey;\n-\t\t\treturn -EINVAL;\n-\t\t}\n+\tconst std::string rawFramesKey = \"raw_frames\";\n+\n+\t/* Ensure only one frame source is specified */\n+\tint sourcesSpecified = cameraConfigData.contains(testPatternKey) +\n+\t\t\t       cameraConfigData.contains(framesKey) +\n+\t\t\t       cameraConfigData.contains(rawFramesKey);\n+\tif (sourcesSpecified > 1) {\n+\t\tLOG(Virtual, Error) << \"A camera should use only one of \"\n+\t\t\t\t    << testPatternKey << \", \" << framesKey\n+\t\t\t\t    << \", or \" << rawFramesKey;\n+\t\treturn -EINVAL;\n+\t}\n\n+\tif (cameraConfigData.contains(testPatternKey)) {\n \t\tauto testPattern = cameraConfigData[testPatternKey].get<std::string>(\"\");\n\n \t\tif (testPattern == \"bars\") {\n@@ -178,6 +185,87 @@ int ConfigParser::parseFrameGenerator(const ValueNode &cameraConfigData, Virtual\n \t\treturn 0;\n \t}\n\n+\tif (cameraConfigData.contains(rawFramesKey)) {\n+\t\tconst ValueNode &rawFrames = cameraConfigData[rawFramesKey];\n+\n+\t\tif (!rawFrames.isDictionary()) {\n+\t\t\tLOG(Virtual, Error) << \"'raw_frames' is not a dictionary.\";\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tauto path = rawFrames[\"path\"].get<std::string>();\n+\t\tif (!path) {\n+\t\t\tLOG(Virtual, Error) << \"raw_frames: path must be specified.\";\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tstd::vector<std::filesystem::path> files;\n+\n+\t\tswitch (std::filesystem::symlink_status(*path).type()) {\n+\t\tcase std::filesystem::file_type::regular:\n+\t\t\tfiles.push_back(*path);\n+\t\t\tbreak;\n+\n+\t\tcase std::filesystem::file_type::directory:\n+\t\t\tfor (const auto &dentry : std::filesystem::directory_iterator{ *path })\n+\t\t\t\tif (dentry.is_regular_file())\n+\t\t\t\t\tfiles.push_back(dentry.path());\n+\n+\t\t\tstd::sort(files.begin(), files.end(), [](const auto &a, const auto &b) {\n+\t\t\t\treturn ::strverscmp(a.c_str(), b.c_str()) < 0;\n+\t\t\t});\n+\n+\t\t\tif (files.empty()) {\n+\t\t\t\tLOG(Virtual, Error) << \"raw_frames directory has no files: \" << *path;\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tLOG(Virtual, Error) << \"raw_frames path: \" << *path << \" is not supported\";\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\t/* Parse bayer_order */\n+\t\tauto bayerOrder = rawFrames[\"bayer_order\"].get<std::string>();\n+\t\tif (!bayerOrder) {\n+\t\t\tLOG(Virtual, Error) << \"raw_frames: bayer_order must be specified.\";\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tstatic const std::map<std::string, uint32_t> bayerOrderMap = {\n+\t\t\t{ \"RGGB\", properties::draft::ColorFilterArrangementEnum::RGGB },\n+\t\t\t{ \"BGGR\", properties::draft::ColorFilterArrangementEnum::BGGR },\n+\t\t\t{ \"GRBG\", properties::draft::ColorFilterArrangementEnum::GRBG },\n+\t\t\t{ \"GBRG\", properties::draft::ColorFilterArrangementEnum::GBRG },\n+\t\t};\n+\n+\t\tauto it = bayerOrderMap.find(*bayerOrder);\n+\t\tif (it == bayerOrderMap.end()) {\n+\t\t\tLOG(Virtual, Error) << \"raw_frames: unsupported bayer_order: \"\n+\t\t\t\t\t    << *bayerOrder\n+\t\t\t\t\t    << \", must be one of RGGB, BGGR, GRBG, GBRG\";\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\t/* Parse bit_depth */\n+\t\tauto bitDepth = rawFrames[\"bit_depth\"].get<unsigned int>();\n+\t\tif (!bitDepth) {\n+\t\t\tLOG(Virtual, Error) << \"raw_frames: bit_depth must be specified.\";\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tstatic const std::set<unsigned int> supportedBitDepths = { 8, 10, 12, 14, 16 };\n+\t\tif (supportedBitDepths.find(*bitDepth) == supportedBitDepths.end()) {\n+\t\t\tLOG(Virtual, Error) << \"raw_frames: bit_depth unsupported: \" << *bitDepth\n+\t\t\t\t\t    << \", must be one of 8, 10, 12, 14, 16\";\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tdata->config_.frame = RawFrames{ std::move(files), it->second, *bitDepth };\n+\n+\t\treturn 0;\n+\t}\n+\n \tconst ValueNode &frames = cameraConfigData[framesKey];\n\n \t/* When there is no frames provided in the config file, use color bar test pattern */\n",
    "prefixes": [
        "RFC",
        "v1",
        "2/3"
    ]
}