diff options
author | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2021-06-15 15:40:45 +0100 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2021-06-25 16:11:02 +0100 |
commit | cbdc93e9d1666010d49e06940158a37c61cc6fa7 (patch) | |
tree | e9ed00bdb6e7131b003ec7f7bb03eceab311cc23 /src | |
parent | 86eaa6c5e10dde632f17b900ea0e3aa4d61cb3b3 (diff) |
libcamera/base: Move utils to the base library
Move the utils functionality to the libcamera/base library.
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src')
38 files changed, 69 insertions, 41 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 4bd125d7..6243c07e 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -20,9 +20,10 @@ #include <libcamera/formats.h> #include <libcamera/property_ids.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/log.h" #include "libcamera/internal/thread.h" -#include "libcamera/internal/utils.h" #include "system/graphics.h" diff --git a/src/android/jpeg/exif.cpp b/src/android/jpeg/exif.cpp index 922086cd..747f1cfa 100644 --- a/src/android/jpeg/exif.cpp +++ b/src/android/jpeg/exif.cpp @@ -14,8 +14,9 @@ #include <tuple> #include <uchar.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/log.h" -#include "libcamera/internal/utils.h" using namespace libcamera; diff --git a/src/ipa/ipu3/ipu3_agc.h b/src/ipa/ipu3/ipu3_agc.h index a5a78233..60c7a84f 100644 --- a/src/ipa/ipu3/ipu3_agc.h +++ b/src/ipa/ipu3/ipu3_agc.h @@ -12,9 +12,9 @@ #include <linux/intel-ipu3.h> -#include <libcamera/geometry.h> +#include <libcamera/base/utils.h> -#include "libcamera/internal/utils.h" +#include <libcamera/geometry.h> #include "libipa/algorithm.h" diff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp index f53f5c39..221898ce 100644 --- a/src/ipa/raspberrypi/cam_helper.hpp +++ b/src/ipa/raspberrypi/cam_helper.hpp @@ -15,7 +15,8 @@ #include "controller/metadata.hpp" #include "md_parser.hpp" -#include "libcamera/internal/utils.h" +#include <libcamera/base/utils.h> + #include "libcamera/internal/v4l2_videodevice.h" namespace RPiController { diff --git a/src/ipa/raspberrypi/controller/agc_algorithm.hpp b/src/ipa/raspberrypi/controller/agc_algorithm.hpp index 134bbcda..61595ea2 100644 --- a/src/ipa/raspberrypi/controller/agc_algorithm.hpp +++ b/src/ipa/raspberrypi/controller/agc_algorithm.hpp @@ -6,7 +6,8 @@ */ #pragma once -#include "libcamera/internal/utils.h" +#include <libcamera/base/utils.h> + #include "algorithm.hpp" namespace RPiController { diff --git a/src/ipa/raspberrypi/controller/agc_status.h b/src/ipa/raspberrypi/controller/agc_status.h index 5d50e177..20cb1b62 100644 --- a/src/ipa/raspberrypi/controller/agc_status.h +++ b/src/ipa/raspberrypi/controller/agc_status.h @@ -6,7 +6,7 @@ */ #pragma once -#include "libcamera/internal/utils.h" +#include <libcamera/base/utils.h> // The AGC algorithm should post the following structure into the image's // "agc.status" metadata. diff --git a/src/ipa/raspberrypi/controller/camera_mode.h b/src/ipa/raspberrypi/controller/camera_mode.h index 2aa2335d..65888230 100644 --- a/src/ipa/raspberrypi/controller/camera_mode.h +++ b/src/ipa/raspberrypi/controller/camera_mode.h @@ -8,7 +8,7 @@ #include <libcamera/transform.h> -#include "libcamera/internal/utils.h" +#include <libcamera/base/utils.h> // Description of a "camera mode", holding enough information for control // algorithms to adapt their behaviour to the different modes of the camera, diff --git a/src/ipa/raspberrypi/controller/device_status.h b/src/ipa/raspberrypi/controller/device_status.h index 131b4cd3..f7423524 100644 --- a/src/ipa/raspberrypi/controller/device_status.h +++ b/src/ipa/raspberrypi/controller/device_status.h @@ -6,7 +6,7 @@ */ #pragma once -#include "libcamera/internal/utils.h" +#include <libcamera/base/utils.h> // Definition of "device metadata" which stores things like shutter time and // analogue gain that downstream control algorithms will want to know. diff --git a/src/ipa/raspberrypi/controller/rpi/agc.hpp b/src/ipa/raspberrypi/controller/rpi/agc.hpp index 75078948..85067dc6 100644 --- a/src/ipa/raspberrypi/controller/rpi/agc.hpp +++ b/src/ipa/raspberrypi/controller/rpi/agc.hpp @@ -9,7 +9,7 @@ #include <vector> #include <mutex> -#include "libcamera/internal/utils.h" +#include <libcamera/base/utils.h> #include "../agc_algorithm.hpp" #include "../agc_status.h" diff --git a/src/ipa/raspberrypi/controller/rpi/lux.hpp b/src/ipa/raspberrypi/controller/rpi/lux.hpp index 45c84439..3ebd35d1 100644 --- a/src/ipa/raspberrypi/controller/rpi/lux.hpp +++ b/src/ipa/raspberrypi/controller/rpi/lux.hpp @@ -8,7 +8,7 @@ #include <mutex> -#include "libcamera/internal/utils.h" +#include <libcamera/base/utils.h> #include "../lux_status.h" #include "../algorithm.hpp" diff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build index e8384602..6d9ec374 100644 --- a/src/libcamera/base/meson.build +++ b/src/libcamera/base/meson.build @@ -1,6 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 libcamera_base_sources = files([ + 'utils.cpp', ]) libcamera_base_deps = [ diff --git a/src/libcamera/utils.cpp b/src/libcamera/base/utils.cpp index c7ebef68..45b92b67 100644 --- a/src/libcamera/utils.cpp +++ b/src/libcamera/base/utils.cpp @@ -5,7 +5,7 @@ * utils.cpp - Miscellaneous utility functions */ -#include "libcamera/internal/utils.h" +#include <libcamera/base/utils.h> #include <iomanip> #include <sstream> @@ -14,7 +14,7 @@ #include <unistd.h> /** - * \file utils.h + * \file base/utils.h * \brief Miscellaneous utility functions */ @@ -35,8 +35,8 @@ namespace utils { */ const char *basename(const char *path) { - const char *base = strrchr(path, '/'); - return base ? base + 1 : path; + const char *base = strrchr(path, '/'); + return base ? base + 1 : path; } /** diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index 1ecf2b07..a3784db6 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -12,13 +12,14 @@ #include <libcamera/camera.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/device_enumerator.h" #include "libcamera/internal/ipa_manager.h" #include "libcamera/internal/log.h" #include "libcamera/internal/pipeline_handler.h" #include "libcamera/internal/process.h" #include "libcamera/internal/thread.h" -#include "libcamera/internal/utils.h" /** * \file camera_manager.h diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 3e135353..94dcf4f9 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -18,11 +18,12 @@ #include <libcamera/property_ids.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/bayer_format.h" #include "libcamera/internal/camera_sensor_properties.h" #include "libcamera/internal/formats.h" #include "libcamera/internal/sysfs.h" -#include "libcamera/internal/utils.h" /** * \file camera_sensor.h diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index 5aef4e71..7df372ad 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -12,9 +12,10 @@ #include <string> #include <string.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/control_validator.h" #include "libcamera/internal/log.h" -#include "libcamera/internal/utils.h" /** * \file controls.h diff --git a/src/libcamera/event_dispatcher_poll.cpp b/src/libcamera/event_dispatcher_poll.cpp index 456c6def..0b6aee18 100644 --- a/src/libcamera/event_dispatcher_poll.cpp +++ b/src/libcamera/event_dispatcher_poll.cpp @@ -16,11 +16,12 @@ #include <sys/eventfd.h> #include <unistd.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/event_notifier.h" #include "libcamera/internal/log.h" #include "libcamera/internal/thread.h" #include "libcamera/internal/timer.h" -#include "libcamera/internal/utils.h" /** * \file event_dispatcher_poll.h diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp index 93d02d94..263cacd6 100644 --- a/src/libcamera/ipa_manager.cpp +++ b/src/libcamera/ipa_manager.cpp @@ -12,12 +12,13 @@ #include <string.h> #include <sys/types.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/file.h" #include "libcamera/internal/ipa_module.h" #include "libcamera/internal/ipa_proxy.h" #include "libcamera/internal/log.h" #include "libcamera/internal/pipeline_handler.h" -#include "libcamera/internal/utils.h" /** * \file ipa_manager.h diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index f53e529b..a4e7fb86 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -23,10 +23,11 @@ #include <libcamera/span.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/file.h" #include "libcamera/internal/log.h" #include "libcamera/internal/pipeline_handler.h" -#include "libcamera/internal/utils.h" /** * \file ipa_module.h diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp index b70fde58..ca980ec7 100644 --- a/src/libcamera/ipa_proxy.cpp +++ b/src/libcamera/ipa_proxy.cpp @@ -12,9 +12,10 @@ #include <sys/types.h> #include <unistd.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/ipa_module.h" #include "libcamera/internal/log.h" -#include "libcamera/internal/utils.h" /** * \file ipa_proxy.h diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp index 74829a56..5ff0e901 100644 --- a/src/libcamera/log.cpp +++ b/src/libcamera/log.cpp @@ -23,8 +23,9 @@ #include <libcamera/logging.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/thread.h" -#include "libcamera/internal/utils.h" /** * \file log.h diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 655c0c16..b70688d8 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -52,7 +52,6 @@ libcamera_sources = files([ 'thread.cpp', 'timer.cpp', 'transform.cpp', - 'utils.cpp', 'v4l2_device.cpp', 'v4l2_pixelformat.cpp', 'v4l2_subdevice.cpp', diff --git a/src/libcamera/object.cpp b/src/libcamera/object.cpp index 5e6b73f9..51cac64e 100644 --- a/src/libcamera/object.cpp +++ b/src/libcamera/object.cpp @@ -11,11 +11,12 @@ #include <libcamera/signal.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/log.h" #include "libcamera/internal/message.h" #include "libcamera/internal/semaphore.h" #include "libcamera/internal/thread.h" -#include "libcamera/internal/utils.h" /** * \file object.h diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp index 4eb3f7b7..32d143a8 100644 --- a/src/libcamera/pipeline/ipu3/imgu.cpp +++ b/src/libcamera/pipeline/ipu3/imgu.cpp @@ -16,9 +16,10 @@ #include <libcamera/formats.h> #include <libcamera/stream.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/log.h" #include "libcamera/internal/media_device.h" -#include "libcamera/internal/utils.h" namespace libcamera { diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 6c93bc6d..6b43ad2f 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -20,6 +20,8 @@ #include <libcamera/request.h> #include <libcamera/stream.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/delayed_controls.h" #include "libcamera/internal/device_enumerator.h" @@ -27,7 +29,6 @@ #include "libcamera/internal/log.h" #include "libcamera/internal/media_device.h" #include "libcamera/internal/pipeline_handler.h" -#include "libcamera/internal/utils.h" #include "cio2.h" #include "frames.h" diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 4e26a193..082eb1ee 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -24,6 +24,8 @@ #include <libcamera/property_ids.h> #include <libcamera/request.h> +#include <libcamera/base/utils.h> + #include <linux/bcm2835-isp.h> #include <linux/videodev2.h> @@ -35,7 +37,6 @@ #include "libcamera/internal/ipa_manager.h" #include "libcamera/internal/media_device.h" #include "libcamera/internal/pipeline_handler.h" -#include "libcamera/internal/utils.h" #include "libcamera/internal/v4l2_videodevice.h" #include "dma_heaps.h" diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 6699839c..c625d724 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -24,6 +24,8 @@ #include <libcamera/request.h> #include <libcamera/stream.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/delayed_controls.h" #include "libcamera/internal/device_enumerator.h" @@ -31,7 +33,6 @@ #include "libcamera/internal/log.h" #include "libcamera/internal/media_device.h" #include "libcamera/internal/pipeline_handler.h" -#include "libcamera/internal/utils.h" #include "libcamera/internal/v4l2_subdevice.h" #include "libcamera/internal/v4l2_videodevice.h" diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp index 68644ef6..589f185b 100644 --- a/src/libcamera/pipeline/simple/converter.cpp +++ b/src/libcamera/pipeline/simple/converter.cpp @@ -15,9 +15,10 @@ #include <libcamera/signal.h> #include <libcamera/stream.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/log.h" #include "libcamera/internal/media_device.h" -#include "libcamera/internal/utils.h" #include "libcamera/internal/v4l2_videodevice.h" namespace libcamera { diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index 12a85b24..d8c17dcc 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -19,12 +19,13 @@ #include <libcamera/request.h> #include <libcamera/stream.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/device_enumerator.h" #include "libcamera/internal/log.h" #include "libcamera/internal/media_device.h" #include "libcamera/internal/pipeline_handler.h" #include "libcamera/internal/sysfs.h" -#include "libcamera/internal/utils.h" #include "libcamera/internal/v4l2_videodevice.h" namespace libcamera { diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp index 8bbac008..025ca562 100644 --- a/src/libcamera/pipeline/vimc/vimc.cpp +++ b/src/libcamera/pipeline/vimc/vimc.cpp @@ -23,13 +23,14 @@ #include <libcamera/request.h> #include <libcamera/stream.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/device_enumerator.h" #include "libcamera/internal/ipa_manager.h" #include "libcamera/internal/log.h" #include "libcamera/internal/media_device.h" #include "libcamera/internal/pipeline_handler.h" -#include "libcamera/internal/utils.h" #include "libcamera/internal/v4l2_subdevice.h" #include "libcamera/internal/v4l2_videodevice.h" diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index e507a8bb..6fb2a743 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -13,11 +13,12 @@ #include <libcamera/camera.h> #include <libcamera/camera_manager.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/device_enumerator.h" #include "libcamera/internal/log.h" #include "libcamera/internal/media_device.h" #include "libcamera/internal/tracepoints.h" -#include "libcamera/internal/utils.h" /** * \file pipeline_handler.h diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp index 40a434a6..35091f60 100644 --- a/src/libcamera/process.cpp +++ b/src/libcamera/process.cpp @@ -20,9 +20,10 @@ #include <unistd.h> #include <vector> +#include <libcamera/base/utils.h> + #include "libcamera/internal/event_notifier.h" #include "libcamera/internal/log.h" -#include "libcamera/internal/utils.h" /** * \file process.h diff --git a/src/libcamera/source_paths.cpp b/src/libcamera/source_paths.cpp index 834b698f..19689585 100644 --- a/src/libcamera/source_paths.cpp +++ b/src/libcamera/source_paths.cpp @@ -14,7 +14,7 @@ #include <sys/stat.h> #include <sys/types.h> -#include "libcamera/internal/utils.h" +#include <libcamera/base/utils.h> /** * \file source_paths.h diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index f7bafcf8..d5d68427 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -15,8 +15,9 @@ #include <libcamera/request.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/log.h" -#include "libcamera/internal/utils.h" /** * \file stream.h diff --git a/src/libcamera/timer.cpp b/src/libcamera/timer.cpp index c242113a..9496671e 100644 --- a/src/libcamera/timer.cpp +++ b/src/libcamera/timer.cpp @@ -11,11 +11,12 @@ #include <libcamera/camera_manager.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/event_dispatcher.h" #include "libcamera/internal/log.h" #include "libcamera/internal/message.h" #include "libcamera/internal/thread.h" -#include "libcamera/internal/utils.h" /** * \file timer.h diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 5660e6ea..facb53e1 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -16,10 +16,11 @@ #include <sys/syscall.h> #include <unistd.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/event_notifier.h" #include "libcamera/internal/log.h" #include "libcamera/internal/sysfs.h" -#include "libcamera/internal/utils.h" /** * \file v4l2_device.h diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index 721ff5a9..2c56cfaf 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -19,10 +19,11 @@ #include <libcamera/geometry.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/log.h" #include "libcamera/internal/media_device.h" #include "libcamera/internal/media_object.h" -#include "libcamera/internal/utils.h" /** * \file v4l2_subdevice.h diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index f8bfe595..a5a25507 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -20,9 +20,10 @@ #include <libcamera/formats.h> #include <libcamera/object.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/formats.h" #include "libcamera/internal/log.h" -#include "libcamera/internal/utils.h" #include "v4l2_camera.h" #include "v4l2_camera_file.h" diff --git a/src/v4l2/v4l2_compat_manager.cpp b/src/v4l2/v4l2_compat_manager.cpp index 96dbcdf2..27de6c50 100644 --- a/src/v4l2/v4l2_compat_manager.cpp +++ b/src/v4l2/v4l2_compat_manager.cpp @@ -22,8 +22,9 @@ #include <libcamera/camera.h> #include <libcamera/camera_manager.h> +#include <libcamera/base/utils.h> + #include "libcamera/internal/log.h" -#include "libcamera/internal/utils.h" #include "v4l2_camera_file.h" |