Show a patch.

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

{
    "id": 17252,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17252/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17252/",
    "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": "<20220830074725.1059643-4-umang.jain@ideasonboard.com>",
    "date": "2022-08-30T07:47:21",
    "name": "[libcamera-devel,v4,3/7] libcamera: v4l2_videodevice: Improve toColorSpace() readability",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "a142d418edbc608243325dec2315f78ce14ebddc",
    "submitter": {
        "id": 86,
        "url": "https://patchwork.libcamera.org/api/1.1/people/86/?format=api",
        "name": "Umang Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "delegate": {
        "id": 12,
        "url": "https://patchwork.libcamera.org/api/1.1/users/12/?format=api",
        "username": "uajain",
        "first_name": "Umang",
        "last_name": "Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/17252/mbox/",
    "series": [
        {
            "id": 3452,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3452/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3452",
            "date": "2022-08-30T07:47:18",
            "name": "Colospace adjustment and gstreamer mapping",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/3452/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17252/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17252/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 8CD65C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Aug 2022 07:47:45 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4098161FCA;\n\tTue, 30 Aug 2022 09:47:45 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CEC2361FB9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Aug 2022 09:47:43 +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 15DA0481;\n\tTue, 30 Aug 2022 09:47:41 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1661845665;\n\tbh=F57f8OYYK+J58sw9ygr9piCiPoT7m3c6N7oT+BqHHrs=;\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:Cc:\n\tFrom;\n\tb=GSHMdpmWAIC+M3Gc6rdgrCZ9Q1TntqzJ8EidYeOkvbdYBQp97vmgq+jqPbl8n0/nX\n\tiHhBezr8xQU2FRKI7ig4/UquDdZ0YBBAc/SamQsfaWAeM+xq3vLFccow+PNxW0h2FA\n\twpL4YmikRnt7ZOk1+AgTM+g8HDs3k9efnTayDBbJOztYLkpW0S/C1u3rC1RrEgCQUZ\n\tL/qVaFzS0WCGxHKuDguiXBHN8PU2gwxPY7qzXoSkWk05xEXJ5FOGfGPd+y+7/G0g3e\n\t88x+wkQEKHLoQ3iOKE16z3q5tqEHoth0APkDXA4vN8vzp4qz+dKbjqsQIPEb/XEIFj\n\tvI14DnTRxnoDg==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1661845663;\n\tbh=F57f8OYYK+J58sw9ygr9piCiPoT7m3c6N7oT+BqHHrs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=mVzQHsa6/+dOzMVtK5fgNs5SScIyZXrKgFtxNr8sQAkM6UYoucs2JAIG1C5V8OTho\n\tHSKjs8NKFie84ouBVmY2RDYHNCCBH/bkSjfTvP9TQZdgsHoiOQjURCsEpWdz6H8XaJ\n\t/rC3jk2AChEhGgMUvGK0G+xgLNqjpGoLqmqgzrUU="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"mVzQHsa6\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 30 Aug 2022 13:17:21 +0530",
        "Message-Id": "<20220830074725.1059643-4-umang.jain@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.37.2",
        "In-Reply-To": "<20220830074725.1059643-1-umang.jain@ideasonboard.com>",
        "References": "<20220830074725.1059643-1-umang.jain@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 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>",
        "Cc": "rishikeshdonadkar@gmail.com",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Wrap V4L2Device::toColorspace() inside a private static member\nfunction in V4L2VideoDevice class. It improves readability in\nsetting the colorspace for V4L2DeviceFormat.\n\nNo functional changes intended.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/v4l2_videodevice.h |  3 +++\n src/libcamera/v4l2_videodevice.cpp            | 19 +++++++++++--------\n 2 files changed, 14 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\nindex ed98a284..d157a447 100644\n--- a/include/libcamera/internal/v4l2_videodevice.h\n+++ b/include/libcamera/internal/v4l2_videodevice.h\n@@ -268,6 +268,9 @@ private:\n \n \tvoid watchdogExpired();\n \n+\ttemplate<typename T>\n+\tstatic std::optional<ColorSpace> toColorSpace(const T &v4l2Format);\n+\n \tV4L2Capability caps_;\n \tV4L2DeviceFormat format_;\n \tconst PixelFormatInfo *formatInfo_;\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 0e3f5436..955e1508 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -914,6 +914,13 @@ int V4L2VideoDevice::trySetFormatMeta(V4L2DeviceFormat *format, bool set)\n \treturn 0;\n }\n \n+template<typename T>\n+std::optional<ColorSpace> V4L2VideoDevice::toColorSpace(const T &v4l2Format)\n+{\n+\tV4L2PixelFormat fourcc{ v4l2Format.pixelformat };\n+\treturn V4L2Device::toColorSpace(v4l2Format, PixelFormatInfo::info(fourcc).colourEncoding);\n+}\n+\n int V4L2VideoDevice::getFormatMultiplane(V4L2DeviceFormat *format)\n {\n \tstruct v4l2_format v4l2Format = {};\n@@ -931,8 +938,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 = toColorSpace(*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 +994,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 = toColorSpace(*pix);\n \n \treturn 0;\n }\n@@ -1013,8 +1018,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 = toColorSpace(*pix);\n \n \treturn 0;\n }\n@@ -1056,8 +1060,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 = toColorSpace(*pix);\n \n \treturn 0;\n }\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "3/7"
    ]
}