summaryrefslogtreecommitdiff
path: root/src/libcamera/pixel_format.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-05-22 03:49:26 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-06-18 13:26:36 +0300
commite8dc74317afa43ffa4096e7e7e0c25b5c5189682 (patch)
tree259b9df651935b40e807c1219034ad02cb7159ac /src/libcamera/pixel_format.cpp
parent469a85f74d631a83e325982d4101909e5e0a7834 (diff)
libcamera: Define constants for pixel formats in the public API
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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/libcamera/pixel_format.cpp')
-rw-r--r--src/libcamera/pixel_format.cpp4
1 files changed, 3 insertions, 1 deletions
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 <libcamera/formats.h>
#include <libcamera/pixel_format.h>
/**
@@ -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.
*/
/**