PipeWire: module.h Source File

PipeWire 0.2.7

module.h
Go to the documentation of this file.
1 /* PipeWire
2 * Copyright (C) 2016 Axis Communications <dev-gstreamer@axis.com>
3 * @author Linus Svensson <linus.svensson@axis.com>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #ifndef __PIPEWIRE_MODULE_H__
22 #define __PIPEWIRE_MODULE_H__
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #include <spa/utils/hook.h>
29
30 #include <pipewire/core.h>
31
32 #define PW_TYPE__Module PW_TYPE_OBJECT_BASE "Module"
33 #define PW_TYPE_MODULE_BASE PW_TYPE__Module ":"
34
35 #define PIPEWIRE_SYMBOL_MODULE_INIT "pipewire__module_init"
36
41 struct pw_module;
42
54 typedef int (*pw_module_init_func_t) (struct pw_module *module, const char *args);
55
57 struct pw_module_events {
58 #define PW_VERSION_MODULE_EVENTS 0
59 uint32_t version;
60
62 void (*destroy) (void *data);
63 };
64
66 #define PW_MODULE_PROP_NAME "pipewire.module.name"
67
68 struct pw_module *
69 pw_module_load(struct pw_core *core,
70 const char *name,
71 const char *args ,
72 struct pw_client *owner,
73 struct pw_global *parent,
74 struct pw_properties *properties );
75
77 struct pw_core * pw_module_get_core(struct pw_module *module);
78
80 struct pw_global * pw_module_get_global(struct pw_module *module);
81
83 const struct pw_module_info *pw_module_get_info(struct pw_module *module);
84
86 void pw_module_add_listener(struct pw_module *module,
87 struct spa_hook *listener,
88 const struct pw_module_events *events,
89 void *data);
90
92 void pw_module_destroy(struct pw_module *module);
93
94 #ifdef __cplusplus
95 }
96 #endif
97
98 #endif /* __PIPEWIRE_MODULE_H__ */
pw_global::pw_global_register
SPA_EXPORT int pw_global_register(struct pw_global *global, struct pw_client *owner, struct pw_global *parent)
register a global to the core registry
Definition: global.c:102
PIPEWIRE_SYMBOL_MODULE_INIT
#define PIPEWIRE_SYMBOL_MODULE_INIT
Definition: module.h:35
pw_module_get_global
SPA_EXPORT struct pw_global * pw_module_get_global(struct pw_module *module)
Get the global of a module.
Definition: module.c:321
pw_module::pw_module_load
SPA_EXPORT struct pw_module * pw_module_load(struct pw_core *core, const char *name, const char *args, struct pw_client *owner, struct pw_global *parent, struct pw_properties *properties)
Load a module.
Definition: module.c:167
pw_module::pw_module_init_func_t
int(* pw_module_init_func_t)(struct pw_module *module, const char *args)
Module init function signature.
Definition: module.h:54
pw_module_get_core
struct pw_core * pw_module_get_core(struct pw_module *module)
Get the core of a module.
Definition: module.c:315
pw_global::pw_global_destroy
SPA_EXPORT void pw_global_destroy(struct pw_global *global)
Destroy a global.
Definition: global.c:241
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:66
resource_data
Definition: factory.c:26
pw_client
PipeWire client object class.
interfaces.h
resource_data::resource_listener
struct spa_hook resource_listener
Definition: factory.c:27
pw_global_events
Global events, use pw_global_add_listener.
Definition: global.h:59
module.h
impl
Definition: control.c:25
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:190
pw_module_events::destroy
void(* destroy)(void *data)
The module is destroyed.
Definition: module.h:62
pw_global
A global object visible to remote clients.
pw_global::pw_global_new
SPA_EXPORT struct pw_global * pw_global_new(struct pw_core *core, uint32_t type, uint32_t version, struct pw_properties *properties, void *object)
Create a new global.
Definition: global.c:61
utils.h
pw_module
pw_resource_new
struct pw_resource * pw_resource_new(struct pw_client *client, uint32_t id, uint32_t permissions, uint32_t type, uint32_t version, size_t user_data_size)
Make a new resource for client.
Definition: resource.c:34
pw_module::pw_module_destroy
SPA_EXPORT void pw_module_destroy(struct pw_module *module)
Destroy a module.
Definition: module.c:287
pw_module_get_core
SPA_EXPORT struct pw_core * pw_module_get_core(struct pw_module *module)
Get the core of a module.
Definition: module.c:315
PW_VERSION_RESOURCE_EVENTS
#define PW_VERSION_RESOURCE_EVENTS
Definition: resource.h:63
pw_module_get_global
struct pw_global * pw_module_get_global(struct pw_module *module)
Get the global of a module.
Definition: module.c:321
pw_resource_get_user_data
void * pw_resource_get_user_data(struct pw_resource *resource)
Get the user data for the resource, the size was given in pw_resource_new.
Definition: resource.c:113
pw_module_events
Module events added with pw_module_add_listener.
Definition: module.h:57
pw_module_info
The module information.
Definition: introspect.h:103
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:308
pw_core
the core PipeWire object
pw_resource
Client owned objects.
pw_resource_destroy
void pw_resource_destroy(struct pw_resource *resource)
Destroy a resource.
Definition: resource.c:169
PW_VERSION_GLOBAL_EVENTS
#define PW_VERSION_GLOBAL_EVENTS
Definition: global.h:60
pw_module_get_info
SPA_EXPORT const struct pw_module_info * pw_module_get_info(struct pw_module *module)
Get the module info.
Definition: module.c:328
core.h
pw_core_resource_error
#define pw_core_resource_error(r,...)
Definition: interfaces.h:338
impl::this
struct pw_control this
Definition: control.c:26
pw_module_resource_info
#define pw_module_resource_info(r,...)
Definition: interfaces.h:485
PW_MODULE_PROP_NAME
#define PW_MODULE_PROP_NAME
The name of the module.
Definition: module.h:66
pw_module_events::version
uint32_t version
Definition: module.h:59
pw_properties::pw_properties_new
SPA_EXPORT struct pw_properties * pw_properties_new(const char *key,...)
Make a new properties object.
Definition: properties.c:89
pw_log::pw_log_error
void pw_log_error(const char *format,...)
pipewire.h
pw_utils::pw_free_strv
SPA_EXPORT void pw_free_strv(char **str)
Free a NULL terminated array of strings.
Definition: utils.c:100
pw_module_add_listener
void pw_module_add_listener(struct pw_module *module, struct spa_hook *listener, const struct pw_module_events *events, void *data)
Add an event listener to a module.
Definition: module.c:334
pw_module_add_listener
SPA_EXPORT void pw_module_add_listener(struct pw_module *module, struct spa_hook *listener, const struct pw_module_events *events, void *data)
Add an event listener to a module.
Definition: module.c:334
PW_VERSION_MODULE
#define PW_VERSION_MODULE
Definition: interfaces.h:459
pw_resource_events
Resource events.
Definition: resource.h:62
pw_module_get_info
const struct pw_module_info * pw_module_get_info(struct pw_module *module)
Get the module info.
Definition: module.c:328
pw_resource_add_listener
void pw_resource_add_listener(struct pw_resource *resource, struct spa_hook *listener, const struct pw_resource_events *events, void *data)
Add an event listener.
Definition: resource.c:119
pw_resource_events::version
uint32_t version
Definition: resource.h:64
pw_log::pw_log_warn
void pw_log_warn(const char *format,...)
pw_log::pw_log_debug
void pw_log_debug(const char *format,...)
pw_properties
A collection of key/value pairs.
Definition: properties.h:38