Show a patch.

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

{
    "id": 542,
    "url": "https://patchwork.libcamera.org/api/patches/542/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/542/",
    "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": "<20190206060818.13907-28-laurent.pinchart@ideasonboard.com>",
    "date": "2019-02-06T06:08:18",
    "name": "[libcamera-devel,27/27] cam: Add option to write raw frames to disk",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "9bfb92fe23545d67d0a63a66eec7c8abc01611f4",
    "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/542/mbox/",
    "series": [
        {
            "id": 170,
            "url": "https://patchwork.libcamera.org/api/series/170/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=170",
            "date": "2019-02-06T06:07:51",
            "name": "Capture frames throught requests",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/170/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/542/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/542/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 0A27461047\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Feb 2019 07:08:30 +0100 (CET)",
            "from pendragon.ideasonboard.com (d51A4137F.access.telenet.be\n\t[81.164.19.127])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A999C41\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Feb 2019 07:08:29 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1549433309;\n\tbh=NB6qFUY2NGlMoTYBWRvhf3ofIxPgq9TkA0jR21AHXBs=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=aLvBMQ67/j+1JkTRkJ6SJw28HDgqW4vVeCiSK9EtNc83WxRE8mkadxf2CFlWKDprq\n\tzEAKbE/F8N/VhezQcMnBXU09HhCOkrQPvsQNH/Y5slbrBAFfXlCwYzwFCuMEyVCYWm\n\tiYrNc4s3yTprv9Ha7t2f4FJWAC1tF4VZNOUfyIfg=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed,  6 Feb 2019 08:08:18 +0200",
        "Message-Id": "<20190206060818.13907-28-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.19.2",
        "In-Reply-To": "<20190206060818.13907-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20190206060818.13907-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 27/27] cam: Add option to write raw frames\n\tto disk",
        "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": "Wed, 06 Feb 2019 06:08:30 -0000"
    },
    "content": "From: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\nUse the helper BufferWriter to optionally write frames to disk as they\nare captured.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/cam/main.cpp | 23 +++++++++++++++++++++++\n 1 file changed, 23 insertions(+)",
    "diff": "diff --git a/src/cam/main.cpp b/src/cam/main.cpp\nindex ec5040e19935..9b67ab75a6a1 100644\n--- a/src/cam/main.cpp\n+++ b/src/cam/main.cpp\n@@ -13,6 +13,7 @@\n \n #include <libcamera/libcamera.h>\n \n+#include \"buffer_writer.h\"\n #include \"event_loop.h\"\n #include \"options.h\"\n \n@@ -21,10 +22,12 @@ using namespace libcamera;\n OptionsParser::Options options;\n std::shared_ptr<Camera> camera;\n EventLoop *loop;\n+BufferWriter *writer;\n \n enum {\n \tOptCamera = 'c',\n \tOptCapture = 'C',\n+\tOptFile = 'F',\n \tOptFormat = 'f',\n \tOptHelp = 'h',\n \tOptList = 'l',\n@@ -52,6 +55,11 @@ static int parseOptions(int argc, char *argv[])\n \t\t\t ArgumentRequired, \"camera\");\n \tparser.addOption(OptCapture, OptionNone,\n \t\t\t \"Capture until interrupted by user\", \"capture\");\n+\tparser.addOption(OptFile, OptionString,\n+\t\t\t \"Write captured frames to disk\\n\"\n+\t\t\t \"The first '#' character in the file name is expanded to the frame sequence number.\\n\"\n+\t\t\t \"The default file name is 'frame-#.bin'.\",\n+\t\t\t \"file\", ArgumentOptional, \"filename\");\n \tparser.addOption(OptFormat, &formatKeyValue,\n \t\t\t \"Set format of the camera's first stream\", \"format\");\n \tparser.addOption(OptHelp, OptionNone, \"Display this help message\",\n@@ -113,6 +121,9 @@ static void requestComplete(Request *request, const std::map<Stream *, Buffer *>\n \t\t  << \" fps: \" << std::fixed << std::setprecision(2) << fps\n \t\t  << std::endl;\n \n+\tif (writer)\n+\t\twriter->write(buffer);\n+\n \trequest = camera->createRequest();\n \tif (!request) {\n \t\tstd::cerr << \"Can't create request\" << std::endl;\n@@ -240,7 +251,19 @@ int main(int argc, char **argv)\n \t\t\tgoto out;\n \t\t}\n \n+\t\tif (options.isSet(OptFile)) {\n+\t\t\tif (!options[OptFile].toString().empty())\n+\t\t\t\twriter = new BufferWriter(options[OptFile]);\n+\t\t\telse\n+\t\t\t\twriter = new BufferWriter();\n+\t\t}\n+\n \t\tcapture();\n+\n+\t\tif (options.isSet(OptFile)) {\n+\t\t\tdelete writer;\n+\t\t\twriter = nullptr;\n+\t\t}\n \t}\n \n \tif (camera) {\n",
    "prefixes": [
        "libcamera-devel",
        "27/27"
    ]
}