Show a patch.

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

{
    "id": 21779,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/21779/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21779/",
    "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": "<20241031081645.302543-1-mailinglist1@johanneskirchmair.de>",
    "date": "2024-10-31T08:16:45",
    "name": "gstreamer:Implement caps parsing for video/x-bayer",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "fbc49e85dacafeefe6b861f7dc3b1aedf6340739",
    "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/21779/mbox/",
    "series": [
        {
            "id": 4758,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4758/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4758",
            "date": "2024-10-31T08:16:45",
            "name": "gstreamer:Implement caps parsing for video/x-bayer",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4758/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21779/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21779/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 20FB8C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 31 Oct 2024 08:22:16 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0DC16653A8;\n\tThu, 31 Oct 2024 09:22:15 +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 D5467618BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 31 Oct 2024 09:16:56 +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=\"BVWixbRH\"; \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=1730362615;\n\tbh=mE9HP2l7qaHtkQRUevyoFZQGQF5FmaA7Iq0Pp77kJjs=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=BVWixbRHgkI/STaXkTJ/x7gwd5+Om0QKPwWvi4TqVz5cSrMRbIGfgSP8zMFIqqfeH\n\t1rR0dJUgZHS42cifoLFy9aYC5ZH1JbbofxukJHa+oZlGCy3ddU454o8wQcTHLo5PDJ\n\tZD+RaCqT54xdDqKJDNdNGr55yL6XT7z8r16Ntc1M=",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "johannes.kirchmair@skidata.com, nicolas.dufresne@collabora.com,\n\tpavel@ucw.cz",
        "Subject": "[PATCH] gstreamer:Implement caps parsing for video/x-bayer",
        "Date": "Thu, 31 Oct 2024 09:16:45 +0100",
        "Message-Id": "<20241031081645.302543-1-mailinglist1@johanneskirchmair.de>",
        "X-Mailer": "git-send-email 2.34.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Mailman-Approved-At": "Thu, 31 Oct 2024 09:22:13 +0100",
        "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---\n src/gstreamer/gstlibcamera-utils.cpp | 90 ++++++++++++++--------------\n 1 file changed, 46 insertions(+), 44 deletions(-)",
    "diff": "diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp\nindex 79f71246..472367f2 100644\n--- a/src/gstreamer/gstlibcamera-utils.cpp\n+++ b/src/gstreamer/gstlibcamera-utils.cpp\n@@ -254,54 +254,53 @@ 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 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@@ -407,9 +406,8 @@ gst_libcamera_stream_configuration_to_caps(const StreamConfiguration &stream_cfg\n \treturn caps;\n }\n \n-void\n-gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg,\n-\t\t\t\t\t GstCaps *caps)\n+void gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg,\n+\t\t\t\t\t      GstCaps *caps)\n {\n \tGstVideoFormat gst_format = pixel_format_to_gst_format(stream_cfg.pixelFormat);\n \tguint i;\n@@ -469,11 +467,15 @@ gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg,\n \t\tgst_structure_fixate_field_string(s, \"format\", format);\n \t}\n \n+\tprintf(\"in the function!!!!!!\");\n \t/* Then configure the stream with the result. */\n \tif (gst_structure_has_name(s, \"video/x-raw\")) {\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": []
}