Show a patch.

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

{
    "id": 9018,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/9018/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/9018/",
    "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": "<20200727151820.24466-2-kgupta@es.iitr.ac.in>",
    "date": "2020-07-27T15:18:18",
    "name": "[libcamera-devel,v3,1/3] libcamera: formats: PixelFormatInfo: Add name lookup function",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "ea83e6eba751821bbc63a52d91e1a5f11f98fa02",
    "submitter": {
        "id": 39,
        "url": "https://patchwork.libcamera.org/api/1.1/people/39/?format=api",
        "name": "Kaaira Gupta",
        "email": "kgupta@es.iitr.ac.in"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/9018/mbox/",
    "series": [
        {
            "id": 1152,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1152/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1152",
            "date": "2020-07-27T15:18:17",
            "name": "Enable formats lookup based on name",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/1152/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/9018/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/9018/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 A4F33BD878\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Jul 2020 15:18:42 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6D6FD613B1;\n\tMon, 27 Jul 2020 17:18:42 +0200 (CEST)",
            "from mail-pg1-x529.google.com (mail-pg1-x529.google.com\n\t[IPv6:2607:f8b0:4864:20::529])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 23240611A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Jul 2020 17:18:41 +0200 (CEST)",
            "by mail-pg1-x529.google.com with SMTP id p3so9751369pgh.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Jul 2020 08:18:41 -0700 (PDT)",
            "from kaaira-HP-Pavilion-Notebook ([103.113.213.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tq14sm15239520pgk.86.2020.07.27.08.18.38\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 27 Jul 2020 08:18:39 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=es-iitr-ac-in.20150623.gappssmtp.com\n\theader.i=@es-iitr-ac-in.20150623.gappssmtp.com\n\theader.b=\"wdv1/0GZ\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=JbzLbXefDsOj7y17Z0ShvC3CdATsNcn1QqYzkV3YnFw=;\n\tb=wdv1/0GZtxQcpPHNexzds3aS43iZkh8HUgAA47M9p/v7NIYhdTqCKV35v4Sqbin6ny\n\tQY+NgRlTeuoSDt/eeNkgyW0yFkTwy6LEOM4GMErDReu5jHkfr+QdSQId+8k1G6LlZzp6\n\tc8QstnKbBh4KdvXFRMMUB8mA9Zs0gRrrRVbicufeAcVfSTobGgWaazdA8pfwd1i4E6u1\n\tu/eVPPX5YeEwRfCv8g9bLO4wWnbBfVkDp/4oTX9Um7AJNVACoBh/sJr9JHVgVW08d0qM\n\toWAzDgx9Vk7y5jbf0V3sOqepNDfCBlzEvLHtygBW0HY/CJVI3snmaHr7xoMG99IPrUvT\n\t+mzQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=JbzLbXefDsOj7y17Z0ShvC3CdATsNcn1QqYzkV3YnFw=;\n\tb=ElcT1ybmy/cY6vDH3984WuG0wTz/FVkkn95RQACgctffJvO2g5xx4n4AL8crBCF60w\n\tBBVcM3Ps1juYQR/ys5k+2pYbPV8NJQh+QZdWAq24S79twp0rTNa9/ktFW+QFoEeJleC7\n\t1DQwid4H2xV81FiO858dI+xyuxOjIqN1z+uJI4jTKzQehdVJSTgV+K9YHY4QjQJ+PbzW\n\tmIHQ6v7P+3qa1cJf/fay1DRdMNoBuXnoTg1khpXJyxXnd1dsTLAGd+JsieO/J0UIq3P6\n\twRjbmCzWA0WqSM1WKkUR0gk10KgJEfhjhz4pYmWlDwZuvVMMXCg3x0JWXuVn+ibSLTsx\n\tRBkQ==",
        "X-Gm-Message-State": "AOAM530UqIyNn89mhrB7XjXQYSoblxE+JuK/xRQgxHmlnp/8KOQokPMK\n\takHcyA7p13ROUOz6WhvM3vVciQ==",
        "X-Google-Smtp-Source": "ABdhPJyeIzAt1t8omGWSzfx6m+pLKQD/KRx0XVwI96yuugLBNW4qqgSFYD/eqkKR97v3TuXszdlKAA==",
        "X-Received": "by 2002:a63:8f51:: with SMTP id\n\tr17mr20106949pgn.124.1595863119601; \n\tMon, 27 Jul 2020 08:18:39 -0700 (PDT)",
        "From": "Kaaira Gupta <kgupta@es.iitr.ac.in>",
        "To": "libcamera-devel@lists.libcamera.org, Kieran Bingham\n\t<kieran.bingham@ideasonboard.com>, =?utf-8?q?Niklas_S=C3=B6derlund?=\n\t<niklas.soderlund@ragnatech.se>",
        "Date": "Mon, 27 Jul 2020 20:48:18 +0530",
        "Message-Id": "<20200727151820.24466-2-kgupta@es.iitr.ac.in>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200727151820.24466-1-kgupta@es.iitr.ac.in>",
        "References": "<20200727151820.24466-1-kgupta@es.iitr.ac.in>",
        "Subject": "[libcamera-devel] [PATCH v3 1/3] libcamera: formats:\n\tPixelFormatInfo: Add name lookup function",
        "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>",
        "Cc": "Kaaira Gupta <kgupta@es.iitr.ac.in>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Add a function which returns a format, given its name as a string.\n\nSigned-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>\n---\n include/libcamera/internal/formats.h |  1 +\n src/libcamera/formats.cpp            | 20 ++++++++++++++++++++\n 2 files changed, 21 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h\nindex 0bb1510..2589e88 100644\n--- a/include/libcamera/internal/formats.h\n+++ b/include/libcamera/internal/formats.h\n@@ -38,6 +38,7 @@ public:\n \n \tstatic const PixelFormatInfo &info(const PixelFormat &format);\n \tstatic const PixelFormatInfo &info(const V4L2PixelFormat &format);\n+\tstatic const PixelFormat &info(const std::string &name);\n \n \tunsigned int stride(unsigned int width, unsigned int plane,\n \t\t\t    unsigned int align = 1) const;\ndiff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\nindex 11774b0..8ea5461 100644\n--- a/src/libcamera/formats.cpp\n+++ b/src/libcamera/formats.cpp\n@@ -23,6 +23,8 @@ namespace libcamera {\n \n LOG_DEFINE_CATEGORY(Formats)\n \n+const PixelFormat invalidPixelFormat = PixelFormat();\n+\n /**\n  * \\class PixelFormatPlaneInfo\n  * \\brief Information about a single plane of a pixel format\n@@ -663,6 +665,24 @@ const PixelFormatInfo &PixelFormatInfo::info(const V4L2PixelFormat &format)\n \treturn info->second;\n }\n \n+/**\n+ * \\brief Retrieve pixel format from its name\n+ * \\param[in] name The name of pixel format\n+ * \\return The pixel format corresponding to \\a name if known, or an invalid\n+ * pixel format otherwise\n+ */\n+const PixelFormat &PixelFormatInfo::info(const std::string &name)\n+{\n+\tauto it = pixelFormatInfo.begin();\n+\twhile (it != pixelFormatInfo.end()) {\n+\t\tif (it->second.name == name) {\n+\t\t\treturn it->first;\n+\t\t}\n+\t\tit++;\n+\t}\n+\treturn invalidPixelFormat;\n+}\n+\n /**\n  * \\brief Compute the stride\n  * \\param[in] width The width of the line, in pixels\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "1/3"
    ]
}