{"id":12842,"url":"https://patchwork.libcamera.org/api/1.1/patches/12842/?format=json","web_url":"https://patchwork.libcamera.org/patch/12842/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","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-30-laurent.pinchart@ideasonboard.com>","date":"2021-07-07T02:19:40","name":"[libcamera-devel,29/30] cam: Add camera index to file name of capture frames","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"75cbff783f01ac3d0b37701d421efca77cfcfcdf","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12842/mbox/","series":[{"id":2213,"url":"https://patchwork.libcamera.org/api/1.1/series/2213/?format=json","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/12842/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12842/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 43156BD794\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 Jul 2021 02:20:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E5FFA6853E;\n\tWed,  7 Jul 2021 04:20:56 +0200 (CEST)","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 6AB9F68542\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Jul 2021 04:20:42 +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 0631BDEE\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=\"t99/rmRY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1625624442;\n\tbh=u9IISQNiJ2dkXRR1zckrrowgaqStDINjemH06IziE4o=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=t99/rmRYC9ngbIxFVzPwx/xD5G+ZbqNstdUkyJOBrrz1GZtdY4yeLpcRGNWSZ2w6S\n\twn43AyU/GVIL+Tm5mtT6tc7S6a5OV7wfBtwBy2AHEcVRjhf5JFQLQeEVCjd1SzvGaE\n\tGaAfg+9dzikC+Z/MuXRiUh9k7TMIGJhsIgGn84FE=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  7 Jul 2021 05:19:40 +0300","Message-Id":"<20210707021941.20804-30-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 29/30] cam: Add camera index to file name\n\tof capture frames","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":"To prepare for multi-camera support, extend the file naming scheme for\ncaptured frames to include the camera index in additiona to the stream\nname and frame number.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/cam/camera_session.cpp | 9 ++++++---\n src/cam/camera_session.h   | 4 +++-\n src/cam/main.cpp           | 4 ++--\n 3 files changed, 11 insertions(+), 6 deletions(-)","diff":"diff --git a/src/cam/camera_session.cpp b/src/cam/camera_session.cpp\nindex f2383567af3b..90261a8cde2e 100644\n--- a/src/cam/camera_session.cpp\n+++ b/src/cam/camera_session.cpp\n@@ -22,9 +22,11 @@ using namespace libcamera;\n \n CameraSession::CameraSession(CameraManager *cm,\n \t\t\t     const std::string &cameraId,\n+\t\t\t     unsigned int cameraIndex,\n \t\t\t     const OptionsParser::Options &options)\n-\t: options_(options), last_(0), queueCount_(0), captureCount_(0),\n-\t  captureLimit_(0), printMetadata_(false)\n+\t: options_(options), cameraIndex_(cameraIndex), last_(0),\n+\t  queueCount_(0), captureCount_(0), captureLimit_(0),\n+\t  printMetadata_(false)\n {\n \tchar *endptr;\n \tunsigned long index = strtoul(cameraId.c_str(), &endptr, 10);\n@@ -152,7 +154,8 @@ int CameraSession::start()\n \tstreamName_.clear();\n \tfor (unsigned int index = 0; index < config_->size(); ++index) {\n \t\tStreamConfiguration &cfg = config_->at(index);\n-\t\tstreamName_[cfg.stream()] = \"stream\" + std::to_string(index);\n+\t\tstreamName_[cfg.stream()] = \"cam\" + std::to_string(cameraIndex_)\n+\t\t\t\t\t  + \"-stream\" + std::to_string(index);\n \t}\n \n \tcamera_->requestCompleted.connect(this, &CameraSession::requestComplete);\ndiff --git a/src/cam/camera_session.h b/src/cam/camera_session.h\nindex f137279ab421..12449c98e582 100644\n--- a/src/cam/camera_session.h\n+++ b/src/cam/camera_session.h\n@@ -28,7 +28,7 @@ class CameraSession\n {\n public:\n \tCameraSession(libcamera::CameraManager *cm,\n-\t\t      const std::string &cameraId,\n+\t\t      const std::string &cameraId, unsigned int cameraIndex,\n \t\t      const OptionsParser::Options &options);\n \t~CameraSession();\n \n@@ -60,6 +60,8 @@ private:\n \n \tstd::map<const libcamera::Stream *, std::string> streamName_;\n \tstd::unique_ptr<BufferWriter> writer_;\n+\tunsigned int cameraIndex_;\n+\n \tuint64_t last_;\n \n \tunsigned int queueCount_;\ndiff --git a/src/cam/main.cpp b/src/cam/main.cpp\nindex 7688fa5540ea..96f55831ca69 100644\n--- a/src/cam/main.cpp\n+++ b/src/cam/main.cpp\n@@ -136,7 +136,7 @@ int CamApp::parseOptions(int argc, char *argv[])\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 \"is expanded to the camera index, 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\", false,\n \t\t\t OptCamera);\n@@ -201,7 +201,7 @@ int CamApp::run()\n \tif (options_.isSet(OptCamera)) {\n \t\tconst OptionValue &camera = options_[OptCamera];\n \t\tsession = std::make_unique<CameraSession>(cm_.get(),\n-\t\t\t\t\t\t\t  camera.toString(),\n+\t\t\t\t\t\t\t  camera.toString(), 0,\n \t\t\t\t\t\t\t  camera.children());\n \t\tif (!session->isValid()) {\n \t\t\tstd::cout << \"Failed to create camera session\" << std::endl;\n","prefixes":["libcamera-devel","29/30"]}