libcamera v0.3.2 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
libcamera::PixelFormat Class Reference

libcamera image pixel format More...

## Public Member Functions
constexpr | PixelFormat ()
| Construct a PixelFormat with an invalid format.
constexpr | PixelFormat (uint32_t fourcc, uint64_t modifier=0)
| Construct a PixelFormat from a DRM FourCC and a modifier.
bool | operator== (const PixelFormat &other) const
| Compare pixel formats for equality.
bool | operator!= (const PixelFormat &other) const
| Compare pixel formats for inequality.
bool | operator< (const PixelFormat &other) const
| Compare pixel formats for smaller than order.
constexpr bool | isValid () const
| Check if the pixel format is valid.
constexpr | operator uint32_t () const
| Convert the the pixel format numerical value.
constexpr uint32_t | fourcc () const
| Retrieve the pixel format FourCC.
constexpr uint64_t | modifier () const
| Retrieve the pixel format modifier.
std::string | toString () const
| Assemble and return a string describing the pixel format.

## Static Public Member Functions
static PixelFormat | fromString (const std::string &name)
| Create a PixelFormat from a string.

## Detailed Description

libcamera image pixel format

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). Constant expressions for all pixel formats supported by libcamera are available in libcamera/formats.h.

## Constructor & Destructor Documentation

## ◆ PixelFormat() [1/2]

libcamera::PixelFormat::PixelFormat | ( |  | ) |
| inline constexpr

Construct a PixelFormat with an invalid format.

PixelFormat instances constructed with the default constructor are invalid, calling the isValid() function returns false.

## ◆ PixelFormat() [2/2]

libcamera::PixelFormat::PixelFormat | ( | uint32_t | fourcc,
|  | uint64_t | modifier = 0 )
| inline explicit constexpr

Construct a PixelFormat from a DRM FourCC and a modifier.

Parameters

  [in] | fourcc | A DRM FourCC
  [in] | modifier | A DRM FourCC modifier

## Member Function Documentation

## ◆ fourcc()

uint32_t libcamera::PixelFormat::fourcc | ( |  | ) | const
| inline constexpr

Retrieve the pixel format FourCC.

Returns
  DRM FourCC

## ◆ fromString()

PixelFormat libcamera::PixelFormat::fromString | ( | const std::string & | name | ) |
| static

Create a PixelFormat from a string.

Returns
  The PixelFormat represented by the name if known, or an invalid pixel format otherwise.

## ◆ isValid()

bool libcamera::PixelFormat::isValid | ( |  | ) | const
| inline constexpr

Check if the pixel format is valid.

PixelFormat instances constructed with the default constructor are invalid. Instances constructed with a FourCC defined in the DRM API are valid. The behaviour is undefined otherwise.

Returns
  True if the pixel format is valid, false otherwise

## ◆ modifier()

uint64_t libcamera::PixelFormat::modifier | ( |  | ) | const
| inline constexpr

Retrieve the pixel format modifier.

Returns
  DRM modifier

## ◆ operator uint32_t()

libcamera::PixelFormat::operator uint32_t | ( |  | ) | const
| inline constexpr

Convert the the pixel format numerical value.

Returns
  The pixel format numerical value

## ◆ operator!=()

bool libcamera::PixelFormat::operator!= | ( | const PixelFormat & | other | ) | const
| inline

Compare pixel formats for inequality.

Returns
  True if the two pixel formats are not equal, false otherwise

## ◆ operator<()

bool libcamera::PixelFormat::operator< | ( | const PixelFormat & | other | ) | const

Compare pixel formats for smaller than order.

Returns
  True if this is smaller than other, false otherwise

## ◆ operator==()

bool libcamera::PixelFormat::operator== | ( | const PixelFormat & | other | ) | const

Compare pixel formats for equality.

Returns
  True if the two pixel formats are equal, false otherwise

## ◆ toString()

std::string libcamera::PixelFormat::toString | ( |  | ) | const

Assemble and return a string describing the pixel format.

Returns
  A string describing the pixel format

The documentation for this class was generated from the following files:

- include/libcamera/pixel_format.h
- src/libcamera/pixel_format.cpp