From 560ceb1ea854b1cb0c7d91efffa0e7aabbed2328 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 5 Sep 2022 19:38:52 +0300 Subject: libcamera: v4l2_subdevice: Silence warning for unknown metadata formats Commit e297673e7686 ("libcamera: v4l2_device: Adjust colorspace based on pixel format") has introduced a warning when trying to convert a color space from V4L2 to libcamera if the media bus code is unknown. This was meant to catch unknown image formats, but turned out to be also triggered for metadata formats. Color spaces are not applicable to metadata formats, there should thus be no warning. Fix it by skipping the color space translation and returning std::nullopt directly if the kernel reports V4L2_COLORSPACE_DEFAULT. This doesn't introduce any change in behaviour other than getting rid of the warning, as the V4L2Device::toColorSpace() function returns std::nullopt already in that case. Fixes: e297673e7686 ("libcamera: v4l2_device: Adjust colorspace based on pixel format") Reported-by: Naushir Patuck Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Tested-by: Naushir Patuck Reviewed-by: Naushir Patuck --- include/libcamera/internal/v4l2_subdevice.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h index 00be17bb..69862de0 100644 --- a/include/libcamera/internal/v4l2_subdevice.h +++ b/include/libcamera/internal/v4l2_subdevice.h @@ -101,6 +101,9 @@ protected: private: LIBCAMERA_DISABLE_COPY(V4L2Subdevice) + std::optional + toColorSpace(const v4l2_mbus_framefmt &format) const; + std::vector enumPadCodes(unsigned int pad); std::vector enumPadSizes(unsigned int pad, unsigned int code); -- cgit v1.2.1