pulse-server: use TARGET_OBJECT

The pulse API uses either the node.name or object.serials so pass this
along in the TARGET_OBJECT instead of the NODE_TARGET now that
wireplumber handles this.
This commit is contained in:
Wim Taymans 2023-01-10 16:05:55 +01:00
parent 624e265fd6
commit ff69454eb4
14 changed files with 16 additions and 44 deletions

View file

@ -82,16 +82,6 @@ uint32_t id_to_index(struct pw_manager *m, uint32_t id)
return SPA_ID_INVALID;
}
uint32_t index_to_id(struct pw_manager *m, uint32_t index)
{
struct pw_manager_object *o;
spa_list_for_each(o, &m->object_list, link) {
if (o->index == index)
return o->id;
}
return SPA_ID_INVALID;
}
bool collect_is_linked(struct pw_manager *m, uint32_t id, enum pw_direction direction)
{
struct pw_manager_object *o;

View file

@ -54,7 +54,6 @@ struct selector {
struct pw_manager_object *select_object(struct pw_manager *m, struct selector *s);
uint32_t id_to_index(struct pw_manager *m, uint32_t id);
uint32_t index_to_id(struct pw_manager *m, uint32_t index);
void select_best(struct selector *s, struct pw_manager_object *o);
/* ========================================================================== */

View file

@ -312,7 +312,7 @@ static void manager_added(void *d, struct pw_manager_object *o)
pw_properties_setf(props, PW_KEY_NODE_NAME,
"combine_output.sink-%u.%s", data->module->index, sink_name);
pw_properties_set(props, PW_KEY_NODE_DESCRIPTION, data->sink_name);
pw_properties_set(props, PW_KEY_NODE_TARGET, sink_name);
pw_properties_set(props, PW_KEY_TARGET_OBJECT, sink_name);
pw_properties_setf(props, PW_KEY_NODE_GROUP, "combine_sink-%u", data->module->index);
pw_properties_setf(props, PW_KEY_NODE_LINK_GROUP, "combine_sink-%u", data->module->index);
pw_properties_set(props, PW_KEY_NODE_DONT_RECONNECT, "true");

View file

@ -208,18 +208,18 @@ static int module_echo_cancel_prepare(struct module * const module)
if ((str = pw_properties_get(props, "source_master")) != NULL) {
if (spa_strendswith(str, ".monitor")) {
pw_properties_setf(capture_props, PW_KEY_NODE_TARGET,
pw_properties_setf(capture_props, PW_KEY_TARGET_OBJECT,
"%.*s", (int)strlen(str)-8, str);
pw_properties_set(capture_props, PW_KEY_STREAM_CAPTURE_SINK,
"true");
} else {
pw_properties_set(capture_props, PW_KEY_NODE_TARGET, str);
pw_properties_set(capture_props, PW_KEY_TARGET_OBJECT, str);
}
pw_properties_set(props, "source_master", NULL);
}
if ((str = pw_properties_get(props, "sink_master")) != NULL) {
pw_properties_set(playback_props, PW_KEY_NODE_TARGET, str);
pw_properties_set(playback_props, PW_KEY_TARGET_OBJECT, str);
pw_properties_set(props, "sink_master", NULL);
}

View file

@ -219,7 +219,7 @@ static int module_ladspa_sink_prepare(struct module * const module)
if ((str = pw_properties_get(props, "master")) != NULL ||
(str = pw_properties_get(props, "sink_master")) != NULL) {
pw_properties_set(playback_props, PW_KEY_NODE_TARGET, str);
pw_properties_set(playback_props, PW_KEY_TARGET_OBJECT, str);
pw_properties_set(props, "master", NULL);
}

View file

@ -219,7 +219,7 @@ static int module_ladspa_source_prepare(struct module * const module)
if ((str = pw_properties_get(props, "master")) != NULL ||
(str = pw_properties_get(props, "source_master")) != NULL) {
pw_properties_set(capture_props, PW_KEY_NODE_TARGET, str);
pw_properties_set(capture_props, PW_KEY_TARGET_OBJECT, str);
pw_properties_set(props, "master", NULL);
}

View file

@ -173,18 +173,18 @@ static int module_loopback_prepare(struct module * const module)
if ((str = pw_properties_get(props, "source")) != NULL) {
if (spa_strendswith(str, ".monitor")) {
pw_properties_setf(capture_props, PW_KEY_NODE_TARGET,
pw_properties_setf(capture_props, PW_KEY_TARGET_OBJECT,
"%.*s", (int)strlen(str)-8, str);
pw_properties_set(capture_props, PW_KEY_STREAM_CAPTURE_SINK,
"true");
} else {
pw_properties_set(capture_props, PW_KEY_NODE_TARGET, str);
pw_properties_set(capture_props, PW_KEY_TARGET_OBJECT, str);
}
pw_properties_set(props, "source", NULL);
}
if ((str = pw_properties_get(props, "sink")) != NULL) {
pw_properties_set(playback_props, PW_KEY_NODE_TARGET, str);
pw_properties_set(playback_props, PW_KEY_TARGET_OBJECT, str);
pw_properties_set(props, "sink", NULL);
}

View file

@ -197,7 +197,7 @@ static int module_remap_sink_prepare(struct module * const module)
}
}
if ((str = pw_properties_get(props, "master")) != NULL) {
pw_properties_set(playback_props, PW_KEY_NODE_TARGET, str);
pw_properties_set(playback_props, PW_KEY_TARGET_OBJECT, str);
pw_properties_set(props, "master", NULL);
}

View file

@ -197,7 +197,7 @@ static int module_remap_source_prepare(struct module * const module)
}
}
if ((str = pw_properties_get(props, "master")) != NULL) {
pw_properties_set(capture_props, PW_KEY_NODE_TARGET, str);
pw_properties_set(capture_props, PW_KEY_TARGET_OBJECT, str);
pw_properties_set(props, "master", NULL);
}

