summaryrefslogtreecommitdiff
path: root/src/libcamera/pixel_format.cpp
AgeCommit message (Collapse)Author
2020-08-03libcamera: pixel_format: Add a function to return format based on stringKaaira Gupta
Add a function which retrieves pixel format corresponding to its name from PixelFormatInfo. Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-06-25libcamera: pixel_format: Replace hex with format namesKaaira Gupta
Print format names defined in formats namespace instead of the hex values in toString() as they are easier to comprehend. For this add a property of 'name' in PixelFormatInfo' so as to map the formats with their names. Print fourcc for formats which are not used in libcamera. Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-06-18libcamera: Define constants for pixel formats in the public APILaurent Pinchart
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>
2020-06-06libcamera: pixel_format: Make PixelFormat usable as a constexprLaurent Pinchart
The PixelFormat class is a lightweight wrapper around a 32-bit FourCC and a 64-bit modifier. Make is usable as a constexpr. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-06-06libcamera: Rename pixelformats.{cpp,h} to pixel_format.{cpp,h}Laurent Pinchart
The libcamera source files are named after class names, using snake_case. pixelformats.h and pixelformats.cpp don't comply with that rule. Fix them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>