PipeWire 1.1.0
Loading...
Searching...
No Matches
plugin-loader.h
Go to the documentation of this file.
1/* Simple Plugin API */
2/* SPDX-FileCopyrightText: Copyright © 2021 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef SPA_PLUGIN_LOADER_H
6#define SPA_PLUGIN_LOADER_H
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#include <spa/utils/hook.h>
13#include <spa/utils/dict.h>
14
24#define SPA_TYPE_INTERFACE_PluginLoader SPA_TYPE_INFO_INTERFACE_BASE "PluginLoader"
25
26#define SPA_VERSION_PLUGIN_LOADER 0
27struct spa_plugin_loader { struct spa_interface iface; };
28
30#define SPA_VERSION_PLUGIN_LOADER_METHODS 0
31 uint32_t version;
32
40 struct spa_handle *(*load) (void *object, const char *factory_name, const struct spa_dict *info);
41
48 int (*unload)(void *object, struct spa_handle *handle);
49};
50
51static inline struct spa_handle *
52spa_plugin_loader_load(struct spa_plugin_loader *loader, const char *factory_name, const struct spa_dict *info)
53{
54 struct spa_handle *res = NULL;
55 if (SPA_LIKELY(loader != NULL))
57 struct spa_plugin_loader_methods, res,
58 load, 0, factory_name, info);
59 return res;
61
62static inline int
63spa_plugin_loader_unload(struct spa_plugin_loader *loader, struct spa_handle *handle)
64{
65 int res = -1;
66 if (SPA_LIKELY(loader != NULL))
68 struct spa_plugin_loader_methods, res,
69 unload, 0, handle);
70 return res;
72
77#ifdef __cplusplus
78} /* extern "C" */
79#endif
80
81#endif /* SPA_PLUGIN_LOADER_H */
#define spa_interface_call_res(iface, method_type, res, method, vers,...)
Invoke method named method in the callbacks on the given interface object.
Definition hook.h:251
static struct spa_handle * spa_plugin_loader_load(struct spa_plugin_loader *loader, const char *factory_name, const struct spa_dict *info)
Definition plugin-loader.h:60
static int spa_plugin_loader_unload(struct spa_plugin_loader *loader, struct spa_handle *handle)
Definition plugin-loader.h:71
#define SPA_LIKELY(x)
Definition defs.h:357
spa/utils/hook.h
Definition dict.h:39
Definition plugin.h:30
Definition hook.h:138
Definition plugin-loader.h:36
int(* unload)(void *object, struct spa_handle *handle)
Unload a SPA plugin.
Definition plugin-loader.h:56
uint32_t version
Definition plugin-loader.h:39
Definition plugin-loader.h:34
struct spa_interface iface
Definition plugin-loader.h:34
spa/utils/dict.h