libcamera: properties: Add location property
Re-use the Control generation infrastructure to generate libcamera properties and define the first 'Location' property. Introduce three additional files: - include/libcamera/property_ids.h Defines the properties ids - src/libcamera/property_ids.cpp Defines the properties Control<> instances - src/libcamera/property_ids.yaml Provide the first 'Location' property definition. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
c9104548af
commit
f870591a9b
5 changed files with 132 additions and 15 deletions
|
@ -25,15 +25,23 @@ install_headers(libcamera_api,
|
||||||
|
|
||||||
gen_controls = files('../../src/libcamera/gen-controls.py')
|
gen_controls = files('../../src/libcamera/gen-controls.py')
|
||||||
|
|
||||||
control_ids_h = custom_target('control_ids_h',
|
control_source_files = [
|
||||||
input : files('../../src/libcamera/control_ids.yaml', 'control_ids.h.in'),
|
'control_ids',
|
||||||
output : 'control_ids.h',
|
'property_ids',
|
||||||
depend_files : gen_controls,
|
]
|
||||||
command : [gen_controls, '-o', '@OUTPUT@', '@INPUT@'],
|
|
||||||
install : true,
|
|
||||||
install_dir : join_paths('include', include_dir))
|
|
||||||
|
|
||||||
libcamera_api += control_ids_h
|
control_headers = []
|
||||||
|
|
||||||
|
foreach header : control_source_files
|
||||||
|
input_files = files('../../src/libcamera/' + header +'.yaml', header + '.h.in')
|
||||||
|
control_headers += custom_target(header + '_h',
|
||||||
|
input : input_files,
|
||||||
|
output : header + '.h',
|
||||||
|
depend_files : gen_controls,
|
||||||
|
command : [gen_controls, '-o', '@OUTPUT@', '@INPUT@'],
|
||||||
|
install : true,
|
||||||
|
install_dir : join_paths('include', include_dir))
|
||||||
|
endforeach
|
||||||
|
|
||||||
gen_header = files('gen-header.sh')
|
gen_header = files('gen-header.sh')
|
||||||
|
|
||||||
|
|
33
include/libcamera/property_ids.h.in
Normal file
33
include/libcamera/property_ids.h.in
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019, Google Inc.
|
||||||
|
*
|
||||||
|
* property_ids.h : Property ID list
|
||||||
|
*
|
||||||
|
* This file is auto-generated. Do not edit.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBCAMERA_PROPERTY_IDS_H__
|
||||||
|
#define __LIBCAMERA_PROPERTY_IDS_H__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <libcamera/controls.h>
|
||||||
|
|
||||||
|
namespace libcamera {
|
||||||
|
|
||||||
|
namespace properties {
|
||||||
|
|
||||||
|
enum {
|
||||||
|
${ids}
|
||||||
|
};
|
||||||
|
|
||||||
|
${controls}
|
||||||
|
|
||||||
|
extern const ControlIdMap properties;
|
||||||
|
|
||||||
|
} /* namespace propertiess */
|
||||||
|
|
||||||
|
} /* namespace libcamera */
|
||||||
|
|
||||||
|
#endif // __LIBCAMERA_PROPERTY_IDS_H__
|
|
@ -69,14 +69,19 @@ endif
|
||||||
|
|
||||||
gen_controls = files('gen-controls.py')
|
gen_controls = files('gen-controls.py')
|
||||||
|
|
||||||
control_ids_cpp = custom_target('control_ids_cpp',
|
control_sources = []
|
||||||
input : files('control_ids.yaml', 'control_ids.cpp.in'),
|
|
||||||
output : 'control_ids.cpp',
|
|
||||||
depend_files : gen_controls,
|
|
||||||
command : [gen_controls, '-o', '@OUTPUT@', '@INPUT@'])
|
|
||||||
|
|
||||||
libcamera_sources += control_ids_cpp
|
foreach source : control_source_files
|
||||||
libcamera_sources += control_ids_h
|
input_files = files(source +'.yaml', source + '.cpp.in')
|
||||||
|
control_sources += custom_target(source + '_cpp',
|
||||||
|
input : input_files,
|
||||||
|
output : source + '.cpp',
|
||||||
|
depend_files : gen_controls,
|
||||||
|
command : [gen_controls, '-o', '@OUTPUT@', '@INPUT@'])
|
||||||
|
endforeach
|
||||||
|
|
||||||
|
libcamera_sources += control_headers
|
||||||
|
libcamera_sources += control_sources
|
||||||
|
|
||||||
gen_version = join_paths(meson.source_root(), 'utils', 'gen-version.sh')
|
gen_version = join_paths(meson.source_root(), 'utils', 'gen-version.sh')
|
||||||
|
|
||||||
|
|
43
src/libcamera/property_ids.cpp.in
Normal file
43
src/libcamera/property_ids.cpp.in
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019, Google Inc.
|
||||||
|
*
|
||||||
|
* property_ids.cpp : Property ID list
|
||||||
|
*
|
||||||
|
* This file is auto-generated. Do not edit.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <libcamera/property_ids.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file property_ids.h
|
||||||
|
* \brief Camera property identifiers
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace libcamera {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Namespace for libcamera properties
|
||||||
|
*/
|
||||||
|
namespace properties {
|
||||||
|
|
||||||
|
${controls_doc}
|
||||||
|
|
||||||
|
#ifndef __DOXYGEN__
|
||||||
|
/*
|
||||||
|
* Keep the properties definitions hidden from doxygen as it incorrectly parses
|
||||||
|
* them as functions.
|
||||||
|
*/
|
||||||
|
${controls_def}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief List of all supported libcamera properties
|
||||||
|
*/
|
||||||
|
extern const ControlIdMap properties {
|
||||||
|
${controls_map}
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* namespace properties */
|
||||||
|
|
||||||
|
} /* namespace libcamera */
|
28
src/libcamera/property_ids.yaml
Normal file
28
src/libcamera/property_ids.yaml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
#
|
||||||
|
# Copyright (C) 2019, Google Inc.
|
||||||
|
#
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
controls:
|
||||||
|
- Location:
|
||||||
|
type: int32_t
|
||||||
|
description: |
|
||||||
|
Camera mounting location
|
||||||
|
enum:
|
||||||
|
- name: CameraLocationFront
|
||||||
|
value: 0
|
||||||
|
description: |
|
||||||
|
The camera is mounted on the front side of the device, facing the
|
||||||
|
user
|
||||||
|
- name: CameraLocationBack
|
||||||
|
value: 1
|
||||||
|
description: |
|
||||||
|
The camera is mounted on the back side of the device, facing away
|
||||||
|
from the user
|
||||||
|
- name: CameraLocationExternal
|
||||||
|
value: 2
|
||||||
|
description: |
|
||||||
|
The camera is attached to the device in a way that allows it to
|
||||||
|
be moved freely
|
||||||
|
...
|
Loading…
Add table
Add a link
Reference in a new issue