From 390a4ce4325afff1344d102bd7967f1338704284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Fri, 19 Jun 2026 11:00:26 +0200 Subject: [PATCH] spa: libcamera: compile fully as C++ There was one file "libcamera.c" that was a C source file, which prevents the addition of C++ functions, includes, etc. to "libcamera.h". So compile that file as C++ as well. --- spa/plugins/libcamera/libcamera-device.cpp | 2 +- spa/plugins/libcamera/libcamera-manager.cpp | 2 +- spa/plugins/libcamera/libcamera-source.cpp | 2 +- spa/plugins/libcamera/{libcamera.c => libcamera.cpp} | 6 +++++- spa/plugins/libcamera/{libcamera.h => libcamera.hpp} | 8 ++------ spa/plugins/libcamera/meson.build | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) rename spa/plugins/libcamera/{libcamera.c => libcamera.cpp} (94%) rename spa/plugins/libcamera/{libcamera.h => libcamera.hpp} (87%) diff --git a/spa/plugins/libcamera/libcamera-device.cpp b/spa/plugins/libcamera/libcamera-device.cpp index 6517860fc..f3fc0b4e9 100644 --- a/spa/plugins/libcamera/libcamera-device.cpp +++ b/spa/plugins/libcamera/libcamera-device.cpp @@ -21,7 +21,7 @@ #include #include -#include "libcamera.h" +#include "libcamera.hpp" #include "libcamera-manager.hpp" #include diff --git a/spa/plugins/libcamera/libcamera-manager.cpp b/spa/plugins/libcamera/libcamera-manager.cpp index de59f6fbc..277a680b3 100644 --- a/spa/plugins/libcamera/libcamera-manager.cpp +++ b/spa/plugins/libcamera/libcamera-manager.cpp @@ -25,7 +25,7 @@ using namespace libcamera; #include #include -#include "libcamera.h" +#include "libcamera.hpp" #include "libcamera-manager.hpp" namespace { diff --git a/spa/plugins/libcamera/libcamera-source.cpp b/spa/plugins/libcamera/libcamera-source.cpp index fba3d8b0b..e4ed7f2ec 100644 --- a/spa/plugins/libcamera/libcamera-source.cpp +++ b/spa/plugins/libcamera/libcamera-source.cpp @@ -42,7 +42,7 @@ #include #include -#include "libcamera.h" +#include "libcamera.hpp" #include "libcamera-manager.hpp" using namespace libcamera; diff --git a/spa/plugins/libcamera/libcamera.c b/spa/plugins/libcamera/libcamera.cpp similarity index 94% rename from spa/plugins/libcamera/libcamera.c rename to spa/plugins/libcamera/libcamera.cpp index 2fea4ab66..3ea094e90 100644 --- a/spa/plugins/libcamera/libcamera.c +++ b/spa/plugins/libcamera/libcamera.cpp @@ -5,7 +5,9 @@ #include #include -#include "libcamera.h" +#include "libcamera.hpp" + +extern "C" { SPA_LOG_TOPIC_DEFINE(libcamera_log_topic, "spa.libcamera"); @@ -34,3 +36,5 @@ int spa_handle_factory_enum(const struct spa_handle_factory **factory, (*index)++; return 1; } + +} diff --git a/spa/plugins/libcamera/libcamera.h b/spa/plugins/libcamera/libcamera.hpp similarity index 87% rename from spa/plugins/libcamera/libcamera.h rename to spa/plugins/libcamera/libcamera.hpp index 29e58a868..0d74df21e 100644 --- a/spa/plugins/libcamera/libcamera.h +++ b/spa/plugins/libcamera/libcamera.hpp @@ -6,9 +6,7 @@ #include -#ifdef __cplusplus extern "C" { -#endif /* __cplusplus */ extern const struct spa_handle_factory spa_libcamera_source_factory; extern const struct spa_handle_factory spa_libcamera_manager_factory; @@ -18,11 +16,9 @@ extern const struct spa_handle_factory spa_libcamera_device_factory; #define SPA_LOG_TOPIC_DEFAULT &libcamera_log_topic extern struct spa_log_topic libcamera_log_topic; +} + static inline void libcamera_log_topic_init(struct spa_log *log) { spa_log_topic_init(log, &libcamera_log_topic); } - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/spa/plugins/libcamera/meson.build b/spa/plugins/libcamera/meson.build index 9f396aba2..00df52cbb 100644 --- a/spa/plugins/libcamera/meson.build +++ b/spa/plugins/libcamera/meson.build @@ -1,5 +1,5 @@ libcamera_sources = [ - 'libcamera.c', + 'libcamera.cpp', 'libcamera-manager.cpp', 'libcamera-device.cpp', 'libcamera-source.cpp'