View file

@ -135,7 +135,7 @@ static int module_rtp_recv_prepare(struct module * const module)
goto out;
}
if ((str = pw_properties_get(props, "sink")) != NULL)
pw_properties_set(stream_props, PW_KEY_NODE_TARGET, str);
pw_properties_set(stream_props, PW_KEY_TARGET_OBJECT, str);
if ((str = pw_properties_get(props, "sap_address")) != NULL)
pw_properties_set(global_props, "sap.ip", str);

View file

@ -163,14 +163,13 @@ static int module_rtp_send_prepare(struct module * const module)
}
if ((str = pw_properties_get(props, "source")) != NULL) {
pw_properties_set(stream_props, PW_KEY_NODE_TARGET, str);
if (spa_strendswith(str, ".monitor")) {
pw_properties_setf(stream_props, PW_KEY_NODE_TARGET,
pw_properties_setf(stream_props, PW_KEY_TARGET_OBJECT,
"%.*s", (int)strlen(str)-8, str);
pw_properties_set(stream_props, PW_KEY_STREAM_CAPTURE_SINK,
"true");
} else {
pw_properties_set(stream_props, PW_KEY_NODE_TARGET, str);
pw_properties_set(stream_props, PW_KEY_TARGET_OBJECT, str);
}
}
if (module_args_to_audioinfo(module->impl, props, &info) < 0) {

View file

@ -168,7 +168,7 @@ static int module_tunnel_sink_prepare(struct module * const module)
remote_sink_name = pw_properties_get(props, "sink");
if (remote_sink_name)
pw_properties_set(props, PW_KEY_NODE_TARGET, remote_sink_name);
pw_properties_set(props, PW_KEY_TARGET_OBJECT, remote_sink_name);
if ((server = pw_properties_get(props, "server")) == NULL) {
pw_log_error("no server given");

View file

@ -168,7 +168,7 @@ static int module_tunnel_source_prepare(struct module * const module)
remote_source_name = pw_properties_get(props, "source");
if (remote_source_name)
pw_properties_set(props, PW_KEY_NODE_TARGET, remote_source_name);
pw_properties_set(props, PW_KEY_TARGET_OBJECT, remote_source_name);
if ((server = pw_properties_get(props, "server")) == NULL) {
pw_log_error("no server given");

View file

@ -1569,7 +1569,6 @@ static void log_format_info(struct impl *impl, enum spa_log_level level, struct
static int do_create_playback_stream(struct client *client, uint32_t command, uint32_t tag, struct message *m)
{
struct impl *impl = client->impl;
struct pw_manager *manager = client->manager;
const char *name = NULL;
int res;
struct sample_spec ss;
@ -1780,14 +1779,9 @@ static int do_create_playback_stream(struct client *client, uint32_t command, ui
flags |= PW_STREAM_FLAG_DONT_RECONNECT;
if (sink_name != NULL) {
pw_properties_set(props,
PW_KEY_NODE_TARGET, sink_name);
pw_properties_set(props,
PW_KEY_TARGET_OBJECT, sink_name);
} else if (sink_index != SPA_ID_INVALID && sink_index != 0) {
pw_properties_setf(props,
PW_KEY_NODE_TARGET, "%u",
index_to_id(manager, sink_index));
pw_properties_setf(props,
PW_KEY_TARGET_OBJECT, "%u", sink_index);
}
@ -1837,7 +1831,6 @@ error:
static int do_create_record_stream(struct client *client, uint32_t command, uint32_t tag, struct message *m)
{
struct impl *impl = client->impl;
struct pw_manager *manager = client->manager;
const char *name = NULL;
int res;
struct sample_spec ss;
@ -2051,24 +2044,16 @@ static int do_create_record_stream(struct client *client, uint32_t command, uint
source_index = id;
}
if (source_index != SPA_ID_INVALID && source_index != 0) {
pw_properties_setf(props,
PW_KEY_NODE_TARGET, "%u",
index_to_id(manager, source_index));
pw_properties_setf(props,
PW_KEY_TARGET_OBJECT, "%u", source_index);
} else if (source_name != NULL) {
if (spa_strendswith(source_name, ".monitor")) {
pw_properties_setf(props,
PW_KEY_NODE_TARGET,
"%.*s", (int)strlen(source_name)-8, source_name);
pw_properties_setf(props,
PW_KEY_TARGET_OBJECT,
"%.*s", (int)strlen(source_name)-8, source_name);
pw_properties_set(props,
PW_KEY_STREAM_CAPTURE_SINK, "true");
} else {
pw_properties_set(props,
PW_KEY_NODE_TARGET, source_name);
pw_properties_set(props,
PW_KEY_TARGET_OBJECT, source_name);
}
@ -2628,7 +2613,6 @@ static int do_play_sample(struct client *client, uint32_t command, uint32_t tag,
if (sample == NULL)
goto error_noent;
pw_properties_setf(props, PW_KEY_NODE_TARGET, "%u", o->id);
pw_properties_setf(props, PW_KEY_TARGET_OBJECT, "%"PRIu64, o->serial);
play = sample_play_new(client->core, sample, props, sizeof(struct pending_sample));