PipeWire  1.4.1
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 
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 
38 #define SPA_VERSION_PLUGIN_LOADER_METHODS 0
39  uint32_t version;
40 
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 
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 
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 
77 #ifdef __cplusplus
78 } /* extern "C" */
79 #endif
80 
81 #endif /* SPA_PLUGIN_LOADER_H */
#define spa_api_method_null_r(rtype, def, type, co, o, method, version,...)
Definition: hook.h:308
SPA_API_PLUGIN_LOADER int spa_plugin_loader_unload(struct spa_plugin_loader *loader, struct spa_handle *handle)
Definition: plugin-loader.h:77
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/utils/hook.h
#define SPA_API_PLUGIN_LOADER
Definition: plugin-loader.h:26
Definition: dict.h:51
Definition: plugin.h:43
Definition: hook.h:148
Definition: plugin-loader.h:46
int(* unload)(void *object, struct spa_handle *handle)
Unload a SPA plugin.
Definition: plugin-loader.h:66
uint32_t version
Definition: plugin-loader.h:49
Definition: plugin-loader.h:44
struct spa_interface iface
Definition: plugin-loader.h:44
spa/utils/dict.h