Show a patch.

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

{
    "id": 1063,
    "url": "https://patchwork.libcamera.org/api/patches/1063/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1063/",
    "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": "<20190418154453.20142-2-laurent.pinchart@ideasonboard.com>",
    "date": "2019-04-18T15:44:52",
    "name": "[libcamera-devel,2/3] libcamera: stream: Add and use toString() method to StreamConfiguration",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "0498b762708581fa0c68d904dc4695dc110c509d",
    "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/1063/mbox/",
    "series": [
        {
            "id": 258,
            "url": "https://patchwork.libcamera.org/api/series/258/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=258",
            "date": "2019-04-18T15:44:51",
            "name": "[libcamera-devel,1/3] libcamera: Document documentation style and update the code accordingly",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/258/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1063/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1063/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0298B60DBE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Apr 2019 17:45:08 +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 7B1009A7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Apr 2019 17:45:07 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1555602307;\n\tbh=mcZzJXhYFOlTkdW/zdVx9uQX/5BviqvzkvHZ0/7Q3sc=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=ca3YNoJhan/X2UrywqiMlAHZ7KM7PWyj+l8iRVYib34eM1lZXCrzRrODFhin5jrTv\n\ta6Ar4Osq9OygLoZ3DodwmefJQtWINeVTZz2RTwNSFMp5xz2cQQP8ZViAraj2UXAAeH\n\tXiGgbAgOVWzHKJW+/6rA/qIlizDUEF+k12iIk3gA=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 18 Apr 2019 18:44:52 +0300",
        "Message-Id": "<20190418154453.20142-2-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190418154453.20142-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20190418154453.20142-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 2/3] libcamera: stream: Add and use\n\ttoString() method to StreamConfiguration",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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": "Thu, 18 Apr 2019 15:45:08 -0000"
    },
    "content": "Add a toString() method to the StreamConfiguration class, and replace\nall manually coded implementations through the source code.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/stream.h               |  4 ++++\n src/libcamera/camera.cpp                 |  4 +---\n src/libcamera/pipeline/ipu3/ipu3.cpp     |  5 +----\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 14 ++++----------\n src/libcamera/stream.cpp                 | 19 +++++++++++++++++++\n 5 files changed, 29 insertions(+), 17 deletions(-)",
    "diff": "diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\nindex 8a47930f8614..3caaefc9f8e9 100644\n--- a/include/libcamera/stream.h\n+++ b/include/libcamera/stream.h\n@@ -7,6 +7,8 @@\n #ifndef __LIBCAMERA_STREAM_H__\n #define __LIBCAMERA_STREAM_H__\n \n+#include <string>\n+\n #include <libcamera/buffer.h>\n #include <libcamera/geometry.h>\n \n@@ -20,6 +22,8 @@ struct StreamConfiguration {\n \tunsigned int pixelFormat;\n \n \tunsigned int bufferCount;\n+\n+\tstd::string toString() const;\n };\n \n class StreamUsage\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 69406b515700..a52769626446 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -596,9 +596,7 @@ int Camera::configureStreams(const CameraConfiguration &config)\n \t\t\treturn -EINVAL;\n \n \t\tconst StreamConfiguration &cfg = config[stream];\n-\t\tmsg << \" (\" << index << \") \" << cfg.width << \"x\"\n-\t\t    << cfg.height << \"-0x\" << std::hex << std::setfill('0')\n-\t\t    << std::setw(8) << cfg.pixelFormat;\n+\t\tmsg << \" (\" << index << \") \" << cfg.toString();\n \n \t\tindex++;\n \t}\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 405d6548fd01..7443224d4f45 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -224,10 +224,7 @@ PipelineHandlerIPU3::streamConfiguration(Camera *camera,\n \tconfig->pixelFormat = V4L2_PIX_FMT_NV12;\n \tconfig->bufferCount = IPU3_BUFFER_COUNT;\n \n-\tLOG(IPU3, Debug)\n-\t\t<< \"Stream format set to \" << config->width << \"x\"\n-\t\t<< config->height << \"-0x\" << std::hex << std::setfill('0')\n-\t\t<< std::setw(8) << config->pixelFormat;\n+\tLOG(IPU3, Debug) << \"Stream format set to \" << config->toString();\n \n \treturn configs;\n }\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 8ed0ba84780a..d21c6266c6ba 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -124,10 +124,7 @@ CameraConfiguration PipelineHandlerRkISP1::streamConfiguration(Camera *camera,\n \n \tconfigs[&data->stream_] = config;\n \n-\tLOG(RkISP1, Debug)\n-\t\t<< \"Stream format set to \" << config.width << \"x\"\n-\t\t<< config.height << \"-0x\" << std::hex << std::setfill('0')\n-\t\t<< std::setw(8) << config.pixelFormat;\n+\tLOG(RkISP1, Debug) << \"Stream format set to \" << config.toString();\n \n \treturn configs;\n }\n@@ -223,7 +220,7 @@ int PipelineHandlerRkISP1::configureStreams(Camera *camera,\n \tV4L2DeviceFormat outputFormat = {};\n \toutputFormat.width = cfg.width;\n \toutputFormat.height = cfg.height;\n-\toutputFormat.fourcc = V4L2_PIX_FMT_NV12;\n+\toutputFormat.fourcc = cfg.pixelFormat;\n \toutputFormat.planesCount = 2;\n \n \tret = video_->setFormat(&outputFormat);\n@@ -232,12 +229,9 @@ int PipelineHandlerRkISP1::configureStreams(Camera *camera,\n \n \tif (outputFormat.width != cfg.width ||\n \t    outputFormat.height != cfg.height ||\n-\t    outputFormat.fourcc != V4L2_PIX_FMT_NV12) {\n+\t    outputFormat.fourcc != cfg.pixelFormat) {\n \t\tLOG(RkISP1, Error)\n-\t\t\t<< \"Unable to configure capture in \" << cfg.width\n-\t\t\t<< \"x\" << cfg.height << \"-0x\"\n-\t\t\t<< std::hex << std::setfill('0') << std::setw(8)\n-\t\t\t<< V4L2_PIX_FMT_NV12;\n+\t\t\t<< \"Unable to configure capture in \" << cfg.toString();\n \t\treturn -EINVAL;\n \t}\n \ndiff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\nindex d4ef506cea95..06db9797ff7e 100644\n--- a/src/libcamera/stream.cpp\n+++ b/src/libcamera/stream.cpp\n@@ -5,6 +5,9 @@\n  * stream.cpp - Video stream for a Camera\n  */\n \n+#include <iomanip>\n+#include <sstream>\n+\n #include <libcamera/stream.h>\n \n /**\n@@ -55,6 +58,22 @@ namespace libcamera {\n  * format described in V4L2 using the V4L2_PIX_FMT_* definitions.\n  */\n \n+/**\n+ * \\brief Assemble and return a string describing the configuration\n+ *\n+ * \\return A string describing the StreamConfiguration\n+ */\n+std::string StreamConfiguration::toString() const\n+{\n+\tstd::stringstream ss;\n+\n+\tss.fill(0);\n+\tss << width << \"x\" << height << \"-0x\" << std::hex\n+\t   << std::setw(8) << pixelFormat;\n+\n+\treturn ss.str();\n+}\n+\n /**\n  * \\var StreamConfiguration::bufferCount\n  * \\brief Requested number of buffers to allocate for the stream\n",
    "prefixes": [
        "libcamera-devel",
        "2/3"
    ]
}