libcamera v0.3.2 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions
libcamera Namespace Reference

Top-level libcamera namespace. More...

## Namespaces
namespace | controls
| Namespace for libcamera controls.
namespace | properties
| Namespace for libcamera properties.

## Classes
class | Camera
| Camera device. More...
class | CameraConfiguration
| Hold configuration for streams of the camera. More...
class | CameraManager
| Provide access and manage all cameras in the system. More...
class | ColorSpace
| Class to describe a color space. More...
class | Control
| Describe a control and its intrinsic properties. More...
class | ControlId
| Control static metadata. More...
class | ControlInfo
| Describe the limits of valid values for a Control. More...
class | ControlInfoMap
| A map of ControlId to ControlInfo. More...
class | ControlList
| Associate a list of ControlId with their values for an object. More...
class | ControlValue
| Abstract type representing the value of a control. More...
class | Fence
| Synchronization primitive to manage resources. More...
class | Flags
| Type-safe container for enum-based bitfields. More...
class | FrameBuffer
| Frame buffer data and its associated dynamic metadata. More...
class | FrameBufferAllocator
| FrameBuffer allocator for applications. More...
struct | FrameMetadata
| Metadata related to a captured frame. More...
class | PixelFormat
| libcamera image pixel format More...
class | Point
| Describe a point in two-dimensional space. More...
class | Rectangle
| Describe a rectangle's position and dimensions. More...
class | Request
| A frame capture request. More...
class | SensorConfiguration
| Camera sensor configuration. More...
class | SharedFD
| RAII-style wrapper for file descriptors. More...
class | Signal
| Generic signal and slot communication mechanism. More...
class | Size
| Describe a two-dimensional size. More...
class | SizeRange
| Describe a range of sizes. More...
class | Stream
| Video stream for a camera. More...
struct | StreamConfiguration
| Configuration parameters for a stream. More...
class | StreamFormats
| Hold information about supported stream formats. More...
class | UniqueFD
| unique_ptr-like wrapper for a file descriptor More...

## Typedefs
using | ControlIdMap = std::unordered_map<unsigned int, const ControlId *>
| A map of numerical control ID to ControlId.

## Enumerations
enum | ConnectionType { ConnectionTypeAuto , ConnectionTypeDirect , ConnectionTypeQueued , ConnectionTypeBlocking }
| Connection type for asynchronous communication. More...
enum | ControlType { ControlTypeNone , ControlTypeBool , ControlTypeByte , ControlTypeInteger32 , ControlTypeInteger64 , ControlTypeFloat , ControlTypeString , ControlTypeRectangle , ControlTypeSize }
| Define the data type of a Control. More...
enum class | Orientation { Rotate0 = 1 , Rotate0Mirror , Rotate180 , Rotate180Mirror , Rotate90Mirror , Rotate270 , Rotate270Mirror , Rotate90 }
| The image orientation in a memory buffer. More...
enum class | StreamRole { Raw , StillCapture , VideoRecording , Viewfinder }
| Identify the role a stream is intended to play. More...
enum class | Transform : int { Identity = 0 , Rot0 = Identity , HFlip = 1 , VFlip = 2 , HVFlip = HFlip | VFlip , Rot180 = HVFlip , Transpose = 4 , Rot270 = HFlip | Transpose , Rot90 = VFlip | Transpose , Rot180Transpose = HFlip | VFlip | Transpose }
| Enum to represent a 2D plane transform. More...

