[libcamera-devel,1/3] pipeline: uvcvideo: Add color space support
diff mbox series

Message ID 20220829100414.28404-2-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • Misc color space plumbing improvements
Related show

Commit Message

Laurent Pinchart Aug. 29, 2022, 10:04 a.m. UTC
Add support for color space to the uvcvideo pipeline handler. UVC
devices have a fixed color space per format, so only the validate()
function needs to be extended to retrieve the color space from the
kernel. There is no need to pass the value back to the driver in
configure().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Umang Jain Aug. 30, 2022, 10:51 a.m. UTC | #1
Hi Laurent,

ThankĀ  you for the patch

On 8/29/22 3:34 PM, Laurent Pinchart via libcamera-devel wrote:
> Add support for color space to the uvcvideo pipeline handler. UVC
> devices have a fixed color space per format, so only the validate()

Ah good to know..
> function needs to be extended to retrieve the color space from the
> kernel. There is no need to pass the value back to the driver in
> configure().

Makes sense!
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>   src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
> index 9cbf126aea57..2ae640a31f68 100644
> --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
> +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
> @@ -159,6 +159,11 @@ CameraConfiguration::Status UVCCameraConfiguration::validate()
>   	cfg.stride = format.planes[0].bpl;
>   	cfg.frameSize = format.planes[0].size;
>   
> +	if (cfg.colorSpace != format.colorSpace) {
> +		cfg.colorSpace = format.colorSpace;
> +		status = Adjusted;
> +	}
> +
>   	return status;
>   }
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
index 9cbf126aea57..2ae640a31f68 100644
--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
@@ -159,6 +159,11 @@  CameraConfiguration::Status UVCCameraConfiguration::validate()
 	cfg.stride = format.planes[0].bpl;
 	cfg.frameSize = format.planes[0].size;
 
+	if (cfg.colorSpace != format.colorSpace) {
+		cfg.colorSpace = format.colorSpace;
+		status = Adjusted;
+	}
+
 	return status;
 }