[libcamera-devel,6/6] cam: Add color space support
diff mbox series

Message ID 20220823174314.14881-7-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • libcamera: Add support for color spaces to rkisp1 pipeline handler
Related show

Commit Message

Laurent Pinchart Aug. 23, 2022, 5:43 p.m. UTC
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@ideasonboard.com>
---
 src/cam/stream_options.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Umang Jain Aug. 23, 2022, 11:26 p.m. UTC | #1
Hi Laurent

Thank you for the patch.

On 8/23/22 11:13 PM, 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@ideasonboard.com>

Reviewed-by: Umang Jain <umang.jain@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;
Nicolas Dufresne via libcamera-devel Aug. 25, 2022, 8:09 p.m. UTC | #2
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@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@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;

Patch
diff mbox series

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;