PipeWire  0.3.66
module.h
Go to the documentation of this file.
1 /* PipeWire */
2 /* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3 /* SPDX-License-Identifier: MIT */
4 
5 #ifndef PIPEWIRE_MODULE_H
6 #define PIPEWIRE_MODULE_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include <spa/utils/defs.h>
13 #include <spa/utils/hook.h>
14 
15 #include <pipewire/proxy.h>
16 
25 #define PW_TYPE_INTERFACE_Module PW_TYPE_INFO_INTERFACE_BASE "Module"
26 
27 #define PW_VERSION_MODULE 3
28 struct pw_module;
29 
31 struct pw_module_info {
32  uint32_t id;
33  const char *name;
34  const char *filename;
35  const char *args;
36 #define PW_MODULE_CHANGE_MASK_PROPS (1 << 0)
37 #define PW_MODULE_CHANGE_MASK_ALL ((1 << 1)-1)
38  uint64_t change_mask;
39  struct spa_dict *props;
40 };
41 
43 struct pw_module_info *
45  const struct pw_module_info *update);
49  const struct pw_module_info *update, bool reset);
51 void pw_module_info_free(struct pw_module_info *info);
52 
53 #define PW_MODULE_EVENT_INFO 0
54 #define PW_MODULE_EVENT_NUM 1
55 
57 struct pw_module_events {
58 #define PW_VERSION_MODULE_EVENTS 0
59  uint32_t version;
65  void (*info) (void *data, const struct pw_module_info *info);
66 };
67 
68 #define PW_MODULE_METHOD_ADD_LISTENER 0
69 #define PW_MODULE_METHOD_NUM 1
70 
72 struct pw_module_methods {
73 #define PW_VERSION_MODULE_METHODS 0
74  uint32_t version;
75 
76  int (*add_listener) (void *object,
77  struct spa_hook *listener,
78  const struct pw_module_events *events,
79  void *data);
80 };
81 
82 #define pw_module_method(o,method,version,...) \
83 ({ \
84  int _res = -ENOTSUP; \
85  spa_interface_call_res((struct spa_interface*)o, \
86  struct pw_module_methods, _res, \
87  method, version, ##__VA_ARGS__); \
88  _res; \
89 })
90 
91 #define pw_module_add_listener(c,...) pw_module_method(c,add_listener,0,__VA_ARGS__)
92 
97 #ifdef __cplusplus
98 } /* extern "C" */
99 #endif
100 
101 #endif /* PIPEWIRE_MODULE_H */
spa/utils/defs.h
void pw_module_info_free(struct pw_module_info *info)
Free a pw_module_info.
Definition: introspect.c:395
struct pw_module_info * pw_module_info_merge(struct pw_module_info *info, const struct pw_module_info *update, bool reset)
Merge and existing pw_module_info with update.
Definition: introspect.c:359
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 with reset.
Definition: introspect.c:388
spa/utils/hook.h
pipewire/proxy.h
Module events.
Definition: module.h:68
uint32_t version
Definition: module.h:71
void(* info)(void *data, const struct pw_module_info *info)
Notify module info.
Definition: module.h:77
The module information.
Definition: module.h:38
uint32_t id
id of the global
Definition: module.h:39
const char * filename
filename of the module
Definition: module.h:41
const char * args
arguments passed to the module
Definition: module.h:42
uint64_t change_mask
bitfield of changed fields since last call
Definition: module.h:47
Module methods.
Definition: module.h:86
uint32_t version
Definition: module.h:89
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_module_events *events, void *data)
Definition: module.h:91
Definition: utils/dict.h:39
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:331