libcamera  v0.2.0+129-626172a1
Supporting cameras in Linux since 2019
Public Member Functions | List of all members
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. More...
 
std::vector< PixelFormatpixelformats () const
 Retrieve the list of supported pixel formats. More...
 
std::vector< Sizesizes (const PixelFormat &pixelformat) const
 Retrieve the list of frame sizes supported for pixelformat. More...
 
SizeRange range (const PixelFormat &pixelformat) const
 Retrieve the range of minimum and maximum sizes. More...
 

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:

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]formatsA 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]pixelformatPixelFormat 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]pixelformatPixelFormat 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: