mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-06-29 13:14:14 -04:00
spa: libcamera: expose libcamera version
Expose the libcamera header and library versions in the device properties similarly to `api.v4l2.cap.version` used by the v4l2 plugin. The keys are not yet promoted into the public `keys.h` header file.
This commit is contained in:
parent
6dc55d2cb4
commit
44176d4118
4 changed files with 25 additions and 1 deletions
|
|
@ -98,7 +98,7 @@ const char *cameraRot(const Camera& camera)
|
|||
|
||||
int emit_info(struct impl *impl, bool full)
|
||||
{
|
||||
struct spa_dict_item items[10];
|
||||
struct spa_dict_item items[12];
|
||||
struct spa_dict dict;
|
||||
uint32_t n_items = 0;
|
||||
struct spa_device_info info;
|
||||
|
|
@ -117,6 +117,8 @@ int emit_info(struct impl *impl, bool full)
|
|||
ADD_ITEM(SPA_KEY_DEVICE_API, "libcamera");
|
||||
ADD_ITEM(SPA_KEY_MEDIA_CLASS, "Video/Device");
|
||||
ADD_ITEM(SPA_KEY_API_LIBCAMERA_PATH, impl->device_id.c_str());
|
||||
ADD_ITEM(KEY_VERSION_LIBRARY, libcamera_library_version());
|
||||
ADD_ITEM(KEY_VERSION_HEADER, libcamera_header_version());
|
||||
|
||||
if (auto location = cameraLoc(camera))
|
||||
ADD_ITEM(SPA_KEY_API_LIBCAMERA_LOCATION, location);
|
||||
|
|
|
|||
|
|
@ -132,6 +132,8 @@ int emit_object_info(struct impl *impl, const struct device *device)
|
|||
{ SPA_KEY_DEVICE_API, "libcamera" },
|
||||
{ SPA_KEY_MEDIA_CLASS, "Video/Device" },
|
||||
{ SPA_KEY_API_LIBCAMERA_PATH, device->camera->id().c_str() },
|
||||
{ KEY_VERSION_LIBRARY, libcamera_library_version() },
|
||||
{ KEY_VERSION_HEADER, libcamera_header_version() },
|
||||
};
|
||||
|
||||
dict = SPA_DICT_INIT_ARRAY(items);
|
||||
|
|
|
|||
|
|
@ -1608,6 +1608,8 @@ void emit_node_info(struct impl *impl, bool full)
|
|||
{ SPA_KEY_MEDIA_CLASS, "Video/Source" },
|
||||
{ SPA_KEY_MEDIA_ROLE, "Camera" },
|
||||
{ SPA_KEY_NODE_DRIVER, "true" },
|
||||
{ KEY_VERSION_LIBRARY, libcamera_library_version() },
|
||||
{ KEY_VERSION_HEADER, libcamera_header_version() },
|
||||
};
|
||||
uint64_t old = full ? impl->info.change_mask : 0;
|
||||
if (full)
|
||||
|
|
|
|||
|
|
@ -7,8 +7,13 @@
|
|||
#include <memory>
|
||||
|
||||
#include <libcamera/camera_manager.h>
|
||||
#include <libcamera/version.h>
|
||||
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/utils/defs.h>
|
||||
|
||||
#define KEY_VERSION_LIBRARY "api.libcamera.version.library"
|
||||
#define KEY_VERSION_HEADER "api.libcamera.version.header"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
|
@ -27,4 +32,17 @@ static inline void libcamera_log_topic_init(struct spa_log *log)
|
|||
spa_log_topic_init(log, &libcamera_log_topic);
|
||||
}
|
||||
|
||||
static inline const char *libcamera_library_version()
|
||||
{
|
||||
return libcamera::CameraManager::version().c_str();
|
||||
}
|
||||
|
||||
static inline const char *libcamera_header_version()
|
||||
{
|
||||
return
|
||||
SPA_STRINGIFY(LIBCAMERA_VERSION_MAJOR) "."
|
||||
SPA_STRINGIFY(LIBCAMERA_VERSION_MINOR) "."
|
||||
SPA_STRINGIFY(LIBCAMERA_VERSION_PATCH);
|
||||
}
|
||||
|
||||
std::shared_ptr<libcamera::CameraManager> libcamera_manager_acquire(int& res);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue