libcamera  v0.3.2+116-83c5ad0f
Supporting cameras in Linux since 2019
debug_controls.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 /*
3  * Copyright (C) 2024, Google Inc.
4  *
5  * Debug metadata helpers
6  */
7 
8 #pragma once
9 
10 #include <libcamera/control_ids.h>
11 
12 namespace libcamera {
13 
15 {
16 public:
17  DebugMetadata() = default;
18 
20  void enable(bool enable = true);
21  void setParent(DebugMetadata *parent);
22  void moveEntries(ControlList &list);
23 
24  template<typename T, typename V>
25  void set(const Control<T> &ctrl, const V &value)
26  {
27  if (parent_) {
28  parent_->set(ctrl, value);
29  return;
30  }
31 
32  if (!enabled_)
33  return;
34 
35  cache_.set(ctrl, value);
36  }
37 
38  void set(unsigned int id, const ControlValue &value);
39 
40 private:
41  bool enabled_ = false;
42  DebugMetadata *parent_ = nullptr;
43  ControlList cache_;
44 };
45 
46 } /* namespace libcamera */
Helper to record metadata for later use.
Definition: debug_controls.h:14
void setParent(DebugMetadata *parent)
Set the parent metadata handler to parent.
Definition: debug_controls.cpp:99
void set(const Control< T > &ctrl, const V &value)
Set the control ctrl value to value.
Definition: controls.h:423
Camera controls identifiers.
Top-level libcamera namespace.
Definition: backtrace.h:17
Abstract type representing the value of a control.
Definition: controls.h:118
void enable(bool enable=true)
Enable or disable metadata handling.
Definition: debug_controls.cpp:82
Describe a control and its intrinsic properties.
Definition: controls.h:283
void enableByControl(const ControlList &controls)
Enable based on controls::DebugMetadataEnable in the supplied ControlList.
Definition: debug_controls.cpp:64
const ControlIdMap controls
List of all supported libcamera controls.
Definition: control_ids.cpp:1952
Associate a list of ControlId with their values for an object.
Definition: controls.h:380
void set(const Control< T > &ctrl, const V &value)
Set the value of ctrl to value.
Definition: debug_controls.h:25
void moveEntries(ControlList &list)
Move all cached entries into control list list.
Definition: debug_controls.cpp:122