libcamera v0.1.0+127-8e215127-dirty (2023-12-02T01:06:12+00:00)
Supporting cameras in Linux since 2019
libcamera::V4L2SubdeviceFormat Struct Reference

The V4L2 sub-device image format and sizes. More...

Collaboration diagram for libcamera::V4L2SubdeviceFormat:

Public Member Functions

const std::string toString () const
 Assemble and return a string describing the format. More...
 
uint8_t bitsPerPixel () const
 Retrieve the number of bits per pixel for the V4L2 subdevice format. More...
 

Public Attributes

uint32_t mbus_code
 The image format bus code.
 
Size size
 The image size in pixels.
 
std::optional< ColorSpacecolorSpace
 The color space of the pixels. More...
 

Detailed Description

The V4L2 sub-device image format and sizes.

This structure describes the format of images when transported between separate components connected through a physical bus, such as image sensor and image receiver or between components part of the same System-on-Chip that realize an image transformation pipeline.

The format of images when transported on physical interconnections is known as the "media bus format", and it is identified by a resolution and a pixel format identification code, known as the "media bus code", not to be confused with the fourcc code that identify the format of images when stored in memory (see V4L2VideoDevice::V4L2DeviceFormat).

Media Bus formats supported by the V4L2 APIs are described in Section 4.15.3.4.1 of the "Part I - Video for Linux API" chapter of the "Linux Media Infrastructure userspace API", part of the Linux kernel documentation.

Image media bus formats are properties of the subdev pads. When images are transported between two media pads identified by a 0-indexed number, the image bus format configured on the two pads should match (according to the underlying driver format matching criteria) in order to prepare for a successful streaming operation. For a more detailed description of the image format negotiation process when performed between V4L2 subdevices, refer to Section 4.15.3.1 of the above mentioned Linux kernel documentation section.

Member Function Documentation

◆ bitsPerPixel()

uint8_t libcamera::V4L2SubdeviceFormat::bitsPerPixel ( ) const

Retrieve the number of bits per pixel for the V4L2 subdevice format.

Returns
The number of bits per pixel for the format, or 0 if the format is not supported

◆ toString()

const std::string libcamera::V4L2SubdeviceFormat::toString ( ) const

Assemble and return a string describing the format.

Returns
A string describing the V4L2SubdeviceFormat

Member Data Documentation

◆ colorSpace

libcamera::V4L2SubdeviceFormat::colorSpace

The color space of the pixels.

The color space of the image. When setting the format this may be unset, in which case the driver gets to use its default color space. After being set, this value should contain the color space that was actually used. If this value is unset, then the color space chosen by the driver could not be represented by the ColorSpace class (and should probably be added).

It is up to the pipeline handler or application to check if the resulting color space is acceptable.


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