Show a patch.

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

{
    "id": 4007,
    "url": "https://patchwork.libcamera.org/api/patches/4007/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/4007/",
    "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": "<20200609232323.29628-3-laurent.pinchart@ideasonboard.com>",
    "date": "2020-06-09T23:23:18",
    "name": "[libcamera-devel,v2,2/7] gst: Replace explicit DRM FourCCs with libcamera formats",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "34a9201678bb234ca60341b5a348ad789f6342fe",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/4007/mbox/",
    "series": [
        {
            "id": 982,
            "url": "https://patchwork.libcamera.org/api/series/982/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=982",
            "date": "2020-06-09T23:23:16",
            "name": "Introduce formats:: namespace for libcamera pixel formats",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/982/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/4007/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/4007/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "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 CD08963C9E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Jun 2020 01:23:49 +0200 (CEST)",
            "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 01F11291\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Jun 2020 01:23:48 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"XLwwUU2X\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1591745029;\n\tbh=LvFRrup4qWP9f7QO+4eu+XAAcUb6ACkW+5ZoL4/jrUg=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=XLwwUU2X4wS+VURVXnHi8mr/OAVhsyYstHPrDHyI967S1UdPdHGIVo9SzGXuiOfN3\n\tn+pM6fWAFrG+1cmmaEoMswT6Cs3BxsONNuagpZCh9NRKZvR6XYOpohfaLNn7LX+Gvw\n\tNwPILHF4w0bUvzoAefiSe9dENVUiI8SvIOg1Jw3I=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 10 Jun 2020 02:23:18 +0300",
        "Message-Id": "<20200609232323.29628-3-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200609232323.29628-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20200609232323.29628-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 2/7] gst: Replace explicit DRM FourCCs\n\twith libcamera formats",
        "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>",
        "X-List-Received-Date": "Tue, 09 Jun 2020 23:23:50 -0000"
    },
    "content": "Use the new pixel format constants to replace usage of macros from\ndrm_fourcc.h.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/gstreamer/gstlibcamera-utils.cpp | 62 ++++++++++++++--------------\n 1 file changed, 31 insertions(+), 31 deletions(-)",
    "diff": "diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp\nindex a3cb0746e012..61370d5fad56 100644\n--- a/src/gstreamer/gstlibcamera-utils.cpp\n+++ b/src/gstreamer/gstlibcamera-utils.cpp\n@@ -8,56 +8,56 @@\n \n #include \"gstlibcamera-utils.h\"\n \n-#include <linux/drm_fourcc.h>\n+#include <libcamera/formats.h>\n \n using namespace libcamera;\n \n static struct {\n \tGstVideoFormat gst_format;\n-\tguint drm_fourcc;\n+\tPixelFormat format;\n } format_map[] = {\n-\t{ GST_VIDEO_FORMAT_ENCODED, DRM_FORMAT_MJPEG },\n-\t{ GST_VIDEO_FORMAT_RGB, DRM_FORMAT_BGR888 },\n-\t{ GST_VIDEO_FORMAT_BGR, DRM_FORMAT_RGB888 },\n-\t{ GST_VIDEO_FORMAT_ARGB, DRM_FORMAT_BGRA8888 },\n-\t{ GST_VIDEO_FORMAT_NV12, DRM_FORMAT_NV12 },\n-\t{ GST_VIDEO_FORMAT_NV21, DRM_FORMAT_NV21 },\n-\t{ GST_VIDEO_FORMAT_NV16, DRM_FORMAT_NV16 },\n-\t{ GST_VIDEO_FORMAT_NV61, DRM_FORMAT_NV61 },\n-\t{ GST_VIDEO_FORMAT_NV24, DRM_FORMAT_NV24 },\n-\t{ GST_VIDEO_FORMAT_UYVY, DRM_FORMAT_UYVY },\n-\t{ GST_VIDEO_FORMAT_VYUY, DRM_FORMAT_VYUY },\n-\t{ GST_VIDEO_FORMAT_YUY2, DRM_FORMAT_YUYV },\n-\t{ GST_VIDEO_FORMAT_YVYU, DRM_FORMAT_YVYU },\n+\t{ GST_VIDEO_FORMAT_ENCODED, formats::MJPEG },\n+\t{ GST_VIDEO_FORMAT_RGB, formats::BGR888 },\n+\t{ GST_VIDEO_FORMAT_BGR, formats::RGB888 },\n+\t{ GST_VIDEO_FORMAT_ARGB, formats::BGRA8888 },\n+\t{ GST_VIDEO_FORMAT_NV12, formats::NV12 },\n+\t{ GST_VIDEO_FORMAT_NV21, formats::NV21 },\n+\t{ GST_VIDEO_FORMAT_NV16, formats::NV16 },\n+\t{ GST_VIDEO_FORMAT_NV61, formats::NV61 },\n+\t{ GST_VIDEO_FORMAT_NV24, formats::NV24 },\n+\t{ GST_VIDEO_FORMAT_UYVY, formats::UYVY },\n+\t{ GST_VIDEO_FORMAT_VYUY, formats::VYUY },\n+\t{ GST_VIDEO_FORMAT_YUY2, formats::YUYV },\n+\t{ GST_VIDEO_FORMAT_YVYU, formats::YVYU },\n \t/* \\todo NV42 is used in libcamera but is not mapped in GStreamer yet. */\n };\n \n static GstVideoFormat\n-drm_to_gst_format(guint drm_fourcc)\n+pixel_format_to_gst_format(const PixelFormat &format)\n {\n \tfor (const auto &item : format_map) {\n-\t\tif (item.drm_fourcc == drm_fourcc)\n+\t\tif (item.format == format)\n \t\t\treturn item.gst_format;\n \t}\n \treturn GST_VIDEO_FORMAT_UNKNOWN;\n }\n \n-static guint\n-gst_format_to_drm(GstVideoFormat gst_format)\n+static PixelFormat\n+gst_format_to_pixel_format(GstVideoFormat gst_format)\n {\n \tif (gst_format == GST_VIDEO_FORMAT_ENCODED)\n-\t\treturn DRM_FORMAT_INVALID;\n+\t\treturn PixelFormat{};\n \n \tfor (const auto &item : format_map)\n \t\tif (item.gst_format == gst_format)\n-\t\t\treturn item.drm_fourcc;\n-\treturn DRM_FORMAT_INVALID;\n+\t\t\treturn item.format;\n+\treturn PixelFormat{};\n }\n \n static GstStructure *\n-bare_structure_from_fourcc(guint fourcc)\n+bare_structure_from_format(const PixelFormat &format)\n {\n-\tGstVideoFormat gst_format = drm_to_gst_format(fourcc);\n+\tGstVideoFormat gst_format = pixel_format_to_gst_format(format);\n \n \tif (gst_format == GST_VIDEO_FORMAT_UNKNOWN)\n \t\treturn nullptr;\n@@ -66,8 +66,8 @@ bare_structure_from_fourcc(guint fourcc)\n \t\treturn gst_structure_new(\"video/x-raw\", \"format\", G_TYPE_STRING,\n \t\t\t\t\t gst_video_format_to_string(gst_format), nullptr);\n \n-\tswitch (fourcc) {\n-\tcase DRM_FORMAT_MJPEG:\n+\tswitch (format) {\n+\tcase formats::MJPEG:\n \t\treturn gst_structure_new_empty(\"image/jpeg\");\n \tdefault:\n \t\treturn nullptr;\n@@ -80,7 +80,7 @@ gst_libcamera_stream_formats_to_caps(const StreamFormats &formats)\n \tGstCaps *caps = gst_caps_new_empty();\n \n \tfor (PixelFormat pixelformat : formats.pixelformats()) {\n-\t\tg_autoptr(GstStructure) bare_s = bare_structure_from_fourcc(pixelformat);\n+\t\tg_autoptr(GstStructure) bare_s = bare_structure_from_format(pixelformat);\n \n \t\tif (!bare_s) {\n \t\t\tGST_WARNING(\"Unsupported DRM format %\" GST_FOURCC_FORMAT,\n@@ -120,7 +120,7 @@ GstCaps *\n gst_libcamera_stream_configuration_to_caps(const StreamConfiguration &stream_cfg)\n {\n \tGstCaps *caps = gst_caps_new_empty();\n-\tGstStructure *s = bare_structure_from_fourcc(stream_cfg.pixelFormat);\n+\tGstStructure *s = bare_structure_from_format(stream_cfg.pixelFormat);\n \n \tgst_structure_set(s,\n \t\t\t  \"width\", G_TYPE_INT, stream_cfg.size.width,\n@@ -135,7 +135,7 @@ void\n gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg,\n \t\t\t\t\t GstCaps *caps)\n {\n-\tGstVideoFormat gst_format = drm_to_gst_format(stream_cfg.pixelFormat);\n+\tGstVideoFormat gst_format = pixel_format_to_gst_format(stream_cfg.pixelFormat);\n \n \t/* First fixate the caps using default configuration value. */\n \tg_assert(gst_caps_is_writable(caps));\n@@ -154,9 +154,9 @@ gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg,\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 = PixelFormat(gst_format_to_drm(gst_format));\n+\t\tstream_cfg.pixelFormat = gst_format_to_pixel_format(gst_format);\n \t} else if (gst_structure_has_name(s, \"image/jpeg\")) {\n-\t\tstream_cfg.pixelFormat = PixelFormat(DRM_FORMAT_MJPEG);\n+\t\tstream_cfg.pixelFormat = formats::MJPEG;\n \t} else {\n \t\tg_critical(\"Unsupported media type: %s\", gst_structure_get_name(s));\n \t}\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "2/7"
    ]
}