Show a patch.

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

{
    "id": 1084,
    "url": "https://patchwork.libcamera.org/api/patches/1084/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1084/",
    "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": "<20190419102844.6838-3-laurent.pinchart@ideasonboard.com>",
    "date": "2019-04-19T10:28:43",
    "name": "[libcamera-devel,v2,3/4] libcamera: stream: Add and use toString() method to StreamConfiguration",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "357f2e4c41fc2cf9164d3f454261b8b151f62f4f",
    "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/1084/mbox/",
    "series": [
        {
            "id": 262,
            "url": "https://patchwork.libcamera.org/api/series/262/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=262",
            "date": "2019-04-19T10:28:41",
            "name": "[libcamera-devel,v2,1/4] libcamera: Document documentation style and update the code accordingly",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/262/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1084/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1084/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 E17BD60004\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 19 Apr 2019 12:29:07 +0200 (CEST)",
            "from pendragon.bb.dnainternet.fi (unknown\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 83AEE31A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 19 Apr 2019 12:29:07 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1555669747;\n\tbh=3gaDSjg8AOO8mDDt/hoPJQ4E2aqZxMy/ZAutuMMdk5o=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=tHCjI8TLN5XVlAwTnepAIk9Pf31ooOF3Y0lUb1MCMW8Wo1+XaoMVuUBUPlYt6ZZqn\n\t3k7W78V6brtILNkSBTRkA3cJP0NEBs+9n2JKyK2PGpCa+7YYQzTs/5YayBIVd81pFh\n\tTe+8PeooU1GU8O81t4wg7AmMTKC1a1Un4HCSTxik=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 19 Apr 2019 13:28:43 +0300",
        "Message-Id": "<20190419102844.6838-3-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190419102844.6838-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20190419102844.6838-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 3/4] 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": "Fri, 19 Apr 2019 10:29: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>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\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 | 10 ++--------\n src/libcamera/stream.cpp                 | 19 +++++++++++++++++++\n 5 files changed, 27 insertions(+), 15 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 51f00fb68402..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@@ -234,10 +231,7 @@ int PipelineHandlerRkISP1::configureStreams(Camera *camera,\n \t    outputFormat.height != cfg.height ||\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<< cfg.pixelFormat;\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..1668b67dd6d1 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@@ -60,6 +63,22 @@ namespace libcamera {\n  * \\brief Requested number of buffers to allocate for the stream\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  * \\class StreamUsage\n  * \\brief Stream usage information\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "3/4"
    ]
}