libcamera  v0.2.0+85-1c5830a9
Supporting cameras in Linux since 2019
Classes | Namespaces | Typedefs | Enumerations
controls.h File Reference

Framework to manage controls related to an object. More...

#include <assert.h>
#include <optional>
#include <set>
#include <stdint.h>
#include <string>
#include <unordered_map>
#include <vector>
#include <libcamera/base/class.h>
#include <libcamera/base/span.h>
#include <libcamera/geometry.h>
Include dependency graph for controls.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


class  libcamera::ControlValue
 Abstract type representing the value of a control. More...
class  libcamera::ControlId
 Control static metadata. More...
class  libcamera::Control< T >
 Describe a control and its intrinsic properties. More...
class  libcamera::ControlInfo
 Describe the limits of valid values for a Control. More...
class  libcamera::ControlInfoMap
 A map of ControlId to ControlInfo. More...
class  libcamera::ControlList
 Associate a list of ControlId with their values for an object. More...


 Top-level libcamera namespace.


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


enum  libcamera::ControlType {
  libcamera::ControlTypeNone, libcamera::ControlTypeBool, libcamera::ControlTypeByte, libcamera::ControlTypeInteger32,
  libcamera::ControlTypeInteger64, libcamera::ControlTypeFloat, libcamera::ControlTypeString, ControlTypeRectangle,
 Define the data type of a Control. More...

Detailed Description

Framework to manage controls related to an object.

A control is a mean to govern or influence the operation of an object, and in particular of a camera. Every control is defined by a unique numerical ID, a name string and the data type of the value it stores. The libcamera API defines a set of standard controls in the libcamera::controls namespace, as a set of instances of the Control class.

The main way for applications to interact with controls is through the ControlList stored in the Request class:

Request *req = ...;
ControlList &controls = req->controls();
controls->set(controls::AwbEnable, false);
controls->set(controls::ManualExposure, 1000);
int32_t exposure = controls->get(controls::ManualExposure);

The ControlList::get() and ControlList::set() functions automatically deduce the data type based on the control.