Patch Detail
Show a patch.
GET /api/patches/12840/?format=api
{ "id": 12840, "url": "https://patchwork.libcamera.org/api/patches/12840/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12840/", "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": "<20210707021941.20804-28-laurent.pinchart@ideasonboard.com>", "date": "2021-07-07T02:19:38", "name": "[libcamera-devel,27/30] cam: Allow specifying directories in the --file option", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "d7c7bb02a3c8a7347d040d800c6d77dee8f9449c", "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/12840/mbox/", "series": [ { "id": 2213, "url": "https://patchwork.libcamera.org/api/series/2213/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2213", "date": "2021-07-07T02:19:12", "name": "Multi-camera support in the cam application", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2213/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12840/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12840/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 7D6F4C3226\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 7 Jul 2021 02:20:56 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3994D68520;\n\tWed, 7 Jul 2021 04:20:56 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B2B6A68537\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 7 Jul 2021 04:20:41 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 48515466\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 7 Jul 2021 04:20:41 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"oQ+lm0a4\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1625624441;\n\tbh=VKXcaqS+RJRLnr0tkYNAWdBApnloPBa17hKpCGpHNx4=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=oQ+lm0a4J9cJ00otOGYHtEqdwHp+oAAXUo2ysWauSSE5zGGouynKSEXMeFLwwDoUv\n\toQZTgUB386HzHH+djK8kqOYKanEQLeBKPXxsHupUq97ubS5uw/yLA7IKzXxPhKFb8E\n\tOYyjmJC8R72qFWiEiXq04RAHHHHf7/QMOTWvUam0=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 7 Jul 2021 05:19:38 +0300", "Message-Id": "<20210707021941.20804-28-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20210707021941.20804-1-laurent.pinchart@ideasonboard.com>", "References": "<20210707021941.20804-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 27/30] cam: Allow specifying directories\n\tin the --file option", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The value of the --file option is the full name of the file to which\ncaptured frames are written. To write files to a specific directory with\nthe default naming scheme, the \"frame-#.bin\" name has to appear at the\nend of the file name. Simplify usage of the option by allowing --file to\nspecify a directory only. If the file name ends with a '/', the default\n\"frame-#.bin\" file name is automatically appended.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/cam/buffer_writer.cpp | 7 ++++++-\n src/cam/buffer_writer.h | 2 +-\n src/cam/main.cpp | 5 ++++-\n 3 files changed, 11 insertions(+), 3 deletions(-)", "diff": "diff --git a/src/cam/buffer_writer.cpp b/src/cam/buffer_writer.cpp\nindex f2b21aef3362..a7648a92fc92 100644\n--- a/src/cam/buffer_writer.cpp\n+++ b/src/cam/buffer_writer.cpp\n@@ -49,7 +49,12 @@ int BufferWriter::write(FrameBuffer *buffer, const std::string &streamName)\n \tsize_t pos;\n \tint fd, ret = 0;\n \n-\tfilename = pattern_;\n+\tif (!pattern_.empty())\n+\t\tfilename = pattern_;\n+\n+\tif (filename.empty() || filename.back() == '/')\n+\t\tfilename += \"frame-#.bin\";\n+\n \tpos = filename.find_first_of('#');\n \tif (pos != std::string::npos) {\n \t\tstd::stringstream ss;\ndiff --git a/src/cam/buffer_writer.h b/src/cam/buffer_writer.h\nindex 604ce8702ec7..7626de42d369 100644\n--- a/src/cam/buffer_writer.h\n+++ b/src/cam/buffer_writer.h\n@@ -15,7 +15,7 @@\n class BufferWriter\n {\n public:\n-\tBufferWriter(const std::string &pattern = \"frame-#.bin\");\n+\tBufferWriter(const std::string &pattern = \"\");\n \t~BufferWriter();\n \n \tvoid mapBuffer(libcamera::FrameBuffer *buffer);\ndiff --git a/src/cam/main.cpp b/src/cam/main.cpp\nindex a3f19d0fa61b..6d7d45e11499 100644\n--- a/src/cam/main.cpp\n+++ b/src/cam/main.cpp\n@@ -118,7 +118,10 @@ int CamApp::parseOptions(int argc, char *argv[])\n \t\t\t \"capture\", ArgumentOptional, \"count\");\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 stream name and frame sequence number.\\n\"\n+\t\t\t \"If the file name ends with a '/', it sets the directory in which\\n\"\n+\t\t\t \"to write files, using the default file name. Otherwise it sets the\\n\"\n+\t\t\t \"full file path and name. The first '#' character in the file name\\n\"\n+\t\t\t \"is expanded to the stream name and 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(OptStream, &streamKeyValue,\n", "prefixes": [ "libcamera-devel", "27/30" ] }