Files
external_libcamera/src/libcamera/control_ids.cpp.in
Paul Elder 34d7b4776b libcamera: controls: Add support for querying direction information
Add support to ControlId for querying direction information. This allows
applications to query whether a ControlId is meant for being set in
controls or to be returned in metadata or both. This also has a side
effect of properly encoding this information, as previously it was only
mentioned losely and inconsistently in the control id definition.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-18 17:27:01 +09:00

124 lines
2.8 KiB
C++

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* {{mode}} ID list
*
* This file is auto-generated. Do not edit.
*/
#include <libcamera/{{filename}}.h>
#include <libcamera/controls.h>
/**
* \file {{filename}}.h
* \brief Camera {{mode}} identifiers
*/
namespace libcamera {
/**
* \brief Namespace for libcamera {{mode}}
*/
namespace {{mode}} {
{%- for vendor, ctrls in controls -%}
{%- if vendor != 'libcamera' %}
/**
* \brief Namespace for {{vendor}} {{mode}}
*/
namespace {{vendor}} {
{%- endif -%}
{% for ctrl in ctrls %}
{% if ctrl.is_enum -%}
/**
* \enum {{ctrl.name}}Enum
* \brief Supported {{ctrl.name}} values
{%- for enum in ctrl.enum_values %}
*
* \var {{enum.name}}
* \brief {{enum.description|format_description}}
{%- endfor %}
*/
/**
* \var {{ctrl.name}}Values
* \brief List of all {{ctrl.name}} supported values
*/
/**
* \var {{ctrl.name}}NameValueMap
* \brief Map of all {{ctrl.name}} supported value names (in std::string format) to value
*/
{% endif -%}
/**
* \var {{ctrl.name}}
* \brief {{ctrl.description|format_description}}
*/
{%- endfor %}
{% if vendor != 'libcamera' %}
} /* namespace {{vendor}} */
{% endif -%}
{%- endfor %}
#ifndef __DOXYGEN__
/*
* Keep the {{mode}} definitions hidden from doxygen as it incorrectly parses
* them as functions.
*/
{% for vendor, ctrls in controls -%}
{% if vendor != 'libcamera' %}
namespace {{vendor}} {
{% endif %}
{%- for ctrl in ctrls %}
{% if ctrl.is_enum -%}
extern const std::array<const ControlValue, {{ctrl.enum_values_count}}> {{ctrl.name}}Values = {
{%- for enum in ctrl.enum_values %}
static_cast<{{ctrl.type}}>({{enum.name}}),
{%- endfor %}
};
extern const std::map<std::string, {{ctrl.type}}> {{ctrl.name}}NameValueMap = {
{%- for enum in ctrl.enum_values %}
{ "{{enum.name}}", {{enum.name}} },
{%- endfor %}
};
extern const Control<{{ctrl.type}}> {{ctrl.name}}({{ctrl.name|snake_case|upper}}, "{{ctrl.name}}", "{{vendor}}", {{ctrl.direction}}, {{ctrl.name}}NameValueMap);
{% else -%}
extern const Control<{{ctrl.type}}> {{ctrl.name}}({{ctrl.name|snake_case|upper}}, "{{ctrl.name}}", "{{vendor}}", {{ctrl.direction}});
{% endif -%}
{%- endfor %}
{% if vendor != 'libcamera' %}
} /* namespace {{vendor}} */
{% endif -%}
{%- endfor %}
#endif /* __DOXYGEN__ */
/**
* \brief List of all supported libcamera {{mode}}
{%- if mode == 'controls' %}
*
* Unless otherwise stated, all controls are bi-directional, i.e. they can be
* set through Request::controls() and returned out through Request::metadata().
{%- endif %}
*/
extern const ControlIdMap {{mode}} {
{%- for vendor, ctrls in controls -%}
{%- for ctrl in ctrls %}
{ {{ctrl.namespace}}{{ctrl.name|snake_case|upper}}, &{{ctrl.namespace}}{{ctrl.name}} },
{%- endfor -%}
{%- endfor %}
};
} /* namespace {{mode}} */
} /* namespace libcamera */