PipeWire 1.2.6

Loading...
Searching...
No Matches
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_MODULE_PERM_MASK PW_PERM_R|PW_PERM_M
28
29#define PW_VERSION_MODULE 3
30 struct pw_module;
31
33 struct pw_module_info {
34 uint32_t id;
35 const char *name;
36 const char *filename;
37 const char *args;
38#define PW_MODULE_CHANGE_MASK_PROPS (1 << 0)
39#define PW_MODULE_CHANGE_MASK_ALL ((1 << 1)-1)
40 uint64_t change_mask;
41 struct spa_dict *props;
42};
43
45 struct pw_module_info *
46 pw_module_info_update(struct pw_module_info *info,
47 const struct pw_module_info *update);
49 struct pw_module_info *
50 pw_module_info_merge(struct pw_module_info *info,
51 const struct pw_module_info *update, bool reset);
53 void pw_module_info_free(struct pw_module_info *info);
54
55#define PW_MODULE_EVENT_INFO 0
56#define PW_MODULE_EVENT_NUM 1
57
59 struct pw_module_events {
60#define PW_VERSION_MODULE_EVENTS 0
61 uint32_t version;
67 void (*info) (void *data, const struct pw_module_info *info);
68};
69
70#define PW_MODULE_METHOD_ADD_LISTENER 0
71#define PW_MODULE_METHOD_NUM 1
72
74 struct pw_module_methods {
75#define PW_VERSION_MODULE_METHODS 0
76 uint32_t version;
77
78 int (*add_listener) (void *object,
79 struct spa_hook *listener,
80 const struct pw_module_events *events,
81 void *data);
82};
83
84#define pw_module_method(o,method,version,...) \
85({ \
86 int _res = -ENOTSUP; \
87 spa_interface_call_res((struct spa_interface*)o, \
88 struct pw_module_methods, _res, \
89 method, version, ##__VA_ARGS__); \
90 _res; \
91})
92
93#define pw_module_add_listener(c,...) pw_module_method(c,add_listener,0,__VA_ARGS__)
94
99#ifdef __cplusplus
100} /* extern "C" */
101#endif
102
103#endif /* PIPEWIRE_MODULE_H */
defs.h
spa/utils/defs.h
pw_module_info_merge
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:362
pw_module_info_free
void pw_module_info_free(struct pw_module_info *info)
Free a pw_module_info.
Definition introspect.c:398
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 with reset.
Definition introspect.c:391
hook.h
spa/utils/hook.h
proxy.h
pipewire/proxy.h
pw_module_events
Module events.
Definition module.h:71
pw_module_events::version
uint32_t version
Definition module.h:74
pw_module_events::info
void(* info)(void *data, const struct pw_module_info *info)
Notify module info.
Definition module.h:80
pw_module_info
The module information.
Definition module.h:41
pw_module_info::id
uint32_t id
id of the global
Definition module.h:42
pw_module_info::filename
const char * filename
filename of the module
Definition module.h:44
pw_module_info::args
const char * args
arguments passed to 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_methods
Module methods.
Definition module.h:89
pw_module_methods::version
uint32_t version
Definition module.h:92
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:94
pw_module
spa_dict
Definition dict.h:39
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:350