## Functions
bool | operator== (const ColorSpace &lhs, const ColorSpace &rhs)
| Compare color spaces for equality.
bool | operator== (const Point &lhs, const Point &rhs)
| Compare points for equality.
std::ostream & | operator<< (std::ostream &out, const Point &p)
| Insert a text representation of a Point into an output stream.
bool | operator== (const Size &lhs, const Size &rhs)
| Compare sizes for equality.
bool | operator< (const Size &lhs, const Size &rhs)
| Compare sizes for smaller than order.
std::ostream & | operator<< (std::ostream &out, const Size &s)
| Insert a text representation of a Size into an output stream.
bool | operator== (const SizeRange &lhs, const SizeRange &rhs)
| Compare size ranges for equality.
std::ostream & | operator<< (std::ostream &out, const SizeRange &sr)
| Insert a text representation of a SizeRange into an output stream.
bool | operator== (const Rectangle &lhs, const Rectangle &rhs)
| Compare rectangles for equality.
std::ostream & | operator<< (std::ostream &out, const Rectangle &r)
| Insert a text representation of a Rectangle into an output stream.
Orientation | orientationFromRotation (int angle, bool *success)
| Return the orientation representing a rotation of the given angle clockwise.
std::ostream & | operator<< (std::ostream &out, const Orientation &orientation)
| Prints human-friendly names for Orientation items.
std::ostream & | operator<< (std::ostream &out, const PixelFormat &f)
| Insert a text representation of a PixelFormat into an output stream.
std::ostream & | operator<< (std::ostream &out, const Request &r)
| Insert a text representation of a Request into an output stream.
std::ostream & | operator<< (std::ostream &out, StreamRole role)
| Insert a text representation of a StreamRole into an output stream.
constexpr Transform | operator& (Transform t0, Transform t1)
| Apply bitwise AND operator between the bits in the two transforms.
constexpr Transform | operator| (Transform t0, Transform t1)
| Apply bitwise OR operator between the bits in the two transforms.
constexpr Transform | operator^ (Transform t0, Transform t1)
| Apply bitwise XOR operator between the bits in the two transforms.
constexpr Transform & | operator&= (Transform &t0, Transform t1)
| Apply bitwise AND-assignment operator between the bits in the two transforms.
constexpr Transform & | operator|= (Transform &t0, Transform t1)
| Apply bitwise OR-assignment operator between the bits in the two transforms.
constexpr Transform & | operator^= (Transform &t0, Transform t1)
| Apply bitwise XOR-assignment operator between the bits in the two transforms.
Transform | operator* (Transform t0, Transform t1)
| Compose two transforms by applying t0 first then t1.
Transform | operator- (Transform t)
| Invert a transform.
constexpr bool | operator! (Transform t)
| Return `true` if the transform is the `Identity`, otherwise `false`
constexpr Transform | operator~ (Transform t)
| Return the transform with all the bits inverted individually.
Transform | transformFromRotation (int angle, bool *success)
| Return the transform representing a rotation of the given angle clockwise.
Transform | operator/ (const Orientation &o1, const Orientation &o2)
| Return the Transform that applied to o2 gives o1.
Orientation | operator* (const Orientation &o, const Transform &t)
| Apply the Transform t on the orientation o.
const char * | transformToString (Transform t)
| Return a character string describing the transform.

## Detailed Description

Top-level libcamera namespace.

## Typedef Documentation

## ◆ ControlIdMap

using libcamera::ControlIdMap = std::unordered_map<unsigned int, const ControlId *>

A map of numerical control ID to ControlId.

The map is used by ControlList instances to access controls by numerical IDs. A global map of all libcamera controls is provided by controls::controls.

## Enumeration Type Documentation

## ◆ ConnectionType

enum libcamera::ConnectionType

Connection type for asynchronous communication.

This enumeration describes the possible types of asynchronous communication between a sender and a receiver. It applies to Signal::emit() and Object::invokeMethod().

Enumerator
ConnectionTypeAuto | If the sender and the receiver live in the same thread, ConnectionTypeDirect is used. Otherwise ConnectionTypeQueued is used.
ConnectionTypeDirect | The receiver is invoked immediately and synchronously in the sender's thread.
ConnectionTypeQueued | The receiver is invoked asynchronously. Invoke the receiver asynchronously in its thread when control returns to the thread's event loop. The sender proceeds without waiting for the invocation to complete.
ConnectionTypeBlocking | The receiver is invoked synchronously. If the sender and the receiver live in the same thread, this is equivalent to ConnectionTypeDirect. Otherwise, the receiver is invoked asynchronously in its thread when control returns to the thread's event loop. The sender blocks until the receiver signals the completion of the invocation.

## ◆ ControlType

enum libcamera::ControlType

Define the data type of a Control.

Enumerator
ControlTypeNone | Invalid type, for empty values
ControlTypeBool | The control stores a boolean value
ControlTypeByte | The control stores a byte value as an unsigned 8-bit integer
ControlTypeInteger32 | The control stores a 32-bit integer value
ControlTypeInteger64 | The control stores a 64-bit integer value
ControlTypeFloat | The control stores a 32-bit floating point value
ControlTypeString | The control stores a string value as an array of char

## ◆ Orientation

enum class libcamera::Orientation
| strong

The image orientation in a memory buffer.

The Orientation enumeration describes the orientation of the images produced by the camera pipeline as they get received by the application inside memory buffers.

The image orientation expressed using the Orientation enumeration can be then inferred by applying to a naturally oriented image a multiple of a 90 degrees rotation in the clockwise direction from the origin and then by applying an optional horizontal mirroring.

