mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-07-05 00:06:16 -04:00
A libcamera camera has a set of static properties found in `Camera::properties()`. Some of the properties are already available for pipewire clients (Model, Rotation, Location), most of them are not. So serialize all properties into a strings and make them available on the pipewire device. The keys have the form "api.libcamera.property.<vendor>.<name>" and the values are intended to be valid json values, parsable by python's `json.loads()` or qt's `QJsonValue::fromJson()`. Controls of type "rectangle", "size", or "point" are not supported for now since their json forms are not self-evident. They can be added when the need arises.
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
/* Spa libcamera support */
|
|
/* SPDX-FileCopyrightText: Copyright © 2020 collabora */
|
|
/* SPDX-License-Identifier: MIT */
|
|
|
|
#pragma once
|
|
|
|
#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"
|
|
#define KEY_PROPERTY_PREFIX "api.libcamera.property"
|
|
|
|
extern "C" {
|
|
|
|
extern const struct spa_handle_factory spa_libcamera_source_factory;
|
|
extern const struct spa_handle_factory spa_libcamera_manager_factory;
|
|
extern const struct spa_handle_factory spa_libcamera_device_factory;
|
|
|
|
#undef SPA_LOG_TOPIC_DEFAULT
|
|
#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);
|
|
}
|
|
|
|
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);
|