libcamera
v0.0.0
Supporting cameras in Linux since 2019
|
V4L2 pixel format FourCC wrapper. More...
Public Member Functions | |
V4L2PixelFormat () | |
Construct a V4L2PixelFormat with an invalid format. More... | |
V4L2PixelFormat (uint32_t fourcc) | |
Construct a V4L2PixelFormat from a FourCC value. More... | |
bool | isValid () const |
Check if the pixel format is valid. More... | |
uint32_t | fourcc () const |
Retrieve the pixel format FourCC numerical value. More... | |
operator uint32_t () const | |
Convert to the pixel format FourCC numerical value. More... | |
std::string | toString () const |
Assemble and return a string describing the pixel format. More... | |
PixelFormat | toPixelFormat () const |
Convert the V4L2 pixel format to the corresponding PixelFormat. More... | |
Static Public Member Functions | |
static V4L2PixelFormat | fromPixelFormat (const PixelFormat &pixelFormat, bool multiplanar) |
Convert pixelFormat to its corresponding V4L2PixelFormat. More... | |
V4L2 pixel format FourCC wrapper.
The V4L2PixelFormat class describes the pixel format of a V4L2 buffer. It wraps the V4L2 numerical FourCC, and shall be used in all APIs that deal with V4L2 pixel formats. Its purpose is to prevent unintentional confusion of V4L2 and DRM FourCCs in code by catching implicit conversion attempts at compile time.
To achieve this goal, construction of a V4L2PixelFormat from an integer value is explicit. To retrieve the integer value of a V4L2PixelFormat, both the explicit value() and implicit uint32_t conversion operators may be used.
|
inline |
Construct a V4L2PixelFormat with an invalid format.
V4L2PixelFormat instances constructed with the default constructor are invalid, calling the isValid() function returns false.
|
inlineexplicit |
Construct a V4L2PixelFormat from a FourCC value.
[in] | fourcc | The pixel format FourCC numerical value |
|
inline |
Retrieve the pixel format FourCC numerical value.
|
static |
Convert pixelFormat to its corresponding V4L2PixelFormat.
[in] | pixelFormat | The PixelFormat to convert |
[in] | multiplanar | V4L2 Multiplanar API support flag |
Multiple V4L2 formats may exist for one PixelFormat when the format uses multiple planes, as V4L2 defines separate 4CCs for contiguous and separate planes formats. Set the multiplanar parameter to false to select a format with contiguous planes, or to true to select a format with non-contiguous planes.
|
inline |
Check if the pixel format is valid.
V4L2PixelFormat instances constructed with the default constructor are invalid. Instances constructed with a FourCC defined in the V4L2 API are valid. The behaviour is undefined otherwise.
|
inline |
Convert to the pixel format FourCC numerical value.
PixelFormat libcamera::V4L2PixelFormat::toPixelFormat | ( | ) | const |
Convert the V4L2 pixel format to the corresponding PixelFormat.
std::string libcamera::V4L2PixelFormat::toString | ( | ) | const |
Assemble and return a string describing the pixel format.