The enumeration numerical values follow the ones defined by the EXIF Specification version 2.32, Tag 274 "Orientation", while the names of the enumerated values report the rotation and mirroring operations performed.

For example, Orientation::Rotate90Mirror describes the orientation obtained by rotating the image 90 degrees clockwise first and then applying a horizontal mirroring.

Enumerator
Rotate0 |
Rotate0Mirror |
Rotate180 |
Rotate180Mirror |
Rotate90Mirror |
Rotate270 |
Rotate270Mirror |
Rotate90 |

## ◆ StreamRole

enum class libcamera::StreamRole
| strong

Identify the role a stream is intended to play.

The StreamRole describes how an application intends to use a stream. Roles are specified by applications and passed to cameras, that then select the most appropriate streams and their default configurations.

Enumerator
Raw | The stream is intended to capture raw frames from the sensor.
StillCapture | The stream is intended to capture high-resolution, high-quality still images with low frame rate. The captured frames may be exposed with flash.
VideoRecording | The stream is intended to capture video for the purpose of recording or streaming. The video stream may produce a high frame rate and may be enhanced with video stabilization.
Viewfinder | The stream is intended to capture video for the purpose of display on the local screen. Trade-offs between quality and usage of system resources are acceptable.

## ◆ Transform

enum class libcamera::Transform : int
| strong

Enum to represent a 2D plane transform.

The Transform can take 8 distinct values, representing the usual 2D plane transforms listed below. Each of these transforms can be constructed out of 3 basic operations, namely a horizontal flip (mirror), a vertical flip, and a transposition (about the main diagonal). The transforms are encoded such that a single bit indicates the presence of each of the 3 basic operations:

- bit 0 - presence of a horizontal flip
- bit 1 - presence of a vertical flip
- bit 2 - presence of a transposition.

We regard these 3 basic operations as being applied in a specific order: first the two flip operations (actually they commute, so the order between them is unimportant) and finally any transpose operation.

Functions are provided to manipulate directly the bits within the transform encoding, but there are also higher-level functions to invert and compose transforms. Transforms are composed according to the usual mathematical convention such that the right transform is applied first, and the left transform is applied second.

Finally, we have a total of 8 distinct transformations, as follows (a couple of them have additional synonyms for convenience). We illustrate each with its nominal effect on a rectangle with vertices labelled A, B, C and D.

See also
  https://en.wikipedia.org/wiki/Examples_of_groups#dihedral_group_of_order_8

The set of 2D plane transforms is also known as the symmetry group of a square, described in the link. Note that the group can be generated by only 2 elements (the horizontal flip and a 90 degree rotation, for example), however, the encoding used here makes the presence of the vertical flip explicit.

Enumerator
Identity | Identity transform. A-B A-B Input image | | goes to output image | | C-D C-D Numeric value: 0 (no bits set).
Rot0 | Synonym for Transform::Identity (zero degree rotation).
HFlip | Horizontal flip. A-B B-A Input image | | goes to output image | | C-D D-C Numeric value: 1 (horizontal flip bit set only).
VFlip | Vertical flip. A-B C-D Input image | | goes to output image | | C-D A-B Numeric value: 2 (vertical flip bit set only).
HVFlip | Horizontal and vertical flip (identical to a 180 degree rotation). A-B D-C Input image | | goes to output image | | C-D B-A Numeric value: 3 (horizontal and vertical flip bits set).
Rot180 | Synonym for `HVFlip` (180 degree rotation).
Transpose | Transpose (about the main diagonal). A-B A-C Input image | | goes to output image | | C-D B-D Numeric value: 4 (transpose bit set only).
Rot270 | Rotation by 270 degrees clockwise (90 degrees anticlockwise). A-B B-D Input image | | goes to output image | | C-D A-C Numeric value: 5 (transpose and horizontal flip bits set).
Rot90 | Rotation by 90 degrees clockwise (270 degrees anticlockwise). A-B C-A Input image | | goes to output image | | C-D D-B Numeric value: 6 (transpose and vertical flip bits set).
Rot180Transpose | Rotation by 180 degrees followed by transpose (alternatively, transposition about the "opposite diagonal"). A-B D-B Input image | | goes to output image | | C-D C-A Numeric value: 7 (all bits set).

## Function Documentation

## ◆ operator!()

bool libcamera::operator! | ( | Transform | t | ) |
| constexpr

Return `true` if the transform is the `Identity`, otherwise `false`

