libcamera::ImageFormats Class Reference

Describe V4L2Device and V4L2SubDevice image formats. More...

## Public Member Functions

int | addFormat (unsigned int format, const std::vector< SizeRange > &sizes)
| Add a format and corresponding sizes to the description. More...
bool | isEmpty () const
| Check if the list of devices supported formats is empty. More...
std::vector< unsigned int > | formats () const
| Retrieve a list of all supported image formats. More...
const std::vector< SizeRange > & | sizes (unsigned int format) const
| Retrieve all sizes for a specific format. More...
const std::map< unsigned int, std::vector< SizeRange > > & | data () const
| Retrieve the map that associates formats to image sizes. More...

## Detailed Description

Describe V4L2Device and V4L2SubDevice image formats.

This class stores a list of image formats, each associated with a corresponding set of image sizes. It is used to describe the formats and sizes supported by a V4L2Device or V4L2Subdevice.

Formats are stored as an integer. When used for a V4L2Device, the image formats are fourcc pixel formats. When used for a V4L2Subdevice they are media bus codes. Both are defined by the V4L2 specification.

Sizes are stored as a list of SizeRange.

## Member Function Documentation

## addFormat()

int libcamera::ImageFormats::addFormat | ( | unsigned int | format,
|  | const std::vector< SizeRange > & | sizes
| ) |  |

Add a format and corresponding sizes to the description.

Parameters

  [in] | format | Pixel format or media bus code to describe
  [in] | sizes | List of supported size ranges for the format

Returns
  0 on success or a negative error code otherwise

Return values

  -EEXIST | The format is already described

## data()

const std::map< unsigned int, std::vector< SizeRange > > & libcamera::ImageFormats::data | ( |  | ) | const

Retrieve the map that associates formats to image sizes.

Returns
  The map that associates formats to image sizes

## formats()

std::vector< unsigned int > libcamera::ImageFormats::formats | ( |  | ) | const

Retrieve a list of all supported image formats.

Returns
  List of pixel formats or media bus codes

## isEmpty()

bool libcamera::ImageFormats::isEmpty | ( |  | ) | const

Check if the list of devices supported formats is empty.

Returns
  True if the list of supported formats is empty

## sizes()

const std::vector< SizeRange > & libcamera::ImageFormats::sizes | ( | unsigned int | format | ) | const

Retrieve all sizes for a specific format.

Parameters

  [in] | format | The pixel format or mbus code

Retrieve all size ranges for a specific format. For V4L2Device format is a pixel format while for a V4L2Subdevice format is a media bus code.

Returns
  The list of image sizes supported for format, or an empty list if the format is not supported

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

- include/libcamera/internal/formats.h
- src/libcamera/formats.cpp