PipeWire: impl-module.h Source File

PipeWire 0.3.7

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
44 struct pw_impl_module;
45
57 typedef int (*pw_impl_module_init_func_t) (struct pw_impl_module *module, const char *args);
58
60 struct pw_impl_module_events {
61 #define PW_VERSION_IMPL_MODULE_EVENTS 0
62 uint32_t version;
63
65 void (*destroy) (void *data);
67 void (*free) (void *data);
69 void (*initialized) (void *data);
70
73 void (*registered) (void *data);
74 };
75
76 struct pw_impl_module *
77 pw_context_load_module(struct pw_context *context,
78 const char *name,
79 const char *args ,
80 struct pw_properties *properties );
81
83 struct pw_context * pw_impl_module_get_context(struct pw_impl_module *module);
84
86 struct pw_global * pw_impl_module_get_global(struct pw_impl_module *module);
87
89 const struct pw_properties *pw_impl_module_get_properties(struct pw_impl_module *module);
90
92 int pw_impl_module_update_properties(struct pw_impl_module *module, const struct spa_dict *dict);
93
95 const struct pw_module_info *pw_impl_module_get_info(struct pw_impl_module *module);
96
98 void pw_impl_module_add_listener(struct pw_impl_module *module,
99 struct spa_hook *listener,
100 const struct pw_impl_module_events *events,
101 void *data);
102
104 void pw_impl_module_destroy(struct pw_impl_module *module);
105
106 #ifdef __cplusplus
107 }
108 #endif
109
110 #endif /* PIPEWIRE_IMPL_MODULE_H */
PW_VERSION_MODULE
#define PW_VERSION_MODULE
Definition: module.h:39
res
static uint32_t int int res
Definition: core.h:323
pw_impl_module_events::registered
void(* registered)(void *data)
The module is registered.
Definition: impl-module.h:73
pw_log::pw_log_error
#define pw_log_error(...)
pw_impl_module
pw_global::pw_global_destroy
SPA_EXPORT void pw_global_destroy(struct pw_global *global)
Destroy a global.
Definition: global.c:367
pw_utils::pw_split_strv
SPA_EXPORT char ** pw_split_strv(const char *str, const char *delimiter, int max_tokens, int *n_tokens)
Split a string based on delimiters.
Definition: utils.c:71
PW_KEY_OBJECT_ID
#define PW_KEY_OBJECT_ID
a global object id
Definition: keys.h:58
pw_impl_module_events::free
void(* free)(void *data)
The module is freed.
Definition: impl-module.h:67
data
Definition: filter.c:71
pw_impl_module_events
Module events added with pw_impl_module_add_listener.
Definition: impl-module.h:60
PW_TYPE_INTERFACE_Module
#define PW_TYPE_INTERFACE_Module
Definition: module.h:37
pw_impl_module_events::initialized
void(* initialized)(void *data)
The module is initialized.
Definition: impl-module.h:69
pw_global_events
Global events, use pw_global_add_listener.
Definition: global.h:65
pw_impl_client
PipeWire client object class.
pw_impl_module_events::destroy
void(* destroy)(void *data)
The module is destroyed.
Definition: impl-module.h:65
impl
Definition: control.c:33
pw_global_add_listener
void pw_global_add_listener(struct pw_global *global, struct spa_hook *listener, const struct pw_global_events *events, void *data)
Add an event listener on the global.
Definition: global.c:252
pw_global
A global object visible to remote clients.
pw_impl_module_add_listener
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:380
impl.h
pw_properties::dict
struct spa_dict dict
dictionary of key/values
Definition: properties.h:46
pw_impl_module_get_properties
SPA_EXPORT const struct pw_properties * pw_impl_module_get_properties(struct pw_impl_module *module)
Get the node properties.
Definition: impl-module.c:344
pw_impl_module_update_properties
SPA_EXPORT int pw_impl_module_update_properties(struct pw_impl_module *module, const struct spa_dict *dict)
Update the module properties.
Definition: impl-module.c:350
pw_impl_module_get_context
SPA_EXPORT struct pw_context * pw_impl_module_get_context(struct pw_impl_module *module)
Get the context of a module.
Definition: impl-module.c:332
pw_properties::pw_properties_setf
SPA_EXPORT int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...)
Set a property value by format.
Definition: properties.c:433
pw_impl_module::pw_context_load_module
SPA_EXPORT 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:157
pw_impl_module::pw_impl_module_init_func_t
int(* pw_impl_module_init_func_t)(struct pw_impl_module *module, const char *args)
Module init function signature.
Definition: impl-module.h:57
pw_log::pw_log_debug
#define pw_log_debug(...)
pw_log::pw_log_warn
#define pw_log_warn(...)
pw_impl_module_get_global
struct pw_global * pw_impl_module_get_global(struct pw_impl_module *module)
Get the global of a module.
Definition: impl-module.c:338
pw_properties::pw_properties_update
SPA_EXPORT int pw_properties_update(struct pw_properties *props, const struct spa_dict *dict)
Update properties.
Definition: properties.c:263
pw_in_valgrind
bool pw_in_valgrind(void)
Definition: pipewire.c:516
pw_module_info
The module information.
Definition: module.h:43
pw_global_add_resource
int pw_global_add_resource(struct pw_global *global, struct pw_resource *resource)
Add a resource to a global.
Definition: global.c:227
pw_impl_module_get_global
SPA_EXPORT struct pw_global * pw_impl_module_get_global(struct pw_impl_module *module)
Get the global of a module.
Definition: impl-module.c:338
pw_context
the PipeWire context
args
static uint32_t int int const char va_list args
Definition: core.h:324
pw_impl_module_get_info
const struct pw_module_info * pw_impl_module_get_info(struct pw_impl_module *module)
Get the module info.
Definition: impl-module.c:374
pw_properties::pw_properties_set
SPA_EXPORT int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:400
pw_resource
Client owned objects.
PW_MODULE_CHANGE_MASK_PROPS
#define PW_MODULE_CHANGE_MASK_PROPS
Definition: module.h:48
PW_KEY_MODULE_NAME
#define PW_KEY_MODULE_NAME
the name of the module
Definition: keys.h:201
PW_VERSION_GLOBAL_EVENTS
#define PW_VERSION_GLOBAL_EVENTS
Definition: global.h:66
pw_resource_new
struct pw_resource * pw_resource_new(struct pw_impl_client *client, uint32_t id, uint32_t permissions, const char *type, uint32_t version, size_t user_data_size)
Make a new resource for client.
Definition: resource.c:43
context.h
pw_global::pw_global_new
SPA_EXPORT struct pw_global * pw_global_new(struct pw_context *context, const char *type, uint32_t version, struct pw_properties *properties, pw_global_bind_func_t func, void *object)
Create a new global.
Definition: global.c:67
impl::this
struct pw_control this
Definition: control.c:34
pw_impl_module_events::version
uint32_t version
Definition: impl-module.h:62
pw_properties::pw_properties_new
SPA_EXPORT struct pw_properties * pw_properties_new(const char *key,...)
Make a new properties object.
Definition: properties.c:98
pw_impl_module_get_properties
const struct pw_properties * pw_impl_module_get_properties(struct pw_impl_module *module)
Get the node properties.
Definition: impl-module.c:344
pw_impl_module::pw_impl_module_destroy
SPA_EXPORT void pw_impl_module_destroy(struct pw_impl_module *module)
Destroy a module.
Definition: impl-module.c:304
pw_utils::pw_free_strv
SPA_EXPORT void pw_free_strv(char **str)
Free a NULL terminated array of strings.
Definition: utils.c:105
pw_global::pw_global_register
SPA_EXPORT int pw_global_register(struct pw_global *global)
register a global to the context registry
Definition: global.c:128
pw_impl_module_add_listener
SPA_EXPORT 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:380
NAME
#define NAME
Definition: impl-module.c:39
pw_impl_module_get_context
struct pw_context * pw_impl_module_get_context(struct pw_impl_module *module)
Get the context of a module.
Definition: impl-module.c:332
pw_impl_module_get_info
SPA_EXPORT const struct pw_module_info * pw_impl_module_get_info(struct pw_impl_module *module)
Get the module info.
Definition: impl-module.c:374
pw_properties
A collection of key/value pairs.
Definition: properties.h:45
pw_properties::pw_properties_free
SPA_EXPORT void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:335
PIPEWIRE_SYMBOL_MODULE_INIT
#define PIPEWIRE_SYMBOL_MODULE_INIT
Definition: impl-module.h:37
pw_impl_module_update_properties
int pw_impl_module_update_properties(struct pw_impl_module *module, const struct spa_dict *dict)
Update the module properties.
Definition: impl-module.c:350