[libcamera-devel] [PATCH] cam: Create stream names after configuring the camera

Niklas Söderlund niklas.soderlund at ragnatech.se
Wed Mar 18 04:22:44 CET 2020


Hi,

I have now pushed this patch to master.

On 2020-03-16 03:01:09 +0100, Niklas Söderlund wrote:
> 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 at ragnatech.se>
> ---
>  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)) {
> -- 
> 2.25.1
> 

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list