PipeWire 1.4.5 |

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
9 extern "C" {
10#endif
11
12#include <spa/utils/hook.h>
13#include <spa/utils/dict.h>
14
15#ifndef SPA_API_PLUGIN_LOADER
16 #ifdef SPA_API_IMPL
17 #define SPA_API_PLUGIN_LOADER SPA_API_IMPL
18 #else
19 #define SPA_API_PLUGIN_LOADER static inline
20 #endif
21#endif
22
26
31
32#define SPA_TYPE_INTERFACE_PluginLoader SPA_TYPE_INFO_INTERFACE_BASE "PluginLoader"
33
34#define SPA_VERSION_PLUGIN_LOADER 0
35 struct spa_plugin_loader { struct spa_interface iface; };
36
37 struct spa_plugin_loader_methods {
38#define SPA_VERSION_PLUGIN_LOADER_METHODS 0
39 uint32_t version;
40
46 * \return plugin handle, or NULL on error
47 */
48 struct spa_handle *(*load) (void *object, const char *factory_name, const struct spa_dict *info);
49
56 int (*unload)(void *object, struct spa_handle *handle);
57};
58
59 SPA_API_PLUGIN_LOADER struct spa_handle *
60 spa_plugin_loader_load(struct spa_plugin_loader *loader, const char *factory_name, const struct spa_dict *info)
61{
62 return spa_api_method_null_r(struct spa_handle *, NULL, spa_plugin_loader, loader, &loader->iface,
63 load, 0, factory_name, info);
64}
65
66 SPA_API_PLUGIN_LOADER int
67 spa_plugin_loader_unload(struct spa_plugin_loader *loader, struct spa_handle *handle)
68{
69 return spa_api_method_null_r(int, -1, spa_plugin_loader, loader, &loader->iface,
70 unload, 0, handle);
71}
72
75
76
77#ifdef __cplusplus
78} /* extern "C" */
79#endif
80
81#endif /* SPA_PLUGIN_LOADER_H */
spa_api_method_null_r
#define spa_api_method_null_r(rtype, def, type, co, o, method, version,...)
Definition hook.h:308
spa_plugin_loader_load
SPA_API_PLUGIN_LOADER 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:70
spa_plugin_loader_unload
SPA_API_PLUGIN_LOADER int spa_plugin_loader_unload(struct spa_plugin_loader *loader, struct spa_handle *handle)
Definition plugin-loader.h:77
hook.h
spa/utils/hook.h
SPA_API_PLUGIN_LOADER
#define SPA_API_PLUGIN_LOADER
Definition plugin-loader.h:26
spa_dict
Definition dict.h:51
spa_handle
Definition plugin.h:43
spa_interface
Definition hook.h:148
spa_plugin_loader_methods
Definition plugin-loader.h:46
spa_plugin_loader_methods::unload
int(* unload)(void *object, struct spa_handle *handle)
Unload a SPA plugin.
Definition plugin-loader.h:66
spa_plugin_loader_methods::version
uint32_t version
Definition plugin-loader.h:49
spa_plugin_loader
Definition plugin-loader.h:44
spa_plugin_loader::iface
struct spa_interface iface
Definition plugin-loader.h:44
dict.h
spa/utils/dict.h