PipeWire: module.h Source File

PipeWire 0.3.12

module.h
Go to the documentation of this file.
1 /* PipeWire
2 *
3 * Copyright © 2018 Wim Taymans
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25 #ifndef PIPEWIRE_MODULE_H
26 #define PIPEWIRE_MODULE_H
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #include <spa/utils/defs.h>
33 #include <spa/utils/hook.h>
34
35 #include <pipewire/proxy.h>
36
37 #define PW_TYPE_INTERFACE_Module PW_TYPE_INFO_INTERFACE_BASE "Module"
38
39 #define PW_VERSION_MODULE 3
40 struct pw_module;
41
43 struct pw_module_info {
44 uint32_t id;
45 const char *name;
46 const char *filename;
47 const char *args;
48 #define PW_MODULE_CHANGE_MASK_PROPS (1 << 0)
49 #define PW_MODULE_CHANGE_MASK_ALL ((1 << 1)-1)
50 uint64_t change_mask;
51 struct spa_dict *props;
52 };
53
55 struct pw_module_info *
56 pw_module_info_update(struct pw_module_info *info,
57 const struct pw_module_info *update);
58
60 void pw_module_info_free(struct pw_module_info *info);
61
62 #define PW_MODULE_EVENT_INFO 0
63 #define PW_MODULE_EVENT_NUM 1
64
66 struct pw_module_events {
67 #define PW_VERSION_MODULE_EVENTS 0
68 uint32_t version;
74 void (*info) (void *object, const struct pw_module_info *info);
75 };
76
77 #define PW_MODULE_METHOD_ADD_LISTENER 0
78 #define PW_MODULE_METHOD_NUM 1
79
81 struct pw_module_methods {
82 #define PW_VERSION_MODULE_METHODS 0
83 uint32_t version;
84
85 int (*add_listener) (void *object,
86 struct spa_hook *listener,
87 const struct pw_module_events *events,
88 void *data);
89 };
90
91 #define pw_module_method(o,method,version,...) \
92 ({ \
93 int _res = -ENOTSUP; \
94 spa_interface_call_res((struct spa_interface*)o, \
95 struct pw_module_methods, _res, \
96 method, version, ##__VA_ARGS__); \
97 _res; \
98 })
99
100 #define pw_module_add_listener(c,...) pw_module_method(c,add_listener,0,__VA_ARGS__)
101
102 #ifdef __cplusplus
103 } /* extern "C" */
104 #endif
105
106 #endif /* PIPEWIRE_MODULE_H */
data
Definition: filter.c:71
pw_module_info::args
const char * args
arguments passed to the module
Definition: module.h:47
pw_introspect::pw_module_info_update
struct pw_module_info * pw_module_info_update(struct pw_module_info *info, const struct pw_module_info *update)
Update and existing pw_module_info with update.
Definition: introspect.c:330
pw_module_methods::version
uint32_t version
Definition: module.h:83
pw_module_info::id
uint32_t id
id of the global
Definition: module.h:44
pw_introspect::pw_module_info_free
void pw_module_info_free(struct pw_module_info *info)
Free a pw_module_info.
Definition: introspect.c:357
pw_module_events
Module events.
Definition: module.h:66
pw_module_info
The module information.
Definition: module.h:43
proxy.h
pw_module_info::props
struct spa_dict * props
extra properties
Definition: module.h:51
pw_module_info::name
const char * name
name of the module
Definition: module.h:45
pw_module_info::change_mask
uint64_t change_mask
bitfield of changed fields since last call
Definition: module.h:50
pw_module_events::version
uint32_t version
Definition: module.h:68
pw_module_events::info
void(* info)(void *object, const struct pw_module_info *info)
Notify module info.
Definition: module.h:74
pw_module_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_module_events *events, void *data)
Definition: module.h:85
pw_module_methods
Module methods.
Definition: module.h:81
pw_module_info::filename
const char * filename
filename of the module
Definition: module.h:46