spa: libcamera: use anon ns instead of static

Move most things into anonymous namespaces for internal linkage
instead of using `static`. This shortes declarations and makes it
hard to forget.
This commit is contained in:
Barnabás Pőcze 2025-07-12 19:18:24 +02:00 committed by Wim Taymans
parent cb71071d93
commit bb8223bff1
3 changed files with 173 additions and 172 deletions

View file

@ -50,9 +50,7 @@ struct impl {
std::string device_id);
};
}
static const libcamera::Span<const int64_t> cameraDevice(const Camera& camera)
const libcamera::Span<const int64_t> cameraDevice(const Camera& camera)
{
if (auto devices = camera.properties().get(properties::SystemDevices))
return devices.value();
@ -60,7 +58,7 @@ static const libcamera::Span<const int64_t> cameraDevice(const Camera& camera)
return {};
}
static std::string cameraModel(const Camera& camera)
std::string cameraModel(const Camera& camera)
{
if (auto model = camera.properties().get(properties::Model))
return std::move(model.value());
@ -68,7 +66,7 @@ static std::string cameraModel(const Camera& camera)
return camera.id();
}
static const char *cameraLoc(const Camera& camera)
const char *cameraLoc(const Camera& camera)
{
if (auto location = camera.properties().get(properties::Location)) {
switch (location.value()) {
@ -84,7 +82,7 @@ static const char *cameraLoc(const Camera& camera)
return nullptr;
}
static const char *cameraRot(const Camera& camera)
const char *cameraRot(const Camera& camera)
{
if (auto rotation = camera.properties().get(properties::Rotation)) {
switch (rotation.value()) {
@ -102,7 +100,7 @@ static const char *cameraRot(const Camera& camera)
return nullptr;
}
static int emit_info(struct impl *impl, bool full)
int emit_info(struct impl *impl, bool full)
{
struct spa_dict_item items[10];
struct spa_dict dict;
@ -179,7 +177,7 @@ static int emit_info(struct impl *impl, bool full)
return 0;
}
static int impl_add_listener(void *object,
int impl_add_listener(void *object,
struct spa_hook *listener,
const struct spa_device_events *events,
void *data)
@ -201,7 +199,7 @@ static int impl_add_listener(void *object,
return res;
}
static int impl_sync(void *object, int seq)
int impl_sync(void *object, int seq)
{
struct impl *impl = (struct impl*) object;
@ -212,21 +210,21 @@ static int impl_sync(void *object, int seq)
return 0;
}
static int impl_enum_params(void *object, int seq,
int impl_enum_params(void *object, int seq,
uint32_t id, uint32_t start, uint32_t num,
const struct spa_pod *filter)
{
return -ENOTSUP;
}
static int impl_set_param(void *object,
int impl_set_param(void *object,
uint32_t id, uint32_t flags,
const struct spa_pod *param)
{
return -ENOTSUP;
}
static const struct spa_device_methods impl_device = {
const struct spa_device_methods impl_device = {
.version = SPA_VERSION_DEVICE_METHODS,
.add_listener = impl_add_listener,
.sync = impl_sync,
@ -234,7 +232,7 @@ static const struct spa_device_methods impl_device = {
.set_param = impl_set_param,
};
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
{
struct impl *impl;
@ -251,7 +249,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
return 0;
}
static int impl_clear(struct spa_handle *handle)
int impl_clear(struct spa_handle *handle)
{
std::destroy_at(reinterpret_cast<impl *>(handle));
return 0;
@ -277,14 +275,14 @@ impl::impl(spa_log *log,
&impl_device, this);
}
static size_t
size_t
impl_get_size(const struct spa_handle_factory *factory,
const struct spa_dict *params)
{
return sizeof(struct impl);
}
static int
int
impl_init(const struct spa_handle_factory *factory,
struct spa_handle *handle,
const struct spa_dict *info,
@ -320,11 +318,11 @@ impl_init(const struct spa_handle_factory *factory,
return 0;
}
static const struct spa_interface_info impl_interfaces[] = {
const struct spa_interface_info impl_interfaces[] = {
{SPA_TYPE_INTERFACE_Device,},
};
static int impl_enum_interface_info(const struct spa_handle_factory *factory,
int impl_enum_interface_info(const struct spa_handle_factory *factory,
const struct spa_interface_info **info,
uint32_t *index)
{
@ -339,6 +337,8 @@ static int impl_enum_interface_info(const struct spa_handle_factory *factory,
return 1;
}
}
extern "C" {
const struct spa_handle_factory spa_libcamera_device_factory = {
SPA_VERSION_HANDLE_FACTORY,

View file

@ -72,27 +72,7 @@ struct impl {
}
};
}
std::shared_ptr<CameraManager> libcamera_manager_acquire(int& res)
{
static std::weak_ptr<CameraManager> global_manager;
static std::mutex lock;
std::lock_guard guard(lock);
if (auto manager = global_manager.lock())
return manager;
auto manager = std::make_shared<CameraManager>();
if ((res = manager->start()) < 0)
return {};
global_manager = manager;
return manager;
}
static uint32_t get_free_id(struct impl *impl)
uint32_t get_free_id(struct impl *impl)
{
for (std::size_t i = 0; i < MAX_DEVICES; i++)
if (impl->devices[i].camera == nullptr)
@ -100,7 +80,7 @@ static uint32_t get_free_id(struct impl *impl)
return 0;
}
static struct device *add_device(struct impl *impl, std::shared_ptr<Camera> camera)
struct device *add_device(struct impl *impl, std::shared_ptr<Camera> camera)
{
struct device *device;
uint32_t id;
@ -115,7 +95,7 @@ static struct device *add_device(struct impl *impl, std::shared_ptr<Camera> came
return device;
}
static struct device *find_device(struct impl *impl, const Camera *camera)
struct device *find_device(struct impl *impl, const Camera *camera)
{
uint32_t i;
for (i = 0; i < impl->n_devices; i++) {
@ -125,7 +105,7 @@ static struct device *find_device(struct impl *impl, const Camera *camera)
return NULL;
}
static void remove_device(struct impl *impl, struct device *device)
void remove_device(struct impl *impl, struct device *device)
{
uint32_t old = --impl->n_devices;
device->camera.reset();
@ -133,13 +113,13 @@ static void remove_device(struct impl *impl, struct device *device)
impl->devices[old].camera = nullptr;
}
static void clear_devices(struct impl *impl)
void clear_devices(struct impl *impl)
{
while (impl->n_devices > 0)
impl->devices[--impl->n_devices].camera.reset();
}
static int emit_object_info(struct impl *impl, struct device *device)
int emit_object_info(struct impl *impl, struct device *device)
{
struct spa_device_object_info info;
uint32_t id = device->id;
@ -169,7 +149,7 @@ static int emit_object_info(struct impl *impl, struct device *device)
return 1;
}
static void try_add_camera(struct impl *impl, std::shared_ptr<Camera> camera)
void try_add_camera(struct impl *impl, std::shared_ptr<Camera> camera)
{
struct device *device;
@ -184,7 +164,7 @@ static void try_add_camera(struct impl *impl, std::shared_ptr<Camera> camera)
emit_object_info(impl, device);
}
static void try_remove_camera(struct impl *impl, const Camera *camera)
void try_remove_camera(struct impl *impl, const Camera *camera)
{
struct device *device;
@ -197,7 +177,7 @@ static void try_remove_camera(struct impl *impl, const Camera *camera)
remove_device(impl, device);
}
static void consume_hotplug_event(struct impl *impl, impl::hotplug_event& event)
void consume_hotplug_event(struct impl *impl, impl::hotplug_event& event)
{
auto& [ type, camera ] = event;
@ -213,7 +193,7 @@ static void consume_hotplug_event(struct impl *impl, impl::hotplug_event& event)
}
}
static void on_hotplug_event(void *data, std::uint64_t)
void on_hotplug_event(void *data, std::uint64_t)
{
auto impl = static_cast<struct impl *>(data);
@ -256,13 +236,13 @@ void impl::removeCamera(std::shared_ptr<Camera> camera)
spa_loop_utils_signal_event(loop_utils, hotplug_event_source);
}
static void start_monitor(struct impl *impl)
void start_monitor(struct impl *impl)
{
impl->manager->cameraAdded.connect(impl, &impl::addCamera);
impl->manager->cameraRemoved.connect(impl, &impl::removeCamera);
}
static int stop_monitor(struct impl *impl)
int stop_monitor(struct impl *impl)
{
if (impl->manager) {
impl->manager->cameraAdded.disconnect(impl, &impl::addCamera);
@ -272,7 +252,7 @@ static int stop_monitor(struct impl *impl)
return 0;
}
static void collect_existing_devices(struct impl *impl)
void collect_existing_devices(struct impl *impl)
{
auto cameras = impl->manager->cameras();
@ -280,12 +260,12 @@ static void collect_existing_devices(struct impl *impl)
try_add_camera(impl, std::move(camera));
}
static const struct spa_dict_item device_info_items[] = {
const struct spa_dict_item device_info_items[] = {
{ SPA_KEY_DEVICE_API, "libcamera" },
{ SPA_KEY_DEVICE_NICK, "libcamera-manager" },
};
static void emit_device_info(struct impl *impl, bool full)
void emit_device_info(struct impl *impl, bool full)
{
uint64_t old = full ? impl->info.change_mask : 0;
if (full)
@ -299,7 +279,7 @@ static void emit_device_info(struct impl *impl, bool full)
}
}
static void impl_hook_removed(struct spa_hook *hook)
void impl_hook_removed(struct spa_hook *hook)
{
struct impl *impl = (struct impl*)hook->priv;
if (spa_hook_list_is_empty(&impl->hooks)) {
@ -308,7 +288,7 @@ static void impl_hook_removed(struct spa_hook *hook)
}
}
static int
int
impl_device_add_listener(void *object, struct spa_hook *listener,
const struct spa_device_events *events, void *data)
{
@ -344,12 +324,12 @@ impl_device_add_listener(void *object, struct spa_hook *listener,
return 0;
}
static const struct spa_device_methods impl_device = {
const struct spa_device_methods impl_device = {
.version = SPA_VERSION_DEVICE_METHODS,
.add_listener = impl_device_add_listener,
};
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
{
struct impl *impl;
@ -366,7 +346,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
return 0;
}
static int impl_clear(struct spa_handle *handle)
int impl_clear(struct spa_handle *handle)
{
auto impl = reinterpret_cast<struct impl *>(handle);
@ -392,14 +372,14 @@ impl::impl(spa_log *log, spa_loop_utils *loop_utils, spa_source *hotplug_event_s
&impl_device, this);
}
static size_t
size_t
impl_get_size(const struct spa_handle_factory *factory,
const struct spa_dict *params)
{
return sizeof(struct impl);
}
static int
int
impl_init(const struct spa_handle_factory *factory,
struct spa_handle *handle,
const struct spa_dict *info,
@ -429,11 +409,11 @@ impl_init(const struct spa_handle_factory *factory,
return 0;
}
static const struct spa_interface_info impl_interfaces[] = {
const struct spa_interface_info impl_interfaces[] = {
{SPA_TYPE_INTERFACE_Device,},
};
static int
int
impl_enum_interface_info(const struct spa_handle_factory *factory,
const struct spa_interface_info **info,
uint32_t *index)
@ -449,6 +429,8 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
return 1;
}
}
extern "C" {
const struct spa_handle_factory spa_libcamera_manager_factory = {
SPA_VERSION_HANDLE_FACTORY,
@ -459,3 +441,22 @@ const struct spa_handle_factory spa_libcamera_manager_factory = {
impl_enum_interface_info,
};
}
std::shared_ptr<CameraManager> libcamera_manager_acquire(int& res)
{
static std::weak_ptr<CameraManager> global_manager;
static std::mutex lock;
std::lock_guard guard(lock);
if (auto manager = global_manager.lock())
return manager;
auto manager = std::make_shared<CameraManager>();
if ((res = manager->start()) < 0)
return {};
global_manager = manager;
return manager;
}

View file

@ -175,14 +175,12 @@ struct impl {
struct spa_dll dll;
};
}
#define CHECK_PORT(impl,direction,port_id) ((direction) == SPA_DIRECTION_OUTPUT && (port_id) == 0)
#define GET_OUT_PORT(impl,p) (&impl->out_ports[p])
#define GET_PORT(impl,d,p) GET_OUT_PORT(impl,p)
static void setup_initial_controls(const ControlInfoMap& ctrl_infos, ControlList& ctrls)
void setup_initial_controls(const ControlInfoMap& ctrl_infos, ControlList& ctrls)
{
/* Libcamera recommends cameras default to manual focus mode, but we don't
* expose any focus controls. So, specifically enable autofocus on
@ -243,7 +241,7 @@ int spa_libcamera_close(struct impl *impl)
return 0;
}
static void spa_libcamera_get_config(struct impl *impl)
void spa_libcamera_get_config(struct impl *impl)
{
if (impl->config)
return;
@ -251,7 +249,7 @@ static void spa_libcamera_get_config(struct impl *impl)
impl->config = impl->camera->generateConfiguration({ StreamRole::VideoRecording });
}
static int spa_libcamera_buffer_recycle(struct impl *impl, struct port *port, uint32_t buffer_id)
int spa_libcamera_buffer_recycle(struct impl *impl, struct port *port, uint32_t buffer_id)
{
struct buffer *b = &port->buffers[buffer_id];
int res;
@ -289,7 +287,7 @@ static int spa_libcamera_buffer_recycle(struct impl *impl, struct port *port, ui
return 0;
}
static int allocBuffers(struct impl *impl, struct port *port, unsigned int count)
int allocBuffers(struct impl *impl, struct port *port, unsigned int count)
{
int res;
@ -331,14 +329,14 @@ static int allocBuffers(struct impl *impl, struct port *port, unsigned int count
return res;
}
static void freeBuffers(struct impl *impl, struct port *port)
void freeBuffers(struct impl *impl, struct port *port)
{
impl->pendingRequests.clear();
impl->requestPool.clear();
impl->allocator->free(port->streamConfig.stream());
}
static int spa_libcamera_clear_buffers(struct impl *impl, struct port *port)
int spa_libcamera_clear_buffers(struct impl *impl, struct port *port)
{
uint32_t i;
@ -381,7 +379,7 @@ struct format_info {
};
#define MAKE_FMT(pix,fmt,mt,mst) { pix, SPA_VIDEO_FORMAT_ ##fmt, SPA_MEDIA_TYPE_ ##mt, SPA_MEDIA_SUBTYPE_ ##mst }
static const struct format_info format_info[] = {
const struct format_info format_info[] = {
/* RGB formats */
MAKE_FMT(formats::RGB565, RGB16, video, raw),
MAKE_FMT(formats::RGB565_BE, RGB16, video, raw),
@ -415,7 +413,7 @@ static const struct format_info format_info[] = {
#undef MAKE_FMT
};
static const struct format_info *video_format_to_info(const PixelFormat &pix)
const struct format_info *video_format_to_info(const PixelFormat &pix)
{
for (const auto& f : format_info) {
if (f.pix == pix)
@ -425,7 +423,7 @@ static const struct format_info *video_format_to_info(const PixelFormat &pix)
return nullptr;
}
static const struct format_info *find_format_info_by_media_type(
const struct format_info *find_format_info_by_media_type(
uint32_t type, uint32_t subtype, uint32_t format)
{
for (const auto& f : format_info) {
@ -437,7 +435,7 @@ static const struct format_info *find_format_info_by_media_type(
return nullptr;
}
static int score_size(const Size &a, const Size &b)
int score_size(const Size &a, const Size &b)
{
int x, y;
x = (int)a.width - (int)b.width;
@ -445,7 +443,7 @@ static int score_size(const Size &a, const Size &b)
return x * x + y * y;
}
static void
void
parse_colorimetry(const ColorSpace& colorspace,
struct spa_video_colorimetry *colorimetry)
{
@ -501,7 +499,7 @@ parse_colorimetry(const ColorSpace& colorspace,
}
}
static int
int
spa_libcamera_enum_format(struct impl *impl, struct port *port, int seq,
uint32_t start, uint32_t num, const struct spa_pod *filter)
{
@ -641,7 +639,7 @@ next_fmt:
return 0;
}
static int spa_libcamera_set_format(struct impl *impl, struct port *port,
int spa_libcamera_set_format(struct impl *impl, struct port *port,
struct spa_video_info *format, bool try_only)
{
const struct format_info *info = NULL;
@ -720,7 +718,7 @@ error:
}
static const struct {
const struct {
uint32_t id;
uint32_t spa_id;
} control_map[] = {
@ -732,7 +730,7 @@ static const struct {
{ libcamera::controls::SHARPNESS, SPA_PROP_sharpness },
};
static uint32_t control_to_prop_id(uint32_t control_id)
uint32_t control_to_prop_id(uint32_t control_id)
{
for (const auto& c : control_map) {
if (c.id == control_id)
@ -742,7 +740,7 @@ static uint32_t control_to_prop_id(uint32_t control_id)
return SPA_PROP_START_CUSTOM + control_id;
}
static uint32_t prop_id_to_control(uint32_t prop_id)
uint32_t prop_id_to_control(uint32_t prop_id)
{
for (const auto& c : control_map) {
if (c.spa_id == prop_id)
@ -755,7 +753,7 @@ static uint32_t prop_id_to_control(uint32_t prop_id)
return SPA_ID_INVALID;
}
static int
int
spa_libcamera_enum_controls(struct impl *impl, struct port *port, int seq,
uint32_t start, uint32_t offset, uint32_t num,
const struct spa_pod *filter)
@ -870,7 +868,7 @@ struct val {
};
};
static int do_update_ctrls(struct spa_loop *loop,
int do_update_ctrls(struct spa_loop *loop,
bool async,
uint32_t seq,
const void *data,
@ -895,7 +893,7 @@ static int do_update_ctrls(struct spa_loop *loop,
return 0;
}
static int
int
spa_libcamera_set_control(struct impl *impl, const struct spa_pod_prop *prop)
{
const ControlInfoMap &info = impl->camera->controls();
@ -941,7 +939,7 @@ done:
}
static void libcamera_on_fd_events(struct spa_source *source)
void libcamera_on_fd_events(struct spa_source *source)
{
struct impl *impl = (struct impl*) source->data;
struct spa_io_buffers *io;
@ -998,13 +996,13 @@ static void libcamera_on_fd_events(struct spa_source *source)
spa_node_call_ready(&impl->callbacks, SPA_STATUS_HAVE_DATA);
}
static int spa_libcamera_use_buffers(struct impl *impl, struct port *port,
int spa_libcamera_use_buffers(struct impl *impl, struct port *port,
struct spa_buffer **buffers, uint32_t n_buffers)
{
return -ENOTSUP;
}
static const struct {
const struct {
Orientation libcamera_orientation; /* clockwise rotation then horizontal mirroring */
uint32_t spa_transform_value; /* horizontal mirroring then counter-clockwise rotation */
} orientation_map[] = {
@ -1018,7 +1016,7 @@ static const struct {
{ Orientation::Rotate270Mirror, SPA_META_TRANSFORMATION_Flipped270 },
};
static uint32_t libcamera_orientation_to_spa_transform_value(Orientation orientation)
uint32_t libcamera_orientation_to_spa_transform_value(Orientation orientation)
{
for (const auto& t : orientation_map) {
if (t.libcamera_orientation == orientation)
@ -1027,7 +1025,7 @@ static uint32_t libcamera_orientation_to_spa_transform_value(Orientation orienta
return SPA_META_TRANSFORMATION_None;
}
static int
int
spa_libcamera_alloc_buffers(struct impl *impl, struct port *port,
struct spa_buffer **buffers,
uint32_t n_buffers)
@ -1226,7 +1224,7 @@ void impl::requestComplete(libcamera::Request *request)
}
static int spa_libcamera_stream_on(struct impl *impl)
int spa_libcamera_stream_on(struct impl *impl)
{
struct port *port = &impl->out_ports[0];
int res;
@ -1276,7 +1274,7 @@ error:
return res == -EACCES ? -EBUSY : res;
}
static int do_remove_source(struct spa_loop *loop,
int do_remove_source(struct spa_loop *loop,
bool async,
uint32_t seq,
const void *data,
@ -1289,7 +1287,7 @@ static int do_remove_source(struct spa_loop *loop,
return 0;
}
static int spa_libcamera_stream_off(struct impl *impl)
int spa_libcamera_stream_off(struct impl *impl)
{
struct port *port = &impl->out_ports[0];
int res;
@ -1322,7 +1320,7 @@ static int spa_libcamera_stream_off(struct impl *impl)
return 0;
}
static int port_get_format(struct impl *impl, struct port *port,
int port_get_format(struct impl *impl, struct port *port,
uint32_t index,
const struct spa_pod *filter,
struct spa_pod **param,
@ -1371,7 +1369,7 @@ static int port_get_format(struct impl *impl, struct port *port,
return 1;
}
static int impl_node_enum_params(void *object, int seq,
int impl_node_enum_params(void *object, int seq,
uint32_t id, uint32_t start, uint32_t num,
const struct spa_pod *filter)
{
@ -1454,7 +1452,7 @@ next:
return 0;
}
static int impl_node_set_param(void *object,
int impl_node_set_param(void *object,
uint32_t id, uint32_t flags,
const struct spa_pod *param)
{
@ -1495,7 +1493,7 @@ static int impl_node_set_param(void *object,
return 0;
}
static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
{
struct impl *impl = (struct impl*)object;
@ -1516,7 +1514,7 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
return 0;
}
static int impl_node_send_command(void *object, const struct spa_command *command)
int impl_node_send_command(void *object, const struct spa_command *command)
{
struct impl *impl = (struct impl*)object;
int res;
@ -1550,7 +1548,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
return 0;
}
static void emit_node_info(struct impl *impl, bool full)
void emit_node_info(struct impl *impl, bool full)
{
static const struct spa_dict_item info_items[] = {
{ SPA_KEY_DEVICE_API, "libcamera" },
@ -1569,7 +1567,7 @@ static void emit_node_info(struct impl *impl, bool full)
}
}
static void emit_port_info(struct impl *impl, struct port *port, bool full)
void emit_port_info(struct impl *impl, struct port *port, bool full)
{
static const struct spa_dict_item info_items[] = {
{ SPA_KEY_PORT_GROUP, "stream.0" },
@ -1586,7 +1584,7 @@ static void emit_port_info(struct impl *impl, struct port *port, bool full)
}
}
static int
int
impl_node_add_listener(void *object,
struct spa_hook *listener,
const struct spa_node_events *events,
@ -1607,7 +1605,7 @@ impl_node_add_listener(void *object,
return 0;
}
static int impl_node_set_callbacks(void *object,
int impl_node_set_callbacks(void *object,
const struct spa_node_callbacks *callbacks,
void *data)
{
@ -1620,7 +1618,7 @@ static int impl_node_set_callbacks(void *object,
return 0;
}
static int impl_node_sync(void *object, int seq)
int impl_node_sync(void *object, int seq)
{
struct impl *impl = (struct impl*)object;
@ -1631,21 +1629,21 @@ static int impl_node_sync(void *object, int seq)
return 0;
}
static int impl_node_add_port(void *object,
int impl_node_add_port(void *object,
enum spa_direction direction,
uint32_t port_id, const struct spa_dict *props)
{
return -ENOTSUP;
}
static int impl_node_remove_port(void *object,
int impl_node_remove_port(void *object,
enum spa_direction direction,
uint32_t port_id)
{
return -ENOTSUP;
}
static int impl_node_port_enum_params(void *object, int seq,
int impl_node_port_enum_params(void *object, int seq,
enum spa_direction direction,
uint32_t port_id,
uint32_t id, uint32_t start, uint32_t num,
@ -1771,7 +1769,7 @@ next:
return 0;
}
static int port_set_format(struct impl *impl, struct port *port,
int port_set_format(struct impl *impl, struct port *port,
uint32_t flags, const struct spa_pod *format)
{
struct spa_video_info info;
@ -1869,7 +1867,7 @@ static int port_set_format(struct impl *impl, struct port *port,
return 0;
}
static int impl_node_port_set_param(void *object,
int impl_node_port_set_param(void *object,
enum spa_direction direction, uint32_t port_id,
uint32_t id, uint32_t flags,
const struct spa_pod *param)
@ -1893,7 +1891,7 @@ static int impl_node_port_set_param(void *object,
return res;
}
static int impl_node_port_use_buffers(void *object,
int impl_node_port_use_buffers(void *object,
enum spa_direction direction,
uint32_t port_id,
uint32_t flags,
@ -1929,7 +1927,7 @@ static int impl_node_port_use_buffers(void *object,
return res;
}
static int impl_node_port_set_io(void *object,
int impl_node_port_set_io(void *object,
enum spa_direction direction,
uint32_t port_id,
uint32_t id,
@ -1956,7 +1954,7 @@ static int impl_node_port_set_io(void *object,
return 0;
}
static int impl_node_port_reuse_buffer(void *object,
int impl_node_port_reuse_buffer(void *object,
uint32_t port_id,
uint32_t buffer_id)
{
@ -1976,7 +1974,7 @@ static int impl_node_port_reuse_buffer(void *object,
return res;
}
static int process_control(struct impl *impl, struct spa_pod_sequence *control)
int process_control(struct impl *impl, struct spa_pod_sequence *control)
{
struct spa_pod_control *c;
@ -1999,7 +1997,7 @@ static int process_control(struct impl *impl, struct spa_pod_sequence *control)
return 0;
}
static int impl_node_process(void *object)
int impl_node_process(void *object)
{
struct impl *impl = (struct impl*)object;
int res;
@ -2045,7 +2043,7 @@ static int impl_node_process(void *object)
return SPA_STATUS_HAVE_DATA;
}
static const struct spa_node_methods impl_node = {
const struct spa_node_methods impl_node = {
.version = SPA_VERSION_NODE_METHODS,
.add_listener = impl_node_add_listener,
.set_callbacks = impl_node_set_callbacks,
@ -2064,7 +2062,7 @@ static const struct spa_node_methods impl_node = {
.process = impl_node_process,
};
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
{
struct impl *impl;
@ -2081,7 +2079,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
return 0;
}
static int impl_clear(struct spa_handle *handle)
int impl_clear(struct spa_handle *handle)
{
std::destroy_at(reinterpret_cast<impl *>(handle));
return 0;
@ -2121,14 +2119,14 @@ impl::impl(spa_log *log, spa_loop *data_loop, spa_system *system,
latency[SPA_DIRECTION_OUTPUT] = SPA_LATENCY_INFO(SPA_DIRECTION_OUTPUT);
}
static size_t
size_t
impl_get_size(const struct spa_handle_factory *factory,
const struct spa_dict *params)
{
return sizeof(struct impl);
}
static int
int
impl_init(const struct spa_handle_factory *factory,
struct spa_handle *handle,
const struct spa_dict *info,
@ -2177,11 +2175,11 @@ impl_init(const struct spa_handle_factory *factory,
return 0;
}
static const struct spa_interface_info impl_interfaces[] = {
const struct spa_interface_info impl_interfaces[] = {
{SPA_TYPE_INTERFACE_Node,},
};
static int impl_enum_interface_info(const struct spa_handle_factory *factory,
int impl_enum_interface_info(const struct spa_handle_factory *factory,
const struct spa_interface_info **info,
uint32_t *index)
{
@ -2196,6 +2194,8 @@ static int impl_enum_interface_info(const struct spa_handle_factory *factory,
return 1;
}
}
extern "C" {
const struct spa_handle_factory spa_libcamera_source_factory = {
SPA_VERSION_HANDLE_FACTORY,