Parameters

  [in] | t | The transform to be tested

## ◆ operator&()

Transform libcamera::operator& | ( | Transform | t0,
|  | Transform | t1 )
| constexpr

Apply bitwise AND operator between the bits in the two transforms.

Parameters

  [in] | t0 | The first transform
  [in] | t1 | The second transform

## ◆ operator&=()

Transform & libcamera::operator&= | ( | Transform & | t0,
|  | Transform | t1 )
| constexpr

Apply bitwise AND-assignment operator between the bits in the two transforms.

Parameters

  [in] | t0 | The first transform
  [in] | t1 | The second transform

## ◆ operator*() [1/2]

Orientation libcamera::operator* | ( | const Orientation & | o,
|  | const Transform & | t )

Apply the Transform t on the orientation o.

Parameters

  o | The orientation
  t | The transform to apply on o

Returns
  The Orientation resulting from applying t on o

## ◆ operator*() [2/2]

Transform libcamera::operator* | ( | Transform | t0,
|  | Transform | t1 )

Compose two transforms by applying t0 first then t1.

Parameters

  [in] | t0 | The first transform to apply
  [in] | t1 | The second transform to apply

Compose two transforms into a transform that is equivalent to first applying t0 and then applying t1. For example, `HFlip * Transpose` performs `HFlip` first and then the `Transpose` yielding `Rot270`, as shown below.

A-B B-A B-D
Input image | | -> HFLip -> | | -> Transpose -> | | = Rot270
C-D D-C A-C
libcamera::Transform::Transpose
@ Transpose
libcamera::Transform::Rot270
@ Rot270

Note that composition is generally non-commutative for Transforms, and not the same as XOR-ing the underlying bit representations.

Returns
  A Transform equivalent to applying t0 and then t1

## ◆ operator-()

Transform libcamera::operator- | ( | Transform | t | ) |

Invert a transform.

Parameters

  [in] | t | The transform to be inverted

That is, we return the transform such that `t * (-t)` and `(-t) * t` both yield the identity transform.

## ◆ operator/()

Transform libcamera::operator/ | ( | const Orientation & | o1,
|  | const Orientation & | o2 )

Return the Transform that applied to o2 gives o1.

Parameters

  o1 | The Orientation to obtain
  o2 | The base Orientation

This operation can be used to easily compute the Transform to apply to a base orientation o2 to get the desired orientation o1.

Returns
  A Transform that applied to o2 gives o1

## ◆ operator<()

bool libcamera::operator< | ( | const Size & | lhs,
|  | const Size & | rhs )

Compare sizes for smaller than order.

Sizes are compared on three criteria, in the following order.

- A size with smaller width and smaller height is smaller.
- A size with smaller area is smaller.
- A size with smaller width is smaller.

Returns
  True if lhs is smaller than rhs, false otherwise

## ◆ operator<<() [1/8]

std::ostream & libcamera::operator<< | ( | std::ostream & | out,
|  | const Orientation & | orientation )

Prints human-friendly names for Orientation items.

Parameters

  [in] | out | The output stream
  [in] | orientation | The Orientation item

Returns
  The output stream out

## ◆ operator<<() [2/8]

std::ostream & libcamera::operator<< | ( | std::ostream & | out,
|  | const PixelFormat & | f )

Insert a text representation of a PixelFormat into an output stream.

Parameters

  [in] | out | The output stream
  [in] | f | The PixelFormat

Returns
  The output stream out

## ◆ operator<<() [3/8]

std::ostream & libcamera::operator<< | ( | std::ostream & | out,
|  | const Point & | p )

Insert a text representation of a Point into an output stream.

Parameters

  [in] | out | The output stream
  [in] | p | The point

Returns
  The output stream out

## ◆ operator<<() [4/8]

std::ostream & libcamera::operator<< | ( | std::ostream & | out,
|  | const Rectangle & | r )

Insert a text representation of a Rectangle into an output stream.

Parameters

  [in] | out | The output stream
  [in] | r | The rectangle

Returns
  The output stream out

## ◆ operator<<() [5/8]

std::ostream & libcamera::operator<< | ( | std::ostream & | out,
|  | const Request & | r )

Insert a text representation of a Request into an output stream.

Parameters

  [in] | out | The output stream
  [in] | r | The Request

Returns
  The output stream out

## ◆ operator<<() [6/8]

std::ostream & libcamera::operator<< | ( | std::ostream & | out,
|  | const Size & | s )

Insert a text representation of a Size into an output stream.

