Loading...
Searching...
No Matches
libcamera::StreamFormats Class Reference

Hold information about supported stream formats. More...

## Public Member Functions

| StreamFormats (const std::map< PixelFormat, std::vector< SizeRange > > &formats)
| Construct a StreamFormats object with a map of image formats.
std::vector< PixelFormat > | pixelformats () const
| Retrieve the list of supported pixel formats.
std::vector< Size > | sizes (const PixelFormat &pixelformat) const
| Retrieve the list of frame sizes supported for pixelformat.
SizeRange | range (const PixelFormat &pixelformat) const
| Retrieve the range of minimum and maximum sizes.

## Detailed Description

Hold information about supported stream formats.

The StreamFormats class holds information about the pixel formats and frame sizes a stream supports. The class groups size information by the pixel format which can produce it.

There are two ways to examine the size information, as a range or as a list of discrete sizes. When sizes are viewed as a range it describes the minimum and maximum width and height values. The range description can include horizontal and vertical steps.

When sizes are viewed as a list of discrete sizes they describe the exact dimensions which can be selected and used.

Pipeline handlers can create StreamFormats describing each pixel format using either a range or a list of discrete sizes. The StreamFormats class attempts to translate between the two different ways to view them. The translations are performed as:

- If the StreamFormat is constructed using a list of discrete image sizes and a range is requested, it gets created by taking the minimum and maximum width/height in the list. The step information is not recreated and is set to 0 to indicate the range is generated.
- If the image sizes used to construct a StreamFormat are expressed as a range and a list of discrete sizes is requested, one which fits inside that range are selected from a list of common sizes. The step information is taken into consideration when generating the sizes.

Applications examining sizes as a range with step values of 0 shall be aware that the range are generated from a list of discrete sizes and there could be a large number of possible Size combinations that may not be supported by the Stream.

All sizes retrieved from StreamFormats shall be treated as advisory and no size shall be considered to be supported until it has been verified using CameraConfiguration::validate().

Todo
  Review the usage patterns of this class, and cache the computed pixelformats(), sizes() and range() if this would improve performances.

## Constructor & Destructor Documentation

## StreamFormats()

libcamera::StreamFormats::StreamFormats | ( | const std::map< PixelFormat, std::vector< SizeRange > > & | formats | ) |

Construct a StreamFormats object with a map of image formats.

Parameters

  [in] | formats | A map of pixel formats to a sizes description

## Member Function Documentation

## pixelformats()

std::vector< PixelFormat > libcamera::StreamFormats::pixelformats | ( |  | ) | const

Retrieve the list of supported pixel formats.

Returns
  The list of supported pixel formats

## range()

SizeRange libcamera::StreamFormats::range | ( | const PixelFormat & | pixelformat | ) | const

Retrieve the range of minimum and maximum sizes.

Parameters

  [in] | pixelformat | PixelFormat to retrieve range for

If the size described for pixelformat is a range, that range is returned directly. If the sizes described are a list of discrete sizes, a range is created from the minimum and maximum sizes in the list. The step values of the range are set to 0 to indicate that the range is generated and that not all image sizes contained in the range might be supported.

Returns
  A range of valid image sizes or an empty range on error

## sizes()

std::vector< Size > libcamera::StreamFormats::sizes | ( | const PixelFormat & | pixelformat | ) | const

Retrieve the list of frame sizes supported for pixelformat.

Parameters

  [in] | pixelformat | PixelFormat to retrieve sizes for

If the sizes described for pixelformat are discrete they are returned directly.

If the sizes are described as a range, a list of discrete sizes are computed from a list of common resolutions that fit inside the described range. When computing the discrete list step values are considered but there are no guarantees that all sizes computed are supported.

Returns
  A list of frame sizes or an empty list on error

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

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