Show a patch.

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

{
    "id": 21780,
    "url": "https://patchwork.libcamera.org/api/patches/21780/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21780/",
    "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": "<20241031091157.304305-1-mailinglist1@johanneskirchmair.de>",
    "date": "2024-10-31T09:11:57",
    "name": "[v2] gstreamer:Implement caps parsing for video/x-bayer",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "c91ddd5c8228009529aacc9559859c7785daa8ca",
    "submitter": {
        "id": 212,
        "url": "https://patchwork.libcamera.org/api/people/212/?format=api",
        "name": null,
        "email": "mailinglist1@johanneskirchmair.de"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21780/mbox/",
    "series": [
        {
            "id": 4759,
            "url": "https://patchwork.libcamera.org/api/series/4759/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4759",
            "date": "2024-10-31T09:11:57",
            "name": "[v2] gstreamer:Implement caps parsing for video/x-bayer",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/4759/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21780/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21780/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 8A01FC31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 31 Oct 2024 09:12:37 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A3E79653A9;\n\tThu, 31 Oct 2024 10:12:36 +0100 (CET)",
            "from mx8.mail-out.lima-city.de (mx8.mail-out.lima-city.de\n\t[91.216.248.210])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5B9C96539F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 31 Oct 2024 10:12:35 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=johanneskirchmair.de\n\theader.i=@johanneskirchmair.de header.b=\"JIohFUUP\"; \n\tdkim-atps=neutral",
        "From": "mailinglist1@johanneskirchmair.de",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=simple/simple; d=johanneskirchmair.de; \n\ts=securedbylima-20161106; t=1730365954;\n\tbh=7J96vF52usTkFEV2byh/fjSVGcGKV7F8GcpNr6jgzOo=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=JIohFUUPZQr8EzUHXTK348WdCY3gPx65g8r8lyg+Z6gbTadms6yYoeZzo6cna95zi\n\t1zvl5XS/mUa7B4GjdBlxjoEgoA4OGSkjBNYCDA3U9WgughYZ8/+SMw7RjNAL3G09Xw\n\thnL3KfxViR34ROVguYVW1u0/P1NDDbJ1WiHgxywM=",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "johannes.kirchmair@skidata.com, kieran.bingham@ideasonboard.com,\n\tnicolas.dufresne@collabora.com, pavel@ucw.cz",
        "Subject": "[PATCH v2] gstreamer:Implement caps parsing for video/x-bayer",
        "Date": "Thu, 31 Oct 2024 10:11:57 +0100",
        "Message-Id": "<20241031091157.304305-1-mailinglist1@johanneskirchmair.de>",
        "X-Mailer": "git-send-email 2.34.1",
        "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": "From: Johannes Kirchmair <johannes.kirchmair@skidata.com>\n\nThe parsing of video/x-bayer sources from string makes is possible to\nuse cameras providing e.g SGRBG8 streams via gst-launch.\n\nLike:\ngst-launch-1.0 libcamerasrc camera-name=<cam> ! video/x-bayer,format=grbg\n\nWithout this change the gstreamer plugin complains about \"Unsupported\nmedia type: video/x-bayer\".\n\nSigned-off-by: Johannes Kirchmair <johannes.kirchmair@skidata.com>\n\nChanges in v2:\n- Coding style changes\n- Removed printf that slipped in\n---\n src/gstreamer/gstlibcamera-utils.cpp | 85 ++++++++++++++--------------\n 1 file changed, 44 insertions(+), 41 deletions(-)",
    "diff": "diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp\nindex 79f71246..80631295 100644\n--- a/src/gstreamer/gstlibcamera-utils.cpp\n+++ b/src/gstreamer/gstlibcamera-utils.cpp\n@@ -254,54 +254,54 @@ gst_format_to_pixel_format(GstVideoFormat gst_format)\n \treturn PixelFormat{};\n }\n \n+static struct {\n+\tPixelFormat format;\n+\tconst gchar *name;\n+} bayer_formats[]{\n+\t{ formats::SBGGR8, \"bggr\" },\n+\t{ formats::SGBRG8, \"gbrg\" },\n+\t{ formats::SGRBG8, \"grbg\" },\n+\t{ formats::SRGGB8, \"rggb\" },\n+\t{ formats::SBGGR10, \"bggr10le\" },\n+\t{ formats::SGBRG10, \"gbrg10le\" },\n+\t{ formats::SGRBG10, \"grbg10le\" },\n+\t{ formats::SRGGB10, \"rggb10le\" },\n+\t{ formats::SBGGR12, \"bggr12le\" },\n+\t{ formats::SGBRG12, \"gbrg12le\" },\n+\t{ formats::SGRBG12, \"grbg12le\" },\n+\t{ formats::SRGGB12, \"rggb12le\" },\n+\t{ formats::SBGGR14, \"bggr14le\" },\n+\t{ formats::SGBRG14, \"gbrg14le\" },\n+\t{ formats::SGRBG14, \"grbg14le\" },\n+\t{ formats::SRGGB14, \"rggb14le\" },\n+\t{ formats::SBGGR16, \"bggr16le\" },\n+\t{ formats::SGBRG16, \"gbrg16le\" },\n+\t{ formats::SGRBG16, \"grbg16le\" },\n+\t{ formats::SRGGB16, \"rggb16le\" },\n+};\n+\n+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))\n+\n static const gchar *\n bayer_format_to_string(int format)\n {\n-\tswitch (format) {\n-\tcase formats::SBGGR8:\n-\t\treturn \"bggr\";\n-\tcase formats::SGBRG8:\n-\t\treturn \"gbrg\";\n-\tcase formats::SGRBG8:\n-\t\treturn \"grbg\";\n-\tcase formats::SRGGB8:\n-\t\treturn \"rggb\";\n-\tcase formats::SBGGR10:\n-\t\treturn \"bggr10le\";\n-\tcase formats::SGBRG10:\n-\t\treturn \"gbrg10le\";\n-\tcase formats::SGRBG10:\n-\t\treturn \"grbg10le\";\n-\tcase formats::SRGGB10:\n-\t\treturn \"rggb10le\";\n-\tcase formats::SBGGR12:\n-\t\treturn \"bggr12le\";\n-\tcase formats::SGBRG12:\n-\t\treturn \"gbrg12le\";\n-\tcase formats::SGRBG12:\n-\t\treturn \"grbg12le\";\n-\tcase formats::SRGGB12:\n-\t\treturn \"rggb12le\";\n-\tcase formats::SBGGR14:\n-\t\treturn \"bggr14le\";\n-\tcase formats::SGBRG14:\n-\t\treturn \"gbrg14le\";\n-\tcase formats::SGRBG14:\n-\t\treturn \"grbg14le\";\n-\tcase formats::SRGGB14:\n-\t\treturn \"rggb14le\";\n-\tcase formats::SBGGR16:\n-\t\treturn \"bggr16le\";\n-\tcase formats::SGBRG16:\n-\t\treturn \"gbrg16le\";\n-\tcase formats::SGRBG16:\n-\t\treturn \"grbg16le\";\n-\tcase formats::SRGGB16:\n-\t\treturn \"rggb16le\";\n+\tfor (unsigned int i = 0; i < ARRAY_SIZE(bayer_formats); i++) {\n+\t\tif ((uint32_t)bayer_formats[i].format == (uint32_t)format)\n+\t\t\treturn bayer_formats[i].name;\n \t}\n \treturn NULL;\n }\n \n+static PixelFormat\n+bayer_format_from_string(const gchar *name)\n+{\n+\tfor (unsigned int i = 0; i < ARRAY_SIZE(bayer_formats); i++) {\n+\t\tif (strcmp(bayer_formats[i].name, name) == 0)\n+\t\t\treturn bayer_formats[i].format;\n+\t}\n+\treturn PixelFormat{};\n+}\n+\n static GstStructure *\n bare_structure_from_format(const PixelFormat &format)\n {\n@@ -474,6 +474,9 @@ gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg,\n \t\tconst gchar *format = gst_structure_get_string(s, \"format\");\n \t\tgst_format = gst_video_format_from_string(format);\n \t\tstream_cfg.pixelFormat = gst_format_to_pixel_format(gst_format);\n+\t} else if (gst_structure_has_name(s, \"video/x-bayer\")) {\n+\t\tconst gchar *format = gst_structure_get_string(s, \"format\");\n+\t\tstream_cfg.pixelFormat = bayer_format_from_string(format);\n \t} else if (gst_structure_has_name(s, \"image/jpeg\")) {\n \t\tstream_cfg.pixelFormat = formats::MJPEG;\n \t} else {\n",
    "prefixes": [
        "v2"
    ]
}