Show a patch.

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

{
    "id": 17230,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17230/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17230/",
    "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": "<20220829163742.1006102-4-umang.jain@ideasonboard.com>",
    "date": "2022-08-29T16:37:38",
    "name": "[libcamera-devel,v3,3/7] libcamera: v4l2_videodevice: Improve toColorSpace() readability",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "578aa7f9a394a6e3be98a61e0341eb9bf3d8a077",
    "submitter": {
        "id": 86,
        "url": "https://patchwork.libcamera.org/api/1.1/people/86/?format=api",
        "name": "Umang Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/17230/mbox/",
    "series": [
        {
            "id": 3447,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3447/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3447",
            "date": "2022-08-29T16:37:35",
            "name": "Colorspace adjustments and gstreamer mappings",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/3447/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17230/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17230/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 973D7C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Aug 2022 16:38:10 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4CE4361FCB;\n\tMon, 29 Aug 2022 18:38:10 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1D0FB61FBA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Aug 2022 18:38:07 +0200 (CEST)",
            "from umang.jainideasonboard.com (unknown\n\t[IPv6:2401:4900:1f3f:1548:78ac:4a3:edc3:c28a])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1780B8BD;\n\tMon, 29 Aug 2022 18:38:05 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1661791090;\n\tbh=acK2S0GxZrfhSb3ahOQmVL+wQKOTvIggEMmTpEK2VcY=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=iRyZV8WpNfhmYwAJfMgk20GBtPfD0lC/xr6w98X2LS6ec9GdYVgba/zfAaFzmSGnm\n\tt2eXe+A9nHGF6Z8GGpLaLdDDq5cM8sMfqeXFoqX7euqynEA5S1dw8SGTUlDoVRe8OU\n\t5oNkQa2vGstu7u+NPLEQ2cIM/Alumfs+NcPopDNRXHTvdtvMDWTj9+UqQwFy+ZXJ9r\n\tH3QCazHgY8y2h7vp1T6wPXBCelGP+WAq3zLvYwLxO9RQz0o/Mm624DhS+0AT01HTbF\n\tK6tSDvoH6lxvcc8CNvlmQj8PiHxm9PS8qZwTo33zd6qw1IdQx+aYz15YxVRId4Ncio\n\t5lQJjE+LNeAVg==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1661791086;\n\tbh=acK2S0GxZrfhSb3ahOQmVL+wQKOTvIggEMmTpEK2VcY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=gmLarNg7PoGl2P/wIKobnpPw9NLYstOuruyoy/gllwp7j+kWs/9IAxYgCqTnsNf0l\n\ty9X4Vm0H3IfoH8EEVoewtveT5AXW4+vVFJWP+gcgCi2SS87iPNhq+sKg5ul8uHZoaq\n\tfcw/TxlyXUzRbkCetawA43oTaSmi+jel6uw9sX8g="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"gmLarNg7\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 29 Aug 2022 22:07:38 +0530",
        "Message-Id": "<20220829163742.1006102-4-umang.jain@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.37.2",
        "In-Reply-To": "<20220829163742.1006102-1-umang.jain@ideasonboard.com>",
        "References": "<20220829163742.1006102-1-umang.jain@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 3/7] libcamera: v4l2_videodevice:\n\tImprove toColorSpace() readability",
        "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>",
        "From": "Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Umang Jain <umang.jain@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Abstract out usage of V4L2Device::toColorspace() to a separate\nnamespace. Since it is separated out in an unnamed namespace,\nthe V4L2Device::toColorSpace() function needs to made public.\nThis is not an issue since V4L2Device is an internal class.\n\nNo functional changes intended.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n include/libcamera/internal/v4l2_device.h | 14 +++++++-------\n src/libcamera/v4l2_videodevice.cpp       | 23 +++++++++++++++--------\n 2 files changed, 22 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h\nindex 75304be1..606332e1 100644\n--- a/include/libcamera/internal/v4l2_device.h\n+++ b/include/libcamera/internal/v4l2_device.h\n@@ -49,6 +49,13 @@ public:\n \n \tvoid updateControlInfo();\n \n+\ttemplate<typename T>\n+\tstatic std::optional<ColorSpace> toColorSpace(const T &v4l2Format,\n+\t\t\t\t\t\t      PixelFormatInfo::ColourEncoding colourEncoding);\n+\n+\ttemplate<typename T>\n+\tstatic int fromColorSpace(const std::optional<ColorSpace> &colorSpace, T &v4l2Format);\n+\n protected:\n \tV4L2Device(const std::string &deviceNode);\n \t~V4L2Device();\n@@ -60,13 +67,6 @@ protected:\n \n \tint fd() const { return fd_.get(); }\n \n-\ttemplate<typename T>\n-\tstatic std::optional<ColorSpace> toColorSpace(const T &v4l2Format,\n-\t\t\t\t\t\t      PixelFormatInfo::ColourEncoding colourEncoding);\n-\n-\ttemplate<typename T>\n-\tstatic int fromColorSpace(const std::optional<ColorSpace> &colorSpace, T &v4l2Format);\n-\n private:\n \tstatic ControlType v4l2CtrlType(uint32_t ctrlType);\n \tstatic std::unique_ptr<ControlId> v4l2ControlId(const v4l2_query_ext_ctrl &ctrl);\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 0e3f5436..b443253d 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -914,6 +914,17 @@ int V4L2VideoDevice::trySetFormatMeta(V4L2DeviceFormat *format, bool set)\n \treturn 0;\n }\n \n+namespace {\n+\n+template<typename T>\n+std::optional<ColorSpace> getColorSpace(const T &v4l2Format)\n+{\n+\tV4L2PixelFormat fourcc{ v4l2Format.pixelformat };\n+\treturn V4L2Device::toColorSpace(v4l2Format, PixelFormatInfo::info(fourcc).colourEncoding);\n+}\n+\n+} /* namespace */\n+\n int V4L2VideoDevice::getFormatMultiplane(V4L2DeviceFormat *format)\n {\n \tstruct v4l2_format v4l2Format = {};\n@@ -931,8 +942,7 @@ int V4L2VideoDevice::getFormatMultiplane(V4L2DeviceFormat *format)\n \tformat->size.height = pix->height;\n \tformat->fourcc = V4L2PixelFormat(pix->pixelformat);\n \tformat->planesCount = pix->num_planes;\n-\tformat->colorSpace =\n-\t\ttoColorSpace(*pix, PixelFormatInfo::info(format->fourcc).colourEncoding);\n+\tformat->colorSpace = getColorSpace(*pix);\n \n \tfor (unsigned int i = 0; i < format->planesCount; ++i) {\n \t\tformat->planes[i].bpl = pix->plane_fmt[i].bytesperline;\n@@ -988,8 +998,7 @@ int V4L2VideoDevice::trySetFormatMultiplane(V4L2DeviceFormat *format, bool set)\n \t\tformat->planes[i].bpl = pix->plane_fmt[i].bytesperline;\n \t\tformat->planes[i].size = pix->plane_fmt[i].sizeimage;\n \t}\n-\tformat->colorSpace =\n-\t\ttoColorSpace(*pix, PixelFormatInfo::info(format->fourcc).colourEncoding);\n+\tformat->colorSpace = getColorSpace(*pix);\n \n \treturn 0;\n }\n@@ -1013,8 +1022,7 @@ int V4L2VideoDevice::getFormatSingleplane(V4L2DeviceFormat *format)\n \tformat->planesCount = 1;\n \tformat->planes[0].bpl = pix->bytesperline;\n \tformat->planes[0].size = pix->sizeimage;\n-\tformat->colorSpace =\n-\t\ttoColorSpace(*pix, PixelFormatInfo::info(format->fourcc).colourEncoding);\n+\tformat->colorSpace = getColorSpace(*pix);\n \n \treturn 0;\n }\n@@ -1056,8 +1064,7 @@ int V4L2VideoDevice::trySetFormatSingleplane(V4L2DeviceFormat *format, bool set)\n \tformat->planesCount = 1;\n \tformat->planes[0].bpl = pix->bytesperline;\n \tformat->planes[0].size = pix->sizeimage;\n-\tformat->colorSpace =\n-\t\ttoColorSpace(*pix, PixelFormatInfo::info(format->fourcc).colourEncoding);\n+\tformat->colorSpace = getColorSpace(*pix);\n \n \treturn 0;\n }\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "3/7"
    ]
}