PipeWire  0.2.0
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 
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 
95 struct pw_module *
96 pw_core_find_module(struct pw_core *core, const char *filename);
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif /* __PIPEWIRE_MODULE_H__ */
A collection of key/value pairs.
Definition: properties.h:38
const struct pw_module_info * pw_module_get_info(struct pw_module *module)
Get the module info.
Definition: module.c:335
the core PipeWire object
Module events added with pw_module_add_listener.
Definition: module.h:57
int(* pw_module_init_func_t)(struct pw_module *module, const char *args)
Module init function signature.
Definition: module.h:54
uint32_t version
Definition: module.h:59
void(* destroy)(void *data)
The module is destroyed.
Definition: module.h:62
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:176
PipeWire client object class.
void pw_module_destroy(struct pw_module *module)
Destroy a module.
Definition: module.c:295
The module information.
Definition: introspect.h:103
struct pw_global * pw_module_get_global(struct pw_module *module)
Get the global of a module.
Definition: module.c:329
A global object visible to remote clients.
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:340
struct pw_core * pw_module_get_core(struct pw_module *module)
Get the core of a module.
Definition: module.c:324
A dynamically loadable module.
struct pw_module * pw_core_find_module(struct pw_core *core, const char *filename)
Find a module by filename.
Definition: module.c:155