Parameters

  [in] | out | The output stream
  [in] | s | The size

Returns
  The output stream out

## ◆ operator<<() [7/8]

std::ostream & libcamera::operator<< | ( | std::ostream & | out,
|  | const SizeRange & | sr )

Insert a text representation of a SizeRange into an output stream.

Parameters

  [in] | out | The output stream
  [in] | sr | The size range

Returns
  The output stream out

## ◆ operator<<() [8/8]

std::ostream & libcamera::operator<< | ( | std::ostream & | out,
|  | StreamRole | role )

Insert a text representation of a StreamRole into an output stream.

Parameters

  [in] | out | The output stream
  [in] | role | The StreamRole

Returns
  The output stream out

## ◆ operator==() [1/5]

bool libcamera::operator== | ( | const ColorSpace & | lhs,
|  | const ColorSpace & | rhs )

Compare color spaces for equality.

Returns
  True if the two color spaces are identical, false otherwise

## ◆ operator==() [2/5]

bool libcamera::operator== | ( | const Point & | lhs,
|  | const Point & | rhs )

Compare points for equality.

Returns
  True if the two points are equal, false otherwise

## ◆ operator==() [3/5]

bool libcamera::operator== | ( | const Rectangle & | lhs,
|  | const Rectangle & | rhs )

Compare rectangles for equality.

Returns
  True if the two rectangles are equal, false otherwise

## ◆ operator==() [4/5]

bool libcamera::operator== | ( | const Size & | lhs,
|  | const Size & | rhs )

Compare sizes for equality.

Returns
  True if the two sizes are equal, false otherwise

## ◆ operator==() [5/5]

bool libcamera::operator== | ( | const SizeRange & | lhs,
|  | const SizeRange & | rhs )

Compare size ranges for equality.

Returns
  True if the two size ranges are equal, false otherwise

## ◆ operator^()

Transform libcamera::operator^ | ( | Transform | t0,
|  | Transform | t1 )
| constexpr

Apply bitwise XOR operator between the bits in the two transforms.

Parameters

  [in] | t0 | The first transform
  [in] | t1 | The second transform

## ◆ operator^=()

Transform & libcamera::operator^= | ( | Transform & | t0,
|  | Transform | t1 )
| constexpr

Apply bitwise XOR-assignment operator between the bits in the two transforms.

Parameters

  [in] | t0 | The first transform
  [in] | t1 | The second transform

## ◆ operator|()

Transform libcamera::operator| | ( | Transform | t0,
|  | Transform | t1 )
| constexpr

Apply bitwise OR operator between the bits in the two transforms.

Parameters

  [in] | t0 | The first transform
  [in] | t1 | The second transform

## ◆ operator|=()

Transform & libcamera::operator|= | ( | Transform & | t0,
|  | Transform | t1 )
| constexpr

Apply bitwise OR-assignment operator between the bits in the two transforms.

Parameters

  [in] | t0 | The first transform
  [in] | t1 | The second transform

## ◆ operator~()

Transform libcamera::operator~ | ( | Transform | t | ) |
| constexpr

Return the transform with all the bits inverted individually.

Parameters

  [in] | t | The transform of which the bits will be inverted

This inverts the bits that encode the transform in a bitwise manner. Note that this is not the proper inverse of transform t (for which use operator-).

## ◆ orientationFromRotation()

Orientation libcamera::orientationFromRotation | ( | int | angle,
|  | bool * | success )

Return the orientation representing a rotation of the given angle clockwise.

Parameters

  [in] | angle | The angle of rotation in a clockwise sense. Negative values can be used to represent anticlockwise rotations
  [out] | success | Set to `true` if the angle is a multiple of 90 degrees, otherwise `false`

Returns
  The orientation corresponding to the rotation if success was set to `true`, otherwise the `Rotate0` orientation

## ◆ transformFromRotation()

Transform libcamera::transformFromRotation | ( | int | angle,
|  | bool * | success )

Return the transform representing a rotation of the given angle clockwise.

Parameters

  [in] | angle | The angle of rotation in a clockwise sense. Negative values can be used to represent anticlockwise rotations
  [out] | success | Set to `true` if the angle is a multiple of 90 degrees, otherwise `false`

Returns
  The transform corresponding to the rotation if success was set to `true`, otherwise the `Identity` transform

## ◆ transformToString()

const char * libcamera::transformToString | ( | Transform | t | ) |

Return a character string describing the transform.

Parameters

  [in] | t | The transform to be described.