Show a patch.

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

{
    "id": 775,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/775/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/775/",
    "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": "<20190320163055.22056-30-jacopo@jmondi.org>",
    "date": "2019-03-20T16:30:53",
    "name": "[libcamera-devel,v4,29/31] src: cam: Handle multiple streams in request complete",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "03ab2771c78fe816958e324aef15f97126c9946b",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/775/mbox/",
    "series": [
        {
            "id": 214,
            "url": "https://patchwork.libcamera.org/api/1.1/series/214/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=214",
            "date": "2019-03-20T16:30:24",
            "name": "libcamera: ipu3: Add ImgU support + multiple streams",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/214/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/775/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/775/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 614496135F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Mar 2019 17:30:46 +0100 (CET)",
            "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id F050620000F;\n\tWed, 20 Mar 2019 16:30:45 +0000 (UTC)"
        ],
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 20 Mar 2019 17:30:53 +0100",
        "Message-Id": "<20190320163055.22056-30-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190320163055.22056-1-jacopo@jmondi.org>",
        "References": "<20190320163055.22056-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 29/31] src: cam: Handle multiple\n\tstreams in request complete",
        "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, 20 Mar 2019 16:30:47 -0000"
    },
    "content": "Add support for requests with multiple streams in 'requestComplete()'\nmethod. Each stream content is optionally dumped to disk with its output\nname.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/cam/main.cpp | 42 +++++++++++++++++++++++++++---------------\n 1 file changed, 27 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/src/cam/main.cpp b/src/cam/main.cpp\nindex 201dbda765fe..a2364ef92bad 100644\n--- a/src/cam/main.cpp\n+++ b/src/cam/main.cpp\n@@ -98,28 +98,40 @@ static int configureStreams(Camera *camera, std::set<Stream *> &streams)\n \treturn camera->configureStreams(config);\n }\n \n-static void requestComplete(Request *request, const std::map<Stream *, Buffer *> &buffers)\n+static void requestComplete(Request *request,\n+\t\t\t    const std::map<Stream *, Buffer *> &streamMap)\n {\n \tstatic uint64_t last = 0;\n \n \tif (request->status() == Request::RequestCancelled)\n \t\treturn;\n \n-\tBuffer *buffer = buffers.begin()->second;\n-\n-\tdouble fps = buffer->timestamp() - last;\n-\tfps = last && fps ? 1000000000.0 / fps : 0.0;\n-\tlast = buffer->timestamp();\n+\tCamera *camera = request->camera();\n+\tstd::set<Stream *> streams = camera->streams();\n+\tfor (const auto &completedStream : streamMap) {\n+\t\tStream *stream = completedStream.first;\n+\t\tBuffer *buffer = completedStream.second;\n+\n+\t\t/* Dump the buffer content! */\n+\t\tdouble fps = buffer->timestamp() - last;\n+\t\tfps = last && fps ? 1000000000.0 / fps : 0.0;\n+\t\tlast = buffer->timestamp();\n+\n+\t\tstd::string streamName = stream == (*streams.begin()) ?\n+\t\t\t\t\t \"output\" : \"viewfinder\";\n+\t\tstd::cout << \"stream: \" << streamName\n+\t\t\t  << \" seq: \" << std::setw(6) << std::setfill('0')\n+\t\t\t  << buffer->sequence()\n+\t\t\t  << \" buf: \" << buffer->index()\n+\t\t\t  << \" bytesused: \" << buffer->bytesused()\n+\t\t\t  << \" timestamp: \" << buffer->timestamp()\n+\t\t\t  << \" fps: \" << std::fixed << std::setprecision(2) << fps\n+\t\t\t  << std::endl;\n \n-\tstd::cout << \"seq: \" << std::setw(6) << std::setfill('0') << buffer->sequence()\n-\t\t  << \" buf: \" << buffer->index()\n-\t\t  << \" bytesused: \" << buffer->bytesused()\n-\t\t  << \" timestamp: \" << buffer->timestamp()\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+\t\tif (writer)\n+\t\t\twriter->write(buffer, streamName);\n+\t}\n \n \trequest = camera->createRequest();\n \tif (!request) {\n@@ -127,7 +139,7 @@ static void requestComplete(Request *request, const std::map<Stream *, Buffer *>\n \t\treturn;\n \t}\n \n-\trequest->setBuffers(buffers);\n+\trequest->setBuffers(streamMap);\n \tcamera->queueRequest(request);\n }\n \n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "29/31"
    ]
}