Show a patch.

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

{
    "id": 21806,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/21806/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21806/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20241104113653.393702-1-mailinglist1@johanneskirchmair.de>",
    "date": "2024-11-04T11:36:53",
    "name": "[v3] gstreamer: Implement caps negotiation for video/x-bayer",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "4939d07fc88372c241fe2c2e5c735a74cfbefa4e",
    "submitter": {
        "id": 212,
        "url": "https://patchwork.libcamera.org/api/1.1/people/212/?format=api",
        "name": null,
        "email": "mailinglist1@johanneskirchmair.de"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21806/mbox/",
    "series": [
        {
            "id": 4765,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4765/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4765",
            "date": "2024-11-04T11:36:53",
            "name": "[v3] gstreamer: Implement caps negotiation for video/x-bayer",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/4765/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21806/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21806/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 56100BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  4 Nov 2024 11:37:28 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4AFB6653D1;\n\tMon,  4 Nov 2024 12:37:27 +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 01F1A65399\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  4 Nov 2024 12:37:24 +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=\"FPY/C3p+\"; \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=1730720243;\n\tbh=+4siAyJbEZ3oYZx1DM4DLZO/1VdOW7NWqd/D22IeyIA=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=FPY/C3p+9Wza/zyiXXc8jED6f4K6zNs38B+gBvAaNQeMRKCBVrgVRHRiDhK7HIBy2\n\tO1CeqIo84W+E1YdyMxIulMOxQgAl+cIG37tL4cQFXxZk/1bPiRqd+4LpwPW9Ix38kz\n\teFT9mPMPAcDFXhoywDvZ4ISx2+rMl/A3y73+uOZs=",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "johannes.kirchmair@skidata.com, kieran.bingham@ideasonboard.com,\n\tpobrn@protonmail.com, nicolas.dufresne@collabora.com, pavel@ucw.cz",
        "Subject": "[PATCH v3] gstreamer: Implement caps negotiation for video/x-bayer",
        "Date": "Mon,  4 Nov 2024 12:36:53 +0100",
        "Message-Id": "<20241104113653.393702-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 it 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 v3:\n- commit msg \"parsing\" -> \"negotiations\" and \"is\"->\"it\"\n- change format argument of bayer_format_to_string to PixelFormat\n- make bayer_format_to_string return nullptr if no entry found\n- make bayer_formats const\n- use range-based for loops\n\nChanges in v2:\n- Coding style changes\n- Removed printf that slipped in\n---\n src/gstreamer/gstlibcamera-utils.cpp | 87 ++++++++++++++--------------\n 1 file changed, 44 insertions(+), 43 deletions(-)",
    "diff": "diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp\nindex 79f71246..0820c4b8 100644\n--- a/src/gstreamer/gstlibcamera-utils.cpp\n+++ b/src/gstreamer/gstlibcamera-utils.cpp\n@@ -254,52 +254,50 @@ gst_format_to_pixel_format(GstVideoFormat gst_format)\n \treturn PixelFormat{};\n }\n \n+static const struct {\n+\tPixelFormat format;\n+\tconst gchar *name;\n+} bayer_map[]{\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 static const gchar *\n-bayer_format_to_string(int format)\n+bayer_format_to_string(PixelFormat 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 (auto &b: bayer_map) {\n+\t\tif (b.format == format)\n+\t\t\treturn b.name;\n \t}\n-\treturn NULL;\n+\treturn nullptr;\n+}\n+\n+static PixelFormat\n+bayer_format_from_string(const gchar *name)\n+{\n+\tfor (auto &b: bayer_map) {\n+\t\tif (strcmp(b.name, name) == 0)\n+\t\t\treturn b.format;\n+\t}\n+\treturn PixelFormat{};\n }\n \n static GstStructure *\n@@ -474,6 +472,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": [
        "v3"
    ]
}