PipeWire  0.3.45
impl-module.h
Go to the documentation of this file.
1 /* PipeWire
2  * Copyright © 2016 Axis Communications <dev-gstreamer@axis.com>
3  * @author Linus Svensson <linus.svensson@axis.com>
4  * Copyright © 2018 Wim Taymans
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice (including the next
14  * paragraph) shall be included in all copies or substantial portions of the
15  * Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23  * DEALINGS IN THE SOFTWARE.
24  */
25 
26 #ifndef PIPEWIRE_IMPL_MODULE_H
27 #define PIPEWIRE_IMPL_MODULE_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #include <spa/utils/hook.h>
34 
35 #include <pipewire/context.h>
36 
37 #define PIPEWIRE_SYMBOL_MODULE_INIT "pipewire__module_init"
38 #define PIPEWIRE_MODULE_PREFIX "libpipewire-"
39 
49 struct pw_impl_module;
50 
60 typedef int (*pw_impl_module_init_func_t) (struct pw_impl_module *module, const char *args);
61 
63 struct pw_impl_module_events {
64 #define PW_VERSION_IMPL_MODULE_EVENTS 0
65  uint32_t version;
66 
68  void (*destroy) (void *data);
70  void (*free) (void *data);
72  void (*initialized) (void *data);
73 
76  void (*registered) (void *data);
77 };
78 
79 struct pw_impl_module *
80 pw_context_load_module(struct pw_context *context,
81  const char *name,
82  const char *args,
83  struct pw_properties *properties);
84 
87 
89 struct pw_global * pw_impl_module_get_global(struct pw_impl_module *module);
90 
92 const struct pw_properties *pw_impl_module_get_properties(struct pw_impl_module *module);
93 
95 int pw_impl_module_update_properties(struct pw_impl_module *module, const struct spa_dict *dict);
96 
98 const struct pw_module_info *pw_impl_module_get_info(struct pw_impl_module *module);
99 
101 void pw_impl_module_add_listener(struct pw_impl_module *module,
102  struct spa_hook *listener,
103  const struct pw_impl_module_events *events,
104  void *data);
105 
107 void pw_impl_module_destroy(struct pw_impl_module *module);
108 
113 #ifdef __cplusplus
114 }
115 #endif
116 
117 #endif /* PIPEWIRE_IMPL_MODULE_H */
pipewire/context.h
const struct pw_properties * pw_impl_module_get_properties(struct pw_impl_module *module)
Get the module properties.
Definition: impl-module.c:358
int(* pw_impl_module_init_func_t)(struct pw_impl_module *module, const char *args)
Module init function signature.
Definition: impl-module.h:65
struct pw_impl_module * pw_context_load_module(struct pw_context *context, const char *name, const char *args, struct pw_properties *properties)
Load a module.
Definition: impl-module.c:160
struct pw_context * pw_impl_module_get_context(struct pw_impl_module *module)
Get the context of a module.
Definition: impl-module.c:346
struct pw_global * pw_impl_module_get_global(struct pw_impl_module *module)
Get the global of a module.
Definition: impl-module.c:352
const struct pw_module_info * pw_impl_module_get_info(struct pw_impl_module *module)
Get the module info.
Definition: impl-module.c:388
void pw_impl_module_add_listener(struct pw_impl_module *module, struct spa_hook *listener, const struct pw_impl_module_events *events, void *data)
Add an event listener to a module.
Definition: impl-module.c:394
int pw_impl_module_update_properties(struct pw_impl_module *module, const struct spa_dict *dict)
Update the module properties.
Definition: impl-module.c:364
void pw_impl_module_destroy(struct pw_impl_module *module)
Destroy a module.
Definition: impl-module.c:316
spa/utils/hook.h
Definition: context.h:67
Module events added with pw_impl_module_add_listener.
Definition: impl-module.h:68
void(* initialized)(void *data)
The module is initialized.
Definition: impl-module.h:78
void(* free)(void *data)
The module is freed.
Definition: impl-module.h:76
void(* destroy)(void *data)
The module is destroyed.
Definition: impl-module.h:74
void(* registered)(void *data)
The module is registered.
Definition: impl-module.h:82
uint32_t version
Definition: impl-module.h:71
Definition: impl.h:41
The module information.
Definition: module.h:58
Definition: properties.h:53
struct spa_dict dict
dictionary of key/values
Definition: properties.h:54
Definition: dict.h:59
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:342