cam: Create stream names after configuring the camera

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 <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Niklas Söderlund 2020-03-16 02:35:44 +01:00
parent d15f979ead
commit 00eb88f893

View file

@ -30,18 +30,18 @@ int Capture::run(EventLoop *loop, const OptionsParser::Options &options)
return -ENODEV; return -ENODEV;
} }
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_); ret = camera_->configure(config_);
if (ret < 0) { if (ret < 0) {
std::cout << "Failed to configure camera" << std::endl; std::cout << "Failed to configure camera" << std::endl;
return ret; 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);
}
camera_->requestCompleted.connect(this, &Capture::requestComplete); camera_->requestCompleted.connect(this, &Capture::requestComplete);
if (options.isSet(OptFile)) { if (options.isSet(OptFile)) {