We truncated the diff of some files because they were too big.
If you want to see the full diff for every file, click here.
Changes of Revision 8
pipewire-aptx.changes
Changed
x
1
2
-------------------------------------------------------------------
3
+Tue May 10 14:06:03 UTC 2022 - Bjørn Lie <zaitor@opensuse.org>
4
+
5
+- Update to version 0.3.51
6
+
7
+-------------------------------------------------------------------
8
Wed Apr 20 11:17:00 UTC 2022 - Bjørn Lie <zaitor@opensuse.org>
9
10
- Update to version 0.3.50
11
pipewire-aptx.spec
Changed
10
1
2
%define soversion 0_2
3
4
Name: pipewire-aptx
5
-Version: 0.3.50
6
+Version: 0.3.51
7
Release: 0
8
Summary: PipeWire Bluetooth aptX codec plugin
9
License: MIT
10
pipewire-0.3.50.tar.gz/NEWS -> pipewire-0.3.51.tar.gz/NEWS
Changed
114
1
2
+# PipeWire 0.3.51 (2022-04-28)
3
+
4
+This is a bugfix release that is API and ABI compatible with previous
5
+0.3.x releases.
6
+
7
+## Highlights
8
+ - Improved graph reconfiguration.
9
+ - Extra configuration options for streams and filters with config
10
+ rules and environment variable.
11
+ - Improve module-pulse-tunnel latency, stability and error recovery.
12
+ - pw-top, pw-cli and pw-link improvements.
13
+ - Fix a channelmixer upmixing clipping issue.
14
+ - The ROC module has seen many improvements.
15
+ - Many more bugfixes and improvements.
16
+
17
+
18
+## PipeWire
19
+ - The graph reconfiguration code was reworked:
20
+ * Moved nodes will update the new driver quantum correctly. (#2293)
21
+ * Inactive nodes are ignored more.
22
+ * Nodes that require a driver are now not scheduled anymore when
23
+ they are passive (unused). (#2309)
24
+ * Improved performance, the graph is reconfigured with a minimal
25
+ amount of changes.
26
+ - Method and event argument names were improved.
27
+ - A linker garbage collection problem was fixed. (#2292)
28
+ - Properties on threads are now implemented. Use common code to
29
+ set thread name and add an option to set stack-size.
30
+ - Streams and filters always want a driver now. This makes it possible
31
+ to just link a playback stream to a capture stream without a driver
32
+ and have it work. (#1761).
33
+ - Streams and filters can now also have rules in the config file.
34
+ - Streams, filters, JACK, ALSA and v4l2 now support PIPEWIRE_PROPS
35
+ environment variable to override node properties.
36
+ - Add config section extensions. This provides a way for modules to
37
+ have specific config to override the default config.
38
+ - Handle realloc errors better.
39
+ - Improve stream and filter property updates.
40
+
41
+## Modules
42
+ - The pulse-tunnel modules has improved latency management and should
43
+ now work a lot better. (#2230)
44
+ - Module-loopback, module-echo-cancel, module-filter-chain unload the
45
+ module when a stream is destroyed. (#1754)
46
+ - Biquads in filter-chain now can have more gain (5->20 dB).
47
+ - Documentation updates. Most Wiki content was moved to the source code
48
+ inline comments.
49
+ - Filter-chain now has a builtin delay line filter. (#2320)
50
+ - Filter-chain can now parse the config key correctly in all cases.
51
+ - The ROC sink and source saw many improvements. roc-source is now a stream
52
+ by default that connects to the default sink. Both modules will try to set
53
+ a graph rate. Both modules have an option to select the FEC mode.
54
+ The ROC source has lower latency now. (#2331)
55
+ - Handle realloc errors better.
56
+
57
+## tools
58
+ - pw-cat does not have --list-targets anymore, use one of the more
59
+ advanced and less buggy tools such as wpctl or pw-cli to list
60
+ sinks and sources.
61
+ - pw-top has seen many improvements.
62
+ * It now has some timeouts to reset the node values to their default
63
+ state when unused.
64
+ * The man page was improved.
65
+ * Invalid timings and errors are displayed in a better way.
66
+ - pw-cli and pw-link can now create links between all ports of given nodes.
67
+ - pw-cat can now save to other file formats than wav, based on the extension
68
+ of the filename.
69
+
70
+## SPA
71
+ - The resampler now uses a different internal method for draining. It can
72
+ now also handle 0 size buffers as input without draining.
73
+ - The channelmixer now uses the front channel averages for FC and LFE.
74
+ This avoids clipping and results in much better upmixing.
75
+ - ALSA should now work again on 32 bits. (#2271)
76
+ - The JSON parser now converts escaped unicode correctly to UTF8.
77
+
78
+## bluetooth
79
+ - Codec switch improvements when the device is disconnected. (#2334)
80
+
81
+## pulse-server
82
+ - There is a new module-roc-sink-input module, the the PulseAudio equivalent.
83
+ - The ROC source and sink-input module now have a much lower latency.
84
+ - The ROC module now has an option to select FEC mode.
85
+ - Playback and record rate adjustements should work now. (#1159)
86
+
87
+## JACK
88
+ - Remove some useless pthread attributes. This makes JACK work in QEMU with
89
+ sandboxing enabled. (#2297)
90
+ - The buffer_size callback is now only called when something has changed
91
+ since the last process() callback or get_buffer_size() method. This
92
+ fixes a GStreamer issue and is more in line with what JACK does. (#2324)
93
+ - Fix a potential deadlock when the process thread is doing IPC and the
94
+ IPC thread is blocking on the data thread.
95
+ - Allocation errors in metadata are handled better.
96
+
97
+
98
+Older versions:
99
+
100
# PipeWire 0.3.50 (2022-04-13)
101
102
This is a bugfix release that is API and ABI compatible with previous
103
104
(#1495).
105
- Port sorting was improved/fixed. (#2260)
106
107
-
108
-Older versions:
109
-
110
-
111
# PipeWire 0.3.49 (2022-03-29)
112
113
This is a bugfix release that is API and ABI compatible with previous
114
pipewire-0.3.50.tar.gz/doc/index.dox -> pipewire-0.3.51.tar.gz/doc/index.dox
Changed
12
1
2
3
### Resources
4
5
+- PipeWire and AGL(https://wiki.automotivelinux.org/_media/pipewire_agl_20181206.pdf)
6
- LAC 2020 Paper(https://lac2020.sciencesconf.org/307881/document)
7
- PipeWire Under The Hood(https://venam.nixers.net/blog/unix/2021/06/23/pipewire-under-the-hood.html)
8
- PipeWire: The Linux audio/video bus (LWN)(https://lwn.net/Articles/847412)
9
- PipeWire Wikipedia(https://en.wikipedia.org/wiki/PipeWire)
10
+- Bluetooth, PipeWire and Whatsapp calls(https://gjhenrique.com/pipewire.html)
11
*/
12
pipewire-0.3.50.tar.gz/doc/tutorial3.dox -> pipewire-0.3.51.tar.gz/doc/tutorial3.dox
Changed
10
1
2
\code{.c}
3
int pending, done = 0;
4
5
- void core_event_done(void *object, uint32_t id, int seq) {
6
+ void core_event_done(void *data, uint32_t id, int seq) {
7
if (id == PW_ID_CORE && seq == pending) {
8
done = 1;
9
pw_main_loop_quit(loop);
10
pipewire-0.3.50.tar.gz/man/pw-cat.1.rst.in -> pipewire-0.3.51.tar.gz/man/pw-cat.1.rst.in
Changed
20
1
2
Don't try to link this node
3
4
<id>
5
- The id of a target node
6
+ The object.serial or the node.name of a target node
7
8
--latency=VALUE*units*
9
Set the node latency (default 100ms)
10
11
If no units are given, the latency value is samples with the samplerate
12
of the file.
13
14
---list-targets
15
- List the available targets for **--target**
16
-
17
-q | --quality=VALUE
18
Resampler quality. When the samplerate of the source or
19
destination file does not match the samplerate of the server, the
20
pipewire-0.3.50.tar.gz/man/pw-top.1.rst.in -> pipewire-0.3.51.tar.gz/man/pw-top.1.rst.in
Changed
112
1
2
The *pw-top* program provides a dynamic real-time view of the pipewire
3
node and device statistics.
4
5
+A hierarchical view is shown of Driver nodes and follower nodes. The Driver
6
+nodes are actively using a timer to schedule dataflow in the followers. The
7
+followers of a driver node as shown below their driver with a + sign in
8
+a tree-like representation.
9
+
10
The columns presented are as follows:
11
12
S
13
14
The ID of the pipewire node/device, as found in *pw-dump*
15
16
QUANT
17
- Current quantum at which the device/node is polled.
18
- See https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/FAQ#pipewire-buffering-explained
19
+ The current quantum (for drivers) and the suggested quantum for follower
20
+ nodes.
21
+
22
+ The quantum by itself needs to be divided by the RATE column to calculate
23
+ the duration of a scheduling period in fractions of a second.
24
+
25
+ For a QUANT of 1024 and a RATE of 48000, the duration of one period in the
26
+ graph is 1024/48000 or 21.3 milliseconds.
27
+
28
+ Follower nodes can have a 0 QUANT field, which means that the node does not
29
+ have a suggestion for the quantum and thus uses what the driver selected.
30
+
31
+ The driver will use the lowest quantum of any of the followers. If none of
32
+ the followers select a quantum, the default quantum in the pipewire configuration
33
+ file will be used.
34
+
35
+ The QUANT on the drivers usually translates directly into the number of audio
36
+ samples processed per processing cycle of the graph.
37
+
38
+ See also https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/FAQ#pipewire-buffering-explained
39
40
RATE
41
- Sample rate used for communicating with this device/node.
42
+ The current rate (for drivers) and the suggested rate for follower
43
+ nodes.
44
+
45
+ This is the rate at which the graph processes data and needs to be combined with
46
+ the QUANT value to derive the duration of a processing cycle in the graph.
47
+
48
+ Some nodes can have a 0 RATE, which means that they don't have any rate
49
+ suggestion for the graph. Nodes that suggest a rate can make the graph switch
50
+ rates if the graph is otherwise idle and the new rate is allowed as
51
+ a possible graph rate (see the pipewire configuration file).
52
+
53
+ The RATE on (audio) driver nodes usually also translates directly to the
54
+ samplerate used by the device. Although some devices might not be able to
55
+ operate at the given samplerate, in which case resampling will need to be
56
+ done.
57
58
WAIT
59
+ The waiting time of a node is the elapsed time between when the node
60
+ is ready to start processing and when it actually started processing.
61
+
62
+ For Driver nodes, this is the time between when the node wakes up to
63
+ start processing the graph and when the driver (and thus also the graph)
64
+ completes a cycle. The WAIT time for driver is thus the elapsed time
65
+ processing the graph.
66
+
67
+ For follower nodes, it is the time spent between being woken up (when all
68
+ dependencies of the node are satisfied) and when processing starts. The
69
+ WAIT time for follower nodes is thus mostly caused by context switching.
70
+
71
+ A value of --- means that the node was not signaled. A value of +++
72
+ means that the node was signaled but not awake.
73
74
BUSY
75
+ The processing time is started when the node starts processing until it
76
+ completes and wakes up the next nodes in the graph.
77
+
78
+ A value of --- means that the node was not started. A value of +++
79
+ means that the node was started but did not complete.
80
81
W/Q
82
Ratio of WAIT / QUANT.
83
84
+ The W/Q time of the driver node is a good measure of the graph
85
+ load. The running averages of the driver W/Q ratios are used as the DSP
86
+ load in other (JACK) tools.
87
+
88
+ Values of --- and +++ are copied from the WAIT column.
89
+
90
B/Q
91
Ratio of BUSY / QUANT
92
93
+ This is a good measure of the load of a particular driver or follower
94
+ node.
95
+
96
+ Values of --- and +++ are copied from the BUSY column.
97
+
98
ERR
99
Total of Xruns and Errors
100
101
+ Xruns for drivers are when the graph did not complete a cycle. This can
102
+ be because a node in the graph also has an Xrun. It can also be caused when
103
+ scheduling delays cause a deadline to be missed, causing a hardware
104
+ Xrun.
105
+
106
+ Xruns for followers are incremented when the node started processing but
107
+ did not complete before the end of the graph cycle deadline.
108
+
109
NAME
110
Name assigned to the device/node, as found in *pw-dump* node.name
111
112
pipewire-0.3.50.tar.gz/meson.build -> pipewire-0.3.51.tar.gz/meson.build
Changed
8
1
2
project('pipewire', 'c' ,
3
- version : '0.3.50',
4
+ version : '0.3.51',
5
license : 'MIT', 'LGPL-2.1-or-later', 'GPL-2.0-only' ,
6
meson_version : '>= 0.59.0',
7
default_options : 'warning_level=3',
8
pipewire-0.3.50.tar.gz/pipewire-alsa/alsa-plugins/ctl_pipewire.c -> pipewire-0.3.51.tar.gz/pipewire-alsa/alsa-plugins/ctl_pipewire.c
Changed
69
1
2
};
3
4
/** device */
5
-static void device_event_info(void *object, const struct pw_device_info *info)
6
+static void device_event_info(void *data, const struct pw_device_info *info)
7
{
8
- struct global *g = object;
9
+ struct global *g = data;
10
snd_ctl_pipewire_t *ctl = g->ctl;
11
uint32_t n;
12
13
14
return NULL;
15
}
16
17
-static void device_event_param(void *object, int seq,
18
+static void device_event_param(void *data, int seq,
19
uint32_t id, uint32_t index, uint32_t next,
20
const struct spa_pod *param)
21
{
22
- struct global *g = object;
23
+ struct global *g = data;
24
snd_ctl_pipewire_t *ctl = g->ctl;
25
26
pw_log_debug("param %d", id);
27
28
};
29
30
/** node */
31
-static void node_event_info(void *object, const struct pw_node_info *info)
32
+static void node_event_info(void *data, const struct pw_node_info *info)
33
{
34
- struct global *g = object;
35
+ struct global *g = data;
36
snd_ctl_pipewire_t *ctl = g->ctl;
37
const char *str;
38
uint32_t i;
39
40
}
41
42
43
-static void node_event_param(void *object, int seq,
44
+static void node_event_param(void *data, int seq,
45
uint32_t id, uint32_t index, uint32_t next,
46
const struct spa_pod *param)
47
{
48
- struct global *g = object;
49
+ struct global *g = data;
50
pw_log_debug("update param %d %d", g->id, id);
51
52
switch (id) {
53
54
return -ENOENT;
55
}
56
57
-static int metadata_property(void *object,
58
+static int metadata_property(void *data,
59
uint32_t subject,
60
const char *key,
61
const char *type,
62
const char *value)
63
{
64
- struct global *g = object;
65
+ struct global *g = data;
66
snd_ctl_pipewire_t *ctl = g->ctl;
67
68
if (subject == PW_ID_CORE) {
69
pipewire-0.3.50.tar.gz/pipewire-alsa/alsa-plugins/pcm_pipewire.c -> pipewire-0.3.51.tar.gz/pipewire-alsa/alsa-plugins/pcm_pipewire.c
Changed
22
1
2
snd_pcm_pipewire_t *pw = io->private_data;
3
snd_pcm_sw_params_t *swparams;
4
const struct spa_pod *params1;
5
- const char *str;
6
uint8_t buffer1024;
7
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
8
struct pw_properties *props;
9
10
pw->stream = NULL;
11
}
12
13
- props = NULL;
14
- if ((str = getenv("PIPEWIRE_PROPS")) != NULL)
15
- props = pw_properties_new_string(str);
16
- if (props == NULL)
17
- props = pw_properties_new(NULL, NULL);
18
+ props = pw_properties_new(NULL, NULL);
19
if (props == NULL)
20
goto error;
21
22
pipewire-0.3.50.tar.gz/pipewire-jack/src/metadata.c -> pipewire-0.3.51.tar.gz/pipewire-jack/src/metadata.c
Changed
80
1
2
prop->type = strdup(type);
3
}
4
5
+static void clear_property(jack_property_t *prop)
6
+{
7
+ free((char*)prop->key);
8
+ free((char*)prop->data);
9
+ free((char*)prop->type);
10
+}
11
+
12
static jack_property_t *copy_properties(jack_property_t *src, uint32_t cnt)
13
{
14
jack_property_t *dst;
15
16
const char *value, const char *type)
17
{
18
jack_property_t *prop;
19
+ void *np;
20
+ size_t ns;
21
22
if (desc->property_cnt == desc->property_size) {
23
- desc->property_size = desc->property_size > 0 ? desc->property_size * 2 : 8;
24
- desc->properties = realloc(desc->properties, sizeof(*prop) * desc->property_size);
25
+ ns = desc->property_size > 0 ? desc->property_size * 2 : 8;
26
+ np = reallocarray(desc->properties, ns, sizeof(*prop));
27
+ if (np == NULL)
28
+ return NULL;
29
+ desc->property_size = ns;
30
+ desc->properties = np;
31
}
32
prop = &desc->propertiesdesc->property_cnt++;
33
set_property(prop, key, value, type);
34
return prop;
35
}
36
37
-static void clear_property(jack_property_t *prop)
38
-{
39
- free((char*)prop->key);
40
- free((char*)prop->data);
41
- free((char*)prop->type);
42
-}
43
-
44
static void remove_property(jack_description_t *desc, jack_property_t *prop)
45
{
46
clear_property(prop);
47
48
} else if (prop == NULL) {
49
if (desc == NULL)
50
desc = add_description(subject);
51
- add_property(desc, key, value, type);
52
- change = PropertyCreated;
53
- changed++;
54
+ if (desc == NULL) {
55
+ changed = -errno;
56
+ pw_log_warn("add_description failed: %m");
57
+ } else if (add_property(desc, key, value, type) == NULL) {
58
+ changed = -errno;
59
+ pw_log_warn("add_property failed: %m");
60
+ } else {
61
+ change = PropertyCreated;
62
+ changed++;
63
+ }
64
} else {
65
changed = change_property(prop, value, type);
66
change = PropertyChanged;
67
68
}
69
pthread_mutex_unlock(&globals.lock);
70
71
- if (c->property_callback && changed) {
72
+ if (c->property_callback && changed > 0) {
73
pw_log_info("emit %lu %s", subject, key);
74
c->property_callback(subject, key, change, c->property_arg);
75
}
76
-
77
return changed;
78
}
79
80
pipewire-0.3.50.tar.gz/pipewire-jack/src/pipewire-jack.c -> pipewire-0.3.51.tar.gz/pipewire-jack/src/pipewire-jack.c
Changed
201
1
2
3
pthread_mutex_t rt_lock;
4
unsigned int rt_locked:1;
5
+ unsigned int data_locked:1;
6
7
unsigned int started:1;
8
unsigned int active:1;
9
10
client->pending_sync = pw_proxy_sync((struct pw_proxy*)client->core, client->pending_sync);
11
12
while (true) {
13
- if (in_data_thread && client->rt_locked)
14
- pthread_mutex_unlock(&client->rt_lock);
15
-
16
+ if (in_data_thread) {
17
+ if (client->rt_locked)
18
+ pthread_mutex_unlock(&client->rt_lock);
19
+ client->data_locked = true;
20
+ }
21
pw_thread_loop_wait(client->context.loop);
22
23
- if (in_data_thread && client->rt_locked)
24
- pthread_mutex_lock(&client->rt_lock);
25
+ if (in_data_thread) {
26
+ client->data_locked = false;
27
+ if (client->rt_locked)
28
+ pthread_mutex_lock(&client->rt_lock);
29
+ }
30
31
if (client->last_res < 0)
32
return client->last_res;
33
34
return NULL;
35
}
36
37
-static int
38
-do_remove_sources(struct spa_loop *loop,
39
- bool async, uint32_t seq, const void *data, size_t size, void *user_data)
40
+static void client_remove_source(struct client *c)
41
{
42
- struct client *c = user_data;
43
-
44
if (c->socket_source) {
45
pw_loop_destroy_source(c->loop->loop, c->socket_source);
46
c->socket_source = NULL;
47
}
48
- return 0;
49
}
50
51
-static void unhandle_socket(struct client *c)
52
+static int
53
+do_remove_sources(struct spa_loop *loop,
54
+ bool async, uint32_t seq, const void *data, size_t size, void *user_data)
55
{
56
- pw_data_loop_invoke(c->loop,
57
- do_remove_sources, 1, NULL, 0, true, c);
58
+ struct client *c = user_data;
59
+ client_remove_source(c);
60
+ return 0;
61
}
62
63
static inline void reuse_buffer(struct client *c, struct mix *mix, uint32_t id)
64
65
if (SPA_UNLIKELY(buffer_frames != c->buffer_frames)) {
66
pw_log_info("%p: bufferframes old:%d new:%d cb:%p", c,
67
c->buffer_frames, buffer_frames, c->bufsize_callback);
68
- pw_loop_invoke(c->context.l, do_buffer_frames, 0,
69
- &buffer_frames, sizeof(buffer_frames), false, c);
70
+ if (c->buffer_frames != (uint32_t)-1)
71
+ pw_loop_invoke(c->context.l, do_buffer_frames, 0,
72
+ &buffer_frames, sizeof(buffer_frames), false, c);
73
+ else
74
+ c->buffer_frames = buffer_frames;
75
}
76
return c->buffer_frames == buffer_frames;
77
}
78
79
80
if (SPA_UNLIKELY(mask & (SPA_IO_ERR | SPA_IO_HUP))) {
81
pw_log_warn("%p: got error", c);
82
- unhandle_socket(c);
83
+ client_remove_source(c);
84
return;
85
}
86
if (SPA_UNLIKELY(c->thread_callback)) {
87
88
static void clear_link(struct client *c, struct link *link)
89
{
90
pw_data_loop_invoke(c->loop,
91
- do_clear_link, 1, NULL, 0, true, link);
92
+ do_clear_link, 1, NULL, 0, !c->data_locked, link);
93
pw_memmap_free(link->mem);
94
close(link->signalfd);
95
spa_list_remove(&link->link);
96
97
if (!c->has_transport)
98
return;
99
100
- unhandle_socket(c);
101
+ pw_data_loop_invoke(c->loop,
102
+ do_remove_sources, 1, NULL, 0, !c->data_locked, c);
103
104
spa_list_consume(l, &c->links, link)
105
clear_link(c, l);
106
107
c->has_transport = false;
108
}
109
110
-static int client_node_transport(void *object,
111
+static int client_node_transport(void *data,
112
int readfd, int writefd,
113
uint32_t mem_id, uint32_t offset, uint32_t size)
114
{
115
- struct client *c = (struct client *) object;
116
+ struct client *c = (struct client *) data;
117
118
clean_transport(c);
119
120
121
return 0;
122
}
123
124
-static int client_node_set_param(void *object,
125
+static int client_node_set_param(void *data,
126
uint32_t id, uint32_t flags,
127
const struct spa_pod *param)
128
{
129
- struct client *c = (struct client *) object;
130
+ struct client *c = (struct client *) data;
131
pw_proxy_error((struct pw_proxy*)c->node, -ENOTSUP, "not supported");
132
return -ENOTSUP;
133
}
134
135
link = find_activation(&c->links, c->driver_id);
136
c->driver_activation = link ? link->activation : NULL;
137
pw_data_loop_invoke(c->loop,
138
- do_update_driver_activation, SPA_ID_INVALID, NULL, 0, true, c);
139
+ do_update_driver_activation, SPA_ID_INVALID, NULL, 0, false, c);
140
install_timeowner(c);
141
142
return 0;
143
}
144
145
-static int client_node_set_io(void *object,
146
+static int client_node_set_io(void *data,
147
uint32_t id,
148
uint32_t mem_id,
149
uint32_t offset,
150
uint32_t size)
151
{
152
- struct client *c = (struct client *) object;
153
+ struct client *c = (struct client *) data;
154
struct pw_memmap *old, *mm;
155
void *ptr;
156
uint32_t tag5 = { c->node_id, id, };
157
158
return 0;
159
}
160
161
-static int client_node_event(void *object, const struct spa_event *event)
162
+static int client_node_event(void *data, const struct spa_event *event)
163
{
164
return -ENOTSUP;
165
}
166
167
-static int client_node_command(void *object, const struct spa_command *command)
168
+static int client_node_command(void *data, const struct spa_command *command)
169
{
170
- struct client *c = (struct client *) object;
171
+ struct client *c = (struct client *) data;
172
173
pw_log_debug("%p: got command %d", c, SPA_COMMAND_TYPE(command));
174
175
176
return 0;
177
}
178
179
-static int client_node_add_port(void *object,
180
+static int client_node_add_port(void *data,
181
enum spa_direction direction,
182
uint32_t port_id, const struct spa_dict *props)
183
{
184
- struct client *c = (struct client *) object;
185
+ struct client *c = (struct client *) data;
186
pw_proxy_error((struct pw_proxy*)c->node, -ENOTSUP, "add port not supported");
187
return -ENOTSUP;
188
}
189
190
-static int client_node_remove_port(void *object,
191
+static int client_node_remove_port(void *data,
192
enum spa_direction direction,
193
uint32_t port_id)
194
{
195
- struct client *c = (struct client *) object;
196
+ struct client *c = (struct client *) data;
197
pw_proxy_error((struct pw_proxy*)c->node, -ENOTSUP, "remove port not supported");
198
return -ENOTSUP;
199
}
200
201
pipewire-0.3.50.tar.gz/pipewire-v4l2/src/pipewire-v4l2.c -> pipewire-0.3.51.tar.gz/pipewire-v4l2/src/pipewire-v4l2.c
Changed
30
1
2
{
3
int res;
4
struct global *g = file->node;
5
- const char *str;
6
struct timespec abstime;
7
const char *error = NULL;
8
uint8_t buffer1024;
9
10
11
disconnect_stream(file);
12
13
- props = NULL;
14
- if ((str = getenv("PIPEWIRE_PROPS")) != NULL)
15
- props = pw_properties_new_string(str);
16
- if (props == NULL)
17
- props = pw_properties_new(NULL, NULL);
18
+ props = pw_properties_new(NULL, NULL);
19
if (props == NULL) {
20
res = -errno;
21
goto exit;
22
23
&file->stream_listener,
24
&stream_events, file);
25
26
+
27
file->error = 0;
28
29
pw_stream_connect(file->stream,
30
pipewire-0.3.50.tar.gz/po/sv.po -> pipewire-0.3.51.tar.gz/po/sv.po
Changed
126
1
2
"Project-Id-Version: pipewire\n"
3
"Report-Msgid-Bugs-To: https://gitlab.freedesktop.org/pipewire/pipewire/-/"
4
"issues\n"
5
-"POT-Creation-Date: 2022-02-13 15:33+0000\n"
6
-"PO-Revision-Date: 2022-02-14 22:57+0100\n"
7
+"POT-Creation-Date: 2022-04-13 15:28+0000\n"
8
+"PO-Revision-Date: 2022-04-15 22:03+0200\n"
9
"Last-Translator: Anders Jonsson <anders.jonsson@norsjovallen.se>\n"
10
"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
11
"Language: sv\n"
12
13
"Plural-Forms: nplurals=2; plural=n != 1;\n"
14
"X-Generator: Poedit 3.0.1\n"
15
16
-#: src/daemon/pipewire.c:45
17
+#: src/daemon/pipewire.c:46
18
#, c-format
19
msgid ""
20
"%s options\n"
21
22
msgid "Start the PipeWire Media System"
23
msgstr "Starta mediasystemet PipeWire"
24
25
-#: src/modules/module-protocol-pulse/modules/module-tunnel-sink.c:188
26
-#: src/modules/module-protocol-pulse/modules/module-tunnel-source.c:188
27
+#: src/modules/module-protocol-pulse/modules/module-tunnel-sink.c:183
28
+#: src/modules/module-protocol-pulse/modules/module-tunnel-source.c:183
29
#, c-format
30
msgid "Tunnel to %s/%s"
31
msgstr "Tunnel till %s/%s"
32
33
msgid "Dummy Output"
34
msgstr "Attrapputgång"
35
36
-#: src/modules/module-pulse-tunnel.c:536
37
+#: src/modules/module-pulse-tunnel.c:545
38
#, c-format
39
msgid "Tunnel for %s@%s"
40
msgstr "Tunnel för %s@%s"
41
42
-#: src/modules/module-zeroconf-discover.c:332
43
+#: src/modules/module-zeroconf-discover.c:313
44
msgid "Unknown device"
45
msgstr "Okänd enhet"
46
47
-#: src/modules/module-zeroconf-discover.c:344
48
+#: src/modules/module-zeroconf-discover.c:325
49
#, c-format
50
msgid "%s on %s@%s"
51
msgstr "%s på %s@%s"
52
53
-#: src/modules/module-zeroconf-discover.c:348
54
+#: src/modules/module-zeroconf-discover.c:329
55
#, c-format
56
msgid "%s on %s"
57
msgstr "%s på %s"
58
59
-#: src/tools/pw-cat.c:1075
60
+#: src/tools/pw-cat.c:867
61
#, c-format
62
msgid ""
63
"%s options <file>\n"
64
65
" -v, --verbose Aktivera utförliga operationer\n"
66
"\n"
67
68
-#: src/tools/pw-cat.c:1082
69
+#: src/tools/pw-cat.c:874
70
#, c-format
71
msgid ""
72
" -R, --remote Remote daemon name\n"
73
74
" or direct samples (256)\n"
75
" the rate is the one of the source "
76
"file\n"
77
-" --list-targets List available targets for --target\n"
78
"\n"
79
msgstr ""
80
" -R, --remote Fjärrdemonnamn\n"
81
82
" Xenhet (enhet = s, ms, us, ns)\n"
83
" eller direkta samplar (256)\n"
84
" hastigheten är källfilens\n"
85
-" --list-targets Lista tillgängliga mål för --target\n"
86
"\n"
87
88
-#: src/tools/pw-cat.c:1100
89
+#: src/tools/pw-cat.c:891
90
#, c-format
91
msgid ""
92
" --rate Sample rate (req. for rec) (default "
93
94
"%d)\n"
95
"\n"
96
97
-#: src/tools/pw-cat.c:1117
98
+#: src/tools/pw-cat.c:908
99
msgid ""
100
" -p, --playback Playback mode\n"
101
" -r, --record Recording mode\n"
102
103
" -d, --dsd DSD-läge\n"
104
"\n"
105
106
-#: src/tools/pw-cli.c:3050
107
+#: src/tools/pw-cli.c:3051
108
#, c-format
109
msgid ""
110
"%s options command\n"
111
112
msgid "Mono Chat + 7.1 Surround"
113
msgstr "Mono Chatt + 7.1 Surround"
114
115
-#: spa/plugins/alsa/acp/alsa-mixer.c:4750
116
+#: spa/plugins/alsa/acp/alsa-mixer.c:4754
117
#, c-format
118
msgid "%s Output"
119
msgstr "%s-utgång"
120
121
-#: spa/plugins/alsa/acp/alsa-mixer.c:4757
122
+#: spa/plugins/alsa/acp/alsa-mixer.c:4761
123
#, c-format
124
msgid "%s Input"
125
msgstr "%s-ingång"
126
pipewire-0.3.50.tar.gz/spa/include/spa/support/thread.h -> pipewire-0.3.51.tar.gz/spa/include/spa/support/thread.h
Changed
36
1
2
uint32_t version;
3
4
/** create a new thread that runs \a start with \a arg */
5
- struct spa_thread * (*create) (void *data, const struct spa_dict *props,
6
+ struct spa_thread * (*create) (void *object, const struct spa_dict *props,
7
void *(*start)(void*), void *arg);
8
/** stop and join a thread */
9
- int (*join)(void *data, struct spa_thread *thread, void **retval);
10
+ int (*join)(void *object, struct spa_thread *thread, void **retval);
11
12
/** get realtime priority range for threads created with \a props */
13
- int (*get_rt_range) (void *data, const struct spa_dict *props, int *min, int *max);
14
+ int (*get_rt_range) (void *object, const struct spa_dict *props, int *min, int *max);
15
/** acquire realtime priority, a priority of -1 refers to the priority
16
* configured in the realtime module
17
*/
18
- int (*acquire_rt) (void *data, struct spa_thread *thread, int priority);
19
+ int (*acquire_rt) (void *object, struct spa_thread *thread, int priority);
20
/** drop realtime priority */
21
- int (*drop_rt) (void *data, struct spa_thread *thread);
22
+ int (*drop_rt) (void *object, struct spa_thread *thread);
23
};
24
25
/** \copydoc spa_thread_utils_methods.create
26
27
return res;
28
}
29
30
+#define SPA_KEY_THREAD_NAME "thread.name" /* the thread name */
31
+#define SPA_KEY_THREAD_STACK_SIZE "thread.stack-size" /* the stack size of the thread */
32
+
33
/**
34
* \}
35
*/
36
pipewire-0.3.50.tar.gz/spa/include/spa/utils/defs.h -> pipewire-0.3.51.tar.gz/spa/include/spa/utils/defs.h
Changed
19
1
2
#define SPA_MEMBER(b,o,t) SPA_PTROFF(b,o,t)
3
#define SPA_MEMBER_ALIGN(b,o,a,t) SPA_PTROFF_ALIGN(b,o,a,t)
4
5
-#define SPA_CONTAINER_OF(p,t,m) (t*)((uintptr_t)p - offsetof (t,m))
6
+#define SPA_CONTAINER_OF(p,t,m) ((t*)((uintptr_t)p - offsetof(t,m)))
7
8
#define SPA_PTRDIFF(p1,p2) ((intptr_t)(p1) - (intptr_t)(p2))
9
10
11
12
#define SPA_PTR_ALIGNMENT(p,align) ((intptr_t)(p) & ((align)-1))
13
#define SPA_IS_ALIGNED(p,align) (SPA_PTR_ALIGNMENT(p,align) == 0)
14
-#define SPA_PTR_ALIGN(p,align,type) (type*)SPA_ROUND_UP_N((intptr_t)(p), (intptr_t)(align))
15
+#define SPA_PTR_ALIGN(p,align,type) ((type*)SPA_ROUND_UP_N((intptr_t)(p), (intptr_t)(align)))
16
17
#ifndef SPA_LIKELY
18
#ifdef __GNUC__
19
pipewire-0.3.50.tar.gz/spa/include/spa/utils/json.h -> pipewire-0.3.51.tar.gz/spa/include/spa/utils/json.h
Changed
69
1
2
return len > 1 && *val == '"';
3
}
4
5
+static inline int spa_json_parse_hex(const char *p, int num, uint32_t *res)
6
+{
7
+ int i;
8
+ *res = 0;
9
+ for (i = 0; i < num; i++) {
10
+ char v = pi;
11
+ if (v >= '0' && v <= '9')
12
+ v = v - '0';
13
+ else if (v >= 'a' && v <= 'f')
14
+ v = v - 'a' + 10;
15
+ else if (v >= 'A' && v <= 'F')
16
+ v = v - 'A' + 10;
17
+ else
18
+ return -1;
19
+ *res = (*res << 4) | v;
20
+ }
21
+ return 1;
22
+}
23
+
24
static inline int spa_json_parse_stringn(const char *val, int len, char *result, int maxlen)
25
{
26
const char *p;
27
28
else if (*p == 'f')
29
*result++ = '\f';
30
else if (*p == 'u') {
31
- char *end;
32
- uint16_t v = strtol(p+1, &end, 16);
33
- if (p+1 == end) {
34
+ uint8_t prefix = { 0, 0xc0, 0xe0, 0xf0 };
35
+ uint32_t idx, n, v, cp, enc = { 0x80, 0x800, 0x10000 };
36
+ if (val + len - p < 5 ||
37
+ spa_json_parse_hex(p+1, 4, &cp) < 0) {
38
*result++ = *p;
39
- } else {
40
- p = end-1;
41
- if (v > 0xff)
42
- *result++ = (v >> 8) & 0xff;
43
- *result++ = v & 0xff;
44
+ continue;
45
}
46
+ p += 4;
47
+
48
+ if (cp >= 0xd800 && cp <= 0xdbff) {
49
+ if (val + len - p < 7 ||
50
+ p1 != '\\' || p2 != 'u' ||
51
+ spa_json_parse_hex(p+3, 4, &v) < 0 ||
52
+ v < 0xdc00 || v > 0xdfff)
53
+ continue;
54
+ p += 6;
55
+ cp = 0x010000 | ((cp & 0x3ff) << 10) | (v & 0x3ff);
56
+ } else if (cp >= 0xdc00 && cp <= 0xdfff)
57
+ continue;
58
+
59
+ for (idx = 0; idx < 3; idx++)
60
+ if (cp < encidx)
61
+ break;
62
+ for (n = idx; n > 0; n--, cp >>= 6)
63
+ resultn = (cp | 0x80) & 0xbf;
64
+ *result++ = (cp | prefixidx) & 0xff;
65
+ result += idx;
66
} else
67
*result++ = *p;
68
} else if (*p == '\"') {
69
pipewire-0.3.50.tar.gz/spa/include/spa/utils/string.h -> pipewire-0.3.51.tar.gz/spa/include/spa/utils/string.h
Changed
27
1
2
static inline float spa_strtof(const char *str, char **endptr)
3
{
4
static locale_t locale = NULL;
5
+ locale_t prev;
6
float v;
7
if (SPA_UNLIKELY(locale == NULL))
8
locale = newlocale(LC_ALL_MASK, "C", NULL);
9
- locale_t prev = uselocale(locale);
10
+ prev = uselocale(locale);
11
v = strtof(str, endptr);
12
uselocale(prev);
13
return v;
14
15
static inline double spa_strtod(const char *str, char **endptr)
16
{
17
static locale_t locale = NULL;
18
+ locale_t prev;
19
double v;
20
if (SPA_UNLIKELY(locale == NULL))
21
locale = newlocale(LC_ALL_MASK, "C", NULL);
22
- locale_t prev = uselocale(locale);
23
+ prev = uselocale(locale);
24
v = strtod(str, endptr);
25
uselocale(prev);
26
return v;
27
pipewire-0.3.50.tar.gz/spa/plugins/aec/aec-null.c -> pipewire-0.3.51.tar.gz/spa/plugins/aec/aec-null.c
Changed
22
1
2
#undef SPA_LOG_TOPIC_DEFAULT
3
#define SPA_LOG_TOPIC_DEFAULT &log_topic
4
5
-static int null_init(void *data, const struct spa_dict *args, const struct spa_audio_info_raw *info)
6
+static int null_init(void *object, const struct spa_dict *args, const struct spa_audio_info_raw *info)
7
{
8
- struct impl *impl = data;
9
+ struct impl *impl = object;
10
impl->channels = info->channels;
11
return 0;
12
}
13
14
-static int null_run(void *data, const float *rec, const float *play, float *out, uint32_t n_samples)
15
+static int null_run(void *object, const float *rec, const float *play, float *out, uint32_t n_samples)
16
{
17
- struct impl *impl = data;
18
+ struct impl *impl = object;
19
uint32_t i;
20
for (i = 0; i < impl->channels; i++)
21
memcpy(outi, reci, n_samples * sizeof(float));
22
pipewire-0.3.50.tar.gz/spa/plugins/alsa/alsa-pcm.c -> pipewire-0.3.51.tar.gz/spa/plugins/alsa/alsa-pcm.c
Changed
10
1
2
SPA_PROP_INFO_name, SPA_POD_String("latency.internal.ns"),
3
SPA_PROP_INFO_description, SPA_POD_String("Internal latency in nanoseconds"),
4
SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Long(state->process_latency.ns,
5
- 0, 2 * SPA_NSEC_PER_SEC),
6
+ 0LL, 2 * SPA_NSEC_PER_SEC),
7
SPA_PROP_INFO_params, SPA_POD_Bool(true));
8
break;
9
case 15:
10
pipewire-0.3.50.tar.gz/spa/plugins/alsa/test-timer.c -> pipewire-0.3.51.tar.gz/spa/plugins/alsa/test-timer.c
Changed
10
1
2
snd_pcm_hw_params_t *hparams;
3
snd_pcm_sw_params_t *sparams;
4
struct timespec now;
5
- char c;
6
+ int c;
7
static const struct option long_options = {
8
{ "help", no_argument, NULL, 'h' },
9
{ "device", required_argument, NULL, 'D' },
10
pipewire-0.3.50.tar.gz/spa/plugins/audioconvert/channelmix-ops-c.c -> pipewire-0.3.51.tar.gz/spa/plugins/audioconvert/channelmix-ops-c.c
Changed
32
1
2
}
3
}
4
5
-static inline void add_c(float *d, const float *s0, const float *s1, uint32_t n_samples)
6
+static inline void avg_c(float *d, const float *s0, const float *s1, uint32_t n_samples)
7
{
8
uint32_t n;
9
for (n = 0; n < n_samples; n++)
10
- dn = s0n + s1n;
11
+ dn = (s0n + s1n) * 0.5f;
12
}
13
14
static inline void sub_c(float *d, const float *s0, const float *s1, uint32_t n_samples)
15
16
if (mix->widen == 0.0f) {
17
vol_c(d0, s0, v0, n_samples);
18
vol_c(d1, s1, v1, n_samples);
19
- add_c(d2, s0, s1, n_samples);
20
+ avg_c(d2, s0, s1, n_samples);
21
} else {
22
for (n = 0; n < n_samples; n++) {
23
float c = s0n + s1n;
24
float w = c * mix->widen;
25
d0n = (s0n - w) * v0;
26
d1n = (s1n - w) * v1;
27
- d2n = c;
28
+ d2n = c * 0.5f;
29
}
30
}
31
lr4_process(&mix->lr43, d3, d2, v3, n_samples);
32
pipewire-0.3.50.tar.gz/spa/plugins/audioconvert/resample.c -> pipewire-0.3.51.tar.gz/spa/plugins/audioconvert/resample.c
Changed
51
1
2
return outio->status = inio->status;
3
}
4
inio->buffer_id = 0;
5
- inport->buffers0.outbuf->datas0.chunk->size = 0;
6
+ inport->buffers0.outbuf->datas0.chunk->size = -1;
7
}
8
9
if (SPA_UNLIKELY(inio->buffer_id >= inport->n_buffers))
10
11
sb = sbuf->outbuf;
12
db = dbuf->outbuf;
13
14
- size = sb->datas0.chunk->size;
15
maxsize = db->datas0.maxsize;
16
17
if (SPA_LIKELY(this->io_position)) {
18
19
src_datas = alloca(sizeof(void*) * this->resample.channels);
20
dst_datas = alloca(sizeof(void*) * this->resample.channels);
21
22
- if (inport->offset > size)
23
- inport->offset = size;
24
if (outport->offset > maxsize)
25
outport->offset = maxsize;
26
27
- if (size == 0) {
28
+ size = sb->datas0.chunk->size;
29
+ if (size == (uint32_t)-1) {
30
size = sb->datas0.maxsize;
31
memset(sb->datas0.data, 0, size);
32
for (i = 0; i < sb->n_datas; i++)
33
34
inport->offset = 0;
35
flush_in = draining = true;
36
} else {
37
+ size = SPA_MIN(size, sb->datas0.maxsize);
38
+ if (inport->offset > size)
39
+ inport->offset = size;
40
for (i = 0; i < sb->n_datas; i++)
41
src_datasi = SPA_PTROFF(sb->datasi.data, inport->offset, void);
42
}
43
44
in_len = (size - inport->offset) / sizeof(float);
45
out_len = (maxsize - outport->offset) / sizeof(float);
46
47
-
48
#ifndef FASTPATH
49
pin_len = in_len;
50
pout_len = out_len;
51
pipewire-0.3.50.tar.gz/spa/plugins/bluez5/bluez-hardware.conf -> pipewire-0.3.51.tar.gz/spa/plugins/bluez5/bluez-hardware.conf
Changed
9
1
2
{ name = "Motorola S305", no-features = sbc-xq }, # #pipewire-1590
3
{ name = "Soundcore Life P2-L", no-features = msbc-alt1, msbc-alt1-rtl },
4
{ name = "SoundCore mini", no-features = hw-volume }, # #pipewire-1686
5
+ { name = "SoundCore 2", no-features = sbc-xq }, # #pipewire-2291
6
{ name = "Tribit MAXSound Plus", no-features = hw-volume }, # #pipewire-1592
7
{ name = "Urbanista Stockholm Plus", no-features = msbc-alt1, msbc-alt1-rtl },
8
9
pipewire-0.3.50.tar.gz/spa/plugins/bluez5/bluez5-dbus.c -> pipewire-0.3.51.tar.gz/spa/plugins/bluez5/bluez5-dbus.c
Changed
22
1
2
if (connected)
3
spa_bt_device_check_profiles(device, false);
4
else {
5
+ /* Stop codec switch on disconnect */
6
+ struct spa_bt_a2dp_codec_switch *sw;
7
+ spa_list_consume(sw, &device->codec_switch_list, device_link)
8
+ a2dp_codec_switch_free(sw);
9
+
10
if (device->reconnect_state != BT_DEVICE_RECONNECT_INIT)
11
device_stop_timer(device);
12
device_connected(monitor, device, BT_DEVICE_DISCONNECTED);
13
14
if (j >= size) {
15
const struct a2dp_codec **p;
16
size = size * 2;
17
- p = realloc(supported_codecs, size * sizeof(const struct a2dp_codec *));
18
+ p = reallocarray(supported_codecs, size, sizeof(const struct a2dp_codec *));
19
if (p == NULL) {
20
free(supported_codecs);
21
return NULL;
22
pipewire-0.3.50.tar.gz/spa/plugins/bluez5/bluez5-device.c -> pipewire-0.3.51.tar.gz/spa/plugins/bluez5/bluez5-device.c
Changed
10
1
2
struct spa_bt_transport *t;
3
int i;
4
5
+ this->switching_codec = false;
6
+
7
if (this->supported_codecs)
8
free(this->supported_codecs);
9
this->supported_codecs = spa_bt_device_get_supported_a2dp_codecs(
10
pipewire-0.3.50.tar.gz/src/daemon/filter-chain/sink-eq6.conf -> pipewire-0.3.51.tar.gz/src/daemon/filter-chain/sink-eq6.conf
Changed
10
1
2
{ output = "eq_band_5:Out" input = "eq_band_6:In" }
3
4
}
5
+ audio.channels = 2
6
+ audio.position = FL FR
7
capture.props = {
8
node.name = "effect_input.eq6"
9
media.class = Audio/Sink
10
pipewire-0.3.50.tar.gz/src/examples/export-spa.c -> pipewire-0.3.51.tar.gz/src/examples/export-spa.c
Changed
13
1
2
uint32_t id;
3
};
4
5
-static void proxy_event_bound(void *object, uint32_t global_id)
6
+static void proxy_event_bound(void *_data, uint32_t global_id)
7
{
8
- struct data *data = object;
9
+ struct data *data = _data;
10
if (data->id != global_id) {
11
printf("node id: %u\n", global_id);
12
data->id = global_id;
13
pipewire-0.3.50.tar.gz/src/gst/gstpipewirecore.c -> pipewire-0.3.51.tar.gz/src/gst/gstpipewirecore.c
Changed
13
1
2
pw_thread_loop_signal(core->loop, FALSE);
3
}
4
5
-static void on_core_done (void *object, uint32_t id, int seq)
6
+static void on_core_done (void *data, uint32_t id, int seq)
7
{
8
- GstPipeWireCore * core = object;
9
+ GstPipeWireCore * core = data;
10
if (id == PW_ID_CORE) {
11
core->last_seq = seq;
12
pw_thread_loop_signal (core->loop, FALSE);
13
pipewire-0.3.50.tar.gz/src/modules/meson.build -> pipewire-0.3.51.tar.gz/src/modules/meson.build
Changed
17
1
2
'module-pulse-tunnel.c',
3
'module-rt.c',
4
'module-raop-discover.c',
5
+ 'module-raop-sink.c',
6
'module-session-manager.c',
7
'module-zeroconf-discover.c',
8
'module-roc-source.c',
9
10
'module-protocol-pulse/modules/module-remap-sink.c',
11
'module-protocol-pulse/modules/module-remap-source.c',
12
'module-protocol-pulse/modules/module-roc-sink.c',
13
+ 'module-protocol-pulse/modules/module-roc-sink-input.c',
14
'module-protocol-pulse/modules/module-roc-source.c',
15
'module-protocol-pulse/modules/module-simple-protocol-tcp.c',
16
'module-protocol-pulse/modules/module-switch-on-connect.c',
17
pipewire-0.3.50.tar.gz/src/modules/module-client-device/protocol-native.c -> pipewire-0.3.51.tar.gz/src/modules/module-client-device/protocol-native.c
Changed
104
1
2
return 0;
3
}
4
5
-static void device_marshal_info(void *object,
6
+static void device_marshal_info(void *data,
7
const struct spa_device_info *info)
8
{
9
- struct pw_proxy *proxy = object;
10
+ struct pw_proxy *proxy = data;
11
struct spa_pod_builder *b;
12
struct spa_pod_frame f2;
13
uint32_t i, n_items;
14
15
pw_protocol_native_end_proxy(proxy, b);
16
}
17
18
-static int device_demarshal_info(void *object,
19
+static int device_demarshal_info(void *data,
20
const struct pw_protocol_native_message *msg)
21
{
22
- struct pw_resource *resource = object;
23
+ struct pw_resource *resource = data;
24
struct spa_pod_parser prs;
25
struct spa_pod *ipod;
26
struct spa_device_info info = SPA_DEVICE_INFO_INIT(), *infop;
27
28
return 0;
29
}
30
31
-static void device_marshal_result(void *object,
32
+static void device_marshal_result(void *data,
33
int seq, int res, uint32_t type, const void *result)
34
{
35
- struct pw_proxy *proxy = object;
36
+ struct pw_proxy *proxy = data;
37
struct spa_pod_builder *b;
38
struct spa_pod_frame f2;
39
40
41
pw_protocol_native_end_proxy(proxy, b);
42
}
43
44
-static int device_demarshal_result(void *object,
45
+static int device_demarshal_result(void *data,
46
const struct pw_protocol_native_message *msg)
47
{
48
- struct pw_resource *resource = object;
49
+ struct pw_resource *resource = data;
50
struct spa_pod_parser prs;
51
struct spa_pod_frame f1;
52
int seq, res;
53
54
return 0;
55
}
56
57
-static void device_marshal_event(void *object, const struct spa_event *event)
58
+static void device_marshal_event(void *data, const struct spa_event *event)
59
{
60
- struct pw_proxy *proxy = object;
61
+ struct pw_proxy *proxy = data;
62
struct spa_pod_builder *b;
63
64
b = pw_protocol_native_begin_proxy(proxy, SPA_DEVICE_EVENT_EVENT, NULL);
65
66
pw_protocol_native_end_proxy(proxy, b);
67
}
68
69
-static int device_demarshal_event(void *object,
70
+static int device_demarshal_event(void *data,
71
const struct pw_protocol_native_message *msg)
72
{
73
- struct pw_resource *resource = object;
74
+ struct pw_resource *resource = data;
75
struct spa_pod_parser prs;
76
struct spa_event *event;
77
78
79
return 0;
80
}
81
82
-static void device_marshal_object_info(void *object, uint32_t id,
83
+static void device_marshal_object_info(void *data, uint32_t id,
84
const struct spa_device_object_info *info)
85
{
86
- struct pw_proxy *proxy = object;
87
+ struct pw_proxy *proxy = data;
88
struct spa_pod_builder *b;
89
struct spa_pod_frame f2;
90
uint32_t i, n_items;
91
92
pw_protocol_native_end_proxy(proxy, b);
93
}
94
95
-static int device_demarshal_object_info(void *object,
96
+static int device_demarshal_object_info(void *data,
97
const struct pw_protocol_native_message *msg)
98
{
99
- struct pw_resource *resource = object;
100
+ struct pw_resource *resource = data;
101
struct spa_pod_parser prs;
102
struct spa_device_object_info info = SPA_DEVICE_OBJECT_INFO_INIT(), *infop;
103
struct spa_pod *ipod;
104
pipewire-0.3.50.tar.gz/src/modules/module-client-node/client-node.c -> pipewire-0.3.51.tar.gz/src/modules/module-client-node/client-node.c
Changed
152
1
2
struct buffer buffersMAX_BUFFERS;
3
};
4
5
+struct params {
6
+ uint32_t n_params;
7
+ struct spa_pod **params;
8
+};
9
+
10
struct port {
11
struct pw_impl_port *port;
12
struct node *node;
13
14
struct spa_port_info info;
15
struct pw_properties *properties;
16
17
- uint32_t n_params;
18
- struct spa_pod **params;
19
+ struct params params;
20
21
unsigned int removed:1;
22
unsigned int destroyed:1;
23
24
25
struct port dummy;
26
27
- uint32_t n_params;
28
- struct spa_pod **params;
29
+ struct params params;
30
};
31
32
struct impl {
33
34
#define pw_client_node_resource_port_set_mix_info(r,...) \
35
pw_client_node_resource(r,port_set_mix_info,1,__VA_ARGS__)
36
37
+static int update_params(struct params *p, uint32_t n_params, const struct spa_pod **params)
38
+{
39
+ uint32_t i;
40
+ for (i = 0; i < p->n_params; i++)
41
+ free(p->paramsi);
42
+ p->n_params = n_params;
43
+ if (p->n_params == 0) {
44
+ free(p->params);
45
+ p->params = NULL;
46
+ } else {
47
+ struct spa_pod **np;
48
+ np = reallocarray(p->params, p->n_params, sizeof(struct spa_pod *));
49
+ if (np == NULL) {
50
+ pw_log_error("%p: can't realloc: %m", p);
51
+ free(p->params);
52
+ p->params = NULL;
53
+ p->n_params = 0;
54
+ return -errno;
55
+ }
56
+ p->params = np;
57
+ }
58
+ for (i = 0; i < p->n_params; i++)
59
+ p->paramsi = paramsi ? spa_pod_copy(paramsi) : NULL;
60
+ return 0;
61
+}
62
+
63
static int
64
do_port_use_buffers(struct impl *impl,
65
enum spa_direction direction,
66
67
struct spa_pod *param;
68
69
result.index = result.next++;
70
- if (result.index >= this->n_params)
71
+ if (result.index >= this->params.n_params)
72
break;
73
74
- param = this->paramsresult.index;
75
+ param = this->params.paramsresult.index;
76
77
if (param == NULL || !spa_pod_is_object_id(param, id))
78
continue;
79
80
const struct spa_pod **params,
81
const struct spa_port_info *info)
82
{
83
- uint32_t i;
84
-
85
if (change_mask & PW_CLIENT_NODE_PORT_UPDATE_PARAMS) {
86
spa_log_debug(this->log, "%p: port %u update %d params", this, port->id, n_params);
87
- for (i = 0; i < port->n_params; i++)
88
- free(port->paramsi);
89
- port->n_params = n_params;
90
- port->params = realloc(port->params, port->n_params * sizeof(struct spa_pod *));
91
- for (i = 0; i < port->n_params; i++) {
92
- port->paramsi = paramsi ? spa_pod_copy(paramsi) : NULL;
93
- }
94
+ update_params(&port->params, n_params, params);
95
}
96
97
if (change_mask & PW_CLIENT_NODE_PORT_UPDATE_INFO) {
98
99
spa_return_val_if_fail(port != NULL, -EINVAL);
100
101
pw_log_debug("%p: seq:%d port %d.%d id:%u start:%u num:%u n_params:%d",
102
- this, seq, direction, port_id, id, start, num, port->n_params);
103
+ this, seq, direction, port_id, id, start, num, port->params.n_params);
104
105
result.id = id;
106
result.next = 0;
107
108
struct spa_pod *param;
109
110
result.index = result.next++;
111
- if (result.index >= port->n_params)
112
+ if (result.index >= port->params.n_params)
113
break;
114
115
- param = port->paramsresult.index;
116
+ param = port->params.paramsresult.index;
117
118
if (param == NULL || !spa_pod_is_object_id(param, id))
119
continue;
120
121
struct node *this = &impl->node;
122
123
if (change_mask & PW_CLIENT_NODE_UPDATE_PARAMS) {
124
- uint32_t i;
125
pw_log_debug("%p: update %d params", this, n_params);
126
-
127
- for (i = 0; i < this->n_params; i++)
128
- free(this->paramsi);
129
- this->n_params = n_params;
130
- this->params = realloc(this->params, this->n_params * sizeof(struct spa_pod *));
131
-
132
- for (i = 0; i < this->n_params; i++)
133
- this->paramsi = paramsi ? spa_pod_copy(paramsi) : NULL;
134
+ update_params(&this->params, n_params, params);
135
}
136
if (change_mask & PW_CLIENT_NODE_UPDATE_INFO) {
137
spa_node_emit_info(&this->hooks, info);
138
139
140
static int node_clear(struct node *this)
141
{
142
- uint32_t i;
143
-
144
- for (i = 0; i < this->n_params; i++)
145
- free(this->paramsi);
146
- free(this->params);
147
-
148
+ update_params(&this->params, 0, NULL);
149
return 0;
150
}
151
152
pipewire-0.3.50.tar.gz/src/modules/module-client-node/protocol-native.c -> pipewire-0.3.51.tar.gz/src/modules/module-client-node/protocol-native.c
Changed
201
1
2
return pw_protocol_native_end_proxy(proxy, b);
3
}
4
5
-static int client_node_demarshal_transport(void *object, const struct pw_protocol_native_message *msg)
6
+static int client_node_demarshal_transport(void *data, const struct pw_protocol_native_message *msg)
7
{
8
- struct pw_proxy *proxy = object;
9
+ struct pw_proxy *proxy = data;
10
struct spa_pod_parser prs;
11
uint32_t mem_id, offset, sz;
12
int64_t ridx, widx;
13
14
return 0;
15
}
16
17
-static int client_node_demarshal_set_param(void *object, const struct pw_protocol_native_message *msg)
18
+static int client_node_demarshal_set_param(void *data, const struct pw_protocol_native_message *msg)
19
{
20
- struct pw_proxy *proxy = object;
21
+ struct pw_proxy *proxy = data;
22
struct spa_pod_parser prs;
23
uint32_t id, flags;
24
const struct spa_pod *param = NULL;
25
26
return 0;
27
}
28
29
-static int client_node_demarshal_event_event(void *object, const struct pw_protocol_native_message *msg)
30
+static int client_node_demarshal_event_event(void *data, const struct pw_protocol_native_message *msg)
31
{
32
- struct pw_proxy *proxy = object;
33
+ struct pw_proxy *proxy = data;
34
struct spa_pod_parser prs;
35
const struct spa_event *event;
36
37
38
return 0;
39
}
40
41
-static int client_node_demarshal_command(void *object, const struct pw_protocol_native_message *msg)
42
+static int client_node_demarshal_command(void *data, const struct pw_protocol_native_message *msg)
43
{
44
- struct pw_proxy *proxy = object;
45
+ struct pw_proxy *proxy = data;
46
struct spa_pod_parser prs;
47
const struct spa_command *command;
48
49
50
return 0;
51
}
52
53
-static int client_node_demarshal_add_port(void *object, const struct pw_protocol_native_message *msg)
54
+static int client_node_demarshal_add_port(void *data, const struct pw_protocol_native_message *msg)
55
{
56
- struct pw_proxy *proxy = object;
57
+ struct pw_proxy *proxy = data;
58
struct spa_pod_parser prs;
59
struct spa_pod_frame f2;
60
int32_t direction, port_id;
61
62
return 0;
63
}
64
65
-static int client_node_demarshal_remove_port(void *object, const struct pw_protocol_native_message *msg)
66
+static int client_node_demarshal_remove_port(void *data, const struct pw_protocol_native_message *msg)
67
{
68
- struct pw_proxy *proxy = object;
69
+ struct pw_proxy *proxy = data;
70
struct spa_pod_parser prs;
71
int32_t direction, port_id;
72
73
74
return 0;
75
}
76
77
-static int client_node_demarshal_port_set_param(void *object, const struct pw_protocol_native_message *msg)
78
+static int client_node_demarshal_port_set_param(void *data, const struct pw_protocol_native_message *msg)
79
{
80
- struct pw_proxy *proxy = object;
81
+ struct pw_proxy *proxy = data;
82
struct spa_pod_parser prs;
83
uint32_t direction, port_id, id, flags;
84
const struct spa_pod *param = NULL;
85
86
return 0;
87
}
88
89
-static int client_node_demarshal_port_use_buffers(void *object, const struct pw_protocol_native_message *msg)
90
+static int client_node_demarshal_port_use_buffers(void *data, const struct pw_protocol_native_message *msg)
91
{
92
- struct pw_proxy *proxy = object;
93
+ struct pw_proxy *proxy = data;
94
struct spa_pod_parser prs;
95
struct spa_pod_frame f;
96
uint32_t direction, port_id, mix_id, flags, n_buffers, data_id;
97
98
return 0;
99
}
100
101
-static int client_node_demarshal_port_set_io(void *object, const struct pw_protocol_native_message *msg)
102
+static int client_node_demarshal_port_set_io(void *data, const struct pw_protocol_native_message *msg)
103
{
104
- struct pw_proxy *proxy = object;
105
+ struct pw_proxy *proxy = data;
106
struct spa_pod_parser prs;
107
uint32_t direction, port_id, mix_id, id, memid, off, sz;
108
109
110
return 0;
111
}
112
113
-static int client_node_demarshal_set_activation(void *object, const struct pw_protocol_native_message *msg)
114
+static int client_node_demarshal_set_activation(void *data, const struct pw_protocol_native_message *msg)
115
{
116
- struct pw_proxy *proxy = object;
117
+ struct pw_proxy *proxy = data;
118
struct spa_pod_parser prs;
119
uint32_t node_id, memid, off, sz;
120
int64_t sigidx;
121
122
return 0;
123
}
124
125
-static int client_node_demarshal_port_set_mix_info(void *object, const struct pw_protocol_native_message *msg)
126
+static int client_node_demarshal_port_set_mix_info(void *data, const struct pw_protocol_native_message *msg)
127
{
128
- struct pw_proxy *proxy = object;
129
+ struct pw_proxy *proxy = data;
130
struct spa_pod_parser prs;
131
uint32_t direction, port_id, mix_id, peer_id;
132
struct spa_pod_frame f2;
133
134
return 0;
135
}
136
137
-static int client_node_demarshal_set_io(void *object, const struct pw_protocol_native_message *msg)
138
+static int client_node_demarshal_set_io(void *data, const struct pw_protocol_native_message *msg)
139
{
140
- struct pw_proxy *proxy = object;
141
+ struct pw_proxy *proxy = data;
142
struct spa_pod_parser prs;
143
uint32_t id, memid, off, sz;
144
145
146
return 0;
147
}
148
149
-static int client_node_marshal_transport(void *object, int readfd, int writefd,
150
+static int client_node_marshal_transport(void *data, int readfd, int writefd,
151
uint32_t mem_id, uint32_t offset, uint32_t size)
152
{
153
struct pw_protocol_native_message *msg;
154
- struct pw_resource *resource = object;
155
+ struct pw_resource *resource = data;
156
struct spa_pod_builder *b;
157
158
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_EVENT_TRANSPORT, &msg);
159
160
}
161
162
static int
163
-client_node_marshal_set_param(void *object, uint32_t id, uint32_t flags,
164
+client_node_marshal_set_param(void *data, uint32_t id, uint32_t flags,
165
const struct spa_pod *param)
166
{
167
- struct pw_resource *resource = object;
168
+ struct pw_resource *resource = data;
169
struct spa_pod_builder *b;
170
171
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_EVENT_SET_PARAM, NULL);
172
173
return pw_protocol_native_end_resource(resource, b);
174
}
175
176
-static int client_node_marshal_event_event(void *object, const struct spa_event *event)
177
+static int client_node_marshal_event_event(void *data, const struct spa_event *event)
178
{
179
- struct pw_resource *resource = object;
180
+ struct pw_resource *resource = data;
181
struct spa_pod_builder *b;
182
183
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_EVENT_EVENT, NULL);
184
185
}
186
187
static int
188
-client_node_marshal_command(void *object, const struct spa_command *command)
189
+client_node_marshal_command(void *data, const struct spa_command *command)
190
{
191
- struct pw_resource *resource = object;
192
+ struct pw_resource *resource = data;
193
struct spa_pod_builder *b;
194
195
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE_EVENT_COMMAND, NULL);
196
197
}
198
199
static int
200
-client_node_marshal_add_port(void *object,
201
pipewire-0.3.50.tar.gz/src/modules/module-client-node/remote-node.c -> pipewire-0.3.51.tar.gz/src/modules/module-client-node/remote-node.c
Changed
188
1
2
}
3
4
5
-static int client_node_transport(void *object,
6
+static int client_node_transport(void *_data,
7
int readfd, int writefd, uint32_t mem_id, uint32_t offset, uint32_t size)
8
{
9
- struct node_data *data = object;
10
+ struct node_data *data = _data;
11
struct pw_proxy *proxy = (struct pw_proxy*)data->client_node;
12
13
clean_transport(data);
14
15
res = spa_node_enum_params_sync(node->node,
16
id, &idx, NULL, ¶m, &b.b);
17
if (res == 1) {
18
- params = realloc(params, sizeof(struct spa_pod *) * (n_params + 1));
19
- paramsn_params++ = spa_pod_copy(param);
20
+ void *p;
21
+ p = reallocarray(params, n_params + 1, sizeof(struct spa_pod *));
22
+ if (p == NULL) {
23
+ res = -errno;
24
+ pw_log_error("realloc failed: %m");
25
+ } else {
26
+ params = p;
27
+ paramsn_params++ = spa_pod_copy(param);
28
+ }
29
}
30
spa_pod_dynamic_builder_clean(&b);
31
if (res != 1)
32
33
port->direction, port->port_id,
34
id, &idx, NULL, ¶m, &b.b);
35
if (res == 1) {
36
- params = realloc(params, sizeof(struct spa_pod *) * (n_params + 1));
37
- paramsn_params++ = spa_pod_copy(param);
38
+ void *p;
39
+ p = reallocarray(params, n_params + 1, sizeof(struct spa_pod*));
40
+ if (p == NULL) {
41
+ res = -errno;
42
+ pw_log_error("realloc failed: %m");
43
+ } else {
44
+ params = p;
45
+ paramsn_params++ = spa_pod_copy(param);
46
+ }
47
}
48
spa_pod_dynamic_builder_clean(&b);
49
50
51
}
52
53
static int
54
-client_node_set_param(void *object, uint32_t id, uint32_t flags,
55
+client_node_set_param(void *_data, uint32_t id, uint32_t flags,
56
const struct spa_pod *param)
57
{
58
- struct node_data *data = object;
59
+ struct node_data *data = _data;
60
struct pw_proxy *proxy = (struct pw_proxy*)data->client_node;
61
int res;
62
63
64
}
65
66
static int
67
-client_node_set_io(void *object,
68
+client_node_set_io(void *_data,
69
uint32_t id,
70
uint32_t memid,
71
uint32_t offset,
72
uint32_t size)
73
{
74
- struct node_data *data = object;
75
+ struct node_data *data = _data;
76
struct pw_proxy *proxy = (struct pw_proxy*)data->client_node;
77
struct pw_memmap *old, *mm;
78
void *ptr;
79
80
return res;
81
}
82
83
-static int client_node_event(void *object, const struct spa_event *event)
84
+static int client_node_event(void *data, const struct spa_event *event)
85
{
86
pw_log_warn("unhandled node event %d", SPA_EVENT_TYPE(event));
87
return -ENOTSUP;
88
}
89
90
-static int client_node_command(void *object, const struct spa_command *command)
91
+static int client_node_command(void *_data, const struct spa_command *command)
92
{
93
- struct node_data *data = object;
94
+ struct node_data *data = _data;
95
struct pw_proxy *proxy = (struct pw_proxy*)data->client_node;
96
int res;
97
98
99
}
100
101
static int
102
-client_node_add_port(void *object, enum spa_direction direction, uint32_t port_id,
103
+client_node_add_port(void *_data, enum spa_direction direction, uint32_t port_id,
104
const struct spa_dict *props)
105
{
106
- struct node_data *data = object;
107
+ struct node_data *data = _data;
108
struct pw_proxy *proxy = (struct pw_proxy*)data->client_node;
109
pw_log_warn("add port not supported");
110
pw_proxy_error(proxy, -ENOTSUP, "add port not supported");
111
112
}
113
114
static int
115
-client_node_remove_port(void *object, enum spa_direction direction, uint32_t port_id)
116
+client_node_remove_port(void *_data, enum spa_direction direction, uint32_t port_id)
117
{
118
- struct node_data *data = object;
119
+ struct node_data *data = _data;
120
struct pw_proxy *proxy = (struct pw_proxy*)data->client_node;
121
pw_log_warn("remove port not supported");
122
pw_proxy_error(proxy, -ENOTSUP, "remove port not supported");
123
124
}
125
126
static int
127
-client_node_port_set_param(void *object,
128
+client_node_port_set_param(void *_data,
129
enum spa_direction direction, uint32_t port_id,
130
uint32_t id, uint32_t flags,
131
const struct spa_pod *param)
132
{
133
- struct node_data *data = object;
134
+ struct node_data *data = _data;
135
struct pw_proxy *proxy = (struct pw_proxy*)data->client_node;
136
struct pw_impl_port *port;
137
int res;
138
139
}
140
141
static int
142
-client_node_port_use_buffers(void *object,
143
+client_node_port_use_buffers(void *_data,
144
enum spa_direction direction, uint32_t port_id, uint32_t mix_id,
145
uint32_t flags,
146
uint32_t n_buffers, struct pw_client_node_buffer *buffers)
147
{
148
- struct node_data *data = object;
149
+ struct node_data *data = _data;
150
struct pw_proxy *proxy = (struct pw_proxy*)data->client_node;
151
struct buffer *bid;
152
uint32_t i, j;
153
154
}
155
156
static int
157
-client_node_port_set_io(void *object,
158
+client_node_port_set_io(void *_data,
159
uint32_t direction,
160
uint32_t port_id,
161
uint32_t mix_id,
162
163
uint32_t offset,
164
uint32_t size)
165
{
166
- struct node_data *data = object;
167
+ struct node_data *data = _data;
168
struct pw_proxy *proxy = (struct pw_proxy*)data->client_node;
169
struct mix *mix;
170
struct pw_memmap *mm, *old;
171
172
}
173
174
static int
175
-client_node_set_activation(void *object,
176
+client_node_set_activation(void *_data,
177
uint32_t node_id,
178
int signalfd,
179
uint32_t memid,
180
uint32_t offset,
181
uint32_t size)
182
{
183
- struct node_data *data = object;
184
+ struct node_data *data = _data;
185
struct pw_proxy *proxy = (struct pw_proxy*)data->client_node;
186
struct pw_impl_node *node = data->node;
187
struct pw_memmap *mm;
188
pipewire-0.3.50.tar.gz/src/modules/module-client-node/v0/client-node.c -> pipewire-0.3.51.tar.gz/src/modules/module-client-node/v0/client-node.c
Changed
45
1
2
for (i = 0; i < port->n_params; i++)
3
free(port->paramsi);
4
port->n_params = n_params;
5
- port->params = realloc(port->params, port->n_params * sizeof(struct spa_pod *));
6
-
7
+ if (port->n_params == 0) {
8
+ free(port->params);
9
+ port->params = NULL;
10
+ } else {
11
+ void *p;
12
+ p = reallocarray(port->params, port->n_params, sizeof(struct spa_pod *));
13
+ if (p == NULL) {
14
+ pw_log_error("%p: port %u can't realloc: %m", this, port_id);
15
+ free(port->params);
16
+ port->n_params = 0;
17
+ }
18
+ port->params = p;
19
+ }
20
for (i = 0; i < port->n_params; i++) {
21
port->paramsi = paramsi ?
22
pw_protocol_native0_pod_from_v2(this->resource->client, paramsi) : NULL;
23
24
for (i = 0; i < this->n_params; i++)
25
free(this->paramsi);
26
this->n_params = n_params;
27
- this->params = realloc(this->params, this->n_params * sizeof(struct spa_pod *));
28
-
29
+ if (this->n_params == 0) {
30
+ free(this->params);
31
+ this->params = NULL;
32
+ } else {
33
+ void *p;
34
+ p = reallocarray(this->params, this->n_params, sizeof(struct spa_pod *));
35
+ if (p == NULL) {
36
+ pw_log_error("%p: can't realloc: %m", this);
37
+ free(this->params);
38
+ this->n_params = 0;
39
+ }
40
+ this->params = p;
41
+ }
42
for (i = 0; i < this->n_params; i++)
43
this->paramsi = paramsi ? spa_pod_copy(paramsi) : NULL;
44
}
45
pipewire-0.3.50.tar.gz/src/modules/module-client-node/v0/ext-client-node.h -> pipewire-0.3.51.tar.gz/src/modules/module-client-node/v0/ext-client-node.h
Changed
97
1
2
* \param memfd the fd of the memory
3
* \param flags flags for the \a memfd
4
*/
5
- void (*add_mem) (void *object,
6
+ void (*add_mem) (void *data,
7
uint32_t mem_id,
8
uint32_t type,
9
int memfd,
10
11
* \param writefd fd for signal data can be written
12
* \param transport the shared transport area
13
*/
14
- void (*transport) (void *object,
15
+ void (*transport) (void *data,
16
uint32_t node_id,
17
int readfd,
18
int writefd,
19
20
* \param flags parameter flags
21
* \param param the param to set
22
*/
23
- void (*set_param) (void *object, uint32_t seq,
24
+ void (*set_param) (void *data, uint32_t seq,
25
uint32_t id, uint32_t flags,
26
const struct spa_pod *param);
27
/**
28
* Receive an event from the client node
29
* \param event the received event */
30
- void (*event) (void *object, const struct spa_event *event);
31
+ void (*event) (void *data, const struct spa_event *event);
32
/**
33
* Notify of a new node command
34
*
35
* \param seq a sequence number
36
* \param command the command
37
*/
38
- void (*command) (void *object, uint32_t seq, const struct spa_command *command);
39
+ void (*command) (void *data, uint32_t seq, const struct spa_command *command);
40
/**
41
* A new port was added to the node
42
*
43
44
* \param direction the direction of the port
45
* \param port_id the new port id
46
*/
47
- void (*add_port) (void *object,
48
+ void (*add_port) (void *data,
49
uint32_t seq,
50
enum spa_direction direction,
51
uint32_t port_id);
52
53
* \param direction a port direction
54
* \param port_id the remove port id
55
*/
56
- void (*remove_port) (void *object,
57
+ void (*remove_port) (void *data,
58
uint32_t seq,
59
enum spa_direction direction,
60
uint32_t port_id);
61
62
* \param flags flags used when setting the param
63
* \param param the new param
64
*/
65
- void (*port_set_param) (void *object,
66
+ void (*port_set_param) (void *data,
67
uint32_t seq,
68
enum spa_direction direction,
69
uint32_t port_id,
70
71
* \param n_buffer the number of buffers
72
* \param buffers and array of buffer descriptions
73
*/
74
- void (*port_use_buffers) (void *object,
75
+ void (*port_use_buffers) (void *data,
76
uint32_t seq,
77
enum spa_direction direction,
78
uint32_t port_id,
79
80
* \param port_id the port id
81
* \param command the command
82
*/
83
- void (*port_command) (void *object,
84
+ void (*port_command) (void *data,
85
enum spa_direction direction,
86
uint32_t port_id,
87
const struct spa_command *command);
88
89
* \param offset offset of io area in memory
90
* \param size size of the io area
91
*/
92
- void (*port_set_io) (void *object,
93
+ void (*port_set_io) (void *data,
94
uint32_t seq,
95
enum spa_direction direction,
96
uint32_t port_id,
97
pipewire-0.3.50.tar.gz/src/modules/module-client-node/v0/protocol-native.c -> pipewire-0.3.51.tar.gz/src/modules/module-client-node/v0/protocol-native.c
Changed
159
1
2
const struct spa_type_info *info, uint32_t type);
3
4
static void
5
-client_node_marshal_add_mem(void *object,
6
+client_node_marshal_add_mem(void *data,
7
uint32_t mem_id,
8
uint32_t type,
9
int memfd, uint32_t flags)
10
{
11
- struct pw_resource *resource = object;
12
+ struct pw_resource *resource = data;
13
struct pw_impl_client *client = pw_resource_get_client(resource);
14
struct spa_pod_builder *b;
15
const char *typename;
16
17
pw_protocol_native_end_resource(resource, b);
18
}
19
20
-static void client_node_marshal_transport(void *object, uint32_t node_id, int readfd, int writefd,
21
+static void client_node_marshal_transport(void *data, uint32_t node_id, int readfd, int writefd,
22
struct pw_client_node0_transport *transport)
23
{
24
- struct pw_resource *resource = object;
25
+ struct pw_resource *resource = data;
26
struct spa_pod_builder *b;
27
struct pw_client_node0_transport_info info;
28
29
30
}
31
32
static void
33
-client_node_marshal_set_param(void *object, uint32_t seq, uint32_t id, uint32_t flags,
34
+client_node_marshal_set_param(void *data, uint32_t seq, uint32_t id, uint32_t flags,
35
const struct spa_pod *param)
36
{
37
- struct pw_resource *resource = object;
38
+ struct pw_resource *resource = data;
39
struct spa_pod_builder *b;
40
41
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE0_EVENT_SET_PARAM, NULL);
42
43
pw_protocol_native_end_resource(resource, b);
44
}
45
46
-static void client_node_marshal_event_event(void *object, const struct spa_event *event)
47
+static void client_node_marshal_event_event(void *data, const struct spa_event *event)
48
{
49
- struct pw_resource *resource = object;
50
+ struct pw_resource *resource = data;
51
struct spa_pod_builder *b;
52
53
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE0_EVENT_EVENT, NULL);
54
55
}
56
57
static void
58
-client_node_marshal_command(void *object, uint32_t seq, const struct spa_command *command)
59
+client_node_marshal_command(void *data, uint32_t seq, const struct spa_command *command)
60
{
61
- struct pw_resource *resource = object;
62
+ struct pw_resource *resource = data;
63
struct pw_impl_client *client = pw_resource_get_client(resource);
64
struct spa_pod_builder *b;
65
struct spa_pod_frame f;
66
67
}
68
69
static void
70
-client_node_marshal_add_port(void *object,
71
+client_node_marshal_add_port(void *data,
72
uint32_t seq, enum spa_direction direction, uint32_t port_id)
73
{
74
- struct pw_resource *resource = object;
75
+ struct pw_resource *resource = data;
76
struct spa_pod_builder *b;
77
78
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE0_EVENT_ADD_PORT, NULL);
79
80
}
81
82
static void
83
-client_node_marshal_remove_port(void *object,
84
+client_node_marshal_remove_port(void *data,
85
uint32_t seq, enum spa_direction direction, uint32_t port_id)
86
{
87
- struct pw_resource *resource = object;
88
+ struct pw_resource *resource = data;
89
struct spa_pod_builder *b;
90
91
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE0_EVENT_REMOVE_PORT, NULL);
92
93
}
94
95
static void
96
-client_node_marshal_port_set_param(void *object,
97
+client_node_marshal_port_set_param(void *data,
98
uint32_t seq,
99
enum spa_direction direction,
100
uint32_t port_id,
101
102
uint32_t flags,
103
const struct spa_pod *param)
104
{
105
- struct pw_resource *resource = object;
106
+ struct pw_resource *resource = data;
107
struct pw_impl_client *client = pw_resource_get_client(resource);
108
struct spa_pod_builder *b;
109
struct spa_pod_frame f;
110
111
}
112
113
static void
114
-client_node_marshal_port_use_buffers(void *object,
115
+client_node_marshal_port_use_buffers(void *data,
116
uint32_t seq,
117
enum spa_direction direction,
118
uint32_t port_id,
119
uint32_t n_buffers, struct pw_client_node0_buffer *buffers)
120
{
121
- struct pw_resource *resource = object;
122
+ struct pw_resource *resource = data;
123
struct pw_impl_client *client = pw_resource_get_client(resource);
124
struct spa_pod_builder *b;
125
struct spa_pod_frame f;
126
127
}
128
129
static void
130
-client_node_marshal_port_command(void *object,
131
+client_node_marshal_port_command(void *data,
132
uint32_t direction,
133
uint32_t port_id,
134
const struct spa_command *command)
135
{
136
- struct pw_resource *resource = object;
137
+ struct pw_resource *resource = data;
138
struct pw_impl_client *client = pw_resource_get_client(resource);
139
struct spa_pod_builder *b;
140
struct spa_pod_frame f;
141
142
}
143
144
static void
145
-client_node_marshal_port_set_io(void *object,
146
+client_node_marshal_port_set_io(void *data,
147
uint32_t seq,
148
uint32_t direction,
149
uint32_t port_id,
150
151
uint32_t offset,
152
uint32_t size)
153
{
154
- struct pw_resource *resource = object;
155
+ struct pw_resource *resource = data;
156
struct spa_pod_builder *b;
157
158
b = pw_protocol_native_begin_resource(resource, PW_CLIENT_NODE0_EVENT_PORT_SET_IO, NULL);
159
pipewire-0.3.50.tar.gz/src/modules/module-echo-cancel.c -> pipewire-0.3.51.tar.gz/src/modules/module-echo-cancel.c
Changed
29
1
2
pw_stream_flush(impl->source, false);
3
pw_stream_flush(impl->capture, false);
4
break;
5
+ case PW_STREAM_STATE_UNCONNECTED:
6
+ pw_log_info("%p: input unconnected", impl);
7
+ pw_impl_module_schedule_destroy(impl->module);
8
+ break;
9
+ case PW_STREAM_STATE_ERROR:
10
+ pw_log_info("%p: input error: %s", impl, error);
11
+ break;
12
default:
13
break;
14
}
15
16
pw_stream_flush(impl->sink, false);
17
pw_stream_flush(impl->playback, false);
18
break;
19
+ case PW_STREAM_STATE_UNCONNECTED:
20
+ pw_log_info("%p: output unconnected", impl);
21
+ pw_impl_module_schedule_destroy(impl->module);
22
+ break;
23
+ case PW_STREAM_STATE_ERROR:
24
+ pw_log_info("%p: output error: %s", impl, error);
25
+ break;
26
default:
27
break;
28
}
29
pipewire-0.3.50.tar.gz/src/modules/module-example-sink.c -> pipewire-0.3.51.tar.gz/src/modules/module-example-sink.c
Changed
66
1
2
#include <pipewire/i18n.h>
3
4
/** \page page_module_example_sink PipeWire Module: Example Sink
5
+ *
6
+ * The example sink is a good starting point for writing a custom
7
+ * sink. We refer to the source code for more information.
8
+ *
9
+ * ## Module Options
10
+ *
11
+ * - `node.name`: a unique name for the stream
12
+ * - `node.description`: a human readable name for the stream
13
+ * - `stream.props = {}`: properties to be passed to the stream
14
+ *
15
+ * ## General options
16
+ *
17
+ * Options with well-known behavior.
18
+ *
19
+ * - \ref PW_KEY_REMOTE_NAME
20
+ * - \ref PW_KEY_AUDIO_RATE
21
+ * - \ref PW_KEY_AUDIO_CHANNELS
22
+ * - \ref SPA_KEY_AUDIO_POSITION
23
+ * - \ref PW_KEY_MEDIA_NAME
24
+ * - \ref PW_KEY_NODE_LATENCY
25
+ * - \ref PW_KEY_NODE_NAME
26
+ * - \ref PW_KEY_NODE_DESCRIPTION
27
+ * - \ref PW_KEY_NODE_GROUP
28
+ * - \ref PW_KEY_NODE_VIRTUAL
29
+ * - \ref PW_KEY_MEDIA_CLASS
30
+ *
31
+ * ## Example configuration
32
+ *
33
+ *\code{.unparsed}
34
+ * context.modules =
35
+ * { name = libpipewire-module-example-sink
36
+ * args = {
37
+ * node.name = "example_sink"
38
+ * node.description = "My Example Sink"
39
+ * stream.props = {
40
+ * audio.position = FL FR
41
+ * }
42
+ * }
43
+ * }
44
+ *
45
+ *\endcode
46
*/
47
48
#define NAME "example-sink"
49
50
impl->context = context;
51
impl->work = pw_context_get_work_queue(context);
52
53
- if (pw_properties_get(props, PW_KEY_NODE_WANT_DRIVER) == NULL)
54
- pw_properties_set(props, PW_KEY_NODE_WANT_DRIVER, "true");
55
if (pw_properties_get(props, PW_KEY_NODE_VIRTUAL) == NULL)
56
pw_properties_set(props, PW_KEY_NODE_VIRTUAL, "true");
57
58
59
copy_props(impl, props, PW_KEY_NODE_NAME);
60
copy_props(impl, props, PW_KEY_NODE_DESCRIPTION);
61
copy_props(impl, props, PW_KEY_NODE_GROUP);
62
- copy_props(impl, props, PW_KEY_NODE_WANT_DRIVER);
63
copy_props(impl, props, PW_KEY_NODE_LATENCY);
64
copy_props(impl, props, PW_KEY_NODE_VIRTUAL);
65
copy_props(impl, props, PW_KEY_MEDIA_CLASS);
66
pipewire-0.3.50.tar.gz/src/modules/module-example-source.c -> pipewire-0.3.51.tar.gz/src/modules/module-example-source.c
Changed
66
1
2
#include <pipewire/i18n.h>
3
4
/** \page page_module_example_source PipeWire Module: Example Source
5
+ *
6
+ * The example source is a good starting point for writing a custom
7
+ * source. We refer to the source code for more information.
8
+ *
9
+ * ## Module Options
10
+ *
11
+ * - `node.name`: a unique name for the stream
12
+ * - `node.description`: a human readable name for the stream
13
+ * - `stream.props = {}`: properties to be passed to the stream
14
+ *
15
+ * ## General options
16
+ *
17
+ * Options with well-known behavior.
18
+ *
19
+ * - \ref PW_KEY_REMOTE_NAME
20
+ * - \ref PW_KEY_AUDIO_RATE
21
+ * - \ref PW_KEY_AUDIO_CHANNELS
22
+ * - \ref SPA_KEY_AUDIO_POSITION
23
+ * - \ref PW_KEY_MEDIA_NAME
24
+ * - \ref PW_KEY_NODE_LATENCY
25
+ * - \ref PW_KEY_NODE_NAME
26
+ * - \ref PW_KEY_NODE_DESCRIPTION
27
+ * - \ref PW_KEY_NODE_GROUP
28
+ * - \ref PW_KEY_NODE_VIRTUAL
29
+ * - \ref PW_KEY_MEDIA_CLASS
30
+ *
31
+ * ## Example configuration
32
+ *
33
+ *\code{.unparsed}
34
+ * context.modules =
35
+ * { name = libpipewire-module-example-source
36
+ * args = {
37
+ * node.name = "example_source"
38
+ * node.description = "My Example Source"
39
+ * stream.props = {
40
+ * audio.position = FL FR
41
+ * }
42
+ * }
43
+ * }
44
+ *
45
+ *\endcode
46
*/
47
48
#define NAME "example-source"
49
50
impl->context = context;
51
impl->work = pw_context_get_work_queue(context);
52
53
- if (pw_properties_get(props, PW_KEY_NODE_WANT_DRIVER) == NULL)
54
- pw_properties_set(props, PW_KEY_NODE_WANT_DRIVER, "true");
55
if (pw_properties_get(props, PW_KEY_NODE_VIRTUAL) == NULL)
56
pw_properties_set(props, PW_KEY_NODE_VIRTUAL, "true");
57
58
59
copy_props(impl, props, PW_KEY_NODE_NAME);
60
copy_props(impl, props, PW_KEY_NODE_DESCRIPTION);
61
copy_props(impl, props, PW_KEY_NODE_GROUP);
62
- copy_props(impl, props, PW_KEY_NODE_WANT_DRIVER);
63
copy_props(impl, props, PW_KEY_NODE_LATENCY);
64
copy_props(impl, props, PW_KEY_NODE_VIRTUAL);
65
copy_props(impl, props, PW_KEY_MEDIA_CLASS);
66
pipewire-0.3.50.tar.gz/src/modules/module-filter-chain.c -> pipewire-0.3.51.tar.gz/src/modules/module-filter-chain.c
Changed
201
1
2
/**
3
* \page page_module_filter_chain PipeWire Module: Filter-Chain
4
*
5
+ * The filter-chain allows you to create an arbitrary processing graph
6
+ * from LADSPA, LV2 and builtin filters. This filter can be made into a
7
+ * virtual sink/source or between any 2 nodes in the graph.
8
+ *
9
+ * The filter chain is built with 2 streams, a capture stream providing
10
+ * the input to the filter chain and a playback stream sending out the
11
+ * filtered stream to the next nodes in the graph.
12
+ *
13
+ * Because both ends of the filter-chain are built with streams, the session
14
+ * manager can manage the configuration and connection with the sinks and
15
+ * sources automatically.
16
+ *
17
+ * ## Module Options
18
+ *
19
+ * - `node.description`: a human readable name for the filter chain
20
+ * - `filter.graph = `: a description of the filter graph to run, see below
21
+ * - `capture.props = {}`: properties to be passed to the input stream
22
+ * - `playback.props = {}`: properties to be passed to the output stream
23
+ *
24
+ * ## Filter graph description
25
+ *
26
+ * The general structure of the graph description is as follows:
27
+ *
28
+ *\code{.unparsed}
29
+ * filter.graph = {
30
+ * nodes =
31
+ * {
32
+ * type = <ladspa | lv2 | builtin>
33
+ * name = <name>
34
+ * plugin = <plugin>
35
+ * label = <label>
36
+ * config = {
37
+ * <configkey> = <value> ...
38
+ * }
39
+ * control = {
40
+ * <controlname|controlindex> = <value> ...
41
+ * }
42
+ * }
43
+ * ...
44
+ *
45
+ * links =
46
+ * { output = <portname> input = <portname> }
47
+ * ...
48
+ *
49
+ * inputs = <portname> ...
50
+ * outputs = <portname> ...
51
+ * }
52
+ *\endcode
53
+ *
54
+ * ### Nodes
55
+ *
56
+ * Nodes describe the processing filters in the graph. Use a tool like lv2ls
57
+ * or listplugins to get a list of available plugins, labels and the port names.
58
+ *
59
+ * - `type` is one of `ladspa`, `lv2` or `builtin`
60
+ * - `name` is the name for this node, you might need this later to refer to this node
61
+ * and its ports when setting controls or making links.
62
+ * - `plugin` is the type specific plugin name.
63
+ * - For LADSPA plugins it will append `.so` to find the shared object with that
64
+ * name in the LADSPA plugin path.
65
+ * - For LV2, this is the plugin URI obtained with lv2ls.
66
+ * - For builtin this is ignored
67
+ * - `label` is the type specific filter inside the plugin.
68
+ * - For LADSPA this is the label
69
+ * - For LV2 this is unused
70
+ * - For builtin this is the name of the filter to use
71
+ *
72
+ * - `config` contains a filter specific configuration section. The convolver
73
+ * plugin needs this.
74
+ * - `control` contains the initial values for the control ports of the filter.
75
+ *
76
+ * ### Links
77
+ *
78
+ * Links can be made between ports of nodes. The `portname` is given as
79
+ * `<node_name>:<port_name>`.
80
+ *
81
+ * You can tee the output of filters to multiple other filters. You need to
82
+ * use a mixer if you want the output of multiple filters to go into one
83
+ * filter input port.
84
+ *
85
+ * links can be omited when the graph has just 1 filter.
86
+ *
87
+ * ### Inputs and Outputs
88
+ *
89
+ * These are the entry and exit ports into the graph definition. Their number
90
+ * defines the number of channels used by the filter-chain.
91
+ *
92
+ * The `<portname>` can be `null` when a channel is to be ignored.
93
+ *
94
+ * Each input/output in the graph can only be linked to one filter input/output.
95
+ * You need to use the copy builtin filter if the stream signal needs to be routed
96
+ * to multiple filters. You need to use the mixer builtin plugin if multiple graph
97
+ * outputs need to go to one output stream.
98
+ *
99
+ * inputs and outputs can be omitted, in which case the filter-chain will use all
100
+ * inputs from the first filter and all outputs from the last filter node. The
101
+ * graph will then be duplicated as many times to match the number of input/output
102
+ * channels of the streams.
103
+ *
104
+ * ## Builtin filters
105
+ *
106
+ * There are some useful builtin filters available. You select them with the label
107
+ * of the filter node.
108
+ *
109
+ * ### Mixer
110
+ *
111
+ * Use the `mixer` plugin if you have multiple input signals that need to be mixed together.
112
+ *
113
+ * The mixer plugin has up to 8 input ports labeled "In 1" to "In 8" and each with
114
+ * a gain control labeled "Gain 1" to "Gain 8". There is an output port labeled
115
+ * "Out". Unused input ports will be ignoded and not cause overhead.
116
+ *
117
+ * ### Copy
118
+ *
119
+ * Use the `copy` plugin if you need to copy a stream input signal to multiple filters.
120
+ *
121
+ * It has one input port "In" and one output port "Out".
122
+ *
123
+ * ### Biquads
124
+ *
125
+ * Biquads can be used to do all kinds of filtering. They are also used when creating
126
+ * equalizers.
127
+ *
128
+ * All biquad filters have an input port "In" and an output port "Out". They have
129
+ * a "Freq", "Q" and "Gain" control. Their meaning depends on the particular biquad that
130
+ * is used. The following labels can be used:
131
+ *
132
+ * - `bq_lowpass` a lowpass filter.
133
+ * - `bq_highpass` a highpass filter.
134
+ * - `bq_bandpass` a bandpass filter.
135
+ * - `bq_lowshelf` a low shelf filter.
136
+ * - `bq_highshelf` a high shelf filter.
137
+ * - `bq_peaking` a peaking filter.
138
+ * - `bq_notch` a notch filter.
139
+ * - `bq_allpass` an allpass filter.
140
+ *
141
+ * ### Convolver
142
+ *
143
+ * The convolver can be used to apply an impulse response to a signal. It is usually used
144
+ * for reverbs or virtual surround. The convolver is implemented with a fast FFT
145
+ * implementation.
146
+ *
147
+ * The convolver has an input port "In" and an output port "Out". It requires a config
148
+ * section in the node declaration in this format:
149
+ *
150
+ *\code{.unparsed}
151
+ * filter.graph = {
152
+ * nodes =
153
+ * {
154
+ * type = builtin
155
+ * name = ...
156
+ * label = convolver
157
+ * config = {
158
+ * blocksize = ...
159
+ * tailsize = ...
160
+ * gain = ...
161
+ * delay = ...
162
+ * filename = ...
163
+ * offset = ...
164
+ * length = ...
165
+ * channel = ...
166
+ * }
167
+ * ...
168
+ * }
169
+ * }
170
+ * ...
171
+ * }
172
+ *\endcode
173
+ *
174
+ * - `blocksize` specifies the size of the blocks to use in the FFT. It is a value
175
+ * between 64 and 256. When not specified, this value is
176
+ * computed automatically from the number of samples in the file.
177
+ * - `tailsize` specifies the size of the tail blocks to use in the FFT.
178
+ * - `gain` the overall gain to apply to the IR file.
179
+ * - `delay` The extra delay (in samples) to add to the IR.
180
+ * - `filename` The IR to load or create. Possible values are:
181
+ * - `/hilbert` creates a hilbert function(https://en.wikipedia.org/wiki/Hilbert_transform)
182
+ * that can be used to phase shift the signal by +/-90 degrees. The
183
+ * `length` will be used as the number of coefficients.
184
+ * - `/dirac` creates a Dirac function(https://en.wikipedia.org/wiki/Dirac_delta_function) that
185
+ * can be used as gain.
186
+ * - A filename to load as the IR. This needs to be a file format supported
187
+ * by sndfile.
188
+ * - `offset` The sample offset in the file as the start of the IR.
189
+ * - `length` The number of samples to use as the IR.
190
+ * - `channel` The channel to use from the file as the IR.
191
+ *
192
+ * ### Delay
193
+ *
194
+ * The delay can be used to delay a signal in time.
195
+ *
196
+ * The delay has an input port "In" and an output port "Out". It also has
197
+ * a "Delay (s)" control port. It requires a config section in the node declaration
198
+ * in this format:
199
+ *
200
+ *\code{.unparsed}
201
pipewire-0.3.50.tar.gz/src/modules/module-filter-chain/builtin_plugin.c -> pipewire-0.3.51.tar.gz/src/modules/module-filter-chain/builtin_plugin.c
Changed
155
1
2
{ .index = 4,
3
.name = "Gain",
4
.flags = FC_PORT_INPUT | FC_PORT_CONTROL,
5
- .def = 0.0f, .min = -120.0f, .max = 5.0f,
6
+ .def = 0.0f, .min = -120.0f, .max = 20.0f,
7
},
8
};
9
10
11
.cleanup = convolver_cleanup,
12
};
13
14
+/** delay */
15
+struct delay_impl {
16
+ unsigned long rate;
17
+ float *port4;
18
+
19
+ float delay;
20
+ uint32_t delay_samples;
21
+ uint32_t buffer_samples;
22
+ float *buffer;
23
+ uint32_t ptr;
24
+};
25
+
26
+static void delay_cleanup(void * Instance)
27
+{
28
+ struct delay_impl *impl = Instance;
29
+ free(impl->buffer);
30
+ free(impl);
31
+}
32
+
33
+static void *delay_instantiate(const struct fc_descriptor * Descriptor,
34
+ unsigned long *SampleRate, int index, const char *config)
35
+{
36
+ struct delay_impl *impl;
37
+ struct spa_json it2;
38
+ const char *val;
39
+ char key256;
40
+ float max_delay = 1.0f;
41
+
42
+ if (config == NULL) {
43
+ errno = EINVAL;
44
+ return NULL;
45
+ }
46
+
47
+ spa_json_init(&it0, config, strlen(config));
48
+ if (spa_json_enter_object(&it0, &it1) <= 0)
49
+ return NULL;
50
+
51
+ while (spa_json_get_string(&it1, key, sizeof(key)) > 0) {
52
+ if (spa_streq(key, "max-delay")) {
53
+ if (spa_json_get_float(&it1, &max_delay) <= 0)
54
+ return NULL;
55
+ }
56
+ else if (spa_json_next(&it1, &val) < 0)
57
+ break;
58
+ }
59
+ if (max_delay <= 0.0f)
60
+ max_delay = 1.0f;
61
+
62
+ impl = calloc(1, sizeof(*impl));
63
+ if (impl == NULL)
64
+ return NULL;
65
+
66
+ impl->rate = *SampleRate;
67
+ impl->buffer_samples = max_delay * impl->rate;
68
+ pw_log_info("%lu %d", impl->rate, impl->buffer_samples);
69
+
70
+ impl->buffer = calloc(impl->buffer_samples, sizeof(float));
71
+ if (impl->buffer == NULL) {
72
+ delay_cleanup(impl);
73
+ return NULL;
74
+ }
75
+ return impl;
76
+}
77
+
78
+static void delay_connect_port(void * Instance, unsigned long Port,
79
+ float * DataLocation)
80
+{
81
+ struct delay_impl *impl = Instance;
82
+ if (Port > 2)
83
+ return;
84
+ impl->portPort = DataLocation;
85
+}
86
+
87
+static void delay_run(void * Instance, unsigned long SampleCount)
88
+{
89
+ struct delay_impl *impl = Instance;
90
+ float *in = impl->port1, *out = impl->port0;
91
+ float delay = impl->port20;
92
+ unsigned long n;
93
+ uint32_t r, w;
94
+
95
+ if (delay != impl->delay) {
96
+ impl->delay_samples = SPA_CLAMP(delay * impl->rate, 0, impl->buffer_samples-1);
97
+ impl->delay = delay;
98
+ }
99
+ r = impl->ptr;
100
+ w = impl->ptr + impl->delay_samples;
101
+ if (w >= impl->buffer_samples)
102
+ w -= impl->buffer_samples;
103
+
104
+ for (n = 0; n < SampleCount; n++) {
105
+ impl->bufferw = inn;
106
+ outn = impl->bufferr;
107
+ if (++r >= impl->buffer_samples)
108
+ r = 0;
109
+ if (++w >= impl->buffer_samples)
110
+ w = 0;
111
+ }
112
+ impl->ptr = r;
113
+}
114
+
115
+static struct fc_port delay_ports = {
116
+ { .index = 0,
117
+ .name = "Out",
118
+ .flags = FC_PORT_OUTPUT | FC_PORT_AUDIO,
119
+ },
120
+ { .index = 1,
121
+ .name = "In",
122
+ .flags = FC_PORT_INPUT | FC_PORT_AUDIO,
123
+ },
124
+ { .index = 2,
125
+ .name = "Delay (s)",
126
+ .flags = FC_PORT_INPUT | FC_PORT_CONTROL,
127
+ .def = 0.0f, .min = 0.0f, .max = 100.0f
128
+ },
129
+};
130
+
131
+static const struct fc_descriptor delay_desc = {
132
+ .name = "delay",
133
+
134
+ .n_ports = 3,
135
+ .ports = delay_ports,
136
+
137
+ .instantiate = delay_instantiate,
138
+ .connect_port = delay_connect_port,
139
+ .run = delay_run,
140
+ .cleanup = delay_cleanup,
141
+};
142
+
143
static const struct fc_descriptor * builtin_descriptor(unsigned long Index)
144
{
145
switch(Index) {
146
147
return ©_desc;
148
case 10:
149
return &convolve_desc;
150
+ case 11:
151
+ return &delay_desc;
152
}
153
return NULL;
154
}
155
pipewire-0.3.50.tar.gz/src/modules/module-loopback.c -> pipewire-0.3.51.tar.gz/src/modules/module-loopback.c
Changed
102
1
2
#include <pipewire/extensions/profiler.h>
3
4
/** \page page_module_loopback PipeWire Module: Loopback
5
+ *
6
+ * The loopback module passes the output of a capture stream unmodified to a playback stream.
7
+ * It can be used to construct a link between a source and sink but also to
8
+ * create new virtual sinks or sources or to remap channel between streams.
9
+ *
10
+ * Because both ends of the loopback are built with streams, the session manager can
11
+ * manage the configuration and connection with the sinks and sources.
12
+ *
13
+ * ## Module Options
14
+ *
15
+ * - `node.description`: a human readable name for the loopback streams
16
+ * - `capture.props = {}`: properties to be passed to the input stream
17
+ * - `playback.props = {}`: properties to be passed to the output stream
18
+ *
19
+ * ## General options
20
+ *
21
+ * Options with well-known behavior. Most options can be added to the global
22
+ * configuration or the individual streams:
23
+ *
24
+ * - \ref PW_KEY_REMOTE_NAME
25
+ * - \ref PW_KEY_AUDIO_RATE
26
+ * - \ref PW_KEY_AUDIO_CHANNELS
27
+ * - \ref SPA_KEY_AUDIO_POSITION
28
+ * - \ref PW_KEY_MEDIA_NAME
29
+ * - \ref PW_KEY_NODE_LATENCY
30
+ * - \ref PW_KEY_NODE_DESCRIPTION
31
+ * - \ref PW_KEY_NODE_GROUP
32
+ * - \ref PW_KEY_NODE_LINK_GROUP
33
+ * - \ref PW_KEY_NODE_VIRTUAL
34
+ *
35
+ * Stream only properties:
36
+ *
37
+ * - \ref PW_KEY_MEDIA_CLASS
38
+ * - \ref PW_KEY_NODE_NAME
39
+ *
40
+ * ## Example configuration of a virtual sink
41
+ *
42
+ * This Virtual sink routes stereo input to the rear channels of a 7.1 sink.
43
+ *
44
+ *\code{.unparsed}
45
+ * context.modules =
46
+ * { name = libpipewire-module-loopback
47
+ * args = {
48
+ * node.description = "CM106 Stereo Pair 2"
49
+ * capture.props = {
50
+ * node.name = "CM106_stereo_pair_2"
51
+ * media.class = "Audio/Sink"
52
+ * audio.position = FL FR
53
+ * }
54
+ * playback.props = {
55
+ * node.name = "playback.CM106_stereo_pair_2"
56
+ * audio.position = RL RR
57
+ * node.target = "alsa_output.usb-0d8c_USB_Sound_Device-00.analog-surround-71"
58
+ * stream.dont-remix = true
59
+ * node.passive = true
60
+ * }
61
+ * }
62
+ * }
63
+ *
64
+ *\endcode
65
+ *
66
+ * ## See also
67
+ *
68
+ * `pw-loopback` : a tool that loads the loopback module with given parameters.
69
*/
70
71
#define NAME "loopback"
72
73
{ PW_KEY_MODULE_DESCRIPTION, "Create loopback streams" },
74
{ PW_KEY_MODULE_USAGE, " remote.name=<remote> "
75
" node.latency=<latency as fraction> "
76
- " node.name=<name of the nodes> "
77
" node.description=<description of the nodes> "
78
" audio.rate=<sample rate> "
79
" audio.channels=<number of channels> "
80
81
pw_stream_flush(impl->playback, false);
82
pw_stream_flush(impl->capture, false);
83
break;
84
+ case PW_STREAM_STATE_UNCONNECTED:
85
+ pw_log_info("module %p: unconnected", impl);
86
+ pw_impl_module_schedule_destroy(impl->module);
87
+ break;
88
+ case PW_STREAM_STATE_ERROR:
89
+ pw_log_info("module %p: error: %s", impl, error);
90
+ break;
91
default:
92
break;
93
}
94
95
impl->playback = NULL;
96
}
97
98
-
99
static void playback_param_changed(void *data, uint32_t id, const struct spa_pod *param)
100
{
101
struct impl *impl = data;
102
pipewire-0.3.50.tar.gz/src/modules/module-metadata/metadata.c -> pipewire-0.3.51.tar.gz/src/modules/module-metadata/metadata.c
Changed
30
1
2
#define pw_metadata_resource_property(r,...) \
3
pw_metadata_resource(r,property,0,__VA_ARGS__)
4
5
-static int metadata_property(void *object,
6
+static int metadata_property(void *data,
7
uint32_t subject,
8
const char *key,
9
const char *type,
10
const char *value)
11
{
12
- struct resource_data *d = object;
13
+ struct resource_data *d = data;
14
struct pw_resource *resource = d->resource;
15
struct pw_impl_client *client = pw_resource_get_client(resource);
16
struct impl *impl = d->impl;
17
18
};
19
20
static int
21
-global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
22
+global_bind(void *object, struct pw_impl_client *client, uint32_t permissions,
23
uint32_t version, uint32_t id)
24
{
25
- struct impl *impl = _data;
26
+ struct impl *impl = object;
27
struct pw_resource *resource;
28
struct resource_data *data;
29
30
pipewire-0.3.50.tar.gz/src/modules/module-profiler.c -> pipewire-0.3.51.tar.gz/src/modules/module-profiler.c
Changed
43
1
2
#include <pipewire/extensions/profiler.h>
3
4
/** \page page_module_profiler PipeWire Module: Profiler
5
+ *
6
+ * The profiler module provides a Profiler interface for applications that
7
+ * can be used to receive profiling information.
8
+ *
9
+ * Use tools like pw-top and pw-profiler to collect profiling information
10
+ * about the pipewire graph.
11
+ *
12
+ * ## Example configuration
13
+ *
14
+ * The module has no arguments and is usually added to the config file of
15
+ * the main pipewire daemon.
16
+ *
17
+ *\code{.unparsed}
18
+ * context.modules =
19
+ * { name = libpipewire-module-profiler }
20
+ *
21
+ *\endcode
22
+ *
23
+ * ## See also
24
+ *
25
+ * - `pw-top`: a tool to display realtime profiler data
26
+ * - `pw-profiler`: a tool to collect and render profiler data
27
*/
28
29
#define NAME "profiler"
30
31
return 0;
32
}
33
static int
34
-global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
35
+global_bind(void *object, struct pw_impl_client *client, uint32_t permissions,
36
uint32_t version, uint32_t id)
37
{
38
- struct impl *impl = _data;
39
+ struct impl *impl = object;
40
struct pw_global *global = impl->global;
41
struct pw_resource *resource;
42
struct resource_data *data;
43
pipewire-0.3.50.tar.gz/src/modules/module-protocol-native.c -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-native.c
Changed
56
1
2
#include <spa/debug/types.h>
3
4
/** \page page_module_protocol_native PipeWire Module: Protocol Native
5
+ *
6
+ * The native protocol module implements the PipeWire communication between
7
+ * a client and a server using unix local sockets.
8
+ *
9
+ * Normally this module is loaded in both client and server config files
10
+ * so that they cam communicate.
11
+ *
12
+ * ## Module Options
13
+ *
14
+ * The module has no options.
15
+ *
16
+ * ## General Options
17
+ *
18
+ * The name of the core is obtained as:
19
+ *
20
+ * - PIPEWIRE_CORE : the environment variable with the name of the core
21
+ * - \ref PW_KEY_CORE_NAME : in the context properties
22
+ * - a name based on the process id
23
+ *
24
+ * The context will also become a server if:
25
+ *
26
+ * - PIPEWIRE_DAEMON : the environment is true
27
+ * - \ref PW_KEY_CORE_DAEMON : in the context properties is true
28
+ *
29
+ * The socket will be located in the directory obtained by looking at the
30
+ * following environment variables:
31
+ *
32
+ * - PIPEWIRE_RUNTIME_DIR
33
+ * - XDG_RUNTIME_DIR
34
+ * - USERPROFILE
35
+ *
36
+ * When a client connect, the connection will be made to:
37
+ *
38
+ * - PIPEWIRE_REMOTE : the environment with the remote name
39
+ * - \ref PW_KEY_REMOTE_NAME : the property in the context.
40
+ * - The default remote named "pipewire-0"
41
+ *
42
+ * A Special remote named "internal" can be used to make a connection to the
43
+ * local context. This can be done even when the server is not a daemon. It can
44
+ * be used to treat a local context as if it was a server.
45
+ *
46
+ * ## Example configuration
47
+ *
48
+ *\code{.unparsed}
49
+ * context.modules =
50
+ { name = libpipewire-module-protocol-native }
51
+ *
52
+ *\endcode
53
*/
54
55
#ifndef UNIX_PATH_MAX
56
pipewire-0.3.50.tar.gz/src/modules/module-protocol-native/connection.c -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-native/connection.c
Changed
76
1
2
}
3
4
buf->msg.fdsindex = fcntl(fd, F_DUPFD_CLOEXEC, 0);
5
+ if (buf->msg.fdsindex == -1) {
6
+ pw_log_error("connection %p: can't DUP fd:%d %m", conn, fd);
7
+ return SPA_IDX_INVALID;
8
+ }
9
buf->msg.n_fds++;
10
- pw_log_debug("connection %p: add fd %d at index %d", conn, fd, index);
11
+ pw_log_debug("connection %p: add fd %d (new fd:%d) at index %d",
12
+ conn, fd, buf->msg.fdsindex, index);
13
14
return index;
15
}
16
17
int res;
18
19
if (buf->buffer_size + size > buf->buffer_maxsize) {
20
- buf->buffer_maxsize = SPA_ROUND_UP_N(buf->buffer_size + size, MAX_BUFFER_SIZE);
21
- buf->buffer_data = realloc(buf->buffer_data, buf->buffer_maxsize);
22
- if (buf->buffer_data == NULL) {
23
+ void *np;
24
+ size_t ns;
25
+
26
+ ns = SPA_ROUND_UP_N(buf->buffer_size + size, MAX_BUFFER_SIZE);
27
+ np = realloc(buf->buffer_data, ns);
28
+ if (np == NULL) {
29
res = -errno;
30
+ free(buf->buffer_data);
31
buf->buffer_maxsize = 0;
32
spa_hook_list_call(&conn->listener_list,
33
struct pw_protocol_native_connection_events,
34
- error, 0, -res);
35
+ error, 0, res);
36
errno = -res;
37
return NULL;
38
}
39
+ buf->buffer_maxsize = ns;
40
+ buf->buffer_data = np;
41
pw_log_debug("connection %p: resize buffer to %zd %zd %zd",
42
conn, buf->buffer_size, size, buf->buffer_maxsize);
43
}
44
45
int fd;
46
47
memcpy(&fd, p, sizeof(fd));
48
+ pw_log_debug("%p: close fd:%d", msg, fd);
49
close(fd);
50
}
51
}
52
53
{
54
uint32_t i;
55
if (fds) {
56
- for (i = 0; i < buf->n_fds; i++)
57
+ for (i = 0; i < buf->n_fds; i++) {
58
+ pw_log_debug("%p: close fd:%d", buf, buf->fdsi);
59
close(buf->fdsi);
60
+ }
61
}
62
buf->n_fds = 0;
63
buf->buffer_size = 0;
64
65
if (size > 0)
66
memmove(buf->buffer_data, data, size);
67
buf->buffer_size = size;
68
- for (i = 0; i < to_close; i++)
69
+ for (i = 0; i < to_close; i++) {
70
+ pw_log_debug("%p: close fd:%d", conn, buf->fdsi);
71
close(buf->fdsi);
72
+ }
73
if (n_fds > 0)
74
memmove(buf->fds, fds, n_fds * sizeof(int));
75
buf->n_fds = n_fds;
76
pipewire-0.3.50.tar.gz/src/modules/module-protocol-native/protocol-native.c -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-native/protocol-native.c
Changed
201
1
2
return pw_protocol_native_end_proxy(proxy, b);
3
}
4
5
-static int core_event_demarshal_info(void *object, const struct pw_protocol_native_message *msg)
6
+static int core_event_demarshal_info(void *data, const struct pw_protocol_native_message *msg)
7
{
8
- struct pw_proxy *proxy = object;
9
+ struct pw_proxy *proxy = data;
10
struct spa_dict props = SPA_DICT_INIT(NULL, 0);
11
struct pw_core_info info = { .props = &props };
12
struct spa_pod_frame f2;
13
14
return pw_proxy_notify(proxy, struct pw_core_events, info, 0, &info);
15
}
16
17
-static int core_event_demarshal_done(void *object, const struct pw_protocol_native_message *msg)
18
+static int core_event_demarshal_done(void *data, const struct pw_protocol_native_message *msg)
19
{
20
- struct pw_proxy *proxy = object;
21
+ struct pw_proxy *proxy = data;
22
struct spa_pod_parser prs;
23
uint32_t id, seq;
24
25
26
return pw_proxy_notify(proxy, struct pw_core_events, done, 0, id, seq);
27
}
28
29
-static int core_event_demarshal_ping(void *object, const struct pw_protocol_native_message *msg)
30
+static int core_event_demarshal_ping(void *data, const struct pw_protocol_native_message *msg)
31
{
32
- struct pw_proxy *proxy = object;
33
+ struct pw_proxy *proxy = data;
34
struct spa_pod_parser prs;
35
uint32_t id, seq;
36
37
38
return pw_proxy_notify(proxy, struct pw_core_events, ping, 0, id, seq);
39
}
40
41
-static int core_event_demarshal_error(void *object, const struct pw_protocol_native_message *msg)
42
+static int core_event_demarshal_error(void *data, const struct pw_protocol_native_message *msg)
43
{
44
- struct pw_proxy *proxy = object;
45
+ struct pw_proxy *proxy = data;
46
struct spa_pod_parser prs;
47
uint32_t id, res;
48
int seq;
49
50
return pw_proxy_notify(proxy, struct pw_core_events, error, 0, id, seq, res, error);
51
}
52
53
-static int core_event_demarshal_remove_id(void *object, const struct pw_protocol_native_message *msg)
54
+static int core_event_demarshal_remove_id(void *data, const struct pw_protocol_native_message *msg)
55
{
56
- struct pw_proxy *proxy = object;
57
+ struct pw_proxy *proxy = data;
58
struct spa_pod_parser prs;
59
uint32_t id;
60
61
62
return pw_proxy_notify(proxy, struct pw_core_events, remove_id, 0, id);
63
}
64
65
-static int core_event_demarshal_bound_id(void *object, const struct pw_protocol_native_message *msg)
66
+static int core_event_demarshal_bound_id(void *data, const struct pw_protocol_native_message *msg)
67
{
68
- struct pw_proxy *proxy = object;
69
+ struct pw_proxy *proxy = data;
70
struct spa_pod_parser prs;
71
uint32_t id, global_id;
72
73
74
return pw_proxy_notify(proxy, struct pw_core_events, bound_id, 0, id, global_id);
75
}
76
77
-static int core_event_demarshal_add_mem(void *object, const struct pw_protocol_native_message *msg)
78
+static int core_event_demarshal_add_mem(void *data, const struct pw_protocol_native_message *msg)
79
{
80
- struct pw_proxy *proxy = object;
81
+ struct pw_proxy *proxy = data;
82
struct spa_pod_parser prs;
83
uint32_t id, type, flags;
84
int64_t idx;
85
86
return pw_proxy_notify(proxy, struct pw_core_events, add_mem, 0, id, type, fd, flags);
87
}
88
89
-static int core_event_demarshal_remove_mem(void *object, const struct pw_protocol_native_message *msg)
90
+static int core_event_demarshal_remove_mem(void *data, const struct pw_protocol_native_message *msg)
91
{
92
- struct pw_proxy *proxy = object;
93
+ struct pw_proxy *proxy = data;
94
struct spa_pod_parser prs;
95
uint32_t id;
96
97
98
return pw_proxy_notify(proxy, struct pw_core_events, remove_mem, 0, id);
99
}
100
101
-static void core_event_marshal_info(void *object, const struct pw_core_info *info)
102
+static void core_event_marshal_info(void *data, const struct pw_core_info *info)
103
{
104
- struct pw_resource *resource = object;
105
+ struct pw_resource *resource = data;
106
struct spa_pod_builder *b;
107
struct spa_pod_frame f;
108
109
110
pw_protocol_native_end_resource(resource, b);
111
}
112
113
-static void core_event_marshal_done(void *object, uint32_t id, int seq)
114
+static void core_event_marshal_done(void *data, uint32_t id, int seq)
115
{
116
- struct pw_resource *resource = object;
117
+ struct pw_resource *resource = data;
118
struct spa_pod_builder *b;
119
120
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_DONE, NULL);
121
122
pw_protocol_native_end_resource(resource, b);
123
}
124
125
-static void core_event_marshal_ping(void *object, uint32_t id, int seq)
126
+static void core_event_marshal_ping(void *data, uint32_t id, int seq)
127
{
128
- struct pw_resource *resource = object;
129
+ struct pw_resource *resource = data;
130
struct spa_pod_builder *b;
131
struct pw_protocol_native_message *msg;
132
133
134
pw_protocol_native_end_resource(resource, b);
135
}
136
137
-static void core_event_marshal_error(void *object, uint32_t id, int seq, int res, const char *error)
138
+static void core_event_marshal_error(void *data, uint32_t id, int seq, int res, const char *error)
139
{
140
- struct pw_resource *resource = object;
141
+ struct pw_resource *resource = data;
142
struct spa_pod_builder *b;
143
144
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_ERROR, NULL);
145
146
pw_protocol_native_end_resource(resource, b);
147
}
148
149
-static void core_event_marshal_remove_id(void *object, uint32_t id)
150
+static void core_event_marshal_remove_id(void *data, uint32_t id)
151
{
152
- struct pw_resource *resource = object;
153
+ struct pw_resource *resource = data;
154
struct spa_pod_builder *b;
155
156
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_REMOVE_ID, NULL);
157
158
pw_protocol_native_end_resource(resource, b);
159
}
160
161
-static void core_event_marshal_bound_id(void *object, uint32_t id, uint32_t global_id)
162
+static void core_event_marshal_bound_id(void *data, uint32_t id, uint32_t global_id)
163
{
164
- struct pw_resource *resource = object;
165
+ struct pw_resource *resource = data;
166
struct spa_pod_builder *b;
167
168
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_BOUND_ID, NULL);
169
170
pw_protocol_native_end_resource(resource, b);
171
}
172
173
-static void core_event_marshal_add_mem(void *object, uint32_t id, uint32_t type, int fd, uint32_t flags)
174
+static void core_event_marshal_add_mem(void *data, uint32_t id, uint32_t type, int fd, uint32_t flags)
175
{
176
- struct pw_resource *resource = object;
177
+ struct pw_resource *resource = data;
178
struct spa_pod_builder *b;
179
180
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_ADD_MEM, NULL);
181
182
pw_protocol_native_end_resource(resource, b);
183
}
184
185
-static void core_event_marshal_remove_mem(void *object, uint32_t id)
186
+static void core_event_marshal_remove_mem(void *data, uint32_t id)
187
{
188
- struct pw_resource *resource = object;
189
+ struct pw_resource *resource = data;
190
struct spa_pod_builder *b;
191
192
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_REMOVE_MEM, NULL);
193
194
return 0;
195
}
196
197
-static void registry_marshal_global(void *object, uint32_t id, uint32_t permissions,
198
+static void registry_marshal_global(void *data, uint32_t id, uint32_t permissions,
199
const char *type, uint32_t version, const struct spa_dict *props)
200
{
201
pipewire-0.3.50.tar.gz/src/modules/module-protocol-native/v0/interfaces.h -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-native/v0/interfaces.h
Changed
134
1
2
* \param types the types as a string
3
* \param n_types the number of \a types
4
*/
5
- void (*update_types) (void *object,
6
+ void (*update_types) (void *data,
7
uint32_t first_id,
8
const char **types,
9
uint32_t n_types);
10
11
* same sequence number.
12
* \param seq the sequence number passed to the sync method call
13
*/
14
- void (*done) (void *object, uint32_t seq);
15
+ void (*done) (void *data, uint32_t seq);
16
/**
17
* Fatal error event
18
*
19
20
* \param res error code
21
* \param error error description
22
*/
23
- void (*error) (void *object, uint32_t id, int res, const char *error, ...);
24
+ void (*error) (void *data, uint32_t id, int res, const char *error, ...);
25
/**
26
* Remove an object ID
27
*
28
29
* safely reuse the object ID.
30
* \param id deleted object ID
31
*/
32
- void (*remove_id) (void *object, uint32_t id);
33
+ void (*remove_id) (void *data, uint32_t id);
34
/**
35
* Notify new core info
36
*
37
* \param info new core info
38
*/
39
- void (*info) (void *object, struct pw_core_info *info);
40
+ void (*info) (void *data, struct pw_core_info *info);
41
};
42
43
#define pw_core_resource_v0_update_types(r,...) pw_resource_notify(r,struct pw_core_v0_events,update_types,__VA_ARGS__)
44
45
* \param version the version of the interface
46
* \param props extra properties of the global
47
*/
48
- void (*global) (void *object, uint32_t id, uint32_t parent_id,
49
+ void (*global) (void *data, uint32_t id, uint32_t parent_id,
50
uint32_t permissions, uint32_t type, uint32_t version,
51
const struct spa_dict *props);
52
/**
53
54
*
55
* \param id the id of the global that was removed
56
*/
57
- void (*global_remove) (void *object, uint32_t id);
58
+ void (*global_remove) (void *data, uint32_t id);
59
};
60
61
#define pw_registry_resource_v0_global(r,...) pw_resource_notify(r,struct pw_registry_v0_events,global,__VA_ARGS__)
62
63
*
64
* \param info info about the module
65
*/
66
- void (*info) (void *object, struct pw_module_info *info);
67
+ void (*info) (void *data, struct pw_module_info *info);
68
};
69
70
#define pw_module_resource_v0_info(r,...) pw_resource_notify(r,struct pw_module_v0_events,info,__VA_ARGS__)
71
72
*
73
* \param info info about the node
74
*/
75
- void (*info) (void *object, struct pw_node_info *info);
76
+ void (*info) (void *data, struct pw_node_info *info);
77
/**
78
* Notify a node param
79
*
80
81
* \param next the param index of the next param
82
* \param param the parameter
83
*/
84
- void (*param) (void *object,
85
+ void (*param) (void *data,
86
uint32_t id, uint32_t index, uint32_t next,
87
const struct spa_pod *param);
88
};
89
90
*
91
* \param info info about the port
92
*/
93
- void (*info) (void *object, struct pw_port_info *info);
94
+ void (*info) (void *data, struct pw_port_info *info);
95
/**
96
* Notify a port param
97
*
98
99
* \param next the param index of the next param
100
* \param param the parameter
101
*/
102
- void (*param) (void *object,
103
+ void (*param) (void *data,
104
uint32_t id, uint32_t index, uint32_t next,
105
const struct spa_pod *param);
106
};
107
108
*
109
* \param info info about the factory
110
*/
111
- void (*info) (void *object, struct pw_factory_info *info);
112
+ void (*info) (void *data, struct pw_factory_info *info);
113
};
114
115
#define pw_factory_resource_v0_info(r,...) pw_resource_notify(r,struct pw_factory_v0_events,info,__VA_ARGS__)
116
117
*
118
* \param info info about the client
119
*/
120
- void (*info) (void *object, struct pw_client_info *info);
121
+ void (*info) (void *data, struct pw_client_info *info);
122
};
123
124
#define pw_client_resource_v0_info(r,...) pw_resource_notify(r,struct pw_client_v0_events,info,__VA_ARGS__)
125
126
*
127
* \param info info about the link
128
*/
129
- void (*info) (void *object, struct pw_link_info *info);
130
+ void (*info) (void *data, struct pw_link_info *info);
131
};
132
133
#define pw_link_resource_v0_info(r,...) pw_resource_notify(r,struct pw_link_v0_events,info,__VA_ARGS__)
134
pipewire-0.3.50.tar.gz/src/modules/module-protocol-native/v0/protocol-native.c -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-native/v0/protocol-native.c
Changed
179
1
2
}
3
4
5
-static void core_marshal_info(void *object, const struct pw_core_info *info)
6
+static void core_marshal_info(void *data, const struct pw_core_info *info)
7
{
8
- struct pw_resource *resource = object;
9
+ struct pw_resource *resource = data;
10
struct pw_impl_client *client = pw_resource_get_client(resource);
11
struct protocol_compat_v2 *compat_v2 = client->compat_v2;
12
struct spa_pod_builder *b;
13
14
pw_protocol_native_end_resource(resource, b);
15
}
16
17
-static void core_marshal_done(void *object, uint32_t id, int seq)
18
+static void core_marshal_done(void *data, uint32_t id, int seq)
19
{
20
- struct pw_resource *resource = object;
21
+ struct pw_resource *resource = data;
22
struct spa_pod_builder *b;
23
24
b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_DONE, NULL);
25
26
pw_protocol_native_end_resource(resource, b);
27
}
28
29
-static void core_marshal_error(void *object, uint32_t id, int seq, int res, const char *error)
30
+static void core_marshal_error(void *data, uint32_t id, int seq, int res, const char *error)
31
{
32
- struct pw_resource *resource = object;
33
+ struct pw_resource *resource = data;
34
struct spa_pod_builder *b;
35
36
b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_ERROR, NULL);
37
38
pw_protocol_native_end_resource(resource, b);
39
}
40
41
-static void core_marshal_remove_id(void *object, uint32_t id)
42
+static void core_marshal_remove_id(void *data, uint32_t id)
43
{
44
- struct pw_resource *resource = object;
45
+ struct pw_resource *resource = data;
46
struct spa_pod_builder *b;
47
48
b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_REMOVE_ID, NULL);
49
50
return 0;
51
}
52
53
-static void registry_marshal_global(void *object, uint32_t id, uint32_t permissions,
54
+static void registry_marshal_global(void *data, uint32_t id, uint32_t permissions,
55
const char *type, uint32_t version, const struct spa_dict *props)
56
{
57
- struct pw_resource *resource = object;
58
+ struct pw_resource *resource = data;
59
struct pw_impl_client *client = pw_resource_get_client(resource);
60
struct spa_pod_builder *b;
61
struct spa_pod_frame f;
62
63
pw_protocol_native_end_resource(resource, b);
64
}
65
66
-static void registry_marshal_global_remove(void *object, uint32_t id)
67
+static void registry_marshal_global_remove(void *data, uint32_t id)
68
{
69
- struct pw_resource *resource = object;
70
+ struct pw_resource *resource = data;
71
struct spa_pod_builder *b;
72
73
b = pw_protocol_native_begin_resource(resource, PW_REGISTRY_V0_EVENT_GLOBAL_REMOVE, NULL);
74
75
return pw_resource_notify(resource, struct pw_registry_methods, bind, 0, id, type_name, version, new_id);
76
}
77
78
-static void module_marshal_info(void *object, const struct pw_module_info *info)
79
+static void module_marshal_info(void *data, const struct pw_module_info *info)
80
{
81
- struct pw_resource *resource = object;
82
+ struct pw_resource *resource = data;
83
struct spa_pod_builder *b;
84
struct spa_pod_frame f;
85
uint32_t i, n_items;
86
87
pw_protocol_native_end_resource(resource, b);
88
}
89
90
-static void factory_marshal_info(void *object, const struct pw_factory_info *info)
91
+static void factory_marshal_info(void *data, const struct pw_factory_info *info)
92
{
93
- struct pw_resource *resource = object;
94
+ struct pw_resource *resource = data;
95
struct pw_impl_client *client = pw_resource_get_client(resource);
96
struct spa_pod_builder *b;
97
struct spa_pod_frame f;
98
99
pw_protocol_native_end_resource(resource, b);
100
}
101
102
-static void node_marshal_info(void *object, const struct pw_node_info *info)
103
+static void node_marshal_info(void *data, const struct pw_node_info *info)
104
{
105
- struct pw_resource *resource = object;
106
+ struct pw_resource *resource = data;
107
struct spa_pod_builder *b;
108
struct spa_pod_frame f;
109
uint32_t i, n_items;
110
111
pw_protocol_native_end_resource(resource, b);
112
}
113
114
-static void node_marshal_param(void *object, int seq, uint32_t id, uint32_t index, uint32_t next,
115
+static void node_marshal_param(void *data, int seq, uint32_t id, uint32_t index, uint32_t next,
116
const struct spa_pod *param)
117
{
118
- struct pw_resource *resource = object;
119
+ struct pw_resource *resource = data;
120
struct pw_impl_client *client = pw_resource_get_client(resource);
121
struct spa_pod_builder *b;
122
struct spa_pod_frame f;
123
124
0, id, index, num, filter);
125
}
126
127
-static void port_marshal_info(void *object, const struct pw_port_info *info)
128
+static void port_marshal_info(void *data, const struct pw_port_info *info)
129
{
130
- struct pw_resource *resource = object;
131
+ struct pw_resource *resource = data;
132
struct spa_pod_builder *b;
133
struct spa_pod_frame f;
134
uint32_t i, n_items;
135
136
pw_protocol_native_end_resource(resource, b);
137
}
138
139
-static void port_marshal_param(void *object, int seq, uint32_t id, uint32_t index, uint32_t next,
140
+static void port_marshal_param(void *data, int seq, uint32_t id, uint32_t index, uint32_t next,
141
const struct spa_pod *param)
142
{
143
- struct pw_resource *resource = object;
144
+ struct pw_resource *resource = data;
145
struct pw_impl_client *client = pw_resource_get_client(resource);
146
struct spa_pod_builder *b;
147
struct spa_pod_frame f;
148
149
0, id, index, num, filter);
150
}
151
152
-static void client_marshal_info(void *object, const struct pw_client_info *info)
153
+static void client_marshal_info(void *data, const struct pw_client_info *info)
154
{
155
- struct pw_resource *resource = object;
156
+ struct pw_resource *resource = data;
157
struct spa_pod_builder *b;
158
struct spa_pod_frame f;
159
uint32_t i, n_items;
160
161
pw_protocol_native_end_resource(resource, b);
162
}
163
164
-static void client_marshal_permissions(void *object, uint32_t index, uint32_t n_permissions,
165
+static void client_marshal_permissions(void *data, uint32_t index, uint32_t n_permissions,
166
const struct pw_permission *permissions)
167
{
168
}
169
170
171
-static void link_marshal_info(void *object, const struct pw_link_info *info)
172
+static void link_marshal_info(void *data, const struct pw_link_info *info)
173
{
174
- struct pw_resource *resource = object;
175
+ struct pw_resource *resource = data;
176
struct spa_pod_builder *b;
177
struct spa_pod_frame f;
178
uint32_t i, n_items;
179
pipewire-0.3.50.tar.gz/src/modules/module-protocol-pulse.c -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-pulse.c
Changed
201
1
2
#include "module-protocol-pulse/pulse-server.h"
3
4
/** \page page_module_protocol_pulse PipeWire Module: Protocol Pulse
5
+ *
6
+ * This module implements a complete PulseAudio server on top of
7
+ * PipeWire. This is only the server implementation, client are expected
8
+ * to use the original PulseAudio client library. This provides a
9
+ * high level of compatibility with existing applications; in fact,
10
+ * all usual PulseAudio tools such as pavucontrol, pactl, pamon, paplay
11
+ * should continue to work as they did before.
12
+ *
13
+ * This module is usually loaded as part of a standalone pipewire process,
14
+ * called pipewire-pulse, with the pipewire-pulse.conf config file.
15
+ *
16
+ * The pulse server implements a sample cache that is otherwise not
17
+ * available in PipeWire.
18
+ *
19
+ * ## Module Options
20
+ *
21
+ * The module arguments can be the contents of the pulse.properties but
22
+ * it is recommended to make a separate pulse.properties section in the
23
+ * config file so that overrides can be done.
24
+ *
25
+ * ## pulse.properties
26
+ *
27
+ * A config section with server properties can be given.
28
+ *
29
+ *\code{.unparsed}
30
+ * pulse.properties = {
31
+ * # the addresses this server listens on
32
+ * server.address =
33
+ * "unix:native"
34
+ * #"unix:/tmp/something" # absolute paths may be used
35
+ * #"tcp:4713" # IPv4 and IPv6 on all addresses
36
+ * #"tcp::::9999" # IPv6 on all addresses
37
+ * #"tcp:127.0.0.1:8888" # IPv4 on a single address
38
+ * #
39
+ * #{ address = "tcp:4713" # address
40
+ * # max-clients = 64 # maximum number of clients
41
+ * # listen-backlog = 32 # backlog in the server listen queue
42
+ * # client.access = "restricted" # permissions for clients
43
+ * #}
44
+ *
45
+ * #pulse.min.req = 256/48000 # 5ms
46
+ * #pulse.default.req = 960/48000 # 20 milliseconds
47
+ * #pulse.min.frag = 256/48000 # 5ms
48
+ * #pulse.default.frag = 96000/48000 # 2 seconds
49
+ * #pulse.default.tlength = 96000/48000 # 2 seconds
50
+ * #pulse.min.quantum = 256/48000 # 5ms
51
+ * #pulse.default.format = F32
52
+ * #pulse.default.position = FL FR
53
+ * # These overrides are only applied when running in a vm.
54
+ * vm.overrides = {
55
+ * pulse.min.quantum = 1024/48000 # 22ms
56
+ * }
57
+ * }
58
+ *\endcode
59
+ *
60
+ * ### Connection options
61
+ *
62
+ *\code{.unparsed}
63
+ * ...
64
+ * server.address =
65
+ * "unix:native"
66
+ * # "tcp:4713"
67
+ *
68
+ * ...
69
+ *\endcode
70
+ *
71
+ * The addresses the server listens on when starting. Uncomment the `tcp:4713` entry to also
72
+ * make the server listen on a tcp socket. This is equivalent to loading `module-native-protocol-tcp`.
73
+ *
74
+ * There is also a slightly more verbose syntax with more options:
75
+ *
76
+ *\code{.unparsed}
77
+ * ....
78
+ * server.address =
79
+ * { address = "tcp:4713" # address
80
+ * max-clients = 64 # maximum number of clients
81
+ * listen-backlog = 32 # backlog in the server listen queue
82
+ * client.access = "restricted" # permissions for clients
83
+ * }
84
+ * ....
85
+ *\endcode
86
+ *
87
+ * Use `client.access` to use one of the access methods to restrict the permissions given to
88
+ * clients connected via this address.
89
+ *
90
+ * By default network access is given the "restricted" permissions. The session manager is responsible
91
+ * for assigning permission to clients with restricted permissions (usually read-only permissions).
92
+ *
93
+ * ### Playback buffering options
94
+ *
95
+ *\code{.unparsed}
96
+ * pulse.min.req = 256/48000 # 5ms
97
+ *\endcode
98
+ *
99
+ * The minimum amount of data to request for clients. The client requested
100
+ * values will be clamped to this value. Lowering this value together with
101
+ * tlength can decrease latency if the client wants this, but increase CPU overhead.
102
+ *
103
+ *\code{.unparsed}
104
+ * pulse.default.req = 960/48000 # 20 milliseconds
105
+ *\endcode
106
+ *
107
+ * The default amount of data to request for clients. If the client does not
108
+ * specify any particular value, this default will be used. Lowering this value
109
+ * together with tlength can decrease latency but increase CPU overhead.
110
+ *
111
+ *\code{.unparsed}
112
+ * pulse.default.tlength = 96000/48000 # 2 seconds
113
+ *\endcode
114
+ *
115
+ * The target amount of data to buffer on the server side. If the client did not
116
+ * specify a value, this default will be used. Lower values can decrease the
117
+ * latency.
118
+ *
119
+ * ### Record buffering options
120
+ *
121
+ *\code{.unparsed}
122
+ * pulse.min.frag = 256/48000 # 5ms
123
+ *\endcode
124
+ *
125
+ * The minimum allowed size of the capture buffer before it is sent to a client.
126
+ * The requested value of the client will be clamped to this. Lowering this value
127
+ * can reduce latency at the expense of more CPU usage.
128
+ *
129
+ *\code{.unparsed}
130
+ * pulse.default.frag = 96000/48000 # 2 seconds
131
+ *\endcode
132
+ *
133
+ * The default size of the capture buffer before it is sent to a client. If the client
134
+ * did not specify any value, this default will be used. Lowering this value can
135
+ * reduce latency at the expense of more CPU usage.
136
+ *
137
+ * ### Scheduling options
138
+ *
139
+ *\code{.unparsed}
140
+ * pulse.min.quantum = 256/48000 # 5ms
141
+ *\endcode
142
+ *
143
+ * The minimum quantum (buffer size in samples) to use for pulseaudio clients.
144
+ * This value is calculated based on the frag and req/tlength for record and
145
+ * playback streams respectively and then clamped to this value to ensure no
146
+ * pulseaudio client asks for too small quantums. Lowering this value might
147
+ * decrease latency at the expense of more CPU usage.
148
+ *
149
+ * ### Format options
150
+ *
151
+ *\code{.unparsed}
152
+ * pulse.default.format = F32
153
+ *\endcode
154
+ *
155
+ * Some modules will default to this format when no other format was given. This
156
+ * is equivalent to the PulseAudio `default-sample-format` option in
157
+ * `/etc/pulse/daemon.conf`.
158
+ *
159
+ *\code{.unparsed}
160
+ * pulse.default.position = FL FR
161
+ *\endcode
162
+ *
163
+ * Some modules will default to this channelmap (with its number of channels).
164
+ * This is equivalent to the PulseAudio `default-sample-channels` and
165
+ * `default-channel-map` options in `/etc/pulse/daemon.conf`.
166
+ *
167
+ * ### VM options
168
+ *
169
+ *\code{.unparsed}
170
+ * vm.overrides = {
171
+ * pulse.min.quantum = 1024/48000 # 22ms
172
+ * }
173
+ *\endcode
174
+ *
175
+ * When running in a VM, the `vm.override` section will override the properties
176
+ * in pulse.properties with the given values. This might be interesting because
177
+ * VMs usually can't support the low latency settings that are possible on real
178
+ * hardware.
179
+ *
180
+ * ## Application settings (Rules)
181
+ *
182
+ * The pulse protocol module supports generic config rules. It provides a `quirks`
183
+ * and an `update-props` action.
184
+ *
185
+ * Streams created by module-protocol-pulse will use the stream.properties
186
+ * section and stream.rules sections as usual.
187
+ *
188
+ *\code{.unparsed}
189
+ * pulse.rules =
190
+ * {
191
+ * # skype does not want to use devices that don't have an S16 sample format.
192
+ * matches =
193
+ * { application.process.binary = "teams" }
194
+ * { application.process.binary = "teams-insiders" }
195
+ * { application.process.binary = "skypeforlinux" }
196
+ *
197
+ * actions = { quirks = force-s16-info }
198
+ * }
199
+ * {
200
+ * # speech dispatcher asks for too small latency and then underruns.
201
pipewire-0.3.50.tar.gz/src/modules/module-protocol-pulse/manager.c -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-pulse/manager.c
Changed
105
1
2
};
3
4
/* client */
5
-static void client_event_info(void *object, const struct pw_client_info *info)
6
+static void client_event_info(void *data, const struct pw_client_info *info)
7
{
8
- struct object *o = object;
9
+ struct object *o = data;
10
int changed = 0;
11
12
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->this.id, info->change_mask);
13
14
};
15
16
/* module */
17
-static void module_event_info(void *object, const struct pw_module_info *info)
18
+static void module_event_info(void *data, const struct pw_module_info *info)
19
{
20
- struct object *o = object;
21
+ struct object *o = data;
22
int changed = 0;
23
24
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->this.id, info->change_mask);
25
26
};
27
28
/* device */
29
-static void device_event_info(void *object, const struct pw_device_info *info)
30
+static void device_event_info(void *data, const struct pw_device_info *info)
31
{
32
- struct object *o = object;
33
+ struct object *o = data;
34
uint32_t i, changed = 0;
35
36
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->this.id, info->change_mask);
37
38
return NULL;
39
}
40
41
-static void device_event_param(void *object, int seq,
42
+static void device_event_param(void *data, int seq,
43
uint32_t id, uint32_t index, uint32_t next,
44
const struct spa_pod *param)
45
{
46
- struct object *o = object, *dev;
47
+ struct object *o = data, *dev;
48
struct manager *m = o->manager;
49
struct pw_manager_param *p;
50
51
52
};
53
54
/* node */
55
-static void node_event_info(void *object, const struct pw_node_info *info)
56
+static void node_event_info(void *data, const struct pw_node_info *info)
57
{
58
- struct object *o = object;
59
+ struct object *o = data;
60
uint32_t i, changed = 0;
61
62
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->this.id, info->change_mask);
63
64
}
65
}
66
67
-static void node_event_param(void *object, int seq,
68
+static void node_event_param(void *data, int seq,
69
uint32_t id, uint32_t index, uint32_t next,
70
const struct spa_pod *param)
71
{
72
- struct object *o = object;
73
+ struct object *o = data;
74
add_param(&o->pending_list, seq, o->param_seq, id, param);
75
}
76
77
78
};
79
80
/* metadata */
81
-static int metadata_property(void *object,
82
+static int metadata_property(void *data,
83
uint32_t subject,
84
const char *key,
85
const char *type,
86
const char *value)
87
{
88
- struct object *o = object;
89
+ struct object *o = data;
90
struct manager *m = o->manager;
91
manager_emit_metadata(m, &o->this, subject, key, type, value);
92
return 0;
93
94
core_sync(m);
95
}
96
97
-static void registry_event_global_remove(void *object, uint32_t id)
98
+static void registry_event_global_remove(void *data, uint32_t id)
99
{
100
- struct manager *m = object;
101
+ struct manager *m = data;
102
struct object *o;
103
104
if ((o = find_object_by_id(m, id)) == NULL)
105
pipewire-0.3.50.tar.gz/src/modules/module-protocol-pulse/message.c -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-pulse/message.c
Changed
15
1
2
3
alloc = SPA_ROUND_UP_N(SPA_MAX(m->allocated + size, 4096u), 4096u);
4
diff = alloc - m->allocated;
5
- if ((data = realloc(m->data, alloc)) == NULL)
6
+ if ((data = realloc(m->data, alloc)) == NULL) {
7
+ free(m->data);
8
+ m->stat->allocated -= m->allocated;
9
+ m->allocated = 0;
10
return -errno;
11
+ }
12
m->stat->allocated += diff;
13
m->stat->accumulated += diff;
14
m->data = data;
15
pipewire-0.3.50.tar.gz/src/modules/module-protocol-pulse/module.h -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-pulse/module.h
Changed
9
1
2
3
#define DEFINE_MODULE_INFO(name) \
4
__attribute__((used)) \
5
+ __attribute__((retain)) \
6
__attribute__((section("pw_mod_pulse_modules"))) \
7
__attribute__((aligned(__alignof__(struct module_info)))) \
8
const struct module_info name
9
pipewire-0.3.50.tar.gz/src/modules/module-protocol-pulse/modules/module-pipe-sink.c -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-pulse/modules/module-pipe-sink.c
Changed
10
1
2
goto out;
3
}
4
5
- if (pw_properties_get(capture_props, PW_KEY_NODE_WANT_DRIVER) == NULL)
6
- pw_properties_set(capture_props, PW_KEY_NODE_WANT_DRIVER, "true");
7
if (pw_properties_get(capture_props, PW_KEY_NODE_VIRTUAL) == NULL)
8
pw_properties_set(capture_props, PW_KEY_NODE_VIRTUAL, "true");
9
pw_properties_set(capture_props, PW_KEY_MEDIA_CLASS, "Audio/Sink");
10
pipewire-0.3.50.tar.gz/src/modules/module-protocol-pulse/modules/module-pipe-source.c -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-pulse/modules/module-pipe-source.c
Changed
10
1
2
goto out;
3
}
4
5
- if (pw_properties_get(playback_props, PW_KEY_NODE_WANT_DRIVER) == NULL)
6
- pw_properties_set(playback_props, PW_KEY_NODE_WANT_DRIVER, "true");
7
if (pw_properties_get(playback_props, PW_KEY_NODE_VIRTUAL) == NULL)
8
pw_properties_set(playback_props, PW_KEY_NODE_VIRTUAL, "true");
9
pw_properties_set(playback_props, PW_KEY_MEDIA_CLASS, "Audio/Source");
10
pipewire-0.3.51.tar.gz/src/modules/module-protocol-pulse/modules/module-roc-sink-input.c
Added
201
1
2
+/* PipeWire
3
+ *
4
+ * Copyright © 2021 Wim Taymans <wim.taymans@gmail.com>
5
+ * Copyright © 2021 Sanchayan Maity <sanchayan@asymptotic.io>
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a
8
+ * copy of this software and associated documentation files (the "Software"),
9
+ * to deal in the Software without restriction, including without limitation
10
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ * and/or sell copies of the Software, and to permit persons to whom the
12
+ * Software is furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice (including the next
15
+ * paragraph) shall be included in all copies or substantial portions of the
16
+ * Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24
+ * DEALINGS IN THE SOFTWARE.
25
+ */
26
+
27
+#include <spa/utils/hook.h>
28
+#include <pipewire/pipewire.h>
29
+#include <pipewire/private.h>
30
+
31
+#include "../defs.h"
32
+#include "../module.h"
33
+
34
+#define NAME "roc-source"
35
+
36
+PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
37
+#define PW_LOG_TOPIC_DEFAULT mod_topic
38
+
39
+struct module_roc_sink_input_data {
40
+ struct module *module;
41
+
42
+ struct spa_hook mod_listener;
43
+ struct pw_impl_module *mod;
44
+
45
+ struct pw_properties *source_props;
46
+ struct pw_properties *roc_props;
47
+};
48
+
49
+static void module_destroy(void *data)
50
+{
51
+ struct module_roc_sink_input_data *d = data;
52
+ spa_hook_remove(&d->mod_listener);
53
+ d->mod = NULL;
54
+ module_schedule_unload(d->module);
55
+}
56
+
57
+static const struct pw_impl_module_events module_events = {
58
+ PW_VERSION_IMPL_MODULE_EVENTS,
59
+ .destroy = module_destroy
60
+};
61
+
62
+static int module_roc_sink_input_load(struct client *client, struct module *module)
63
+{
64
+ struct module_roc_sink_input_data *data = module->user_data;
65
+ FILE *f;
66
+ char *args;
67
+ size_t size;
68
+
69
+ pw_properties_setf(data->source_props, "pulse.module.id",
70
+ "%u", module->index);
71
+
72
+ if ((f = open_memstream(&args, &size)) == NULL)
73
+ return -errno;
74
+
75
+ fprintf(f, "{");
76
+ pw_properties_serialize_dict(f, &data->roc_props->dict, 0);
77
+ fprintf(f, " source.props = {");
78
+ pw_properties_serialize_dict(f, &data->source_props->dict, 0);
79
+ fprintf(f, " } }");
80
+ fclose(f);
81
+
82
+ data->mod = pw_context_load_module(module->impl->context,
83
+ "libpipewire-module-roc-source",
84
+ args, NULL);
85
+
86
+ free(args);
87
+
88
+ if (data->mod == NULL)
89
+ return -errno;
90
+
91
+ pw_impl_module_add_listener(data->mod,
92
+ &data->mod_listener,
93
+ &module_events, data);
94
+
95
+ return 0;
96
+}
97
+
98
+static int module_roc_sink_input_unload(struct module *module)
99
+{
100
+ struct module_roc_sink_input_data *d = module->user_data;
101
+
102
+ if (d->mod) {
103
+ spa_hook_remove(&d->mod_listener);
104
+ pw_impl_module_destroy(d->mod);
105
+ d->mod = NULL;
106
+ }
107
+
108
+ pw_properties_free(d->roc_props);
109
+ pw_properties_free(d->source_props);
110
+
111
+ return 0;
112
+}
113
+
114
+static const struct spa_dict_item module_roc_sink_input_info = {
115
+ { PW_KEY_MODULE_AUTHOR, "Sanchayan Maity <sanchayan@asymptotic.io>" },
116
+ { PW_KEY_MODULE_DESCRIPTION, "roc sink-input" },
117
+ { PW_KEY_MODULE_USAGE, "sink=<name for the sink> "
118
+ "sink_input_properties=<properties for the sink_input> "
119
+ "resampler_profile=<empty>|disable|high|medium|low "
120
+ "fec_code=<empty>|disable|rs8m|ldpc "
121
+ "sess_latency_msec=<target network latency in milliseconds> "
122
+ "local_ip=<local receiver ip> "
123
+ "local_source_port=<local receiver port for source packets> "
124
+ "local_repair_port=<local receiver port for repair packets> " },
125
+ { PW_KEY_MODULE_VERSION, PACKAGE_VERSION },
126
+};
127
+
128
+struct module *create_module_roc_sink_input(struct impl *impl, const char *argument)
129
+{
130
+ struct module *module;
131
+ struct module_roc_sink_input_data *d;
132
+ struct pw_properties *props = NULL, *source_props = NULL, *roc_props = NULL;
133
+ const char *str;
134
+ int res;
135
+
136
+ PW_LOG_TOPIC_INIT(mod_topic);
137
+
138
+ props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_roc_sink_input_info));
139
+ source_props = pw_properties_new(NULL, NULL);
140
+ roc_props = pw_properties_new(NULL, NULL);
141
+ if (!props || !source_props || !roc_props) {
142
+ res = -errno;
143
+ goto out;
144
+ }
145
+
146
+ if (argument != NULL)
147
+ module_args_add_props(props, argument);
148
+
149
+ if ((str = pw_properties_get(props, "sink")) != NULL) {
150
+ pw_properties_set(source_props, PW_KEY_TARGET_OBJECT, str);
151
+ pw_properties_set(props, "sink", NULL);
152
+ }
153
+ if ((str = pw_properties_get(props, "sink_input_properties")) != NULL) {
154
+ module_args_add_props(source_props, str);
155
+ pw_properties_set(props, "sink_input_properties", NULL);
156
+ }
157
+
158
+ if ((str = pw_properties_get(props, "local_ip")) != NULL) {
159
+ pw_properties_set(roc_props, "local.ip", str);
160
+ pw_properties_set(props, "local_ip", NULL);
161
+ }
162
+
163
+ if ((str = pw_properties_get(props, "local_source_port")) != NULL) {
164
+ pw_properties_set(roc_props, "local.source.port", str);
165
+ pw_properties_set(props, "local_source_port", NULL);
166
+ }
167
+
168
+ if ((str = pw_properties_get(props, "local_repair_port")) != NULL) {
169
+ pw_properties_set(roc_props, "local.repair.port", str);
170
+ pw_properties_set(props, "local_repair_port", NULL);
171
+ }
172
+
173
+ if ((str = pw_properties_get(props, "sess_latency_msec")) != NULL) {
174
+ pw_properties_set(roc_props, "sess.latency.msec", str);
175
+ pw_properties_set(props, "sess_latency_msec", NULL);
176
+ }
177
+
178
+ if ((str = pw_properties_get(props, "resampler_profile")) != NULL) {
179
+ pw_properties_set(roc_props, "resampler.profile", str);
180
+ pw_properties_set(props, "resampler_profile", NULL);
181
+ }
182
+
183
+ if ((str = pw_properties_get(props, "fec_code")) != NULL) {
184
+ pw_properties_set(roc_props, "fec.code", str);
185
+ pw_properties_set(props, "fec_code", NULL);
186
+ }
187
+
188
+ module = module_new(impl, sizeof(*d));
189
+ if (module == NULL) {
190
+ res = -errno;
191
+ goto out;
192
+ }
193
+
194
+ module->props = props;
195
+ d = module->user_data;
196
+ d->module = module;
197
+ d->source_props = source_props;
198
+ d->roc_props = roc_props;
199
+
200
+ return module;
201
pipewire-0.3.50.tar.gz/src/modules/module-protocol-pulse/modules/module-roc-sink.c -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-pulse/modules/module-roc-sink.c
Changed
47
1
2
PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
3
#define PW_LOG_TOPIC_DEFAULT mod_topic
4
5
-#define ROC_DEFAULT_IP "0.0.0.0"
6
-#define ROC_DEFAULT_SOURCE_PORT "10001"
7
-#define ROC_DEFAULT_REPAIR_PORT "10002"
8
-
9
struct module_roc_sink_data {
10
struct module *module;
11
12
13
{ PW_KEY_MODULE_DESCRIPTION, "roc sink" },
14
{ PW_KEY_MODULE_USAGE, "sink_name=<name for the sink> "
15
"sink_properties=<properties for the sink> "
16
+ "fec_code=<empty>|disable|rs8m|ldpc "
17
"local_ip=<local sender ip> "
18
"remote_ip=<remote receiver ip> "
19
"remote_source_port=<remote receiver port for source packets> "
20
21
if ((str = pw_properties_get(props, "local_ip")) != NULL) {
22
pw_properties_set(roc_props, "local.ip", str);
23
pw_properties_set(props, "local_ip", NULL);
24
- } else {
25
- pw_properties_set(roc_props, "local.ip", ROC_DEFAULT_IP);
26
}
27
28
if ((str = pw_properties_get(props, "remote_source_port")) != NULL) {
29
pw_properties_set(roc_props, "remote.source.port", str);
30
pw_properties_set(props, "remote_source_port", NULL);
31
- } else {
32
- pw_properties_set(roc_props, "remote.source.port", ROC_DEFAULT_SOURCE_PORT);
33
}
34
35
if ((str = pw_properties_get(props, "remote_repair_port")) != NULL) {
36
pw_properties_set(roc_props, "remote.repair.port", str);
37
pw_properties_set(props, "remote_repair_port", NULL);
38
- } else {
39
- pw_properties_set(roc_props, "remote.repair.port", ROC_DEFAULT_REPAIR_PORT);
40
+ }
41
+ if ((str = pw_properties_get(props, "fec_code")) != NULL) {
42
+ pw_properties_set(roc_props, "fec.code", str);
43
+ pw_properties_set(props, "fec_code", NULL);
44
}
45
46
module = module_new(impl, sizeof(*d));
47
pipewire-0.3.50.tar.gz/src/modules/module-protocol-pulse/modules/module-roc-source.c -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-pulse/modules/module-roc-source.c
Changed
62
1
2
PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
3
#define PW_LOG_TOPIC_DEFAULT mod_topic
4
5
-#define ROC_DEFAULT_IP "0.0.0.0"
6
-#define ROC_DEFAULT_SOURCE_PORT "10001"
7
-#define ROC_DEFAULT_REPAIR_PORT "10002"
8
-
9
struct module_roc_source_data {
10
struct module *module;
11
12
13
{ PW_KEY_MODULE_USAGE, "source_name=<name for the source> "
14
"source_properties=<properties for the source> "
15
"resampler_profile=<empty>|disable|high|medium|low "
16
+ "fec_code=<empty>|disable|rs8m|ldpc "
17
"sess_latency_msec=<target network latency in milliseconds> "
18
"local_ip=<local receiver ip> "
19
"local_source_port=<local receiver port for source packets> "
20
21
if ((str = pw_properties_get(props, "local_ip")) != NULL) {
22
pw_properties_set(roc_props, "local.ip", str);
23
pw_properties_set(props, "local_ip", NULL);
24
- } else {
25
- pw_properties_set(roc_props, "local.ip", ROC_DEFAULT_IP);
26
}
27
28
if ((str = pw_properties_get(props, "local_source_port")) != NULL) {
29
pw_properties_set(roc_props, "local.source.port", str);
30
pw_properties_set(props, "local_source_port", NULL);
31
- } else {
32
- pw_properties_set(roc_props, "local.source.port", ROC_DEFAULT_SOURCE_PORT);
33
}
34
35
if ((str = pw_properties_get(props, "local_repair_port")) != NULL) {
36
pw_properties_set(roc_props, "local.repair.port", str);
37
pw_properties_set(props, "local_repair_port", NULL);
38
- } else {
39
- pw_properties_set(roc_props, "local.repair.port", ROC_DEFAULT_REPAIR_PORT);
40
}
41
42
if ((str = pw_properties_get(props, "sess_latency_msec")) != NULL) {
43
pw_properties_set(roc_props, "sess.latency.msec", str);
44
pw_properties_set(props, "sess_latency_msec", NULL);
45
- } else {
46
- pw_properties_set(roc_props, "sess.latency.msec", ROC_DEFAULT_REPAIR_PORT);
47
}
48
49
if ((str = pw_properties_get(props, "resampler_profile")) != NULL) {
50
pw_properties_set(roc_props, "resampler.profile", str);
51
pw_properties_set(props, "resampler_profile", NULL);
52
- } else {
53
- pw_properties_set(roc_props, "resampler.profile", ROC_DEFAULT_REPAIR_PORT);
54
+ }
55
+
56
+ if ((str = pw_properties_get(props, "fec_code")) != NULL) {
57
+ pw_properties_set(roc_props, "fec.code", str);
58
+ pw_properties_set(props, "fec_code", NULL);
59
}
60
61
module = module_new(impl, sizeof(*d));
62
pipewire-0.3.50.tar.gz/src/modules/module-protocol-pulse/pulse-server.c -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-pulse/pulse-server.c
Changed
39
1
2
{
3
struct stream *stream = data;
4
switch (id) {
5
- case SPA_IO_RateMatch:
6
- stream->rate_match = area;
7
- break;
8
case SPA_IO_Position:
9
stream->position = area;
10
break;
11
12
{
13
uint32_t channel, rate;
14
struct stream *stream;
15
- bool match;
16
+ float corr;
17
18
if (message_get(m,
19
TAG_U32, &channel,
20
21
if (stream == NULL || stream->type == STREAM_TYPE_UPLOAD)
22
return -ENOENT;
23
24
- if (stream->rate_match == NULL)
25
- return -ENOTSUP;
26
-
27
- match = rate != stream->ss.rate;
28
stream->rate = rate;
29
- stream->rate_match->rate = match ?
30
- (double)rate/(double)stream->ss.rate : 1.0;
31
- SPA_FLAG_UPDATE(stream->rate_match->flags,
32
- SPA_IO_RATE_MATCH_FLAG_ACTIVE, match);
33
+
34
+ corr = (double)rate/(double)stream->ss.rate;
35
+ pw_stream_set_control(stream->stream, SPA_PROP_rate, 1, &corr, NULL);
36
37
return reply_simple_ack(client, tag);
38
}
39
pipewire-0.3.50.tar.gz/src/modules/module-protocol-pulse/server.c -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-pulse/server.c
Changed
9
1
2
3
client->props = pw_properties_new(
4
PW_KEY_CLIENT_API, "pipewire-pulse",
5
+ "config.ext", pw_properties_get(impl->props, "config.ext"),
6
NULL);
7
if (client->props == NULL)
8
goto error;
9
pipewire-0.3.50.tar.gz/src/modules/module-protocol-pulse/stream.h -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-pulse/stream.h
Changed
9
1
2
struct pw_stream *stream;
3
struct spa_hook stream_listener;
4
5
- struct spa_io_rate_match *rate_match;
6
struct spa_io_position *position;
7
struct spa_ringbuffer ring;
8
void *buffer;
9
pipewire-0.3.50.tar.gz/src/modules/module-protocol-simple.c -> pipewire-0.3.51.tar.gz/src/modules/module-protocol-simple.c
Changed
112
1
2
#include <pipewire/impl.h>
3
4
/** \page page_module_protocol_simple PipeWire Module: Protocol Simple
5
+ *
6
+ * The simple protocol provides a bidirectional audio stream on a network
7
+ * socket.
8
+ *
9
+ * It is meant to be used with the `simple protocol player` app, available on
10
+ * Android to play and record a stream.
11
+ *
12
+ * Each client that connects will create a capture and/or playback stream,
13
+ * depending on the configuration options.
14
+ *
15
+ * ## Module Options
16
+ *
17
+ * - `capture`: boolean if capture is enabled. This will create a capture stream
18
+ * for each connected client.
19
+ * - `playback`: boolean if playback is enabled. This will create a playback
20
+ * stream for each connected client.
21
+ * - `capture.node`: an optional node id or name to use for capture.
22
+ * - `playback.node`: an optional node id or name to use for playback.
23
+ * - `server.address = `: an array of server addresses to listen on as
24
+ * tcp:<ip>:<port>.
25
+ *
26
+ * ## General options
27
+ *
28
+ * Options with well-known behavior.
29
+ *
30
+ * - \ref PW_KEY_REMOTE_NAME
31
+ * - \ref PW_KEY_AUDIO_RATE
32
+ * - \ref PW_KEY_AUDIO_FORMAT
33
+ * - \ref PW_KEY_AUDIO_CHANNELS
34
+ * - \ref SPA_KEY_AUDIO_POSITION
35
+ * - \ref PW_KEY_NODE_LATENCY
36
+ * - \ref PW_KEY_NODE_RATE
37
+ * - \ref PW_KEY_STREAM_CAPTURE_SINK
38
+ *
39
+ * By default the server will work with stereo 16 bits samples at 44.1KHz.
40
+ *
41
+ * ## Example configuration
42
+ *
43
+ *\code{.unparsed}
44
+ * context.modules =
45
+ * { name = libpipewire-module-protocol-simple
46
+ * args = {
47
+ * # Provide capture stream, clients can capture data from PipeWire
48
+ * capture = true
49
+ * #
50
+ * # Provide playback stream, client can send data to PipeWire for playback
51
+ * playback = true
52
+ * #
53
+ * # The node name or id to use for capture.
54
+ * #capture.node = null
55
+ * #
56
+ * # To make the capture stream capture the monitor ports
57
+ * #stream.capture.sink = false
58
+ * #
59
+ * # The node name or id to use for playback.
60
+ * #playback.node = null
61
+ * #
62
+ * #audio.rate = 44100
63
+ * #audio.format = S16
64
+ * #audio.channels = 2
65
+ * #audio.position = FL FR
66
+ * #
67
+ * # The addresses this server listens on for new
68
+ * # client connections
69
+ * server.address =
70
+ * "tcp:4711"
71
+ *
72
+ * }
73
+ * }
74
+ *
75
+ *\endcode
76
*/
77
78
#define NAME "protocol-simple"
79
80
81
#define MODULE_USAGE " capture=<bool> " \
82
" playback=<bool> " \
83
+ " remote.name=<remote> " \
84
" node.latency=<num/denom, default:"DEFAULT_LATENCY"> " \
85
" node.rate=<1/rate, default:1/"DEFAULT_RATE"> " \
86
" capture.node=<source-target> stream.capture.sink=true " \
87
88
89
if (impl->capture) {
90
props = pw_properties_new(
91
- PW_KEY_NODE_WANT_DRIVER, "true",
92
PW_KEY_NODE_LATENCY, latency,
93
PW_KEY_NODE_RATE, pw_properties_get(impl->props, PW_KEY_NODE_RATE),
94
PW_KEY_NODE_TARGET, pw_properties_get(impl->props, "capture.node"),
95
96
}
97
if (impl->playback) {
98
props = pw_properties_new(
99
- PW_KEY_NODE_WANT_DRIVER, "true",
100
PW_KEY_NODE_LATENCY, latency,
101
PW_KEY_NODE_RATE, pw_properties_get(impl->props, PW_KEY_NODE_RATE),
102
PW_KEY_NODE_TARGET, pw_properties_get(impl->props, "playback.node"),
103
104
105
props = pw_properties_new(
106
PW_KEY_CLIENT_API, "protocol-simple",
107
+ PW_KEY_REMOTE_NAME,
108
+ pw_properties_get(impl->props, PW_KEY_REMOTE_NAME),
109
NULL);
110
if (props == NULL)
111
goto error;
112
pipewire-0.3.50.tar.gz/src/modules/module-pulse-tunnel.c -> pipewire-0.3.51.tar.gz/src/modules/module-pulse-tunnel.c
Changed
201
1
2
#include "module-protocol-pulse/format.h"
3
4
/** \page page_module_pulse_tunnel PipeWire Module: Pulse Tunnel
5
+ *
6
+ * The pulse-tunnel module provides a source or sink that tunnels all audio to
7
+ * a remote PulseAudio connection.
8
+ *
9
+ * It is usually used with the PulseAudio or module-protocol-pulse on the remote
10
+ * end to accept the connection.
11
+ *
12
+ * This module is usually used together with module-zeroconf-discover that will
13
+ * automatically load the tunnel with the right parameters based on zeroconf
14
+ * information.
15
+ *
16
+ * ## Module Options
17
+ *
18
+ * - `tunnel.mode`: the desired tunnel to create, must be `capture` or `playback`.
19
+ * (Default `playback`)
20
+ * - `pulse.server.address`: the address of the PulseAudio server to tunnel to.
21
+ * - `pulse.latency`: the latency to end-to-end latency in milliseconds to
22
+ * maintain (Default 200ms).
23
+ * - `stream.props`: Extra properties for the local stream.
24
+ *
25
+ * ## General options
26
+ *
27
+ * Options with well-known behavior.
28
+ *
29
+ * - \ref PW_KEY_REMOTE_NAME
30
+ * - \ref PW_KEY_AUDIO_RATE
31
+ * - \ref PW_KEY_AUDIO_CHANNELS
32
+ * - \ref SPA_KEY_AUDIO_POSITION
33
+ * - \ref PW_KEY_NODE_LATENCY
34
+ * - \ref PW_KEY_NODE_NAME
35
+ * - \ref PW_KEY_NODE_DESCRIPTION
36
+ * - \ref PW_KEY_NODE_GROUP
37
+ * - \ref PW_KEY_NODE_VIRTUAL
38
+ * - \ref PW_KEY_MEDIA_CLASS
39
+ * - \ref PW_KEY_NODE_TARGET to specify the remote name or id to link to
40
+ *
41
+ * ## Example configuration of a virtual sink
42
+ *
43
+ *\code{.unparsed}
44
+ * context.modules =
45
+ * { name = libpipewire-module-pulse-tunnel
46
+ * args = {
47
+ * tunnel.mode = playback
48
+ * # Set the remote address to tunnel to
49
+ * pulse.server.address = "tcp:192.168.1.126"
50
+ * #audio.rate=<sample rate>
51
+ * #audio.channels=<number of channels>
52
+ * #audio.position=<channel map>
53
+ * #node.target=<remote target node>
54
+ * stream.props = {
55
+ * # extra sink properties
56
+ * }
57
+ * }
58
+ * }
59
+ *
60
+ *\endcode
61
*/
62
63
#define NAME "pulse-tunnel"
64
65
pa_context *pa_context;
66
pa_stream *pa_stream;
67
68
+ uint32_t target_latency;
69
+ uint32_t current_latency;
70
uint32_t target_buffer;
71
struct spa_dll dll;
72
float max_error;
73
+ unsigned resync:1;
74
75
unsigned int do_disconnect:1;
76
};
77
78
79
pa_threaded_mainloop_lock(impl->pa_mainloop);
80
81
- pw_log_info("corking: %d", cork);
82
+ pw_log_debug("corking: %d", cork);
83
if (cork && impl->mode == MODE_PLAYBACK) {
84
/* When the sink becomes suspended (which is the only case where we
85
* cork the stream), we don't want to keep any old data around, because
86
87
* played at the time when the sink starts running again. */
88
if ((operation = pa_stream_flush(impl->pa_stream, NULL, NULL)))
89
pa_operation_unref(operation);
90
+
91
spa_ringbuffer_init(&impl->ring);
92
+ memset(impl->buffer, 0, RINGBUFFER_SIZE);
93
}
94
+ if (!cork)
95
+ impl->resync = true;
96
+
97
if ((operation = pa_stream_cork(impl->pa_stream, cork, NULL, NULL)))
98
pa_operation_unref(operation);
99
100
101
if (filled < 0) {
102
pw_log_warn("%p: underrun write:%u filled:%d",
103
impl, write_index, filled);
104
+ } else if ((uint32_t)filled + size > RINGBUFFER_SIZE) {
105
+ pw_log_warn("%p: overrun write:%u filled:%d + size:%u > max:%u",
106
+ impl, write_index, filled,
107
+ size, RINGBUFFER_SIZE);
108
+ impl->resync = true;
109
} else {
110
float error, corr;
111
112
- if ((uint32_t)filled + size > impl->target_buffer * 2) {
113
- pw_log_warn("%p: overrun write:%u filled:%d size:%u max:%u",
114
- impl, write_index, filled,
115
- size, RINGBUFFER_SIZE);
116
- write_index -= impl->target_buffer;
117
- filled -= impl->target_buffer;
118
- } else {
119
- error = (float)filled - (float)impl->target_buffer;
120
- error = SPA_CLAMP(error, -impl->max_error, impl->max_error);
121
+ error = (float)(impl->current_latency) - (float)impl->target_latency;
122
+ error = SPA_CLAMP(error, -impl->max_error, impl->max_error);
123
124
- pw_log_debug("filled:%u target:%u error:%f corr:%f", filled,
125
- impl->target_buffer, error, corr);
126
- corr = spa_dll_update(&impl->dll, error);
127
- pw_stream_set_control(impl->stream,
128
- SPA_PROP_rate, 1, &corr, NULL);
129
- }
130
+ corr = spa_dll_update(&impl->dll, error);
131
+ pw_log_debug("filled:%u target:%u error:%f corr:%f %u %u", filled,
132
+ impl->target_buffer, error, corr,
133
+ impl->current_latency, impl->target_latency);
134
+ pw_stream_set_control(impl->stream,
135
+ SPA_PROP_rate, 1, &corr, NULL);
136
}
137
spa_ringbuffer_write_data(&impl->ring,
138
impl->buffer, RINGBUFFER_SIZE,
139
140
struct pw_buffer *buf;
141
struct spa_data *bd;
142
int32_t avail;
143
- uint32_t size, req, read_index;
144
+ uint32_t size, req, index;
145
146
if ((buf = pw_stream_dequeue_buffer(impl->stream)) == NULL) {
147
pw_log_debug("out of buffers: %m");
148
149
if ((req = buf->requested * impl->frame_size) == 0)
150
req = 4096 * impl->frame_size;
151
152
- avail = spa_ringbuffer_get_read_index(&impl->ring, &read_index);
153
- if (avail <= 0) {
154
- size = SPA_MIN(bd->maxsize, req);
155
+ size = SPA_MIN(bd->maxsize, req);
156
+
157
+ avail = spa_ringbuffer_get_read_index(&impl->ring, &index);
158
+ if (avail < (int32_t)size) {
159
memset(bd->data, 0, size);
160
} else {
161
float error, corr;
162
163
- if (avail > (int32_t)impl->target_buffer * 2) {
164
- avail -= impl->target_buffer;
165
- read_index += impl->target_buffer;
166
+ if (avail > (int32_t)RINGBUFFER_SIZE) {
167
+ avail = impl->target_buffer;
168
+ index += avail - impl->target_buffer;
169
} else {
170
- error = (float)impl->target_buffer - (float)avail;
171
+ error = (float)(impl->current_latency) - (float)impl->target_latency;
172
error = SPA_CLAMP(error, -impl->max_error, impl->max_error);
173
174
corr = spa_dll_update(&impl->dll, error);
175
176
- pw_log_debug("avail:%u target:%u error:%f corr:%f", avail,
177
- impl->target_buffer, error, corr);
178
+ pw_log_debug("avail:%u target:%u error:%f corr:%f %u %u", avail,
179
+ impl->target_buffer, error, corr,
180
+ impl->current_latency, impl->target_latency);
181
pw_stream_set_control(impl->stream,
182
SPA_PROP_rate, 1, &corr, NULL);
183
}
184
185
- size = SPA_MIN(bd->maxsize, (uint32_t)avail);
186
- size = SPA_MIN(size, req);
187
-
188
spa_ringbuffer_read_data(&impl->ring,
189
impl->buffer, RINGBUFFER_SIZE,
190
- read_index & RINGBUFFER_MASK,
191
+ index & RINGBUFFER_MASK,
192
bd->data, size);
193
194
- read_index += size;
195
- spa_ringbuffer_read_update(&impl->ring, read_index);
196
-
197
+ index += size;
198
+ spa_ringbuffer_read_update(&impl->ring, index);
199
}
200
bd->chunk->offset = 0;
201
pipewire-0.3.50.tar.gz/src/modules/module-raop-discover.c -> pipewire-0.3.51.tar.gz/src/modules/module-raop-discover.c
Changed
33
1
2
#include "module-zeroconf-discover/avahi-poll.h"
3
4
/** \page page_module_raop_discover PipeWire Module: RAOP Discover
5
+ *
6
+ * Automatically creates RAOP (Airplay) sink devices based on zeroconf
7
+ * information.
8
+ *
9
+ * This module will load module-raop-sink for each discovered sink
10
+ * with the right parameters.
11
+ *
12
+ * ## Module Options
13
+ *
14
+ * This module has no options.
15
+ *
16
+ * ## Example configuration
17
+ *
18
+ *\code{.unparsed}
19
+ * context.modules =
20
+ * { name = libpipewire-raop-discover
21
+ * args = { }
22
+ * }
23
+ * }
24
+ *
25
+ *\endcode
26
+ *
27
+ * ## See also
28
+ *
29
+ * \ref page_module_raop_sink
30
*/
31
32
#define NAME "raop-discover"
33
pipewire-0.3.50.tar.gz/src/modules/module-raop-sink.c -> pipewire-0.3.51.tar.gz/src/modules/module-raop-sink.c
Changed
35
1
2
#include "module-raop/rtsp-client.h"
3
4
/** \page page_module_raop_sink PipeWire Module: AirPlay Sink
5
+ *
6
+ * Creates a new Sink to stream to an Airplay device.
7
+ *
8
+ * ## Module Options
9
+ *
10
+ * ## Example configuration
11
+ *
12
+ * ## See also
13
+ *
14
+ * \ref page_module_raop_discover
15
*/
16
17
#define NAME "raop-sink"
18
19
impl->context = context;
20
impl->loop = pw_context_get_main_loop(context);
21
22
- if (pw_properties_get(props, PW_KEY_NODE_WANT_DRIVER) == NULL)
23
- pw_properties_set(props, PW_KEY_NODE_WANT_DRIVER, "true");
24
if (pw_properties_get(props, PW_KEY_NODE_VIRTUAL) == NULL)
25
pw_properties_set(props, PW_KEY_NODE_VIRTUAL, "true");
26
27
28
copy_props(impl, props, PW_KEY_NODE_NAME);
29
copy_props(impl, props, PW_KEY_NODE_DESCRIPTION);
30
copy_props(impl, props, PW_KEY_NODE_GROUP);
31
- copy_props(impl, props, PW_KEY_NODE_WANT_DRIVER);
32
copy_props(impl, props, PW_KEY_NODE_LATENCY);
33
copy_props(impl, props, PW_KEY_NODE_VIRTUAL);
34
copy_props(impl, props, PW_KEY_MEDIA_CLASS);
35
pipewire-0.3.50.tar.gz/src/modules/module-roc-sink.c -> pipewire-0.3.51.tar.gz/src/modules/module-roc-sink.c
Changed
201
1
2
* - `remote.ip = <str>`: remote receiver ip
3
* - `remote.source.port = <str>`: remote receiver TCP/UDP port for source packets
4
* - `remote.repair.port = <str>`: remote receiver TCP/UDP port for receiver packets
5
+ * - `fec.code = <str>`: Possible values: `disable`, `rs8m`, `ldpc`
6
*
7
* ## General options
8
*
9
10
* { name = libpipewire-module-roc-sink
11
* args = {
12
* local.ip = 0.0.0.0
13
+ * fec.code = disable
14
* remote.ip = 192.168.0.244
15
* remote.source.port = 10001
16
* remote.repair.port = 10002
17
18
roc_context *context;
19
roc_sender *sender;
20
21
+ roc_fec_code fec_code;
22
char *local_ip;
23
char *remote_ip;
24
int remote_source_port;
25
int remote_repair_port;
26
};
27
28
+static int roc_parse_fec_code(roc_fec_code *out, const char *str)
29
+{
30
+ if (!str || !*str)
31
+ *out = ROC_FEC_DEFAULT;
32
+ else if (spa_streq(str, "disable"))
33
+ *out = ROC_FEC_DISABLE;
34
+ else if (spa_streq(str, "rs8m"))
35
+ *out = ROC_FEC_RS8M;
36
+ else if (spa_streq(str, "ldpc"))
37
+ *out = ROC_FEC_LDPC_STAIRCASE;
38
+ else
39
+ return -EINVAL;
40
+ return 0;
41
+}
42
+
43
static void stream_destroy(void *d)
44
{
45
struct module_roc_sink_data *data = d;
46
47
uint32_t n_params;
48
uint8_t buffer1024;
49
int res;
50
+ roc_protocol audio_proto, repair_proto;
51
52
if (roc_address_init(&data->local_addr, ROC_AF_AUTO, data->local_ip, 0)) {
53
pw_log_error("Invalid local IP address");
54
55
sender_config.frame_sample_rate = 44100;
56
sender_config.frame_channels = ROC_CHANNEL_SET_STEREO;
57
sender_config.frame_encoding = ROC_FRAME_ENCODING_PCM_FLOAT;
58
+ sender_config.fec_code = data->fec_code;
59
60
/* Fixed to be the same as ROC sender config above */
61
info.rate = 44100;
62
63
info.position0 = SPA_AUDIO_CHANNEL_FL;
64
info.position1 = SPA_AUDIO_CHANNEL_FR;
65
66
+ pw_properties_setf(data->capture_props, PW_KEY_NODE_RATE, "1/%d", info.rate);
67
+
68
data->sender = roc_sender_open(data->context, &sender_config);
69
if (!data->sender) {
70
pw_log_error("Failed to create roc sender");
71
72
return -EINVAL;
73
}
74
75
- if (roc_sender_connect(data->sender, ROC_PORT_AUDIO_SOURCE, ROC_PROTO_RTP_RS8M_SOURCE,
76
+ switch (data->fec_code) {
77
+ case ROC_FEC_DEFAULT:
78
+ case ROC_FEC_RS8M:
79
+ audio_proto = ROC_PROTO_RTP_RS8M_SOURCE;
80
+ repair_proto = ROC_PROTO_RS8M_REPAIR;
81
+ break;
82
+ case ROC_FEC_LDPC_STAIRCASE:
83
+ audio_proto = ROC_PROTO_RTP_LDPC_SOURCE;
84
+ repair_proto = ROC_PROTO_LDPC_REPAIR;
85
+ break;
86
+ default:
87
+ audio_proto = ROC_PROTO_RTP;
88
+ repair_proto = 0;
89
+ break;
90
+ }
91
+
92
+ if (roc_sender_connect(data->sender, ROC_PORT_AUDIO_SOURCE, audio_proto,
93
&data->remote_source_addr) != 0) {
94
pw_log_error("can't connect roc sender to remote source address");
95
return -EINVAL;
96
}
97
98
- if (roc_sender_connect(data->sender, ROC_PORT_AUDIO_REPAIR, ROC_PROTO_RS8M_REPAIR,
99
- &data->remote_repair_addr) != 0) {
100
- pw_log_error("can't connect roc sender to remote repair address");
101
- return -EINVAL;
102
+ if (repair_proto != 0) {
103
+ if (roc_sender_connect(data->sender, ROC_PORT_AUDIO_REPAIR, repair_proto,
104
+ &data->remote_repair_addr) != 0) {
105
+ pw_log_error("can't connect roc sender to remote repair address");
106
+ return -EINVAL;
107
+ }
108
}
109
110
data->capture = pw_stream_new(data->core,
111
112
{ PW_KEY_MODULE_DESCRIPTION, "roc sink" },
113
{ PW_KEY_MODULE_USAGE, "sink.name=<name for the sink> "
114
"local.ip=<local sender ip> "
115
+ "fec.code=<empty>|disable|rs8m|ldpc "
116
"remote.ip=<remote receiver ip> "
117
"remote.source.port=<remote receiver port for source packets> "
118
"remote.repair.port=<remote receiver port for repair packets> "
119
120
struct module_roc_sink_data *data;
121
struct pw_properties *props = NULL, *capture_props = NULL;
122
const char *str;
123
- char *local_ip = NULL, *remote_ip = NULL;
124
- int res = 0, remote_repair_port, remote_source_port;
125
+ int res = 0;
126
127
PW_LOG_TOPIC_INIT(mod_topic);
128
129
130
pw_properties_set(capture_props, PW_KEY_NODE_NAME, "roc-sink");
131
if (pw_properties_get(capture_props, PW_KEY_NODE_DESCRIPTION) == NULL)
132
pw_properties_set(capture_props, PW_KEY_NODE_DESCRIPTION, "ROC Sink");
133
- if (pw_properties_get(capture_props, PW_KEY_NODE_WANT_DRIVER) == NULL)
134
- pw_properties_set(capture_props, PW_KEY_NODE_WANT_DRIVER, "true");
135
if (pw_properties_get(capture_props, PW_KEY_NODE_VIRTUAL) == NULL)
136
pw_properties_set(capture_props, PW_KEY_NODE_VIRTUAL, "true");
137
if (pw_properties_get(capture_props, PW_KEY_NODE_NETWORK) == NULL)
138
139
pw_properties_set(capture_props, PW_KEY_MEDIA_CLASS, "Audio/Sink");
140
141
if ((str = pw_properties_get(props, "remote.ip")) != NULL) {
142
- remote_ip = strdup(str);
143
+ data->remote_ip = strdup(str);
144
pw_properties_set(props, "remote.ip", NULL);
145
} else {
146
pw_log_error("Remote IP not specified");
147
148
}
149
150
if ((str = pw_properties_get(props, "local.ip")) != NULL) {
151
- local_ip = strdup(str);
152
+ data->local_ip = strdup(str);
153
pw_properties_set(props, "local.ip", NULL);
154
} else {
155
- local_ip = strdup(ROC_DEFAULT_IP);
156
+ data->local_ip = strdup(ROC_DEFAULT_IP);
157
}
158
159
if ((str = pw_properties_get(props, "remote.source.port")) != NULL) {
160
- remote_source_port = pw_properties_parse_int(str);
161
+ data->remote_source_port = pw_properties_parse_int(str);
162
pw_properties_set(props, "remote.source.port", NULL);
163
} else {
164
- remote_source_port = ROC_DEFAULT_SOURCE_PORT;
165
+ data->remote_source_port = ROC_DEFAULT_SOURCE_PORT;
166
}
167
168
if ((str = pw_properties_get(props, "remote.repair.port")) != NULL) {
169
- remote_repair_port = pw_properties_parse_int(str);
170
+ data->remote_repair_port = pw_properties_parse_int(str);
171
pw_properties_set(props, "remote.repair.port", NULL);
172
} else {
173
- remote_repair_port = ROC_DEFAULT_REPAIR_PORT;
174
+ data->remote_repair_port = ROC_DEFAULT_REPAIR_PORT;
175
+ }
176
+ if ((str = pw_properties_get(props, "fec.code")) != NULL) {
177
+ if (roc_parse_fec_code(&data->fec_code, str)) {
178
+ pw_log_error("Invalid fec code %s, using default", str);
179
+ data->fec_code = ROC_FEC_DEFAULT;
180
+ }
181
+ pw_log_info("using fec.code %s %d", str, data->fec_code);
182
+ pw_properties_set(props, "fec.code", NULL);
183
+ } else {
184
+ data->fec_code = ROC_FEC_DEFAULT;
185
}
186
187
data->core = pw_context_get_object(data->module_context, PW_TYPE_INTERFACE_Core);
188
189
&data->core_listener,
190
&core_events, data);
191
192
- data->capture_props = capture_props;
193
- data->local_ip = local_ip;
194
- data->remote_ip = remote_ip;
195
- data->remote_source_port = remote_source_port;
196
- data->remote_repair_port = remote_repair_port;
197
-
198
if ((res = roc_sink_setup(data)) < 0)
199
goto out;
200
201
pipewire-0.3.50.tar.gz/src/modules/module-roc-source.c -> pipewire-0.3.51.tar.gz/src/modules/module-roc-source.c
Changed
201
1
2
* - `sess.latency.msec = <str>`: target network latency in milliseconds
3
* - `resampler.profile = <str>`: Possible values: `disable`, `high`,
4
* `medium`, `low`.
5
+ * - `fec.code = <str>`: Possible values: `disable`, `rs8m`, `ldpc`
6
*
7
* ## General options
8
*
9
10
* args = {
11
* local.ip = 0.0.0.0
12
* resampler.profile = medium
13
+ * fec.code = disable
14
* sess.latency.msec = 5000
15
* local.source.port = 10001
16
* local.repair.port = 10002
17
18
struct pw_properties *playback_props;
19
20
unsigned int do_disconnect:1;
21
+ uint32_t stride;
22
23
roc_address local_addr;
24
roc_address local_source_addr;
25
26
roc_context *context;
27
roc_receiver *receiver;
28
29
- char *resampler_profile;
30
+ roc_resampler_profile resampler_profile;
31
+ roc_fec_code fec_code;
32
char *local_ip;
33
int local_source_port;
34
int local_repair_port;
35
36
37
static int roc_parse_resampler_profile(roc_resampler_profile *out, const char *str)
38
{
39
- if (!str || !*str) {
40
+ if (!str || !*str)
41
*out = ROC_RESAMPLER_DEFAULT;
42
- return 0;
43
- } else if (spa_streq(str, "disable") == 0) {
44
+ else if (spa_streq(str, "disable"))
45
*out = ROC_RESAMPLER_DISABLE;
46
- return 0;
47
- } else if (spa_streq(str, "high") == 0) {
48
+ else if (spa_streq(str, "high"))
49
*out = ROC_RESAMPLER_HIGH;
50
- return 0;
51
- } else if (spa_streq(str, "medium") == 0) {
52
+ else if (spa_streq(str, "medium"))
53
*out = ROC_RESAMPLER_MEDIUM;
54
- return 0;
55
- } else if (spa_streq(str, "low") == 0) {
56
+ else if (spa_streq(str, "low"))
57
*out = ROC_RESAMPLER_LOW;
58
- return 0;
59
- } else {
60
- pw_log_error("Invalid resampler profile: %s", str);
61
+ else
62
return -EINVAL;
63
- }
64
+ return 0;
65
+}
66
+
67
+static int roc_parse_fec_code(roc_fec_code *out, const char *str)
68
+{
69
+ if (!str || !*str)
70
+ *out = ROC_FEC_DEFAULT;
71
+ else if (spa_streq(str, "disable"))
72
+ *out = ROC_FEC_DISABLE;
73
+ else if (spa_streq(str, "rs8m"))
74
+ *out = ROC_FEC_RS8M;
75
+ else if (spa_streq(str, "ldpc"))
76
+ *out = ROC_FEC_LDPC_STAIRCASE;
77
+ else
78
+ return -EINVAL;
79
+ return 0;
80
}
81
82
static void playback_process(void *data)
83
84
return;
85
86
buf->datas0.chunk->offset = 0;
87
- buf->datas0.chunk->stride = 8; /* channels = 2, format = F32LE */
88
+ buf->datas0.chunk->stride = impl->stride;
89
buf->datas0.chunk->size = 0;
90
91
- memset(&frame, 0, sizeof(frame));
92
-
93
+ spa_zero(frame);
94
frame.samples = dst;
95
- frame.samples_size = buf->datas0.maxsize;
96
+ frame.samples_size = SPA_MIN(b->requested * impl->stride, buf->datas0.maxsize);
97
98
if (roc_receiver_read(impl->receiver, &frame) != 0) {
99
/* Handle EOF and error */
100
pw_log_error("Failed to read from roc source");
101
pw_impl_module_schedule_destroy(impl->module);
102
- return;
103
+ frame.samples_size = 0;
104
}
105
106
buf->datas0.chunk->size = frame.samples_size;
107
+ b->size = frame.samples_size / impl->stride;
108
109
pw_stream_queue_buffer(impl->playback, b);
110
}
111
112
roc_context_close(data->context);
113
114
free(data->local_ip);
115
- free(data->resampler_profile);
116
free(data);
117
}
118
119
120
uint32_t n_params;
121
uint8_t buffer1024;
122
int res;
123
+ roc_protocol audio_proto, repair_proto;
124
125
if (roc_address_init(&data->local_addr, ROC_AF_AUTO, data->local_ip, 0)) {
126
pw_log_error("Invalid local IP address");
127
128
return -EINVAL;
129
}
130
131
- memset(&context_config, 0, sizeof(context_config));
132
-
133
+ spa_zero(context_config);
134
data->context = roc_context_open(&context_config);
135
if (!data->context) {
136
pw_log_error("Failed to create roc context");
137
return -EINVAL;
138
}
139
140
- memset(&receiver_config, 0, sizeof(receiver_config));
141
-
142
+ spa_zero(receiver_config);
143
receiver_config.frame_sample_rate = 44100;
144
receiver_config.frame_channels = ROC_CHANNEL_SET_STEREO;
145
receiver_config.frame_encoding = ROC_FRAME_ENCODING_PCM_FLOAT;
146
+ receiver_config.resampler_profile = data->resampler_profile;
147
148
/* Fixed to be the same as ROC receiver config above */
149
info.rate = 44100;
150
151
info.format = SPA_AUDIO_FORMAT_F32_LE;
152
info.position0 = SPA_AUDIO_CHANNEL_FL;
153
info.position1 = SPA_AUDIO_CHANNEL_FR;
154
+ data->stride = info.channels * sizeof(float);
155
156
- if (roc_parse_resampler_profile(&receiver_config.resampler_profile,
157
- data->resampler_profile)) {
158
- pw_log_error("Invalid resampler profile");
159
- return -EINVAL;
160
- }
161
+ pw_properties_setf(data->playback_props, PW_KEY_NODE_RATE, "1/%d", info.rate);
162
163
/*
164
* Note that target latency is in nano seconds.
165
166
return -EINVAL;
167
}
168
169
- if (roc_receiver_bind(data->receiver, ROC_PORT_AUDIO_SOURCE, ROC_PROTO_RTP_RS8M_SOURCE,
170
+ switch (data->fec_code) {
171
+ case ROC_FEC_DEFAULT:
172
+ case ROC_FEC_RS8M:
173
+ audio_proto = ROC_PROTO_RTP_RS8M_SOURCE;
174
+ repair_proto = ROC_PROTO_RS8M_REPAIR;
175
+ break;
176
+ case ROC_FEC_LDPC_STAIRCASE:
177
+ audio_proto = ROC_PROTO_RTP_LDPC_SOURCE;
178
+ repair_proto = ROC_PROTO_LDPC_REPAIR;
179
+ break;
180
+ default:
181
+ audio_proto = ROC_PROTO_RTP;
182
+ repair_proto = 0;
183
+ break;
184
+ }
185
+
186
+ if (roc_receiver_bind(data->receiver, ROC_PORT_AUDIO_SOURCE, audio_proto,
187
&data->local_source_addr) != 0) {
188
pw_log_error("can't connect roc receiver to local source address");
189
return -EINVAL;
190
}
191
-
192
- if (roc_receiver_bind(data->receiver, ROC_PORT_AUDIO_REPAIR, ROC_PROTO_RS8M_REPAIR,
193
- &data->local_repair_addr) != 0) {
194
- pw_log_error("can't connect roc receiver to local repair address");
195
- return -EINVAL;
196
+ if (repair_proto != 0) {
197
+ if (roc_receiver_bind(data->receiver, ROC_PORT_AUDIO_REPAIR, repair_proto,
198
+ &data->local_repair_addr) != 0) {
199
+ pw_log_error("can't connect roc receiver to local repair address");
200
+ return -EINVAL;
201
pipewire-0.3.50.tar.gz/src/modules/module-rt.c -> pipewire-0.3.51.tar.gz/src/modules/module-rt.c
Changed
201
1
2
3
/** \page page_module_rt PipeWire Module: RT
4
*
5
- * The `rt` module uses the operating system's scheduler to enable realtime
6
- * scheduling for certain threads to assist with low latency audio processing.
7
+ * The `rt` modules can give real-time priorities to processing threads.
8
+ *
9
+ * It uses the operating system's scheduler to enable realtime scheduling
10
+ * for certain threads to assist with low latency audio processing.
11
* This requires `RLIMIT_RTPRIO` to be set to a value that's equal to this
12
* module's `rt.prio` parameter or higher. Most distros will come with some
13
* package that configures this for certain groups or users. If this is not set
14
* up and DBus is available, then this module will fall back to using RTKit.
15
+ *
16
+ * ## Module Options
17
+ *
18
+ * - `nice.level`: The nice value set for the application thread. It improves
19
+ * performance of the communication with the pipewire daemon.
20
+ * - `rt.prio`: The realtime priority of the data thread. Higher values are
21
+ * higher priority.
22
+ * - `rt.time.soft`, `rt.time.hard`: The amount of CPU time an RT thread can
23
+ * consume without doing any blocking calls before the kernel kills
24
+ * the thread. This is a safety measure to avoid lockups of the complete
25
+ * system when some thread consumes 100%.
26
+
27
+ * The nice level is by default set to an invalid value so that clients don't
28
+ * automatically have the nice level raised.
29
+ *
30
+ * The PipeWire server processes are explicitly configured with a valid nice level.
31
+ *
32
+ * ## Example configuration
33
+ *
34
+ *\code{.unparsed}
35
+ * context.modules =
36
+ * { name = libpipewire-module-rt
37
+ * args = {
38
+ * #nice.level = 20
39
+ * #rt.prio = 88
40
+ * #rt.time.soft = -1
41
+ * #rt.time.hard = -1
42
+ * }
43
+ * flags = ifexists nofail
44
+ * }
45
+ *
46
+ *\endcode
47
*/
48
49
#define NAME "rt"
50
51
* scheduling without that rlimit being set such as `CAP_SYS_NICE` or
52
* running as root. Instead of checking a bunch of preconditions, we
53
* just try if setting realtime scheduling works or not. */
54
- if ((old_policy = sched_getscheduler(0)) < 0 ||
55
- sched_getparam(0, &old_sched_params) != 0) {
56
+ if (pthread_getschedparam(pthread_self(),&old_policy,&old_sched_params) < 0) {
57
+ pw_log_warn("Failed to check RLIMIT_RTPRIO %m");
58
return false;
59
}
60
61
/* If the current scheduling policy has `SCHED_RESET_ON_FORK` set, then
62
- * this also needs to be set here or `sched_setscheduler()` will return
63
+ * this also needs to be set here or `pthread_setschedparam()` will return
64
* an error code. Similarly, if it is not set, then we don't want to set
65
* it here as it would irreversible change the current thread's
66
* scheduling policy. */
67
spa_zero(new_sched_params);
68
new_sched_params.sched_priority = priority;
69
- if ((old_policy & PW_SCHED_RESET_ON_FORK) != 0) {
70
+ if ((old_policy & PW_SCHED_RESET_ON_FORK) != 0)
71
new_policy |= PW_SCHED_RESET_ON_FORK;
72
- }
73
74
- if (sched_setscheduler(0, new_policy, &new_sched_params) == 0) {
75
- sched_setscheduler(0, old_policy, &old_sched_params);
76
+ if (pthread_setschedparam(pthread_self(), new_policy, &new_sched_params) == 0) {
77
+ pthread_setschedparam(pthread_self(), old_policy, &old_sched_params);
78
return true;
79
} else {
80
return false;
81
82
return 0;
83
}
84
85
-static int impl_drop_rt_generic(void *data, struct spa_thread *thread)
86
+static int impl_drop_rt_generic(void *object, struct spa_thread *thread)
87
{
88
struct sched_param sp;
89
pthread_t pt = (pthread_t)thread;
90
91
return this->start(this->arg);
92
}
93
94
-static struct spa_thread *impl_create(void *data, const struct spa_dict *props,
95
+static struct spa_thread *impl_create(void *object, const struct spa_dict *props,
96
void *(*start_routine)(void*), void *arg)
97
{
98
- struct impl *impl = data;
99
+ struct impl *impl = object;
100
struct thread *this;
101
- int err;
102
+ struct spa_thread *thread;
103
104
this = calloc(1, sizeof(*this));
105
this->impl = impl;
106
107
108
/* This thread list is only used for the RTKit implementation */
109
pthread_mutex_lock(&impl->lock);
110
- err = pthread_create(&this->thread, NULL, custom_start, this);
111
- if (err != 0)
112
+ thread = pw_thread_utils_create(props, custom_start, this);
113
+ if (thread == NULL)
114
goto exit;
115
116
+ this->thread = (pthread_t)thread;
117
pthread_cond_wait(&impl->cond, &impl->lock);
118
119
spa_list_append(&impl->threads_list, &this->link);
120
exit:
121
pthread_mutex_unlock(&impl->lock);
122
123
- if (err != 0) {
124
- errno = err;
125
+ if (thread == NULL) {
126
free(this);
127
return NULL;
128
}
129
- return (struct spa_thread*)this->thread;
130
+ return thread;
131
}
132
133
-static int impl_join(void *data, struct spa_thread *thread, void **retval)
134
+static int impl_join(void *object, struct spa_thread *thread, void **retval)
135
{
136
- struct impl *impl = data;
137
+ struct impl *impl = object;
138
pthread_t pt = (pthread_t)thread;
139
struct thread *thr;
140
141
142
return pthread_join(pt, retval);
143
}
144
145
-static int impl_get_rt_range(void *data, const struct spa_dict *props,
146
+static int impl_get_rt_range(void *object, const struct spa_dict *props,
147
int *min, int *max)
148
{
149
- struct impl *impl = data;
150
+ struct impl *impl = object;
151
if (impl->use_rtkit) {
152
if (min)
153
*min = 1;
154
155
return pid;
156
}
157
158
-static int impl_acquire_rt(void *data, struct spa_thread *thread, int priority)
159
+static int impl_acquire_rt(void *object, struct spa_thread *thread, int priority)
160
{
161
- struct impl *impl = data;
162
+ struct impl *impl = object;
163
struct sched_param sp;
164
int err, rtprio_limit;
165
pthread_t pt = (pthread_t)thread;
166
167
168
#else /* HAVE_DBUS */
169
170
-static struct spa_thread *impl_create(void *data, const struct spa_dict *props,
171
+static struct spa_thread *impl_create(void *object, const struct spa_dict *props,
172
void *(*start_routine)(void*), void *arg)
173
{
174
- pthread_t pt;
175
- int err;
176
-
177
- err = pthread_create(&pt, NULL, start_routine, arg);
178
- if (err != 0) {
179
- errno = err;
180
- return NULL;
181
- }
182
- return (struct spa_thread*)pt;
183
+ return pw_thread_utils_create(props, start_routine, arg);
184
}
185
186
-static int impl_join(void *data, struct spa_thread *thread, void **retval)
187
+static int impl_join(void *object, struct spa_thread *thread, void **retval)
188
{
189
- return pthread_join((pthread_t)thread, retval);
190
+ return pw_thread_utils_join(thread, retval);
191
}
192
193
-static int impl_get_rt_range(void *data, const struct spa_dict *props,
194
+static int impl_get_rt_range(void *object, const struct spa_dict *props,
195
int *min, int *max)
196
{
197
if (min)
198
199
return 0;
200
}
201
pipewire-0.3.50.tar.gz/src/modules/module-session-manager.c -> pipewire-0.3.51.tar.gz/src/modules/module-session-manager.c
Changed
11
1
2
#include <pipewire/impl.h>
3
4
/** \page page_module_session_manager PipeWire Module: Session Manager
5
+ *
6
+ * This module implements some usefull objects for implementing a session
7
+ * manager. It is not yet actively used.
8
*/
9
10
/* client-endpoint.c */
11
pipewire-0.3.50.tar.gz/src/modules/module-session-manager/client-endpoint/endpoint-stream.c -> pipewire-0.3.51.tar.gz/src/modules/module-session-manager/client-endpoint/endpoint-stream.c
Changed
67
1
2
{
3
if (change_mask & PW_CLIENT_ENDPOINT_UPDATE_PARAMS) {
4
uint32_t i;
5
- size_t size = n_params * sizeof(struct spa_pod *);
6
7
pw_log_debug(NAME" %p: update %d params", this, n_params);
8
9
for (i = 0; i < this->n_params; i++)
10
free(this->paramsi);
11
- this->params = realloc(this->params, size);
12
- if (size > 0 && !this->params) {
13
- this->n_params = 0;
14
- goto no_mem;
15
- }
16
this->n_params = n_params;
17
-
18
+ if (this->n_params == 0) {
19
+ free(this->params);
20
+ this->params = NULL;
21
+ } else {
22
+ void *p;
23
+ p = reallocarray(this->params, n_params, sizeof(struct spa_pod*));
24
+ if (p == NULL) {
25
+ free(this->params);
26
+ this->params = NULL;
27
+ this->n_params = 0;
28
+ goto no_mem;
29
+ }
30
+ this->params = p;
31
+ }
32
for (i = 0; i < this->n_params; i++) {
33
this->paramsi = paramsi ? spa_pod_copy(paramsi) : NULL;
34
endpoint_stream_notify_subscribed(this, i, i+1);
35
36
pw_properties_update(this->props, info->props);
37
38
if (info->change_mask & PW_ENDPOINT_STREAM_CHANGE_MASK_PARAMS) {
39
- size_t size = info->n_params * sizeof(struct spa_param_info);
40
-
41
- this->info.params = realloc(this->info.params, size);
42
- if (size > 0 && !this->info.params) {
43
- this->info.n_params = 0;
44
- goto no_mem;
45
- }
46
this->info.n_params = info->n_params;
47
-
48
- memcpy(this->info.params, info->params, size);
49
+ if (info->n_params == 0) {
50
+ free(this->info.params);
51
+ this->info.params = NULL;
52
+ } else {
53
+ void *p;
54
+ p = reallocarray(this->info.params, info->n_params, sizeof(struct spa_param_info));
55
+ if (p == NULL) {
56
+ free(this->info.params);
57
+ this->info.params = NULL;
58
+ this->info.n_params = 0;
59
+ goto no_mem;
60
+ }
61
+ this->info.params = p;
62
+ memcpy(this->info.params, info->params, info->n_params * sizeof(struct spa_param_info));
63
+ }
64
}
65
66
if (!this->info.name)
67
pipewire-0.3.50.tar.gz/src/modules/module-session-manager/client-endpoint/endpoint.c -> pipewire-0.3.51.tar.gz/src/modules/module-session-manager/client-endpoint/endpoint.c
Changed
67
1
2
{
3
if (change_mask & PW_CLIENT_ENDPOINT_UPDATE_PARAMS) {
4
uint32_t i;
5
- size_t size = n_params * sizeof(struct spa_pod *);
6
7
pw_log_debug(NAME" %p: update %d params", this, n_params);
8
9
for (i = 0; i < this->n_params; i++)
10
free(this->paramsi);
11
- this->params = realloc(this->params, size);
12
- if (size > 0 && !this->params) {
13
- this->n_params = 0;
14
- goto no_mem;
15
- }
16
this->n_params = n_params;
17
-
18
+ if (this->n_params == 0) {
19
+ free(this->params);
20
+ this->params = NULL;
21
+ } else {
22
+ void *p;
23
+ p = reallocarray(this->params, n_params, sizeof(struct spa_pod*));
24
+ if (p == NULL) {
25
+ free(this->params);
26
+ this->params = NULL;
27
+ this->n_params = 0;
28
+ goto no_mem;
29
+ }
30
+ this->params = p;
31
+ }
32
for (i = 0; i < this->n_params; i++) {
33
this->paramsi = paramsi ? spa_pod_copy(paramsi) : NULL;
34
endpoint_notify_subscribed(this, i, i+1);
35
36
pw_properties_update(this->props, info->props);
37
38
if (info->change_mask & PW_ENDPOINT_CHANGE_MASK_PARAMS) {
39
- size_t size = info->n_params * sizeof(struct spa_param_info);
40
-
41
- this->info.params = realloc(this->info.params, size);
42
- if (size > 0 && !this->info.params) {
43
- this->info.n_params = 0;
44
- goto no_mem;
45
- }
46
this->info.n_params = info->n_params;
47
-
48
- memcpy(this->info.params, info->params, size);
49
+ if (info->n_params == 0) {
50
+ free(this->info.params);
51
+ this->info.params = NULL;
52
+ } else {
53
+ void *p;
54
+ p = reallocarray(this->info.params, info->n_params, sizeof(struct spa_param_info));
55
+ if (p == NULL) {
56
+ free(this->info.params);
57
+ this->info.params = NULL;
58
+ this->info.n_params = 0;
59
+ goto no_mem;
60
+ }
61
+ this->info.params = p;
62
+ memcpy(this->info.params, info->params, info->n_params * sizeof(struct spa_param_info));
63
+ }
64
}
65
66
if (!this->info.name) {
67
pipewire-0.3.50.tar.gz/src/modules/module-session-manager/client-session/endpoint-link.c -> pipewire-0.3.51.tar.gz/src/modules/module-session-manager/client-session/endpoint-link.c
Changed
67
1
2
{
3
if (change_mask & PW_CLIENT_SESSION_UPDATE_PARAMS) {
4
uint32_t i;
5
- size_t size = n_params * sizeof(struct spa_pod *);
6
7
pw_log_debug(NAME" %p: update %d params", this, n_params);
8
9
for (i = 0; i < this->n_params; i++)
10
free(this->paramsi);
11
- this->params = realloc(this->params, size);
12
- if (size > 0 && !this->params) {
13
- this->n_params = 0;
14
- goto no_mem;
15
- }
16
this->n_params = n_params;
17
-
18
+ if (this->n_params == 0) {
19
+ free(this->params);
20
+ this->params = NULL;
21
+ } else {
22
+ void *p;
23
+ p = reallocarray(this->params, n_params, sizeof(struct spa_pod*));
24
+ if (p == NULL) {
25
+ free(this->params);
26
+ this->params = NULL;
27
+ this->n_params = 0;
28
+ goto no_mem;
29
+ }
30
+ this->params = p;
31
+ }
32
for (i = 0; i < this->n_params; i++) {
33
this->paramsi = paramsi ? spa_pod_copy(paramsi) : NULL;
34
endpoint_link_notify_subscribed(this, i, i+1);
35
36
pw_properties_update(this->props, info->props);
37
38
if (info->change_mask & PW_ENDPOINT_LINK_CHANGE_MASK_PARAMS) {
39
- size_t size = info->n_params * sizeof(struct spa_param_info);
40
-
41
- this->info.params = realloc(this->info.params, size);
42
- if (size > 0 && !this->info.params) {
43
- this->info.n_params = 0;
44
- goto no_mem;
45
- }
46
this->info.n_params = info->n_params;
47
-
48
- memcpy(this->info.params, info->params, size);
49
+ if (info->n_params == 0) {
50
+ free(this->info.params);
51
+ this->info.params = NULL;
52
+ } else {
53
+ void *p;
54
+ p = reallocarray(this->info.params, info->n_params, sizeof(struct spa_param_info));
55
+ if (p == NULL) {
56
+ free(this->info.params);
57
+ this->info.params = NULL;
58
+ this->info.n_params = 0;
59
+ goto no_mem;
60
+ }
61
+ this->info.params = p;
62
+ memcpy(this->info.params, info->params, info->n_params * sizeof(struct spa_param_info));
63
+ }
64
}
65
66
if (!this->info.output_endpoint_id) {
67
pipewire-0.3.50.tar.gz/src/modules/module-session-manager/client-session/session.c -> pipewire-0.3.51.tar.gz/src/modules/module-session-manager/client-session/session.c
Changed
69
1
2
{
3
if (change_mask & PW_CLIENT_SESSION_UPDATE_PARAMS) {
4
uint32_t i;
5
- size_t size = n_params * sizeof(struct spa_pod *);
6
7
pw_log_debug(NAME" %p: update %d params", this, n_params);
8
9
for (i = 0; i < this->n_params; i++)
10
free(this->paramsi);
11
- this->params = realloc(this->params, size);
12
- if (size > 0 && !this->params) {
13
- this->n_params = 0;
14
- goto no_mem;
15
- }
16
this->n_params = n_params;
17
-
18
+ if (this->n_params == 0) {
19
+ free(this->params);
20
+ this->params = NULL;
21
+ } else {
22
+ void *p;
23
+ p = reallocarray(this->params, n_params, sizeof(struct spa_pod*));
24
+ if (p == NULL) {
25
+ free(this->params);
26
+ this->params = NULL;
27
+ this->n_params = 0;
28
+ goto no_mem;
29
+ }
30
+ this->params = p;
31
+ }
32
for (i = 0; i < this->n_params; i++) {
33
this->paramsi = paramsi ? spa_pod_copy(paramsi) : NULL;
34
session_notify_subscribed(this, i, i+1);
35
36
pw_properties_update(this->props, info->props);
37
38
if (info->change_mask & PW_SESSION_CHANGE_MASK_PARAMS) {
39
- size_t size = info->n_params * sizeof(struct spa_param_info);
40
-
41
- this->info.params = realloc(this->info.params, size);
42
- if (size > 0 && !this->info.params) {
43
- this->info.n_params = 0;
44
- goto no_mem;
45
- }
46
this->info.n_params = info->n_params;
47
-
48
- memcpy(this->info.params, info->params, size);
49
+ if (info->n_params == 0) {
50
+ free(this->info.params);
51
+ this->info.params = NULL;
52
+ } else {
53
+ void *p;
54
+ p = reallocarray(this->info.params, info->n_params, sizeof(struct spa_param_info));
55
+ if (p == NULL) {
56
+ free(this->info.params);
57
+ this->info.params = NULL;
58
+ this->info.n_params = 0;
59
+ goto no_mem;
60
+ }
61
+ this->info.params = p;
62
+ memcpy(this->info.params, info->params, info->n_params * sizeof(struct spa_param_info));
63
+ }
64
}
65
-
66
this->info.change_mask = info->change_mask;
67
pw_global_for_each_resource(this->global, emit_info, this);
68
this->info.change_mask = 0;
69
pipewire-0.3.50.tar.gz/src/modules/module-session-manager/endpoint-link.c -> pipewire-0.3.51.tar.gz/src/modules/module-session-manager/endpoint-link.c
Changed
40
1
2
.request_state = method_request_state,
3
};
4
5
-static int global_bind(void *_data, struct pw_impl_client *client,
6
+static int global_bind(void *object, struct pw_impl_client *client,
7
uint32_t permissions, uint32_t version, uint32_t id)
8
{
9
- struct impl *impl = _data;
10
+ struct impl *impl = object;
11
struct pw_resource *resource;
12
struct resource_data *data;
13
14
15
return 0;
16
}
17
18
-static void event_info(void *object, const struct pw_endpoint_link_info *info)
19
+static void event_info(void *data, const struct pw_endpoint_link_info *info)
20
{
21
- struct impl *impl = object;
22
+ struct impl *impl = data;
23
uint32_t changed_idsMAX_PARAMS, n_changed_ids = 0;
24
uint32_t i;
25
26
27
return 0;
28
}
29
30
-static void event_param(void *object, int seq,
31
+static void event_param(void *data, int seq,
32
uint32_t id, uint32_t index, uint32_t next,
33
const struct spa_pod *param)
34
{
35
- struct impl *impl = object;
36
+ struct impl *impl = data;
37
struct param_data *pdata;
38
struct spa_pod **pod;
39
struct param_event_args args = { id, index, next, param };
40
pipewire-0.3.50.tar.gz/src/modules/module-session-manager/endpoint-stream.c -> pipewire-0.3.51.tar.gz/src/modules/module-session-manager/endpoint-stream.c
Changed
40
1
2
.set_param = method_set_param,
3
};
4
5
-static int global_bind(void *_data, struct pw_impl_client *client,
6
+static int global_bind(void *object, struct pw_impl_client *client,
7
uint32_t permissions, uint32_t version, uint32_t id)
8
{
9
- struct impl *impl = _data;
10
+ struct impl *impl = object;
11
struct pw_resource *resource;
12
struct resource_data *data;
13
14
15
return 0;
16
}
17
18
-static void event_info(void *object, const struct pw_endpoint_stream_info *info)
19
+static void event_info(void *data, const struct pw_endpoint_stream_info *info)
20
{
21
- struct impl *impl = object;
22
+ struct impl *impl = data;
23
uint32_t changed_idsMAX_PARAMS, n_changed_ids = 0;
24
uint32_t i;
25
26
27
return 0;
28
}
29
30
-static void event_param(void *object, int seq,
31
+static void event_param(void *data, int seq,
32
uint32_t id, uint32_t index, uint32_t next,
33
const struct spa_pod *param)
34
{
35
- struct impl *impl = object;
36
+ struct impl *impl = data;
37
struct param_data *pdata;
38
struct spa_pod **pod;
39
struct param_event_args args = { id, index, next, param };
40
pipewire-0.3.50.tar.gz/src/modules/module-session-manager/endpoint.c -> pipewire-0.3.51.tar.gz/src/modules/module-session-manager/endpoint.c
Changed
40
1
2
.create_link = method_create_link,
3
};
4
5
-static int global_bind(void *_data, struct pw_impl_client *client,
6
+static int global_bind(void *object, struct pw_impl_client *client,
7
uint32_t permissions, uint32_t version, uint32_t id)
8
{
9
- struct impl *impl = _data;
10
+ struct impl *impl = object;
11
struct pw_resource *resource;
12
struct resource_data *data;
13
14
15
return 0;
16
}
17
18
-static void event_info(void *object, const struct pw_endpoint_info *info)
19
+static void event_info(void *data, const struct pw_endpoint_info *info)
20
{
21
- struct impl *impl = object;
22
+ struct impl *impl = data;
23
uint32_t changed_idsMAX_PARAMS, n_changed_ids = 0;
24
uint32_t i;
25
26
27
return 0;
28
}
29
30
-static void event_param(void *object, int seq,
31
+static void event_param(void *data, int seq,
32
uint32_t id, uint32_t index, uint32_t next,
33
const struct spa_pod *param)
34
{
35
- struct impl *impl = object;
36
+ struct impl *impl = data;
37
struct param_data *pdata;
38
struct spa_pod **pod;
39
struct param_event_args args = { id, index, next, param };
40
pipewire-0.3.50.tar.gz/src/modules/module-session-manager/protocol-native.c -> pipewire-0.3.51.tar.gz/src/modules/module-session-manager/protocol-native.c
Changed
201
1
2
return pw_protocol_native_end_proxy(proxy, b);
3
}
4
5
-static int client_endpoint_demarshal_set_session_id(void *object,
6
+static int client_endpoint_demarshal_set_session_id(void *data,
7
const struct pw_protocol_native_message *msg)
8
{
9
- struct pw_proxy *proxy = object;
10
+ struct pw_proxy *proxy = data;
11
struct spa_pod_parser prs;
12
uint32_t id;
13
14
15
set_session_id, 0, id);
16
}
17
18
-static int client_endpoint_demarshal_set_param(void *object,
19
+static int client_endpoint_demarshal_set_param(void *data,
20
const struct pw_protocol_native_message *msg)
21
{
22
- struct pw_proxy *proxy = object;
23
+ struct pw_proxy *proxy = data;
24
struct spa_pod_parser prs;
25
uint32_t id, flags;
26
const struct spa_pod *param = NULL;
27
28
set_param, 0, id, flags, param);
29
}
30
31
-static int client_endpoint_demarshal_stream_set_param(void *object,
32
+static int client_endpoint_demarshal_stream_set_param(void *data,
33
const struct pw_protocol_native_message *msg)
34
{
35
- struct pw_proxy *proxy = object;
36
+ struct pw_proxy *proxy = data;
37
struct spa_pod_parser prs;
38
uint32_t stream_id, id, flags;
39
const struct spa_pod *param = NULL;
40
41
stream_set_param, 0, stream_id, id, flags, param);
42
}
43
44
-static int client_endpoint_demarshal_create_link(void *object,
45
+static int client_endpoint_demarshal_create_link(void *data,
46
const struct pw_protocol_native_message *msg)
47
{
48
- struct pw_proxy *proxy = object;
49
+ struct pw_proxy *proxy = data;
50
struct spa_pod_parser prs;
51
struct spa_pod_frame f;
52
struct spa_dict props = SPA_DICT_INIT(NULL, 0);
53
54
* CLIENT SESSION
55
***********************************************/
56
57
-static int client_session_marshal_set_param (void *object,
58
+static int client_session_marshal_set_param (void *data,
59
uint32_t id, uint32_t flags,
60
const struct spa_pod *param)
61
{
62
- struct pw_resource *resource = object;
63
+ struct pw_resource *resource = data;
64
struct spa_pod_builder *b;
65
66
b = pw_protocol_native_begin_resource(resource,
67
68
return pw_protocol_native_end_resource(resource, b);
69
}
70
71
-static int client_session_marshal_link_set_param (void *object,
72
+static int client_session_marshal_link_set_param (void *data,
73
uint32_t link_id, uint32_t id,
74
uint32_t flags, const struct spa_pod *param)
75
{
76
- struct pw_resource *resource = object;
77
+ struct pw_resource *resource = data;
78
struct spa_pod_builder *b;
79
80
b = pw_protocol_native_begin_resource(resource,
81
82
return pw_protocol_native_end_resource(resource, b);
83
}
84
85
-static int client_session_marshal_link_request_state (void *object,
86
+static int client_session_marshal_link_request_state (void *data,
87
uint32_t link_id, uint32_t state)
88
{
89
- struct pw_resource *resource = object;
90
+ struct pw_resource *resource = data;
91
struct spa_pod_builder *b;
92
93
b = pw_protocol_native_begin_resource(resource,
94
95
return pw_protocol_native_end_proxy(proxy, b);
96
}
97
98
-static int client_session_demarshal_set_param(void *object,
99
+static int client_session_demarshal_set_param(void *data,
100
const struct pw_protocol_native_message *msg)
101
{
102
- struct pw_proxy *proxy = object;
103
+ struct pw_proxy *proxy = data;
104
struct spa_pod_parser prs;
105
uint32_t id, flags;
106
const struct spa_pod *param = NULL;
107
108
set_param, 0, id, flags, param);
109
}
110
111
-static int client_session_demarshal_link_set_param(void *object,
112
+static int client_session_demarshal_link_set_param(void *data,
113
const struct pw_protocol_native_message *msg)
114
{
115
- struct pw_proxy *proxy = object;
116
+ struct pw_proxy *proxy = data;
117
struct spa_pod_parser prs;
118
uint32_t link_id, id, flags;
119
const struct spa_pod *param = NULL;
120
121
link_set_param, 0, link_id, id, flags, param);
122
}
123
124
-static int client_session_demarshal_link_request_state(void *object,
125
+static int client_session_demarshal_link_request_state(void *data,
126
const struct pw_protocol_native_message *msg)
127
{
128
- struct pw_proxy *proxy = object;
129
+ struct pw_proxy *proxy = data;
130
struct spa_pod_parser prs;
131
uint32_t link_id, state;
132
133
134
* ENDPOINT LINK
135
***********************************************/
136
137
-static void endpoint_link_proxy_marshal_info (void *object,
138
+static void endpoint_link_proxy_marshal_info (void *data,
139
const struct pw_endpoint_link_info *info)
140
{
141
- struct pw_proxy *proxy = object;
142
+ struct pw_proxy *proxy = data;
143
struct spa_pod_builder *b;
144
145
b = pw_protocol_native_begin_proxy(proxy,
146
147
pw_protocol_native_end_proxy(proxy, b);
148
}
149
150
-static void endpoint_link_resource_marshal_info (void *object,
151
+static void endpoint_link_resource_marshal_info (void *data,
152
const struct pw_endpoint_link_info *info)
153
{
154
- struct pw_resource *resource = object;
155
+ struct pw_resource *resource = data;
156
struct spa_pod_builder *b;
157
158
b = pw_protocol_native_begin_resource(resource,
159
160
pw_protocol_native_end_resource(resource, b);
161
}
162
163
-static void endpoint_link_proxy_marshal_param (void *object, int seq, uint32_t id,
164
+static void endpoint_link_proxy_marshal_param (void *data, int seq, uint32_t id,
165
uint32_t index, uint32_t next,
166
const struct spa_pod *param)
167
{
168
- struct pw_proxy *proxy = object;
169
+ struct pw_proxy *proxy = data;
170
struct spa_pod_builder *b;
171
172
b = pw_protocol_native_begin_proxy(proxy,
173
174
175
pw_protocol_native_end_proxy(proxy, b);
176
}
177
-static void endpoint_link_resource_marshal_param (void *object, int seq, uint32_t id,
178
+static void endpoint_link_resource_marshal_param (void *data, int seq, uint32_t id,
179
uint32_t index, uint32_t next,
180
const struct spa_pod *param)
181
{
182
- struct pw_resource *resource = object;
183
+ struct pw_resource *resource = data;
184
struct spa_pod_builder *b;
185
186
b = pw_protocol_native_begin_resource(resource,
187
188
return pw_protocol_native_end_resource(resource, b);
189
}
190
191
-static int endpoint_link_proxy_demarshal_info(void *object,
192
+static int endpoint_link_proxy_demarshal_info(void *data,
193
const struct pw_protocol_native_message *msg)
194
{
195
- struct pw_proxy *proxy = object;
196
+ struct pw_proxy *proxy = data;
197
struct spa_pod_parser prs;
198
struct spa_pod_frame f;
199
struct spa_dict props = SPA_DICT_INIT(NULL, 0);
200
201
pipewire-0.3.50.tar.gz/src/modules/module-session-manager/session.c -> pipewire-0.3.51.tar.gz/src/modules/module-session-manager/session.c
Changed
40
1
2
.set_param = method_set_param,
3
};
4
5
-static int global_bind(void *_data, struct pw_impl_client *client,
6
+static int global_bind(void *object, struct pw_impl_client *client,
7
uint32_t permissions, uint32_t version, uint32_t id)
8
{
9
- struct impl *impl = _data;
10
+ struct impl *impl = object;
11
struct pw_resource *resource;
12
struct resource_data *data;
13
14
15
return 0;
16
}
17
18
-static void event_info(void *object, const struct pw_session_info *info)
19
+static void event_info(void *data, const struct pw_session_info *info)
20
{
21
- struct impl *impl = object;
22
+ struct impl *impl = data;
23
uint32_t changed_idsMAX_PARAMS, n_changed_ids = 0;
24
uint32_t i;
25
26
27
return 0;
28
}
29
30
-static void event_param(void *object, int seq,
31
+static void event_param(void *data, int seq,
32
uint32_t id, uint32_t index, uint32_t next,
33
const struct spa_pod *param)
34
{
35
- struct impl *impl = object;
36
+ struct impl *impl = data;
37
struct param_data *pdata;
38
struct spa_pod **pod;
39
struct param_event_args args = { id, index, next, param };
40
pipewire-0.3.50.tar.gz/src/modules/module-zeroconf-discover.c -> pipewire-0.3.51.tar.gz/src/modules/module-zeroconf-discover.c
Changed
36
1
2
#include "module-zeroconf-discover/avahi-poll.h"
3
4
/** \page page_module_zeroconf_discover PipeWire Module: Zeroconf Discover
5
+ *
6
+ * Use zeroconf to detect and load module-pulse-tunnel with the right
7
+ * parameters. This will automatically create sinks and sources to stream
8
+ * audio to/from remote PulseAudio servers. It also works with
9
+ * module-protocol-pulse.
10
+ *
11
+ * This module has no options.
12
+ *
13
+ * ## Example configuration
14
+ *
15
+ *\code{.unparsed}
16
+ * context.modules =
17
+ * { name = libpipewire-module-zeroconf-discover
18
+ * args = { }
19
+ * }
20
+ *
21
+ *\endcode
22
*/
23
24
#define NAME "zeroconf-discover"
25
26
.destroy = module_destroy,
27
};
28
29
-static void pw_properties_from_avahi_string(const char *key, const char *value, struct pw_properties *props) {
30
+static void pw_properties_from_avahi_string(const char *key, const char *value,
31
+ struct pw_properties *props)
32
+{
33
if (spa_streq(key, "device")) {
34
pw_properties_set(props, PW_KEY_NODE_TARGET, value);
35
}
36
pipewire-0.3.50.tar.gz/src/pipewire/client.h -> pipewire-0.3.51.tar.gz/src/pipewire/client.h
Changed
19
1
2
*
3
* \param info info about the client
4
*/
5
- void (*info) (void *object, const struct pw_client_info *info);
6
+ void (*info) (void *data, const struct pw_client_info *info);
7
/**
8
* Notify a client permission
9
*
10
11
* \param n_permissions the number of permissions
12
* \param permissions the permissions
13
*/
14
- void (*permissions) (void *object,
15
+ void (*permissions) (void *data,
16
uint32_t index,
17
uint32_t n_permissions,
18
const struct pw_permission *permissions);
19
pipewire-0.3.50.tar.gz/src/pipewire/conf.c -> pipewire-0.3.51.tar.gz/src/pipewire/conf.c
Changed
54
1
2
{
3
struct data data = { .context = context, .props = props };
4
int res;
5
+ const char *str = pw_properties_get(props, "config.ext");
6
+
7
res = pw_context_conf_section_for_each(context, section,
8
+ update_props, &data);
9
+ if (res == 0 && str != NULL) {
10
+ char key128;
11
+ snprintf(key, sizeof(key), "%s.%s", section, str);
12
+ res = pw_context_conf_section_for_each(context, key,
13
update_props, &data);
14
+ }
15
return res == 0 ? data.count : res;
16
}
17
18
19
* rules =
20
* {
21
* matches =
22
- * # any of the items in matches needs to match, it one does,
23
+ * # any of the items in matches needs to match, if one does,
24
* # actions are emited.
25
* {
26
* # all keys must match the value. ~ in value starts regex.
27
28
29
SPA_EXPORT
30
int pw_context_conf_section_match_rules(struct pw_context *context, const char *section,
31
- struct spa_dict *props,
32
+ const struct spa_dict *props,
33
int (*callback) (void *data, const char *location, const char *action,
34
const char *str, size_t len),
35
void *data)
36
37
.props = props,
38
.matched = callback,
39
.data = data };
40
- return pw_context_conf_section_for_each(context, section, match_rules, &match);
41
+ int res;
42
+ const char *str = spa_dict_lookup(props, "config.ext");
43
+
44
+ res = pw_context_conf_section_for_each(context, section,
45
+ match_rules, &match);
46
+ if (res == 0 && str != NULL) {
47
+ char key128;
48
+ snprintf(key, sizeof(key), "%s.%s", section, str);
49
+ res = pw_context_conf_section_for_each(context, key,
50
+ match_rules, &match);
51
+ }
52
+ return res;
53
}
54
pipewire-0.3.50.tar.gz/src/pipewire/context.c -> pipewire-0.3.51.tar.gz/src/pipewire/context.c
Changed
201
1
2
return pw_impl_node_set_state(node, state);
3
}
4
5
-static int collect_nodes(struct pw_context *context, struct pw_impl_node *node)
6
+static int collect_nodes(struct pw_context *context, struct pw_impl_node *node, struct spa_list *collect)
7
{
8
struct spa_list queue;
9
- struct pw_impl_node *n, *t, *driver;
10
+ struct pw_impl_node *n, *t;
11
struct pw_impl_port *p;
12
struct pw_impl_link *l;
13
14
pw_log_debug("node %p: '%s'", node, node->name);
15
16
- if (node->driver) {
17
- driver = node;
18
- spa_list_consume(t, &driver->follower_list, follower_link) {
19
- spa_list_remove(&t->follower_link);
20
- spa_list_init(&t->follower_link);
21
- }
22
- } else {
23
- driver = node->driver_node;
24
- if (driver == NULL)
25
- return -EINVAL;
26
- }
27
-
28
/* start with node in the queue */
29
spa_list_init(&queue);
30
spa_list_append(&queue, &node->sort_link);
31
32
/* now follow all the links from the nodes in the queue
33
* and add the peers to the queue. */
34
spa_list_consume(n, &queue, sort_link) {
35
+ pw_log_debug(" next node %p: '%s'", n, n->name);
36
+
37
spa_list_remove(&n->sort_link);
38
- pw_impl_node_set_driver(n, driver);
39
+ spa_list_append(collect, &n->sort_link);
40
n->passive = true;
41
42
+ if (!n->active)
43
+ continue;
44
+
45
spa_list_for_each(p, &n->input_ports, link) {
46
spa_list_for_each(l, &p->links, input_link) {
47
t = l->output->node;
48
49
continue;
50
51
if (!l->passive)
52
- driver->passive = n->passive = false;
53
+ node->passive = n->passive = false;
54
55
if (!t->visited) {
56
t->visited = true;
57
58
continue;
59
60
if (!l->passive)
61
- driver->passive = n->passive = false;
62
+ node->passive = n->passive = false;
63
64
if (!t->visited) {
65
t->visited = true;
66
67
return 0;
68
}
69
70
+static void move_to_driver(struct pw_context *context, struct spa_list *nodes,
71
+ struct pw_impl_node *driver)
72
+{
73
+ struct pw_impl_node *n;
74
+ pw_log_debug("driver: %p %s", driver, driver->name);
75
+ spa_list_consume(n, nodes, sort_link) {
76
+ spa_list_remove(&n->sort_link);
77
+ pw_log_debug(" follower: %p %s", n, n->name);
78
+ pw_impl_node_set_driver(n, driver);
79
+ }
80
+}
81
+static void remove_from_driver(struct pw_context *context, struct spa_list *nodes)
82
+{
83
+ struct pw_impl_node *n;
84
+ spa_list_consume(n, nodes, sort_link) {
85
+ spa_list_remove(&n->sort_link);
86
+ pw_impl_node_set_driver(n, NULL);
87
+ ensure_state(n, false);
88
+ }
89
+}
90
+
91
static inline void get_quantums(struct pw_context *context, uint32_t *def,
92
uint32_t *min, uint32_t *max, uint32_t *limit, uint32_t *rate)
93
{
94
95
return false;
96
}
97
98
+/* here we evaluate the complete state of the graph.
99
+ *
100
+ * It roughly operates in 3 stages:
101
+ *
102
+ * 1. go over all drivers and collect the nodes that need to be scheduled with the
103
+ * driver. This include all nodes that have an active link with the driver or
104
+ * with a node already scheduled with the driver.
105
+ *
106
+ * 2. go over all nodes that are not assigned to a driver. The ones that require
107
+ * a driver are moved to some random active driver found in step 1.
108
+ *
109
+ * 3. go over all drivers again, collect the quantum/rate of all followers, select
110
+ * the desired final value and activate the followers and then the driver.
111
+ *
112
+ * A complete graph evaluation is performed for each change that is made to the
113
+ * graph, such as making/destroting links, adding/removing nodes, property changes such
114
+ * as quantum/rate changes or metadata changes.
115
+ */
116
int pw_context_recalc_graph(struct pw_context *context, const char *reason)
117
{
118
struct impl *impl = SPA_CONTAINER_OF(context, struct impl, this);
119
120
uint32_t max_quantum, min_quantum, def_quantum, lim_quantum, rate_quantum;
121
uint32_t *rates, n_rates, def_rate;
122
bool freewheel = false, global_force_rate, force_rate, force_quantum, global_force_quantum;
123
+ struct spa_list collect;
124
125
pw_log_info("%p: busy:%d reason:%s", context, impl->recalc, reason);
126
127
128
if (n->exported)
129
continue;
130
131
- if (!n->visited)
132
- collect_nodes(context, n);
133
-
134
+ if (!n->visited) {
135
+ spa_list_init(&collect);
136
+ collect_nodes(context, n, &collect);
137
+ move_to_driver(context, &collect, n);
138
+ }
139
/* from now on we are only interested in active driving nodes.
140
* We're going to see if there are active followers. */
141
if (!n->driving || !n->active)
142
143
144
/* now go through all available nodes. The ones we didn't visit
145
* in collect_nodes() are not linked to any driver. We assign them
146
- * to either an active driver of the first driver */
147
+ * to either an active driver or the first driver if they are in a
148
+ * group that needs a driver. Else we remove them from a driver
149
+ * and stop them. */
150
spa_list_for_each(n, &context->node_list, link) {
151
- if (n->exported)
152
- continue;
153
+ struct pw_impl_node *t, *driver;
154
155
- if (!n->visited) {
156
- struct pw_impl_node *t;
157
+ if (n->exported || n->visited)
158
+ continue;
159
160
- pw_log_debug("%p: unassigned node %p: '%s' active:%d want_driver:%d target:%p",
161
- context, n, n->name, n->active, n->want_driver, target);
162
+ pw_log_debug("%p: unassigned node %p: '%s' active:%d want_driver:%d target:%p",
163
+ context, n, n->name, n->active, n->want_driver, target);
164
165
- t = n->want_driver ? target : NULL;
166
+ /* collect all nodes in this group */
167
+ spa_list_init(&collect);
168
+ collect_nodes(context, n, &collect);
169
170
- pw_impl_node_set_driver(n, t);
171
- if (t == NULL)
172
- ensure_state(n, false);
173
- else {
174
- if (n->always_process)
175
- t->passive = false;
176
- collect_nodes(context, n);
177
- }
178
+ driver = NULL;
179
+ spa_list_for_each(t, &collect, sort_link) {
180
+ /* is any active and want a driver or it want process */
181
+ if ((t->want_driver && t->active && !n->passive) ||
182
+ t->always_process)
183
+ driver = target;
184
+ }
185
+ if (driver != NULL) {
186
+ /* driver needed for this group */
187
+ driver->passive = false;
188
+ move_to_driver(context, &collect, driver);
189
+ } else {
190
+ /* no driver, make sure the nodes stops */
191
+ remove_from_driver(context, &collect);
192
}
193
- n->visited = false;
194
}
195
+ /* clean up the visited flag now */
196
+ spa_list_for_each(n, &context->node_list, link)
197
+ n->visited = false;
198
199
/* assign final quantum and set state for followers and drivers */
200
spa_list_for_each(n, &context->driver_list, driver_link) {
201
pipewire-0.3.50.tar.gz/src/pipewire/context.h -> pipewire-0.3.51.tar.gz/src/pipewire/context.h
Changed
10
1
2
void *data);
3
/** emit callback for all matched properties. Since 0.3.46 */
4
int pw_context_conf_section_match_rules(struct pw_context *context, const char *section,
5
- struct spa_dict *props,
6
+ const struct spa_dict *props,
7
int (*callback) (void *data, const char *location, const char *action,
8
const char *str, size_t len),
9
void *data);
10
pipewire-0.3.50.tar.gz/src/pipewire/core.h -> pipewire-0.3.51.tar.gz/src/pipewire/core.h
Changed
89
1
2
*
3
* \param info new core info
4
*/
5
- void (*info) (void *object, const struct pw_core_info *info);
6
+ void (*info) (void *data, const struct pw_core_info *info);
7
/**
8
* Emit a done event
9
*
10
11
*
12
* \param seq the seq number passed to the sync method call
13
*/
14
- void (*done) (void *object, uint32_t id, int seq);
15
+ void (*done) (void *data, uint32_t id, int seq);
16
17
/** Emit a ping event
18
*
19
* The client should reply with a pong reply with the same seq
20
* number.
21
*/
22
- void (*ping) (void *object, uint32_t id, int seq);
23
+ void (*ping) (void *data, uint32_t id, int seq);
24
25
/**
26
* Fatal error event
27
28
* \param res error code
29
* \param message error description
30
*/
31
- void (*error) (void *object, uint32_t id, int seq, int res, const char *message);
32
+ void (*error) (void *data, uint32_t id, int seq, int res, const char *message);
33
/**
34
* Remove an object ID
35
*
36
37
*
38
* \param id deleted object ID
39
*/
40
- void (*remove_id) (void *object, uint32_t id);
41
+ void (*remove_id) (void *data, uint32_t id);
42
43
/**
44
* Notify an object binding
45
46
* \param id bound object ID
47
* \param global_id the global id bound to
48
*/
49
- void (*bound_id) (void *object, uint32_t id, uint32_t global_id);
50
+ void (*bound_id) (void *data, uint32_t id, uint32_t global_id);
51
52
/**
53
* Add memory for a client
54
55
* \param fd the file descriptor
56
* \param flags extra flags
57
*/
58
- void (*add_mem) (void *object, uint32_t id, uint32_t type, int fd, uint32_t flags);
59
+ void (*add_mem) (void *data, uint32_t id, uint32_t type, int fd, uint32_t flags);
60
61
/**
62
* Remove memory for a client
63
*
64
* \param id the memory id to remove
65
*/
66
- void (*remove_mem) (void *object, uint32_t id);
67
+ void (*remove_mem) (void *data, uint32_t id);
68
};
69
70
#define PW_CORE_METHOD_ADD_LISTENER 0
71
72
* \param version the version of the interface
73
* \param props extra properties of the global
74
*/
75
- void (*global) (void *object, uint32_t id,
76
+ void (*global) (void *data, uint32_t id,
77
uint32_t permissions, const char *type, uint32_t version,
78
const struct spa_dict *props);
79
/**
80
81
*
82
* \param id the id of the global that was removed
83
*/
84
- void (*global_remove) (void *object, uint32_t id);
85
+ void (*global_remove) (void *data, uint32_t id);
86
};
87
88
#define PW_REGISTRY_METHOD_ADD_LISTENER 0
89
pipewire-0.3.50.tar.gz/src/pipewire/device.h -> pipewire-0.3.51.tar.gz/src/pipewire/device.h
Changed
19
1
2
*
3
* \param info info about the device
4
*/
5
- void (*info) (void *object, const struct pw_device_info *info);
6
+ void (*info) (void *data, const struct pw_device_info *info);
7
/**
8
* Notify a device param
9
*
10
11
* \param next the param index of the next param
12
* \param param the parameter
13
*/
14
- void (*param) (void *object, int seq,
15
+ void (*param) (void *data, int seq,
16
uint32_t id, uint32_t index, uint32_t next,
17
const struct spa_pod *param);
18
};
19
pipewire-0.3.50.tar.gz/src/pipewire/extensions/client-node.h -> pipewire-0.3.51.tar.gz/src/pipewire/extensions/client-node.h
Changed
107
1
2
* \param offset offset of activation memory
3
* \param size size of activation memory
4
*/
5
- int (*transport) (void *object,
6
+ int (*transport) (void *data,
7
int readfd,
8
int writefd,
9
uint32_t mem_id,
10
11
* \param flags parameter flags
12
* \param param the param to set
13
*/
14
- int (*set_param) (void *object,
15
+ int (*set_param) (void *data,
16
uint32_t id, uint32_t flags,
17
const struct spa_pod *param);
18
/**
19
20
* \param offset offset of io area in memory
21
* \param size size of the io area
22
*/
23
- int (*set_io) (void *object,
24
+ int (*set_io) (void *data,
25
uint32_t id,
26
uint32_t mem_id,
27
uint32_t offset,
28
29
/**
30
* Receive an event from the client node
31
* \param event the received event */
32
- int (*event) (void *object, const struct spa_event *event);
33
+ int (*event) (void *data, const struct spa_event *event);
34
/**
35
* Notify of a new node command
36
*
37
* \param command the command
38
*/
39
- int (*command) (void *object, const struct spa_command *command);
40
+ int (*command) (void *data, const struct spa_command *command);
41
/**
42
* A new port was added to the node
43
*
44
45
* \param port_id the new port id
46
* \param props extra properties
47
*/
48
- int (*add_port) (void *object,
49
+ int (*add_port) (void *data,
50
enum spa_direction direction,
51
uint32_t port_id,
52
const struct spa_dict *props);
53
54
* \param direction a port direction
55
* \param port_id the remove port id
56
*/
57
- int (*remove_port) (void *object,
58
+ int (*remove_port) (void *data,
59
enum spa_direction direction,
60
uint32_t port_id);
61
/**
62
63
* \param flags flags used when setting the param
64
* \param param the new param
65
*/
66
- int (*port_set_param) (void *object,
67
+ int (*port_set_param) (void *data,
68
enum spa_direction direction,
69
uint32_t port_id,
70
uint32_t id, uint32_t flags,
71
72
* \param n_buffer the number of buffers
73
* \param buffers and array of buffer descriptions
74
*/
75
- int (*port_use_buffers) (void *object,
76
+ int (*port_use_buffers) (void *data,
77
enum spa_direction direction,
78
uint32_t port_id,
79
uint32_t mix_id,
80
81
* \param offset offset of io area in memory
82
* \param size size of the io area
83
*/
84
- int (*port_set_io) (void *object,
85
+ int (*port_set_io) (void *data,
86
enum spa_direction direction,
87
uint32_t port_id,
88
uint32_t mix_id,
89
90
* \param the offset in \a mem_id to map
91
* \param the size of \a mem_id to map
92
*/
93
- int (*set_activation) (void *object,
94
+ int (*set_activation) (void *data,
95
uint32_t node_id,
96
int signalfd,
97
uint32_t mem_id,
98
99
*
100
* Since version 4:1
101
*/
102
- int (*port_set_mix_info) (void *object,
103
+ int (*port_set_mix_info) (void *data,
104
enum spa_direction direction,
105
uint32_t port_id,
106
uint32_t mix_id,
107
pipewire-0.3.50.tar.gz/src/pipewire/extensions/metadata.h -> pipewire-0.3.51.tar.gz/src/pipewire/extensions/metadata.h
Changed
10
1
2
#define PW_VERSION_METADATA_EVENTS 0
3
uint32_t version;
4
5
- int (*property) (void *object,
6
+ int (*property) (void *data,
7
uint32_t subject,
8
const char *key,
9
const char *type,
10
pipewire-0.3.50.tar.gz/src/pipewire/extensions/profiler.h -> pipewire-0.3.51.tar.gz/src/pipewire/extensions/profiler.h
Changed
10
1
2
#define PW_VERSION_PROFILER_EVENTS 0
3
uint32_t version;
4
5
- void (*profile) (void *object, const struct spa_pod *pod);
6
+ void (*profile) (void *data, const struct spa_pod *pod);
7
};
8
9
#define PW_PROFILER_METHOD_ADD_LISTENER 0
10
pipewire-0.3.50.tar.gz/src/pipewire/extensions/session-manager/impl-interfaces.h -> pipewire-0.3.51.tar.gz/src/pipewire/extensions/session-manager/impl-interfaces.h
Changed
56
1
2
* -EINVAL when the session id has already been set
3
* -ENOTSUP when the endpoint is a session master
4
*/
5
- int (*set_session_id) (void *object, uint32_t session_id);
6
+ int (*set_session_id) (void *data, uint32_t session_id);
7
8
/**
9
* Set the configurable parameter in \a endpoint.
10
11
* -ENOTSUP when there are no parameters implemented on \a endpoint
12
* -ENOENT the parameter is unknown
13
*/
14
- int (*set_param) (void *object,
15
+ int (*set_param) (void *data,
16
uint32_t id, uint32_t flags,
17
const struct spa_pod *param);
18
19
20
* -ESRCH when the type or size of a property is not correct.
21
* -ENOENT when the param id is not found
22
*/
23
- int (*stream_set_param) (void *object, uint32_t stream_id,
24
+ int (*stream_set_param) (void *data, uint32_t stream_id,
25
uint32_t id, uint32_t flags,
26
const struct spa_pod *param);
27
28
- int (*create_link) (void *object, const struct spa_dict *props);
29
+ int (*create_link) (void *data, const struct spa_dict *props);
30
};
31
32
#define PW_CLIENT_ENDPOINT_METHOD_ADD_LISTENER 0
33
34
* -ENOTSUP when there are no parameters implemented on \a session
35
* -ENOENT the parameter is unknown
36
*/
37
- int (*set_param) (void *object,
38
+ int (*set_param) (void *data,
39
uint32_t id, uint32_t flags,
40
const struct spa_pod *param);
41
42
43
* -ESRCH when the type or size of a property is not correct.
44
* -ENOENT when the param id is not found
45
*/
46
- int (*link_set_param) (void *object, uint32_t link_id,
47
+ int (*link_set_param) (void *data, uint32_t link_id,
48
uint32_t id, uint32_t flags,
49
const struct spa_pod *param);
50
51
- int (*link_request_state) (void *object, uint32_t link_id, uint32_t state);
52
+ int (*link_request_state) (void *data, uint32_t link_id, uint32_t state);
53
};
54
55
#define PW_CLIENT_SESSION_METHOD_ADD_LISTENER 0
56
pipewire-0.3.50.tar.gz/src/pipewire/extensions/session-manager/interfaces.h -> pipewire-0.3.51.tar.gz/src/pipewire/extensions/session-manager/interfaces.h
Changed
73
1
2
*
3
* \param info info about the session
4
*/
5
- void (*info) (void *object, const struct pw_session_info *info);
6
+ void (*info) (void *data, const struct pw_session_info *info);
7
8
/**
9
* Notify a session param
10
11
* \param next the param index of the next param
12
* \param param the parameter
13
*/
14
- void (*param) (void *object, int seq,
15
+ void (*param) (void *data, int seq,
16
uint32_t id, uint32_t index, uint32_t next,
17
const struct spa_pod *param);
18
};
19
20
*
21
* \param info info about the endpoint
22
*/
23
- void (*info) (void *object, const struct pw_endpoint_info *info);
24
+ void (*info) (void *data, const struct pw_endpoint_info *info);
25
26
/**
27
* Notify a endpoint param
28
29
* \param next the param index of the next param
30
* \param param the parameter
31
*/
32
- void (*param) (void *object, int seq,
33
+ void (*param) (void *data, int seq,
34
uint32_t id, uint32_t index, uint32_t next,
35
const struct spa_pod *param);
36
};
37
38
*
39
* \param info info about the endpoint stream
40
*/
41
- void (*info) (void *object, const struct pw_endpoint_stream_info *info);
42
+ void (*info) (void *data, const struct pw_endpoint_stream_info *info);
43
44
/**
45
* Notify a endpoint stream param
46
47
* \param next the param index of the next param
48
* \param param the parameter
49
*/
50
- void (*param) (void *object, int seq,
51
+ void (*param) (void *data, int seq,
52
uint32_t id, uint32_t index, uint32_t next,
53
const struct spa_pod *param);
54
};
55
56
*
57
* \param info info about the endpoint link
58
*/
59
- void (*info) (void *object, const struct pw_endpoint_link_info *info);
60
+ void (*info) (void *data, const struct pw_endpoint_link_info *info);
61
62
/**
63
* Notify a endpoint link param
64
65
* \param next the param index of the next param
66
* \param param the parameter
67
*/
68
- void (*param) (void *object, int seq,
69
+ void (*param) (void *data, int seq,
70
uint32_t id, uint32_t index, uint32_t next,
71
const struct spa_pod *param);
72
};
73
pipewire-0.3.50.tar.gz/src/pipewire/factory.h -> pipewire-0.3.51.tar.gz/src/pipewire/factory.h
Changed
10
1
2
*
3
* \param info info about the factory
4
*/
5
- void (*info) (void *object, const struct pw_factory_info *info);
6
+ void (*info) (void *data, const struct pw_factory_info *info);
7
};
8
9
#define PW_FACTORY_METHOD_ADD_LISTENER 0
10
pipewire-0.3.50.tar.gz/src/pipewire/filter.c -> pipewire-0.3.51.tar.gz/src/pipewire/filter.c
Changed
114
1
2
.error = on_core_error,
3
};
4
5
+struct match {
6
+ struct pw_filter *filter;
7
+ int count;
8
+};
9
+#define MATCH_INIT(f) (struct match){ .filter = f }
10
+
11
+static int execute_match(void *data, const char *location, const char *action,
12
+ const char *val, size_t len)
13
+{
14
+ struct match *match = data;
15
+ struct pw_filter *this = match->filter;
16
+ if (spa_streq(action, "update-props"))
17
+ match->count += pw_properties_update_string(this->properties, val, len);
18
+ return 1;
19
+}
20
+
21
static struct filter *
22
filter_new(struct pw_context *context, const char *name,
23
struct pw_properties *props, const struct pw_properties *extra)
24
25
struct filter *impl;
26
struct pw_filter *this;
27
const char *str;
28
+ struct match match;
29
int res;
30
31
impl = calloc(1, sizeof(struct filter));
32
33
res = -errno;
34
goto error_properties;
35
}
36
+ spa_hook_list_init(&impl->hooks);
37
+ this->properties = props;
38
+
39
pw_context_conf_update_props(context, "filter.properties", props);
40
41
- if (pw_properties_get(props, PW_KEY_NODE_NAME) == NULL && extra) {
42
- str = pw_properties_get(extra, PW_KEY_APP_NAME);
43
- if (str == NULL)
44
- str = pw_properties_get(extra, PW_KEY_APP_PROCESS_BINARY);
45
- if (str == NULL)
46
- str = name;
47
- pw_properties_set(props, PW_KEY_NODE_NAME, str);
48
- }
49
- if ((str = getenv("PIPEWIRE_LATENCY")) != NULL)
50
- pw_properties_set(props, PW_KEY_NODE_LATENCY, str);
51
- if ((str = getenv("PIPEWIRE_RATE")) != NULL)
52
- pw_properties_set(props, PW_KEY_NODE_RATE, str);
53
+ match = MATCH_INIT(this);
54
+ pw_context_conf_section_match_rules(context, "filter.rules",
55
+ &this->properties->dict, execute_match, &match);
56
+
57
+ if ((str = getenv("PIPEWIRE_PROPS")) != NULL)
58
+ pw_properties_update_string(props, str, strlen(str));
59
if ((str = getenv("PIPEWIRE_QUANTUM")) != NULL) {
60
struct spa_fraction q;
61
if (sscanf(str, "%u/%u", &q.num, &q.denom) == 2 && q.denom != 0) {
62
63
"%u/%u", q.num, q.denom);
64
}
65
}
66
+ if ((str = getenv("PIPEWIRE_LATENCY")) != NULL)
67
+ pw_properties_set(props, PW_KEY_NODE_LATENCY, str);
68
+ if ((str = getenv("PIPEWIRE_RATE")) != NULL)
69
+ pw_properties_set(props, PW_KEY_NODE_RATE, str);
70
71
- spa_hook_list_init(&impl->hooks);
72
- this->properties = props;
73
+ if (pw_properties_get(props, PW_KEY_NODE_NAME) == NULL && extra) {
74
+ str = pw_properties_get(extra, PW_KEY_APP_NAME);
75
+ if (str == NULL)
76
+ str = pw_properties_get(extra, PW_KEY_APP_PROCESS_BINARY);
77
+ if (str == NULL)
78
+ str = name;
79
+ pw_properties_set(props, PW_KEY_NODE_NAME, str);
80
+ }
81
82
this->name = name ? strdup(name) : NULL;
83
this->node_id = SPA_ID_INVALID;
84
85
emit_port_info(impl, port, false);
86
}
87
} else {
88
+ struct match match;
89
+
90
changed = pw_properties_update(filter->properties, dict);
91
+
92
+ match = MATCH_INIT(filter);
93
+ pw_context_conf_section_match_rules(impl->context, "filter.rules",
94
+ &filter->properties->dict, execute_match, &match);
95
+
96
impl->info.props = &filter->properties->dict;
97
- if (changed > 0) {
98
+ if (changed > 0 || match.count > 0) {
99
impl->info.change_mask |= SPA_NODE_CHANGE_MASK_PROPS;
100
emit_node_info(impl, false);
101
}
102
103
impl->disconnecting = false;
104
filter_set_state(filter, PW_FILTER_STATE_CONNECTING, NULL);
105
106
+ if (flags & PW_FILTER_FLAG_DRIVER)
107
+ pw_properties_set(filter->properties, PW_KEY_NODE_DRIVER, "true");
108
+ if ((pw_properties_get(filter->properties, PW_KEY_NODE_WANT_DRIVER) == NULL))
109
+ pw_properties_set(filter->properties, PW_KEY_NODE_WANT_DRIVER, "true");
110
+
111
if (filter->core == NULL) {
112
filter->core = pw_context_connect(impl->context,
113
pw_properties_copy(filter->properties), 0);
114
pipewire-0.3.50.tar.gz/src/pipewire/impl-client.c -> pipewire-0.3.51.tar.gz/src/pipewire/impl-client.c
Changed
26
1
2
};
3
4
static int
5
-global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
6
+global_bind(void *object, struct pw_impl_client *client, uint32_t permissions,
7
uint32_t version, uint32_t id)
8
{
9
- struct pw_impl_client *this = _data;
10
+ struct pw_impl_client *this = object;
11
struct pw_global *global = this->global;
12
struct pw_resource *resource;
13
struct resource_data *data;
14
15
return NULL;
16
}
17
18
-static void global_destroy(void *object)
19
+static void global_destroy(void *data)
20
{
21
- struct pw_impl_client *client = object;
22
+ struct pw_impl_client *client = data;
23
spa_hook_remove(&client->global_listener);
24
client->global = NULL;
25
pw_impl_client_destroy(client);
26
pipewire-0.3.50.tar.gz/src/pipewire/impl-core.c -> pipewire-0.3.51.tar.gz/src/pipewire/impl-core.c
Changed
41
1
2
.destroy = registry_destroy
3
};
4
5
-static void destroy_registry_resource(void *object)
6
+static void destroy_registry_resource(void *_data)
7
{
8
- struct resource_data *data = object;
9
+ struct resource_data *data = _data;
10
struct pw_resource *resource = data->resource;
11
spa_list_remove(&resource->link);
12
spa_hook_remove(&data->resource_listener);
13
14
};
15
16
static int
17
-global_bind(void *_data,
18
+global_bind(void *object,
19
struct pw_impl_client *client,
20
uint32_t permissions,
21
uint32_t version,
22
uint32_t id)
23
{
24
- struct pw_impl_core *this = _data;
25
+ struct pw_impl_core *this = object;
26
struct pw_global *global = this->global;
27
struct pw_resource *resource;
28
struct resource_data *data;
29
30
return res;
31
}
32
33
-static void global_destroy(void *object)
34
+static void global_destroy(void *data)
35
{
36
- struct pw_impl_core *core = object;
37
+ struct pw_impl_core *core = data;
38
spa_hook_remove(&core->global_listener);
39
core->global = NULL;
40
pw_impl_core_destroy(core);
41
pipewire-0.3.50.tar.gz/src/pipewire/impl-device.c -> pipewire-0.3.51.tar.gz/src/pipewire/impl-device.c
Changed
26
1
2
};
3
4
static int
5
-global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
6
+global_bind(void *object, struct pw_impl_client *client, uint32_t permissions,
7
uint32_t version, uint32_t id)
8
{
9
- struct pw_impl_device *this = _data;
10
+ struct pw_impl_device *this = object;
11
struct pw_global *global = this->global;
12
struct pw_resource *resource;
13
struct resource_data *data;
14
15
return -errno;
16
}
17
18
-static void global_destroy(void *object)
19
+static void global_destroy(void *data)
20
{
21
- struct pw_impl_device *device = object;
22
+ struct pw_impl_device *device = data;
23
spa_hook_remove(&device->global_listener);
24
device->global = NULL;
25
pw_impl_device_destroy(device);
26
pipewire-0.3.50.tar.gz/src/pipewire/impl-factory.c -> pipewire-0.3.51.tar.gz/src/pipewire/impl-factory.c
Changed
26
1
2
}
3
4
static int
5
-global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
6
+global_bind(void *object, struct pw_impl_client *client, uint32_t permissions,
7
uint32_t version, uint32_t id)
8
{
9
- struct pw_impl_factory *this = _data;
10
+ struct pw_impl_factory *this = object;
11
struct pw_global *global = this->global;
12
struct pw_resource *resource;
13
14
15
return -errno;
16
}
17
18
-static void global_destroy(void *object)
19
+static void global_destroy(void *data)
20
{
21
- struct pw_impl_factory *factory = object;
22
+ struct pw_impl_factory *factory = data;
23
spa_hook_remove(&factory->global_listener);
24
factory->global = NULL;
25
pw_impl_factory_destroy(factory);
26
pipewire-0.3.50.tar.gz/src/pipewire/impl-link.c -> pipewire-0.3.51.tar.gz/src/pipewire/impl-link.c
Changed
26
1
2
}
3
4
static int
5
-global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
6
+global_bind(void *object, struct pw_impl_client *client, uint32_t permissions,
7
uint32_t version, uint32_t id)
8
{
9
- struct pw_impl_link *this = _data;
10
+ struct pw_impl_link *this = object;
11
struct pw_global *global = this->global;
12
struct pw_resource *resource;
13
14
15
return NULL;
16
}
17
18
-static void global_destroy(void *object)
19
+static void global_destroy(void *data)
20
{
21
- struct pw_impl_link *link = object;
22
+ struct pw_impl_link *link = data;
23
spa_hook_remove(&link->global_listener);
24
link->global = NULL;
25
pw_impl_link_destroy(link);
26
pipewire-0.3.50.tar.gz/src/pipewire/impl-metadata.c -> pipewire-0.3.51.tar.gz/src/pipewire/impl-metadata.c
Changed
55
1
2
};
3
4
5
-static int metadata_property(void *object, uint32_t subject, const char *key,
6
+static int metadata_property(void *data, uint32_t subject, const char *key,
7
const char *type, const char *value)
8
{
9
- struct pw_impl_metadata *this = object;
10
+ struct pw_impl_metadata *this = data;
11
pw_impl_metadata_emit_property(this, subject, key, type, value);
12
return 0;
13
}
14
15
#define pw_metadata_resource_property(r,...) \
16
pw_metadata_resource(r,property,0,__VA_ARGS__)
17
18
-static int metadata_resource_property(void *object,
19
+static int metadata_resource_property(void *data,
20
uint32_t subject,
21
const char *key,
22
const char *type,
23
const char *value)
24
{
25
- struct resource_data *d = object;
26
+ struct resource_data *d = data;
27
struct pw_resource *resource = d->resource;
28
struct pw_impl_client *client = pw_resource_get_client(resource);
29
30
31
};
32
33
static int
34
-global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
35
+global_bind(void *object, struct pw_impl_client *client, uint32_t permissions,
36
uint32_t version, uint32_t id)
37
{
38
- struct pw_impl_metadata *this = _data;
39
+ struct pw_impl_metadata *this = object;
40
struct pw_global *global = this->global;
41
struct pw_resource *resource;
42
struct resource_data *data;
43
44
return -errno;
45
}
46
47
-static void global_destroy(void *object)
48
+static void global_destroy(void *data)
49
{
50
- struct pw_impl_metadata *metadata = object;
51
+ struct pw_impl_metadata *metadata = data;
52
spa_hook_remove(&metadata->global_listener);
53
metadata->global = NULL;
54
pw_impl_metadata_destroy(metadata);
55
pipewire-0.3.50.tar.gz/src/pipewire/impl-module.c -> pipewire-0.3.51.tar.gz/src/pipewire/impl-module.c
Changed
34
1
2
}
3
4
static int
5
-global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
6
+global_bind(void *object, struct pw_impl_client *client, uint32_t permissions,
7
uint32_t version, uint32_t id)
8
{
9
- struct pw_impl_module *this = _data;
10
+ struct pw_impl_module *this = object;
11
struct pw_global *global = this->global;
12
struct pw_resource *resource;
13
14
15
return -errno;
16
}
17
18
-static void global_destroy(void *object)
19
+static void global_destroy(void *data)
20
{
21
- struct pw_impl_module *module = object;
22
+ struct pw_impl_module *module = data;
23
spa_hook_remove(&module->global_listener);
24
module->global = NULL;
25
pw_impl_module_destroy(module);
26
27
if (hnd != NULL)
28
break;
29
30
+ pw_log_debug("open failed: %s", dlerror());
31
free(filename);
32
filename = NULL;
33
}
34
pipewire-0.3.50.tar.gz/src/pipewire/impl-node.c -> pipewire-0.3.51.tar.gz/src/pipewire/impl-node.c
Changed
22
1
2
};
3
4
static int
5
-global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
6
+global_bind(void *object, struct pw_impl_client *client, uint32_t permissions,
7
uint32_t version, uint32_t id)
8
{
9
- struct pw_impl_node *this = _data;
10
+ struct pw_impl_node *this = object;
11
struct pw_global *global = this->global;
12
struct pw_resource *resource;
13
struct resource_data *data;
14
15
old->name, old->info.id, driver->name, driver->info.id);
16
17
node->driver_node = driver;
18
+ node->moved = true;
19
20
pw_loop_invoke(node->data_loop,
21
do_move_nodes, SPA_ID_INVALID, &driver, sizeof(struct pw_impl_node *),
22
pipewire-0.3.50.tar.gz/src/pipewire/impl-port.c -> pipewire-0.3.51.tar.gz/src/pipewire/impl-port.c
Changed
26
1
2
};
3
4
static int
5
-global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
6
+global_bind(void *object, struct pw_impl_client *client, uint32_t permissions,
7
uint32_t version, uint32_t id)
8
{
9
- struct pw_impl_port *this = _data;
10
+ struct pw_impl_port *this = object;
11
struct pw_global *global = this->global;
12
struct pw_resource *resource;
13
struct resource_data *data;
14
15
return res;
16
}
17
18
-static void global_destroy(void *object)
19
+static void global_destroy(void *data)
20
{
21
- struct pw_impl_port *port = object;
22
+ struct pw_impl_port *port = data;
23
spa_hook_remove(&port->global_listener);
24
port->global = NULL;
25
pw_impl_port_destroy(port);
26
pipewire-0.3.50.tar.gz/src/pipewire/introspect.c -> pipewire-0.3.51.tar.gz/src/pipewire/introspect.c
Changed
58
1
2
}
3
if (update->change_mask & PW_NODE_CHANGE_MASK_PARAMS) {
4
uint32_t i, user, n_params = update->n_params;
5
+ void *np;
6
7
- info->params = realloc(info->params, n_params * sizeof(struct spa_param_info));
8
- if (info->params == NULL)
9
- n_params = 0;
10
+ np = reallocarray(info->params, n_params, sizeof(struct spa_param_info));
11
+ if (np == NULL) {
12
+ free(info->params);
13
+ info->params = NULL;
14
+ info->n_params = n_params = 0;
15
+ }
16
+ info->params = np;
17
18
for (i = 0; i < SPA_MIN(info->n_params, n_params); i++) {
19
user = reset ? 0 : info->paramsi.user;
20
21
}
22
if (update->change_mask & PW_PORT_CHANGE_MASK_PARAMS) {
23
uint32_t i, user, n_params = update->n_params;
24
+ void *np;
25
26
- info->params = realloc(info->params, n_params * sizeof(struct spa_param_info));
27
- if (info->params == NULL)
28
- n_params = 0;
29
+ np = reallocarray(info->params, n_params, sizeof(struct spa_param_info));
30
+ if (np == NULL) {
31
+ free(info->params);
32
+ info->params = NULL;
33
+ info->n_params = n_params = 0;
34
+ }
35
+ info->params = np;
36
37
for (i = 0; i < SPA_MIN(info->n_params, n_params); i++) {
38
user = reset ? 0 : info->paramsi.user;
39
40
}
41
if (update->change_mask & PW_DEVICE_CHANGE_MASK_PARAMS) {
42
uint32_t i, user, n_params = update->n_params;
43
+ void *np;
44
45
- info->params = realloc(info->params, n_params * sizeof(struct spa_param_info));
46
- if (info->params == NULL)
47
- n_params = 0;
48
+ np = reallocarray(info->params, n_params, sizeof(struct spa_param_info));
49
+ if (np == NULL) {
50
+ free(info->params);
51
+ info->params = NULL;
52
+ info->n_params = n_params = 0;
53
+ }
54
+ info->params = np;
55
56
for (i = 0; i < SPA_MIN(info->n_params, n_params); i++) {
57
user = reset ? 0 : info->paramsi.user;
58
pipewire-0.3.50.tar.gz/src/pipewire/link.h -> pipewire-0.3.51.tar.gz/src/pipewire/link.h
Changed
10
1
2
*
3
* \param info info about the link
4
*/
5
- void (*info) (void *object, const struct pw_link_info *info);
6
+ void (*info) (void *data, const struct pw_link_info *info);
7
};
8
9
#define PW_LINK_METHOD_ADD_LISTENER 0
10
pipewire-0.3.50.tar.gz/src/pipewire/loop.c -> pipewire-0.3.51.tar.gz/src/pipewire/loop.c
Changed
14
1
2
#include <pipewire/log.h>
3
#include <pipewire/type.h>
4
5
-#define DATAS_SIZE (4096 * 8)
6
-
7
PW_LOG_TOPIC_EXTERN(log_loop);
8
#define PW_LOG_TOPIC_DEFAULT log_loop
9
10
-
11
/** \cond */
12
13
struct impl {
14
pipewire-0.3.50.tar.gz/src/pipewire/mem.c -> pipewire-0.3.51.tar.gz/src/pipewire/mem.c
Changed
9
1
2
return &b->this;
3
4
error_close:
5
+ pw_log_debug("%p: close fd:%d", pool, b->this.fd);
6
close(b->this.fd);
7
error_free:
8
free(b);
9
pipewire-0.3.50.tar.gz/src/pipewire/module.h -> pipewire-0.3.51.tar.gz/src/pipewire/module.h
Changed
10
1
2
*
3
* \param info info about the module
4
*/
5
- void (*info) (void *object, const struct pw_module_info *info);
6
+ void (*info) (void *data, const struct pw_module_info *info);
7
};
8
9
#define PW_MODULE_METHOD_ADD_LISTENER 0
10
pipewire-0.3.50.tar.gz/src/pipewire/node.h -> pipewire-0.3.51.tar.gz/src/pipewire/node.h
Changed
19
1
2
*
3
* \param info info about the node
4
*/
5
- void (*info) (void *object, const struct pw_node_info *info);
6
+ void (*info) (void *data, const struct pw_node_info *info);
7
/**
8
* Notify a node param
9
*
10
11
* \param next the param index of the next param
12
* \param param the parameter
13
*/
14
- void (*param) (void *object, int seq,
15
+ void (*param) (void *data, int seq,
16
uint32_t id, uint32_t index, uint32_t next,
17
const struct spa_pod *param);
18
};
19
pipewire-0.3.50.tar.gz/src/pipewire/port.h -> pipewire-0.3.51.tar.gz/src/pipewire/port.h
Changed
19
1
2
*
3
* \param info info about the port
4
*/
5
- void (*info) (void *object, const struct pw_port_info *info);
6
+ void (*info) (void *data, const struct pw_port_info *info);
7
/**
8
* Notify a port param
9
*
10
11
* \param next the param index of the next param
12
* \param param the parameter
13
*/
14
- void (*param) (void *object, int seq,
15
+ void (*param) (void *data, int seq,
16
uint32_t id, uint32_t index, uint32_t next,
17
const struct spa_pod *param);
18
};
19
pipewire-0.3.50.tar.gz/src/pipewire/private.h -> pipewire-0.3.51.tar.gz/src/pipewire/private.h
Changed
18
1
2
unsigned int lock_rate:1; /**< don't change graph rate */
3
unsigned int transport_sync:1; /**< supports transport sync */
4
unsigned int current_pending:1; /**< a quantum/rate update is pending */
5
+ unsigned int moved:1; /**< the node was moved drivers */
6
7
uint32_t port_user_data_size; /**< extra size for port user data */
8
9
10
11
void pw_impl_module_schedule_destroy(struct pw_impl_module *module);
12
13
+pthread_attr_t *pw_thread_fill_attr(const struct spa_dict *props, pthread_attr_t *attr);
14
+
15
/** \endcond */
16
17
#ifdef __cplusplus
18
pipewire-0.3.50.tar.gz/src/pipewire/stream.c -> pipewire-0.3.51.tar.gz/src/pipewire/stream.c
Changed
154
1
2
return 0;
3
}
4
5
-static void node_event_info(void *object, const struct pw_node_info *info)
6
+static void node_event_info(void *data, const struct pw_node_info *info)
7
{
8
- struct pw_stream *stream = object;
9
+ struct pw_stream *stream = data;
10
struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
11
uint32_t i;
12
13
14
.info_changed = node_event_info,
15
};
16
17
-static void on_core_error(void *object, uint32_t id, int seq, int res, const char *message)
18
+static void on_core_error(void *data, uint32_t id, int seq, int res, const char *message)
19
{
20
- struct pw_stream *stream = object;
21
+ struct pw_stream *stream = data;
22
23
pw_log_debug("%p: error id:%u seq:%d res:%d (%s): %s", stream,
24
id, seq, res, spa_strerror(res), message);
25
26
.drained = context_drained,
27
};
28
29
+struct match {
30
+ struct pw_stream *stream;
31
+ int count;
32
+};
33
+#define MATCH_INIT(s) (struct match){ .stream = s }
34
+
35
+static int execute_match(void *data, const char *location, const char *action,
36
+ const char *val, size_t len)
37
+{
38
+ struct match *match = data;
39
+ struct pw_stream *this = match->stream;
40
+ if (spa_streq(action, "update-props"))
41
+ match->count += pw_properties_update_string(this->properties, val, len);
42
+ return 1;
43
+}
44
+
45
static struct stream *
46
stream_new(struct pw_context *context, const char *name,
47
struct pw_properties *props, const struct pw_properties *extra)
48
49
struct stream *impl;
50
struct pw_stream *this;
51
const char *str;
52
+ struct match match;
53
int res;
54
55
impl = calloc(1, sizeof(struct stream));
56
57
res = -errno;
58
goto error_properties;
59
}
60
+ spa_hook_list_init(&impl->hooks);
61
+ this->properties = props;
62
+
63
pw_context_conf_update_props(context, "stream.properties", props);
64
65
- if (pw_properties_get(props, PW_KEY_STREAM_IS_LIVE) == NULL)
66
- pw_properties_set(props, PW_KEY_STREAM_IS_LIVE, "true");
67
+ match = MATCH_INIT(this);
68
+ pw_context_conf_section_match_rules(context, "stream.rules",
69
+ &this->properties->dict, execute_match, &match);
70
71
- if (pw_properties_get(props, PW_KEY_NODE_NAME) == NULL && extra) {
72
- str = pw_properties_get(extra, PW_KEY_APP_NAME);
73
- if (str == NULL)
74
- str = pw_properties_get(extra, PW_KEY_APP_PROCESS_BINARY);
75
- if (str == NULL)
76
- str = name;
77
- pw_properties_set(props, PW_KEY_NODE_NAME, str);
78
- }
79
- if ((str = getenv("PIPEWIRE_LATENCY")) != NULL)
80
- pw_properties_set(props, PW_KEY_NODE_LATENCY, str);
81
- if ((str = getenv("PIPEWIRE_RATE")) != NULL)
82
- pw_properties_set(props, PW_KEY_NODE_RATE, str);
83
+ if ((str = getenv("PIPEWIRE_PROPS")) != NULL)
84
+ pw_properties_update_string(props, str, strlen(str));
85
if ((str = getenv("PIPEWIRE_QUANTUM")) != NULL) {
86
struct spa_fraction q;
87
if (sscanf(str, "%u/%u", &q.num, &q.denom) == 2 && q.denom != 0) {
88
89
"%u/%u", q.num, q.denom);
90
}
91
}
92
+ if ((str = getenv("PIPEWIRE_LATENCY")) != NULL)
93
+ pw_properties_set(props, PW_KEY_NODE_LATENCY, str);
94
+ if ((str = getenv("PIPEWIRE_RATE")) != NULL)
95
+ pw_properties_set(props, PW_KEY_NODE_RATE, str);
96
97
- spa_hook_list_init(&impl->hooks);
98
- this->properties = props;
99
+ if (pw_properties_get(props, PW_KEY_STREAM_IS_LIVE) == NULL)
100
+ pw_properties_set(props, PW_KEY_STREAM_IS_LIVE, "true");
101
+ if (pw_properties_get(props, PW_KEY_NODE_NAME) == NULL && extra) {
102
+ str = pw_properties_get(extra, PW_KEY_APP_NAME);
103
+ if (str == NULL)
104
+ str = pw_properties_get(extra, PW_KEY_APP_PROCESS_BINARY);
105
+ if (str == NULL)
106
+ str = name;
107
+ pw_properties_set(props, PW_KEY_NODE_NAME, str);
108
+ }
109
110
this->name = name ? strdup(name) : NULL;
111
this->node_id = SPA_ID_INVALID;
112
113
{
114
struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
115
int changed, res = 0;
116
+ struct match match;
117
118
changed = pw_properties_update(stream->properties, dict);
119
-
120
if (!changed)
121
return 0;
122
123
+ match = MATCH_INIT(stream);
124
+ pw_context_conf_section_match_rules(impl->context, "stream.rules",
125
+ &stream->properties->dict, execute_match, &match);
126
+
127
if (impl->node)
128
- res = pw_impl_node_update_properties(impl->node, dict);
129
+ res = pw_impl_node_update_properties(impl->node,
130
+ match.count == 0 ?
131
+ dict :
132
+ &stream->properties->dict);
133
134
return res;
135
}
136
137
}
138
if (flags & PW_STREAM_FLAG_DRIVER)
139
pw_properties_set(stream->properties, PW_KEY_NODE_DRIVER, "true");
140
+ if ((pw_properties_get(stream->properties, PW_KEY_NODE_WANT_DRIVER) == NULL))
141
+ pw_properties_set(stream->properties, PW_KEY_NODE_WANT_DRIVER, "true");
142
+
143
if (flags & PW_STREAM_FLAG_EXCLUSIVE)
144
pw_properties_set(stream->properties, PW_KEY_NODE_EXCLUSIVE, "true");
145
if (flags & PW_STREAM_FLAG_DONT_RECONNECT)
146
147
direction == PW_DIRECTION_INPUT ? "Input" : "Output",
148
media_type ? media_type : get_media_class(impl));
149
}
150
+
151
if ((str = pw_properties_get(stream->properties, PW_KEY_FORMAT_DSP)) != NULL)
152
pw_properties_set(impl->port_props, PW_KEY_FORMAT_DSP, str);
153
else if (impl->media_type == SPA_MEDIA_TYPE_application &&
154
pipewire-0.3.50.tar.gz/src/pipewire/thread-loop.c -> pipewire-0.3.51.tar.gz/src/pipewire/thread-loop.c
Changed
70
1
2
#include <errno.h>
3
#include <sys/time.h>
4
5
+#include <spa/support/thread.h>
6
#include <spa/utils/result.h>
7
8
#include "log.h"
9
+#include "thread.h"
10
#include "thread-loop.h"
11
12
PW_LOG_TOPIC_EXTERN(log_thread_loop);
13
14
#define pw_thread_loop_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_thread_loop_events, m, v, ##__VA_ARGS__)
15
#define pw_thread_loop_events_destroy(o) pw_thread_loop_events_emit(o, destroy, 0)
16
17
-#ifdef __FreeBSD__
18
-#include <sys/param.h>
19
-#if __FreeBSD_version < 1202000
20
-int pthread_setname_np(pthread_t thread, const char *name)
21
-{
22
- pthread_set_name_np(thread, name);
23
- return 0;
24
-}
25
-#endif
26
-#endif
27
-
28
/** \cond */
29
struct pw_thread_loop {
30
struct pw_loop *loop;
31
32
SPA_EXPORT
33
int pw_thread_loop_start(struct pw_thread_loop *loop)
34
{
35
+ int err;
36
+
37
if (!loop->running) {
38
- int err;
39
+ struct spa_thread *thr;
40
+ struct spa_dict_item items1;
41
42
loop->running = true;
43
- if ((err = pthread_create(&loop->thread, NULL, do_loop, loop)) != 0) {
44
- pw_log_warn("%p: can't create thread: %s", loop,
45
- strerror(err));
46
- loop->running = false;
47
- return -err;
48
- }
49
- if ((err = pthread_setname_np(loop->thread, loop->name)) != 0)
50
- pw_log_warn("%p: error: %s", loop, strerror(err));
51
+
52
+ items0 = SPA_DICT_ITEM_INIT(SPA_KEY_THREAD_NAME, loop->name);
53
+ thr = pw_thread_utils_create(&SPA_DICT_INIT_ARRAY(items), do_loop, loop);
54
+ if (thr == NULL)
55
+ goto error;
56
+
57
+ loop->thread = (pthread_t)thr;
58
}
59
return 0;
60
+
61
+error:
62
+ err = errno;
63
+ pw_log_warn("%p: can't create thread: %s", loop,
64
+ strerror(err));
65
+ loop->running = false;
66
+ return -err;
67
}
68
69
/** Quit the loop and stop its thread
70
pipewire-0.3.50.tar.gz/src/pipewire/thread.c -> pipewire-0.3.51.tar.gz/src/pipewire/thread.c
Changed
93
1
2
#include <sys/types.h>
3
#include <pthread.h>
4
5
+#include <spa/utils/dict.h>
6
#include <spa/utils/defs.h>
7
#include <spa/utils/list.h>
8
9
10
11
#include "thread.h"
12
13
-static struct spa_thread *impl_create(void *data,
14
+#define CHECK(expression,label) \
15
+do { \
16
+ if ((errno = expression) != 0) { \
17
+ res = -errno; \
18
+ pw_log_error(#expression ": %s", strerror(errno)); \
19
+ goto label; \
20
+ } \
21
+} while(false);
22
+
23
+SPA_EXPORT
24
+pthread_attr_t *pw_thread_fill_attr(const struct spa_dict *props, pthread_attr_t *attr)
25
+{
26
+ const char *str;
27
+ int res;
28
+
29
+ if (props == NULL)
30
+ return NULL;
31
+
32
+ pthread_attr_init(attr);
33
+ if ((str = spa_dict_lookup(props, SPA_KEY_THREAD_STACK_SIZE)) != NULL)
34
+ CHECK(pthread_attr_setstacksize(attr, atoi(str)), error);
35
+ return attr;
36
+error:
37
+ errno = -res;
38
+ return NULL;
39
+}
40
+
41
+#ifdef __FreeBSD__
42
+#include <sys/param.h>
43
+#if __FreeBSD_version < 1202000
44
+int pthread_setname_np(pthread_t thread, const char *name)
45
+{
46
+ pthread_set_name_np(thread, name);
47
+ return 0;
48
+}
49
+#endif
50
+#endif
51
+
52
+static struct spa_thread *impl_create(void *object,
53
const struct spa_dict *props,
54
void *(*start)(void*), void *arg)
55
{
56
pthread_t pt;
57
+ pthread_attr_t *attr = NULL, attributes;
58
+ const char *str;
59
int err;
60
- if ((err = pthread_create(&pt, NULL, start, arg)) != 0) {
61
+
62
+ attr = pw_thread_fill_attr(props, &attributes);
63
+
64
+ err = pthread_create(&pt, attr, start, arg);
65
+
66
+ if (attr)
67
+ pthread_attr_destroy(attr);
68
+
69
+ if (err != 0) {
70
errno = err;
71
return NULL;
72
}
73
+ if (props) {
74
+ if ((str = spa_dict_lookup(props, SPA_KEY_THREAD_NAME)) != NULL &&
75
+ (err = pthread_setname_np(pt, str)) != 0)
76
+ pw_log_warn("pthread_setname error: %s", strerror(err));
77
+ }
78
return (struct spa_thread*)pt;
79
}
80
81
-static int impl_join(void *data, struct spa_thread *thread, void **retval)
82
+static int impl_join(void *object, struct spa_thread *thread, void **retval)
83
{
84
pthread_t pt = (pthread_t)thread;
85
return pthread_join(pt, retval);
86
}
87
88
-static int impl_get_rt_range(void *data, const struct spa_dict *props,
89
+static int impl_get_rt_range(void *object, const struct spa_dict *props,
90
int *min, int *max)
91
{
92
if (min)
93
pipewire-0.3.50.tar.gz/src/tests/test-endpoint.c -> pipewire-0.3.51.tar.gz/src/tests/test-endpoint.c
Changed
65
1
2
};
3
4
static void
5
-endpoint_event_info(void *object, const struct pw_endpoint_info *info)
6
+endpoint_event_info(void *data, const struct pw_endpoint_info *info)
7
{
8
- struct test_endpoint_data *d = object;
9
+ struct test_endpoint_data *d = data;
10
const char *val;
11
12
spa_assert_se(info);
13
14
}
15
16
static void
17
-endpoint_event_param(void *object, int seq,
18
+endpoint_event_param(void *data, int seq,
19
uint32_t id, uint32_t index, uint32_t next,
20
const struct spa_pod *param)
21
{
22
- struct test_endpoint_data *d = object;
23
+ struct test_endpoint_data *d = data;
24
25
if (id == SPA_PARAM_Props) {
26
struct props *p = &d->props;
27
28
};
29
30
static void
31
-endpoint_proxy_destroy(void *object)
32
+endpoint_proxy_destroy(void *data)
33
{
34
- struct test_endpoint_data *d = object;
35
+ struct test_endpoint_data *d = data;
36
d->bound_proxy = NULL;
37
pw_main_loop_quit(d->loop);
38
}
39
40
};
41
42
static void
43
-test_endpoint_global(void *object, uint32_t id,
44
+test_endpoint_global(void *data, uint32_t id,
45
uint32_t permissions, const char *type, uint32_t version,
46
const struct spa_dict *props)
47
{
48
- struct test_endpoint_data *d = object;
49
+ struct test_endpoint_data *d = data;
50
const char *val;
51
52
if (!spa_streq(type, PW_TYPE_INTERFACE_Endpoint))
53
54
}
55
56
static void
57
-test_endpoint_global_remove(void *object, uint32_t id)
58
+test_endpoint_global_remove(void *data, uint32_t id)
59
{
60
- struct test_endpoint_data *d = object;
61
+ struct test_endpoint_data *d = data;
62
if (d->bound_proxy && id == pw_proxy_get_bound_id(d->bound_proxy))
63
pw_proxy_destroy(d->bound_proxy);
64
}
65
pipewire-0.3.50.tar.gz/src/tests/test-interfaces.c -> pipewire-0.3.51.tar.gz/src/tests/test-interfaces.c
Changed
108
1
2
} methods = { PW_VERSION_CORE_METHODS, };
3
static const struct {
4
uint32_t version;
5
- void (*info) (void *object, const struct pw_core_info *info);
6
- void (*done) (void *object, uint32_t id, int seq);
7
- void (*ping) (void *object, uint32_t id, int seq);
8
- void (*error) (void *object, uint32_t id, int seq, int res, const char *error);
9
- void (*remove_id) (void *object, uint32_t id);
10
- void (*bound_id) (void *object, uint32_t id, uint32_t global_id);
11
- void (*add_mem) (void *object, uint32_t id, uint32_t type, int fd, uint32_t flags);
12
- void (*remove_mem) (void *object, uint32_t id);
13
+ void (*info) (void *data, const struct pw_core_info *info);
14
+ void (*done) (void *data, uint32_t id, int seq);
15
+ void (*ping) (void *data, uint32_t id, int seq);
16
+ void (*error) (void *data, uint32_t id, int seq, int res, const char *error);
17
+ void (*remove_id) (void *data, uint32_t id);
18
+ void (*bound_id) (void *data, uint32_t id, uint32_t global_id);
19
+ void (*add_mem) (void *data, uint32_t id, uint32_t type, int fd, uint32_t flags);
20
+ void (*remove_mem) (void *data, uint32_t id);
21
} events = { PW_VERSION_CORE_EVENTS, };
22
23
struct pw_core_events e;
24
25
} methods = { PW_VERSION_REGISTRY_METHODS, };
26
struct {
27
uint32_t version;
28
- void (*global) (void *object, uint32_t id,
29
+ void (*global) (void *data, uint32_t id,
30
uint32_t permissions, const char *type, uint32_t version,
31
const struct spa_dict *props);
32
- void (*global_remove) (void *object, uint32_t id);
33
+ void (*global_remove) (void *data, uint32_t id);
34
} events = { PW_VERSION_REGISTRY_EVENTS, };
35
36
TEST_FUNC(m, methods, version);
37
38
} methods = { PW_VERSION_MODULE_METHODS, };
39
struct {
40
uint32_t version;
41
- void (*info) (void *object, const struct pw_module_info *info);
42
+ void (*info) (void *data, const struct pw_module_info *info);
43
} events = { PW_VERSION_MODULE_EVENTS, };
44
45
TEST_FUNC(m, methods, version);
46
47
} methods = { PW_VERSION_DEVICE_METHODS, };
48
struct {
49
uint32_t version;
50
- void (*info) (void *object, const struct pw_device_info *info);
51
- void (*param) (void *object, int seq,
52
+ void (*info) (void *data, const struct pw_device_info *info);
53
+ void (*param) (void *data, int seq,
54
uint32_t id, uint32_t index, uint32_t next,
55
const struct spa_pod *param);
56
} events = { PW_VERSION_DEVICE_EVENTS, };
57
58
} methods = { PW_VERSION_NODE_METHODS, };
59
struct {
60
uint32_t version;
61
- void (*info) (void *object, const struct pw_node_info *info);
62
- void (*param) (void *object, int seq,
63
+ void (*info) (void *data, const struct pw_node_info *info);
64
+ void (*param) (void *data, int seq,
65
uint32_t id, uint32_t index, uint32_t next,
66
const struct spa_pod *param);
67
} events = { PW_VERSION_NODE_EVENTS, };
68
69
} methods = { PW_VERSION_PORT_METHODS, };
70
struct {
71
uint32_t version;
72
- void (*info) (void *object, const struct pw_port_info *info);
73
- void (*param) (void *object, int seq,
74
+ void (*info) (void *data, const struct pw_port_info *info);
75
+ void (*param) (void *data, int seq,
76
uint32_t id, uint32_t index, uint32_t next,
77
const struct spa_pod *param);
78
} events = { PW_VERSION_PORT_EVENTS, };
79
80
} methods = { PW_VERSION_FACTORY_METHODS, };
81
struct {
82
uint32_t version;
83
- void (*info) (void *object, const struct pw_factory_info *info);
84
+ void (*info) (void *data, const struct pw_factory_info *info);
85
} events = { PW_VERSION_FACTORY_EVENTS, };
86
87
TEST_FUNC(m, methods, version);
88
89
} methods = { PW_VERSION_CLIENT_METHODS, };
90
struct {
91
uint32_t version;
92
- void (*info) (void *object, const struct pw_client_info *info);
93
- void (*permissions) (void *object, uint32_t index,
94
+ void (*info) (void *data, const struct pw_client_info *info);
95
+ void (*permissions) (void *data, uint32_t index,
96
uint32_t n_permissions, const struct pw_permission *permissions);
97
} events = { PW_VERSION_CLIENT_EVENTS, };
98
99
100
} methods = { PW_VERSION_LINK_METHODS, };
101
struct {
102
uint32_t version;
103
- void (*info) (void *object, const struct pw_link_info *info);
104
+ void (*info) (void *data, const struct pw_link_info *info);
105
} events = { PW_VERSION_LINK_EVENTS, };
106
107
TEST_FUNC(m, methods, version);
108
pipewire-0.3.50.tar.gz/src/tools/pw-cat.c -> pipewire-0.3.51.tar.gz/src/tools/pw-cat.c
Changed
201
1
2
3
typedef int (*fill_fn)(struct data *d, void *dest, unsigned int n_frames);
4
5
-struct target {
6
- struct spa_list link;
7
- uint32_t id;
8
-#define TARGET_TYPE_SINK 0
9
-#define TARGET_TYPE_SOURCE 1
10
-#define TARGET_TYPE_STREAM 2
11
- uint32_t type;
12
- char *name;
13
- char *desc;
14
- int prio;
15
-};
16
-
17
struct channelmap {
18
int n_channels;
19
int channelsSPA_AUDIO_MAX_CHANNELS;
20
21
struct pw_context *context;
22
struct pw_core *core;
23
struct spa_hook core_listener;
24
- struct pw_registry *registry;
25
- struct spa_hook registry_listener;
26
- struct pw_metadata *metadata;
27
- struct spa_hook metadata_listener;
28
- char default_sink1024;
29
- char default_source1024;
30
31
struct pw_stream *stream;
32
struct spa_hook stream_listener;
33
34
35
fill_fn fill;
36
37
- uint32_t target_id;
38
- bool list_targets;
39
- bool targets_listed;
40
- struct spa_list targets;
41
- int sync;
42
-
43
struct spa_io_position *position;
44
bool drained;
45
uint64_t clock_time;
46
47
}
48
}
49
50
-static void
51
-target_destroy(struct target *target)
52
-{
53
- if (!target)
54
- return;
55
- if (target->name)
56
- free(target->name);
57
- if (target->desc)
58
- free(target->desc);
59
- free(target);
60
-}
61
-
62
-static struct target *
63
-target_create(uint32_t id, uint32_t type, const char *name, const char *desc, int prio)
64
-{
65
- struct target *target;
66
-
67
- target = malloc(sizeof(*target));
68
- if (!target)
69
- return NULL;
70
- target->id = id;
71
- target->type = type;
72
- target->name = strdup(name);
73
- target->desc = strdup(desc ? : "");
74
- target->prio = prio;
75
-
76
- if (!target->name || !target->desc) {
77
- target_destroy(target);
78
- return NULL;
79
- }
80
- return target;
81
-}
82
-
83
static void on_core_info(void *userdata, const struct pw_core_info *info)
84
{
85
struct data *data = userdata;
86
87
info->id, info->name);
88
}
89
90
-static void on_core_done(void *userdata, uint32_t id, int seq)
91
-{
92
- struct data *data = userdata;
93
-
94
- /* if we're listing targets just exist */
95
- if (data->sync == seq && data->list_targets) {
96
- data->targets_listed = true;
97
- pw_main_loop_quit(data->loop);
98
- }
99
-}
100
-
101
static void on_core_error(void *userdata, uint32_t id, int seq, int res, const char *message)
102
{
103
struct data *data = userdata;
104
105
static const struct pw_core_events core_events = {
106
PW_VERSION_CORE_EVENTS,
107
.info = on_core_info,
108
- .done = on_core_done,
109
.error = on_core_error,
110
};
111
112
-static int json_object_find(const char *obj, const char *key, char *value, size_t len)
113
-{
114
- struct spa_json it2;
115
- const char *v;
116
- char k128;
117
-
118
- spa_json_init(&it0, obj, strlen(obj));
119
- if (spa_json_enter_object(&it0, &it1) <= 0)
120
- return -EINVAL;
121
-
122
- while (spa_json_get_string(&it1, k, sizeof(k)) > 0) {
123
- if (spa_streq(k, key)) {
124
- if (spa_json_get_string(&it1, value, len) <= 0)
125
- continue;
126
- return 0;
127
- } else {
128
- if (spa_json_next(&it1, &v) <= 0)
129
- break;
130
- }
131
- }
132
- return -ENOENT;
133
-}
134
-
135
-static int metadata_property(void *object,
136
- uint32_t subject, const char *key, const char *type, const char *value)
137
-{
138
- struct data *data = object;
139
-
140
- if (subject == PW_ID_CORE) {
141
- if (key == NULL || spa_streq(key, "default.audio.sink")) {
142
- if (value == NULL ||
143
- json_object_find(value, "name",
144
- data->default_sink, sizeof(data->default_sink)) < 0)
145
- data->default_sink0 = '\0';
146
- }
147
- if (key == NULL || spa_streq(key, "default.audio.source")) {
148
- if (value == NULL ||
149
- json_object_find(value, "name",
150
- data->default_source, sizeof(data->default_source)) < 0)
151
- data->default_source0 = '\0';
152
- }
153
- }
154
- return 0;
155
-}
156
-
157
-static const struct pw_metadata_events metadata_events = {
158
- PW_VERSION_METADATA_EVENTS,
159
- .property = metadata_property,
160
-};
161
-
162
-static void registry_event_global(void *userdata, uint32_t id,
163
- uint32_t permissions, const char *type, uint32_t version,
164
- const struct spa_dict *props)
165
-{
166
- struct data *data = userdata;
167
- const struct spa_dict_item *item;
168
- const char *name, *desc, *media_class, *prio_session;
169
- int prio;
170
- struct target *target;
171
- uint32_t ttype;
172
-
173
- /* only once */
174
- if (data->targets_listed)
175
- return;
176
-
177
- /* must be listing targets and interface must be a node */
178
- if (!data->list_targets)
179
- return;
180
-
181
- if (spa_streq(type, PW_TYPE_INTERFACE_Metadata)) {
182
- if (data->metadata != NULL)
183
- return;
184
- if ((name = spa_dict_lookup(props, PW_KEY_METADATA_NAME)) != NULL &&
185
- !spa_streq(name, "default"))
186
- return;
187
-
188
- data->metadata = pw_registry_bind(data->registry,
189
- id, type, PW_VERSION_METADATA, 0);
190
- pw_metadata_add_listener(data->metadata,
191
- &data->metadata_listener,
192
- &metadata_events, data);
193
-
194
- data->sync = pw_core_sync(data->core, 0, data->sync);
195
-
196
- } else if (spa_streq(type, PW_TYPE_INTERFACE_Node)) {
197
- name = spa_dict_lookup(props, PW_KEY_NODE_NAME);
198
- desc = spa_dict_lookup(props, PW_KEY_NODE_DESCRIPTION);
199
- media_class = spa_dict_lookup(props, PW_KEY_MEDIA_CLASS);
200
- prio_session = spa_dict_lookup(props, PW_KEY_PRIORITY_SESSION);
201
pipewire-0.3.50.tar.gz/src/tools/pw-cli.c -> pipewire-0.3.51.tar.gz/src/tools/pw-cli.c
Changed
201
1
2
bool (*func) (struct data *data, const char *cmd, char *args, char **error);
3
};
4
5
+static struct spa_dict * global_props(struct global *global);
6
+static struct global * obj_global(struct remote_data *rd, uint32_t id);
7
+static int children_of(struct remote_data *rd, uint32_t parent_id,
8
+ const char *child_type, uint32_t **children);
9
+
10
static int pw_split_ip(char *str, const char *delimiter, int max_tokens, char *tokens)
11
{
12
const char *state = NULL;
13
14
info->change_mask = 0;
15
}
16
17
-static void core_event_info(void *object, const struct pw_core_info *info)
18
+static void core_event_info(void *data, const struct pw_core_info *info)
19
{
20
- struct proxy_data *pd = object;
21
+ struct proxy_data *pd = data;
22
struct remote_data *rd = pd->rd;
23
if (pd->info)
24
printf("remote %d core %d changed\n", rd->id, info->id);
25
26
};
27
28
29
-static void module_event_info(void *object, const struct pw_module_info *info)
30
+static void module_event_info(void *data, const struct pw_module_info *info)
31
{
32
- struct proxy_data *pd = object;
33
+ struct proxy_data *pd = data;
34
struct remote_data *rd = pd->rd;
35
if (pd->info)
36
printf("remote %d module %d changed\n", rd->id, info->id);
37
38
.info = module_event_info
39
};
40
41
-static void node_event_info(void *object, const struct pw_node_info *info)
42
+static void node_event_info(void *data, const struct pw_node_info *info)
43
{
44
- struct proxy_data *pd = object;
45
+ struct proxy_data *pd = data;
46
struct remote_data *rd = pd->rd;
47
if (pd->info)
48
printf("remote %d node %d changed\n", rd->id, info->id);
49
50
}
51
}
52
53
-static void event_param(void *object, int seq, uint32_t id,
54
+static void event_param(void *_data, int seq, uint32_t id,
55
uint32_t index, uint32_t next, const struct spa_pod *param)
56
{
57
- struct proxy_data *data = object;
58
+ struct proxy_data *data = _data;
59
struct remote_data *rd = data->rd;
60
61
if (rd->data->interactive)
62
63
};
64
65
66
-static void port_event_info(void *object, const struct pw_port_info *info)
67
+static void port_event_info(void *data, const struct pw_port_info *info)
68
{
69
- struct proxy_data *pd = object;
70
+ struct proxy_data *pd = data;
71
struct remote_data *rd = pd->rd;
72
if (pd->info)
73
printf("remote %d port %d changed\n", rd->id, info->id);
74
75
.param = event_param
76
};
77
78
-static void factory_event_info(void *object, const struct pw_factory_info *info)
79
+static void factory_event_info(void *data, const struct pw_factory_info *info)
80
{
81
- struct proxy_data *pd = object;
82
+ struct proxy_data *pd = data;
83
struct remote_data *rd = pd->rd;
84
if (pd->info)
85
printf("remote %d factory %d changed\n", rd->id, info->id);
86
87
.info = factory_event_info
88
};
89
90
-static void client_event_info(void *object, const struct pw_client_info *info)
91
+static void client_event_info(void *data, const struct pw_client_info *info)
92
{
93
- struct proxy_data *pd = object;
94
+ struct proxy_data *pd = data;
95
struct remote_data *rd = pd->rd;
96
if (pd->info)
97
printf("remote %d client %d changed\n", rd->id, info->id);
98
99
}
100
}
101
102
-static void client_event_permissions(void *object, uint32_t index,
103
+static void client_event_permissions(void *_data, uint32_t index,
104
uint32_t n_permissions, const struct pw_permission *permissions)
105
{
106
- struct proxy_data *data = object;
107
+ struct proxy_data *data = _data;
108
struct remote_data *rd = data->rd;
109
uint32_t i;
110
111
112
.permissions = client_event_permissions
113
};
114
115
-static void link_event_info(void *object, const struct pw_link_info *info)
116
+static void link_event_info(void *data, const struct pw_link_info *info)
117
{
118
- struct proxy_data *pd = object;
119
+ struct proxy_data *pd = data;
120
struct remote_data *rd = pd->rd;
121
if (pd->info)
122
printf("remote %d link %d changed\n", rd->id, info->id);
123
124
};
125
126
127
-static void device_event_info(void *object, const struct pw_device_info *info)
128
+static void device_event_info(void *data, const struct pw_device_info *info)
129
{
130
- struct proxy_data *pd = object;
131
+ struct proxy_data *pd = data;
132
struct remote_data *rd = pd->rd;
133
if (pd->info)
134
printf("remote %d device %d changed\n", rd->id, info->id);
135
136
free(info);
137
}
138
139
-static void session_event_info(void *object,
140
+static void session_event_info(void *data,
141
const struct pw_session_info *update)
142
{
143
- struct proxy_data *pd = object;
144
+ struct proxy_data *pd = data;
145
struct remote_data *rd = pd->rd;
146
struct pw_session_info *info = pd->info;
147
148
149
free(info);
150
}
151
152
-static void endpoint_event_info(void *object,
153
+static void endpoint_event_info(void *data,
154
const struct pw_endpoint_info *update)
155
{
156
- struct proxy_data *pd = object;
157
+ struct proxy_data *pd = data;
158
struct remote_data *rd = pd->rd;
159
struct pw_endpoint_info *info = pd->info;
160
161
162
free(info);
163
}
164
165
-static void endpoint_stream_event_info(void *object,
166
+static void endpoint_stream_event_info(void *data,
167
const struct pw_endpoint_stream_info *update)
168
{
169
- struct proxy_data *pd = object;
170
+ struct proxy_data *pd = data;
171
struct remote_data *rd = pd->rd;
172
struct pw_endpoint_stream_info *info = pd->info;
173
174
175
return true;
176
}
177
178
-static bool do_create_link(struct data *data, const char *cmd, char *args, char **error)
179
+static struct global *
180
+obj_global_port(struct remote_data *rd, struct global *global, const char *port_direction, const char *port_id)
181
+{
182
+ struct global *global_port_found = NULL;
183
+ uint32_t *ports = NULL;
184
+ int port_count;
185
+
186
+ port_count = children_of(rd, global->id, PW_TYPE_INTERFACE_Port, &ports);
187
+
188
+ if (port_count <= 0)
189
+ return NULL;
190
+
191
+ for (int i = 0; i < port_count; i++) {
192
+ struct global *global_port = obj_global(rd, portsi);
193
+
194
+ if (!global_port)
195
+ continue;
196
+
197
+ struct spa_dict *props_port = global_props(global_port);
198
+
199
+ if (spa_streq(spa_dict_lookup(props_port, "port.direction"), port_direction)
200
+ && spa_streq(spa_dict_lookup(props_port, "port.id"), port_id)) {
201
pipewire-0.3.50.tar.gz/src/tools/pw-dot.c -> pipewire-0.3.51.tar.gz/src/tools/pw-dot.c
Changed
21
1
2
.info = module_event_info
3
};
4
5
-static void removed_proxy(void *user_data)
6
+static void removed_proxy(void *data)
7
{
8
- struct global *g = user_data;
9
+ struct global *g = data;
10
pw_proxy_destroy(g->proxy);
11
}
12
13
-static void destroy_proxy(void *user_data)
14
+static void destroy_proxy(void *data)
15
{
16
- struct global *g = user_data;
17
+ struct global *g = data;
18
spa_hook_remove(&g->object_listener);
19
spa_hook_remove(&g->proxy_listener);
20
}
21
pipewire-0.3.50.tar.gz/src/tools/pw-dump.c -> pipewire-0.3.51.tar.gz/src/tools/pw-dump.c
Changed
155
1
2
put_end(d, "}", 0);
3
}
4
5
-static void client_event_info(void *object, const struct pw_client_info *info)
6
+static void client_event_info(void *data, const struct pw_client_info *info)
7
{
8
- struct object *o = object;
9
+ struct object *o = data;
10
int changed = 0;
11
12
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->id, info->change_mask);
13
14
put_end(d, "}", 0);
15
}
16
17
-static void module_event_info(void *object, const struct pw_module_info *info)
18
+static void module_event_info(void *data, const struct pw_module_info *info)
19
{
20
- struct object *o = object;
21
+ struct object *o = data;
22
int changed = 0;
23
24
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->id, info->change_mask);
25
26
put_end(d, "}", 0);
27
}
28
29
-static void factory_event_info(void *object, const struct pw_factory_info *info)
30
+static void factory_event_info(void *data, const struct pw_factory_info *info)
31
{
32
- struct object *o = object;
33
+ struct object *o = data;
34
int changed = 0;
35
36
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->id, info->change_mask);
37
38
put_end(d, "}", 0);
39
}
40
41
-static void device_event_info(void *object, const struct pw_device_info *info)
42
+static void device_event_info(void *data, const struct pw_device_info *info)
43
{
44
- struct object *o = object;
45
+ struct object *o = data;
46
uint32_t i, changed = 0;
47
48
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->id, info->change_mask);
49
50
}
51
}
52
53
-static void device_event_param(void *object, int seq,
54
+static void device_event_param(void *data, int seq,
55
uint32_t id, uint32_t index, uint32_t next,
56
const struct spa_pod *param)
57
{
58
- struct object *o = object;
59
+ struct object *o = data;
60
add_param(&o->pending_list, id, param);
61
}
62
63
64
put_end(d, "}", 0);
65
}
66
67
-static void node_event_info(void *object, const struct pw_node_info *info)
68
+static void node_event_info(void *data, const struct pw_node_info *info)
69
{
70
- struct object *o = object;
71
+ struct object *o = data;
72
uint32_t i, changed = 0;
73
74
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->id, info->change_mask);
75
76
}
77
}
78
79
-static void node_event_param(void *object, int seq,
80
+static void node_event_param(void *data, int seq,
81
uint32_t id, uint32_t index, uint32_t next,
82
const struct spa_pod *param)
83
{
84
- struct object *o = object;
85
+ struct object *o = data;
86
add_param(&o->pending_list, id, param);
87
}
88
89
90
put_end(d, "}", 0);
91
}
92
93
-static void port_event_info(void *object, const struct pw_port_info *info)
94
+static void port_event_info(void *data, const struct pw_port_info *info)
95
{
96
- struct object *o = object;
97
+ struct object *o = data;
98
uint32_t i, changed = 0;
99
100
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->id, info->change_mask);
101
102
}
103
}
104
105
-static void port_event_param(void *object, int seq,
106
+static void port_event_param(void *data, int seq,
107
uint32_t id, uint32_t index, uint32_t next,
108
const struct spa_pod *param)
109
{
110
- struct object *o = object;
111
+ struct object *o = data;
112
add_param(&o->pending_list, id, param);
113
}
114
115
116
put_end(d, "}", 0);
117
}
118
119
-static void link_event_info(void *object, const struct pw_link_info *info)
120
+static void link_event_info(void *data, const struct pw_link_info *info)
121
{
122
- struct object *o = object;
123
+ struct object *o = data;
124
uint32_t changed = 0;
125
126
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->id, info->change_mask);
127
128
return NULL;
129
}
130
131
-static int metadata_property(void *object,
132
+static int metadata_property(void *data,
133
uint32_t subject,
134
const char *key,
135
const char *type,
136
const char *value)
137
{
138
- struct object *o = object;
139
+ struct object *o = data;
140
struct metadata_entry *e;
141
142
while ((e = metadata_find(o, subject, key)) != NULL) {
143
144
return;
145
}
146
147
-static void registry_event_global_remove(void *object, uint32_t id)
148
+static void registry_event_global_remove(void *data, uint32_t id)
149
{
150
- struct data *d = object;
151
+ struct data *d = data;
152
struct object *o;
153
154
if ((o = find_object(d, id)) == NULL)
155
pipewire-0.3.50.tar.gz/src/tools/pw-link.c -> pipewire-0.3.51.tar.gz/src/tools/pw-link.c
Changed
201
1
2
struct pw_proxy *proxy;
3
struct spa_hook listener;
4
5
+ data->link_res = 0;
6
+
7
proxy = pw_core_create_object(data->core,
8
"link-factory",
9
PW_TYPE_INTERFACE_Link,
10
11
return NULL;
12
}
13
14
+static struct object *find_node_port(struct data *data, struct object *node, enum pw_direction direction, const char *port_id)
15
+{
16
+ struct object *o;
17
+
18
+ spa_list_for_each(o, &data->objects, link) {
19
+ const char *o_port_id;
20
+ if (o->type != OBJECT_PORT)
21
+ continue;
22
+ if (o->extra1 != node->id)
23
+ continue;
24
+ if (o->extra0 != direction)
25
+ continue;
26
+ if ((o_port_id = pw_properties_get(o->props, PW_KEY_PORT_ID)) == NULL)
27
+ continue;
28
+ if (spa_streq(o_port_id, port_id))
29
+ return o;
30
+ }
31
+
32
+ return NULL;
33
+}
34
+
35
+static char *node_name(char *buffer, int size, struct object *n)
36
+{
37
+ const char *name;
38
+ buffer0 = '\0';
39
+ if ((name = pw_properties_get(n->props, PW_KEY_NODE_NAME)) == NULL)
40
+ return buffer;
41
+ snprintf(buffer, size, "%s", name);
42
+ return buffer;
43
+}
44
+
45
+static char *node_path(char *buffer, int size, struct object *n)
46
+{
47
+ const char *name;
48
+ buffer0 = '\0';
49
+ if ((name = pw_properties_get(n->props, PW_KEY_OBJECT_PATH)) == NULL)
50
+ return buffer;
51
+ snprintf(buffer, size, "%s", name);
52
+ return buffer;
53
+}
54
+
55
static char *port_name(char *buffer, int size, struct object *n, struct object *p)
56
{
57
const char *name1, *name2;
58
59
}
60
}
61
62
+static int node_matches(struct data *data, struct object *n, const char *name)
63
+{
64
+ char buffer1024;
65
+ uint32_t id = atoi(name);
66
+ if (n->id == id)
67
+ return 1;
68
+ if (spa_streq(node_name(buffer, sizeof(buffer), n), name))
69
+ return 1;
70
+ if (spa_streq(node_path(buffer, sizeof(buffer), n), name))
71
+ return 1;
72
+ return 0;
73
+}
74
+
75
static int port_matches(struct data *data, struct object *n, struct object *p, const char *name)
76
{
77
char buffer1024;
78
79
{
80
uint32_t in_port = 0, out_port = 0;
81
struct object *n, *p;
82
+ struct object *in_node = NULL, *out_node = NULL;
83
84
spa_list_for_each(n, &data->objects, link) {
85
if (n->type != OBJECT_NODE)
86
continue;
87
88
+ if (out_node == NULL && node_matches(data, n, data->opt_output)) {
89
+ out_node = n;
90
+ continue;
91
+ } else if (in_node == NULL && node_matches(data, n, data->opt_input)) {
92
+ in_node = n;
93
+ continue;
94
+ }
95
+
96
spa_list_for_each(p, &data->objects, link) {
97
if (p->type != OBJECT_PORT)
98
continue;
99
100
in_port = p->id;
101
}
102
}
103
+
104
+ if (in_node && out_node) {
105
+ int i, ret;
106
+ char port_id32;
107
+ bool all_links_exist = true;
108
+
109
+ for (i=0;; i++) {
110
+ snprintf(port_id, sizeof(port_id), "%d", i);
111
+
112
+ struct object *port_out = find_node_port(data, out_node, PW_DIRECTION_OUTPUT, port_id);
113
+ struct object *port_in = find_node_port(data, in_node, PW_DIRECTION_INPUT, port_id);
114
+
115
+ if (!port_out || !port_in)
116
+ break;
117
+
118
+ pw_properties_setf(data->props, PW_KEY_LINK_OUTPUT_PORT, "%u", port_out->id);
119
+ pw_properties_setf(data->props, PW_KEY_LINK_INPUT_PORT, "%u", port_in->id);
120
+
121
+ if ((ret = create_link(data)) < 0 && ret != -EEXIST)
122
+ return ret;
123
+
124
+ if (ret >= 0)
125
+ all_links_exist = false;
126
+ }
127
+ return (all_links_exist ? -EEXIST : 0);
128
+ }
129
+
130
if (in_port == 0 || out_port == 0)
131
return -ENOENT;
132
133
134
static int do_unlink_ports(struct data *data)
135
{
136
struct object *l, *n, *p;
137
- uint32_t link_id = 0;
138
+ bool found_any = false;
139
+ struct object *in_node = NULL, *out_node = NULL;
140
+
141
+ if (data->opt_input != NULL) {
142
+ /* 2 args, check if they are node names */
143
+ spa_list_for_each(n, &data->objects, link) {
144
+ if (n->type != OBJECT_NODE)
145
+ continue;
146
+
147
+ if (out_node == NULL && node_matches(data, n, data->opt_output)) {
148
+ out_node = n;
149
+ continue;
150
+ } else if (in_node == NULL && node_matches(data, n, data->opt_input)) {
151
+ in_node = n;
152
+ continue;
153
+ }
154
+ }
155
+ }
156
157
spa_list_for_each(l, &data->objects, link) {
158
if (l->type != OBJECT_LINK)
159
160
/* 1 arg, check link id */
161
if (l->id != (uint32_t)atoi(data->opt_output))
162
continue;
163
+ } else if (out_node && in_node) {
164
+ /* 2 args, check nodes */
165
+ if ((p = find_object(data, OBJECT_PORT, l->extra0)) == NULL)
166
+ continue;
167
+ if ((n = find_object(data, OBJECT_NODE, p->extra1)) == NULL)
168
+ continue;
169
+ if (n->id != out_node->id)
170
+ continue;
171
+
172
+ if ((p = find_object(data, OBJECT_PORT, l->extra1)) == NULL)
173
+ continue;
174
+ if ((n = find_object(data, OBJECT_NODE, p->extra1)) == NULL)
175
+ continue;
176
+ if (n->id != in_node->id)
177
+ continue;
178
} else {
179
/* 2 args, check port names */
180
if ((p = find_object(data, OBJECT_PORT, l->extra0)) == NULL)
181
182
if (!port_matches(data, n, p, data->opt_input))
183
continue;
184
}
185
- link_id = l->id;
186
- break;
187
+ pw_registry_destroy(data->registry, l->id);
188
+ found_any = true;
189
}
190
- if (link_id == 0)
191
+ if (!found_any)
192
return -ENOENT;
193
194
- pw_registry_destroy(data->registry, link_id);
195
-
196
core_sync(data);
197
pw_main_loop_run(data->loop);
198
199
200
}
201
pipewire-0.3.50.tar.gz/src/tools/pw-mididump.c -> pipewire-0.3.51.tar.gz/src/tools/pw-mididump.c
Changed
13
1
2
return 0;
3
}
4
5
-static void on_process(void *userdata, struct spa_io_position *position)
6
+static void on_process(void *_data, struct spa_io_position *position)
7
{
8
- struct data *data = userdata;
9
+ struct data *data = _data;
10
struct pw_buffer *b;
11
struct spa_buffer *buf;
12
struct spa_data *d;
13
pipewire-0.3.50.tar.gz/src/tools/pw-mon.c -> pipewire-0.3.51.tar.gz/src/tools/pw-mon.c
Changed
110
1
2
}
3
}
4
5
-static void event_param(void *object, int seq, uint32_t id,
6
+static void event_param(void *_data, int seq, uint32_t id,
7
uint32_t index, uint32_t next, const struct spa_pod *param)
8
{
9
- struct proxy_data *data = object;
10
+ struct proxy_data *data = _data;
11
struct param *p;
12
13
/* remove all params with the same id and older seq */
14
15
}
16
}
17
18
-static void module_event_info(void *object, const struct pw_module_info *info)
19
+static void module_event_info(void *_data, const struct pw_module_info *info)
20
{
21
- struct proxy_data *data = object;
22
+ struct proxy_data *data = _data;
23
bool print_all, print_mark;
24
25
print_all = true;
26
27
}
28
}
29
30
-static void node_event_info(void *object, const struct pw_node_info *info)
31
+static void node_event_info(void *_data, const struct pw_node_info *info)
32
{
33
- struct proxy_data *data = object;
34
+ struct proxy_data *data = _data;
35
uint32_t i;
36
37
info = data->info = pw_node_info_update(data->info, info);
38
39
}
40
}
41
42
-static void port_event_info(void *object, const struct pw_port_info *info)
43
+static void port_event_info(void *_data, const struct pw_port_info *info)
44
{
45
- struct proxy_data *data = object;
46
+ struct proxy_data *data = _data;
47
uint32_t i;
48
49
info = data->info = pw_port_info_update(data->info, info);
50
51
.param = event_param
52
};
53
54
-static void factory_event_info(void *object, const struct pw_factory_info *info)
55
+static void factory_event_info(void *_data, const struct pw_factory_info *info)
56
{
57
- struct proxy_data *data = object;
58
+ struct proxy_data *data = _data;
59
bool print_all, print_mark;
60
61
print_all = true;
62
63
.info = factory_event_info
64
};
65
66
-static void client_event_info(void *object, const struct pw_client_info *info)
67
+static void client_event_info(void *_data, const struct pw_client_info *info)
68
{
69
- struct proxy_data *data = object;
70
+ struct proxy_data *data = _data;
71
bool print_all, print_mark;
72
73
print_all = true;
74
75
.info = client_event_info
76
};
77
78
-static void link_event_info(void *object, const struct pw_link_info *info)
79
+static void link_event_info(void *_data, const struct pw_link_info *info)
80
{
81
- struct proxy_data *data = object;
82
+ struct proxy_data *data = _data;
83
bool print_all, print_mark;
84
85
print_all = true;
86
87
}
88
89
90
-static void device_event_info(void *object, const struct pw_device_info *info)
91
+static void device_event_info(void *_data, const struct pw_device_info *info)
92
{
93
- struct proxy_data *data = object;
94
+ struct proxy_data *data = _data;
95
uint32_t i;
96
97
info = data->info = pw_device_info_update(data->info, info);
98
99
return NULL;
100
}
101
102
-static void registry_event_global_remove(void *object, uint32_t id)
103
+static void registry_event_global_remove(void *data, uint32_t id)
104
{
105
- struct data *d = object;
106
+ struct data *d = data;
107
struct proxy_data *pd;
108
109
printf("removed:\n");
110
pipewire-0.3.50.tar.gz/src/tools/pw-top.c -> pipewire-0.3.51.tar.gz/src/tools/pw-top.c
Changed
129
1
2
struct node *driver;
3
uint32_t errors;
4
int32_t last_error_status;
5
+ uint32_t generation;
6
};
7
8
struct data {
9
10
11
int n_nodes;
12
struct spa_list node_list;
13
+ uint32_t generation;
14
15
WINDOW *win;
16
};
17
18
n->measurement = m;
19
n->info = point->info;
20
point->driver = n;
21
+ n->generation = d->generation;
22
23
if (m.status != 3) {
24
n->errors++;
25
26
27
n->measurement = m;
28
n->driver = point->driver;
29
+ n->generation = d->generation;
30
if (m.status != 3) {
31
n->errors++;
32
if (n->last_error_status == -1)
33
34
35
static const char *print_time(char *buf, size_t len, uint64_t val)
36
{
37
- if (val < 1000000llu)
38
+ if (val == (uint64_t)-1)
39
+ snprintf(buf, len, " --- ");
40
+ else if (val == (uint64_t)-2)
41
+ snprintf(buf, len, " +++ ");
42
+ else if (val < 1000000llu)
43
snprintf(buf, len, "%5.1fµs", val/1000.f);
44
else if (val < 1000000000llu)
45
snprintf(buf, len, "%5.1fms", val/1000000.f);
46
47
return buf;
48
}
49
50
-static const char *print_perc(char *buf, size_t len, float val, float quantum)
51
+static const char *print_perc(char *buf, size_t len, uint64_t val, float quantum)
52
{
53
- snprintf(buf, len, "%5.2f", quantum == 0.0f ? 0.0f : val/quantum);
54
+ if (val == (uint64_t)-1) {
55
+ snprintf(buf, len, " --- ");
56
+ } else if (val == (uint64_t)-2) {
57
+ snprintf(buf, len, " +++ ");
58
+ } else {
59
+ float frac = val / 1000000000.f;
60
+ snprintf(buf, len, "%5.2f", quantum == 0.0f ? 0.0f : frac/quantum);
61
+ }
62
return buf;
63
}
64
65
66
char buf264;
67
char buf364;
68
char buf464;
69
- float waiting, busy, quantum;
70
+ uint64_t waiting, busy;
71
+ float quantum;
72
struct spa_fraction frac;
73
74
if (n->driver == n)
75
76
else
77
quantum = 0.0;
78
79
- waiting = (n->measurement.awake - n->measurement.signal) / 1000000000.f,
80
- busy = (n->measurement.finish - n->measurement.awake) / 1000000000.f,
81
+ if (n->measurement.awake >= n->measurement.signal)
82
+ waiting = n->measurement.awake - n->measurement.signal;
83
+ else if (n->measurement.signal > n->measurement.prev_signal)
84
+ waiting = -2;
85
+ else
86
+ waiting = -1;
87
+
88
+ if (n->measurement.finish >= n->measurement.awake)
89
+ busy = n->measurement.finish - n->measurement.awake;
90
+ else if (n->measurement.awake > n->measurement.prev_signal)
91
+ busy = -2;
92
+ else
93
+ busy = -1;
94
95
mvwprintw(d->win, y, 0, "%s %4.1u %6.1u %6.1u %s %s %s %s %3.1u %s%s",
96
n->measurement.status != 3 ? "!" : " ",
97
n->id,
98
frac.num, frac.denom,
99
- print_time(buf1, 64, n->measurement.awake - n->measurement.signal),
100
- print_time(buf2, 64, n->measurement.finish - n->measurement.awake),
101
+ print_time(buf1, 64, waiting),
102
+ print_time(buf2, 64, busy),
103
print_perc(buf3, 64, waiting, quantum),
104
print_perc(buf4, 64, busy, quantum),
105
i->xrun_count + n->errors,
106
107
break;
108
109
spa_list_for_each(f, &d->node_list, link) {
110
+ if (d->generation > f->generation + 2) {
111
+ f->driver = f;
112
+ spa_zero(f->measurement);
113
+ spa_zero(f->info);
114
+ f->errors = 0;
115
+ f->last_error_status = 0;
116
+ }
117
+
118
if (f->driver != n || f == n)
119
continue;
120
121
122
static void do_timeout(void *data, uint64_t expirations)
123
{
124
struct data *d = data;
125
+ d->generation++;
126
do_refresh(d);
127
}
128
129
pipewire-0.3.50.tar.gz/test/pwtest-implementation.h -> pipewire-0.3.51.tar.gz/test/pwtest-implementation.h
Changed
10
1
2
struct pwtest_suite_decl {
3
const char *name;
4
enum pwtest_result (*setup)(struct pwtest_context *, struct pwtest_suite *);
5
-} __attribute__((aligned(16)));
6
+};
7
8
9
#endif /* PWTEST_IMPLEMENTATION_H */
10
pipewire-0.3.50.tar.gz/test/pwtest.h -> pipewire-0.3.51.tar.gz/test/pwtest.h
Changed
15
1
2
*/
3
#define PWTEST_SUITE(cname) \
4
static enum pwtest_result (cname##__setup)(struct pwtest_context *ctx, struct pwtest_suite *suite); \
5
- static const struct pwtest_suite_decl _test_suite \
6
__attribute__((used)) \
7
- __attribute((section("pwtest_suite_section"))) = { \
8
+ __attribute__((retain)) \
9
+ __attribute__((section("pwtest_suite_section"))) \
10
+ __attribute__((aligned(__alignof__(struct pwtest_suite_decl)))) \
11
+ static const struct pwtest_suite_decl _test_suite = { \
12
.name = #cname, \
13
.setup = cname##__setup, \
14
}; \
15
pipewire-0.3.50.tar.gz/test/test-spa-json.c -> pipewire-0.3.51.tar.gz/test/test-spa-json.c
Changed
14
1
2
pwtest_str_eq(dst, "\"\\u0004\\u0005\\u001f \\u0001\x7f\x90\"");
3
pwtest_int_eq(spa_json_parse_stringn(dst, sizeof(dst), result, sizeof(result)), 1);
4
pwtest_str_eq(result, "\x04\x05\x1f\x20\x01\x7f\x90");
5
+ strcpy(dst, "\"\\u03b2a\"");
6
+ pwtest_int_eq(spa_json_parse_stringn(dst, sizeof(dst), result, sizeof(result)), 1);
7
+ pwtest_str_eq(result, "\316\262a");
8
+ strcpy(dst, "\"\\u 03b2a \"");
9
+ pwtest_int_eq(spa_json_parse_stringn(dst, sizeof(dst), result, sizeof(result)), 1);
10
+ pwtest_str_eq(result, "u 03b2a ");
11
12
return PWTEST_PASS;
13
}
14