From e8dc74317afa43ffa4096e7e7e0c25b5c5189682 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 22 May 2020 03:49:26 +0300 Subject: libcamera: Define constants for pixel formats in the public API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libcamera uses pixel format FourCC and modifier values from DRM. This requires inclusion of drm_fourcc.h, creating a dependency on a header that is packaged differently between distributions, and causing possible issues with third-party applications. Define constants for the supported pixel formats in the new formats.h public API header, in order to remove the dependency on drm_fourcc.h. The header is generated by a Python script from a list of supported formats. The numerical values for the FourCC and modifier are extracted from drm_fourcc.h by the script, ensuring that numerical values are not inadvertently modified and preserving the direct interoperability. The pixel formats constants can't be generated solely from drm_fourcc.h, as that header defines FourCC values and modifier values, but doesn't list the valid combinations. The supported formats are thus stored in a YAML file, which contains the FourCC and optional modifier for each supported format. We may later extend the YAML file to include formats documentation, and possibly formats metadata to populate the pixelFormatInfo map (in formats.cpp) automatically. Now that two formats.h header are present (one in include/libcamera/ and one in include/libcamera/internal/), we need to explicitly qualify the Doxygen \file directive with a path. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Kieran Bingham --- src/libcamera/pixel_format.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/libcamera/pixel_format.cpp') diff --git a/src/libcamera/pixel_format.cpp b/src/libcamera/pixel_format.cpp index d501c5f0..f191851a 100644 --- a/src/libcamera/pixel_format.cpp +++ b/src/libcamera/pixel_format.cpp @@ -5,6 +5,7 @@ * pixel_format.cpp - libcamera Pixel Format */ +#include #include /** @@ -21,7 +22,8 @@ namespace libcamera { * The PixelFormat type describes the format of images in the public libcamera * API. It stores a FourCC value as a 32-bit unsigned integer and a modifier. * The FourCC and modifier values are defined in the Linux kernel DRM/KMS API - * (see linux/drm_fourcc.h). + * (see linux/drm_fourcc.h). Constant expressions for all pixel formats + * supported by libcamera are available in libcamera/formats.h. */ /** -- cgit v1.2.1