From patchwork Mon Mar 16 02:01:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 3103 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D8FFA6041D for ; Mon, 16 Mar 2020 03:01:17 +0100 (CET) X-Halon-ID: 038a35bd-672a-11ea-9f85-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2392.dip0.t-ipconnect.de [79.202.35.146]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id 038a35bd-672a-11ea-9f85-005056917a89; Mon, 16 Mar 2020 03:01:16 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Mon, 16 Mar 2020 03:01:09 +0100 Message-Id: <20200316020109.2466468-1-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] cam: Create stream names after configuring the camera X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2020 02:01:18 -0000 The stream in the stream configuration is not filled in before we configure the camera, move the generating and caching of names after the configuration. Without this fix writing multiple streams to disk overwrites the frames as the filenames are not unique. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/cam/capture.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp index b62a9b24b2169b05..55fa2dabcee97f21 100644 --- a/src/cam/capture.cpp +++ b/src/cam/capture.cpp @@ -30,18 +30,18 @@ int Capture::run(EventLoop *loop, const OptionsParser::Options &options) return -ENODEV; } + ret = camera_->configure(config_); + if (ret < 0) { + std::cout << "Failed to configure camera" << std::endl; + return ret; + } + streamName_.clear(); for (unsigned int index = 0; index < config_->size(); ++index) { StreamConfiguration &cfg = config_->at(index); streamName_[cfg.stream()] = "stream" + std::to_string(index); } - ret = camera_->configure(config_); - if (ret < 0) { - std::cout << "Failed to configure camera" << std::endl; - return ret; - } - camera_->requestCompleted.connect(this, &Capture::requestComplete); if (options.isSet(OptFile)) {