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:
@@ -30,18 +30,18 @@ int Capture::run(EventLoop *loop, const OptionsParser::Options &options)
|
||||
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_);
|
||||
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);
|
||||
}
|
||||
|
||||
camera_->requestCompleted.connect(this, &Capture::requestComplete);
|
||||
|
||||
if (options.isSet(OptFile)) {
|
||||
|
||||
Reference in New Issue
Block a user