[libcamera-devel] [PATCH 6/6] cam: Add color space support

paul.elder at ideasonboard.com paul.elder at ideasonboard.com
Thu Aug 25 22:09:19 CEST 2022


On Tue, Aug 23, 2022 at 08:43:14PM +0300, Laurent Pinchart via libcamera-devel wrote:
> Add support for color space to the StreamKeyValueParser, allowing
> selection of a color space on the command line.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>

> ---
>  src/cam/stream_options.cpp | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/cam/stream_options.cpp b/src/cam/stream_options.cpp
> index a68135a9ed88..3a5625f5f267 100644
> --- a/src/cam/stream_options.cpp
> +++ b/src/cam/stream_options.cpp
> @@ -8,6 +8,8 @@
>  
>  #include <iostream>
>  
> +#include <libcamera/color_space.h>
> +
>  using namespace libcamera;
>  
>  StreamKeyValueParser::StreamKeyValueParser()
> @@ -21,6 +23,8 @@ StreamKeyValueParser::StreamKeyValueParser()
>  		  ArgumentRequired);
>  	addOption("pixelformat", OptionString, "Pixel format name",
>  		  ArgumentRequired);
> +	addOption("colorspace", OptionString, "Color space",
> +		  ArgumentRequired);
>  }
>  
>  KeyValueParser::Options StreamKeyValueParser::parse(const char *arguments)
> @@ -96,6 +100,9 @@ int StreamKeyValueParser::updateConfiguration(CameraConfiguration *config,
>  
>  		if (opts.isSet("pixelformat"))
>  			cfg.pixelFormat = PixelFormat::fromString(opts["pixelformat"].toString());
> +
> +		if (opts.isSet("colorspace"))
> +			cfg.colorSpace = ColorSpace::fromString(opts["colorspace"].toString());
>  	}
>  
>  	return 0;


More information about the libcamera-devel mailing list