diff --git a/src/modules/module-protocol-pulse/modules/module-combine-sink.c b/src/modules/module-protocol-pulse/modules/module-combine-sink.c index e6ca6574f..c271d1795 100644 --- a/src/modules/module-protocol-pulse/modules/module-combine-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-combine-sink.c @@ -270,6 +270,7 @@ static void manager_added(void *d, struct pw_manager_object *o) pw_properties_set(props, PW_KEY_NODE_DONT_RECONNECT, "true"); pw_properties_set(props, PW_KEY_NODE_VIRTUAL, "true"); pw_properties_set(props, PW_KEY_NODE_PASSIVE, "true"); + pw_properties_setf(props, "pulse.module.id", "%u", module->index); cstream->data = data; cstream->stream = pw_stream_new(data->core, NULL, props); @@ -354,6 +355,7 @@ static int module_combine_sink_load(struct client *client, struct module *module 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_VIRTUAL, "true"); + pw_properties_setf(props, "pulse.module.id", "%u", module->index); if ((str = pw_properties_get(module->props, "sink_properties")) != NULL) module_args_add_props(props, str); diff --git a/src/modules/module-protocol-pulse/modules/module-ladspa-sink.c b/src/modules/module-protocol-pulse/modules/module-ladspa-sink.c index 1fc1eba0f..b748da7c9 100644 --- a/src/modules/module-protocol-pulse/modules/module-ladspa-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-ladspa-sink.c @@ -75,6 +75,8 @@ static int module_ladspa_sink_load(struct client *client, struct module *module) pw_properties_setf(data->capture_props, PW_KEY_NODE_GROUP, "ladspa-sink-%u", module->index); pw_properties_setf(data->playback_props, PW_KEY_NODE_GROUP, "ladspa-sink-%u", module->index); + pw_properties_setf(data->capture_props, "pulse.module.id", "%u", module->index); + pw_properties_setf(data->playback_props, "pulse.module.id", "%u", module->index); f = open_memstream(&args, &size); fprintf(f, "{"); diff --git a/src/modules/module-protocol-pulse/modules/module-ladspa-source.c b/src/modules/module-protocol-pulse/modules/module-ladspa-source.c index 1cfb32769..e8d275ac7 100644 --- a/src/modules/module-protocol-pulse/modules/module-ladspa-source.c +++ b/src/modules/module-protocol-pulse/modules/module-ladspa-source.c @@ -75,6 +75,8 @@ static int module_ladspa_source_load(struct client *client, struct module *modul pw_properties_setf(data->capture_props, PW_KEY_NODE_GROUP, "ladspa-source-%u", module->index); pw_properties_setf(data->playback_props, PW_KEY_NODE_GROUP, "ladspa-source-%u", module->index); + pw_properties_setf(data->capture_props, "pulse.module.id", "%u", module->index); + pw_properties_setf(data->playback_props, "pulse.module.id", "%u", module->index); f = open_memstream(&args, &size); fprintf(f, "{"); diff --git a/src/modules/module-protocol-pulse/modules/module-loopback.c b/src/modules/module-protocol-pulse/modules/module-loopback.c index 71e314191..bceef11d2 100644 --- a/src/modules/module-protocol-pulse/modules/module-loopback.c +++ b/src/modules/module-protocol-pulse/modules/module-loopback.c @@ -72,6 +72,8 @@ static int module_loopback_load(struct client *client, struct module *module) pw_properties_setf(data->capture_props, PW_KEY_NODE_GROUP, "loopback-%u", module->index); pw_properties_setf(data->playback_props, PW_KEY_NODE_GROUP, "loopback-%u", module->index); + pw_properties_setf(data->capture_props, "pulse.module.id", "%u", module->index); + pw_properties_setf(data->playback_props, "pulse.module.id", "%u", module->index); f = open_memstream(&args, &size); fprintf(f, "{"); diff --git a/src/modules/module-protocol-pulse/modules/module-null-sink.c b/src/modules/module-protocol-pulse/modules/module-null-sink.c index a0dbe5b0e..e97d042f0 100644 --- a/src/modules/module-protocol-pulse/modules/module-null-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-null-sink.c @@ -115,6 +115,8 @@ static int module_null_sink_load(struct client *client, struct module *module) pw_core_add_listener(d->core, &d->core_listener, &core_events, module); + pw_properties_setf(module->props, "pulse.module.id", "%u", module->index); + d->proxy = pw_core_create_object(d->core, "adapter", PW_TYPE_INTERFACE_Node, PW_VERSION_NODE, module->props ? &module->props->dict : NULL, 0); diff --git a/src/modules/module-protocol-pulse/modules/module-pipe-sink.c b/src/modules/module-protocol-pulse/modules/module-pipe-sink.c index 0f3609cee..d6aecc5ba 100644 --- a/src/modules/module-protocol-pulse/modules/module-pipe-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-pipe-sink.c @@ -159,6 +159,8 @@ static int module_pipesink_load(struct client *client, struct module *module) &data->core_listener, &core_events, data); + pw_properties_setf(data->capture_props, "pulse.module.id", "%u", module->index); + data->capture = pw_stream_new(data->core, "pipesink capture", data->capture_props); data->capture_props = NULL; diff --git a/src/modules/module-protocol-pulse/modules/module-pipe-source.c b/src/modules/module-protocol-pulse/modules/module-pipe-source.c index 3203d0982..2c11fa115 100644 --- a/src/modules/module-protocol-pulse/modules/module-pipe-source.c +++ b/src/modules/module-protocol-pulse/modules/module-pipe-source.c @@ -180,6 +180,9 @@ static int module_pipesource_load(struct client *client, struct module *module) &data->core_listener, &core_events, data); + pw_properties_setf(data->playback_props, "pulse.module.id", + "%u", module->index); + data->playback = pw_stream_new(data->core, "pipesource playback", data->playback_props); data->playback_props = NULL; diff --git a/src/modules/module-protocol-pulse/modules/module-remap-sink.c b/src/modules/module-protocol-pulse/modules/module-remap-sink.c index 571c1ac45..880571a20 100644 --- a/src/modules/module-protocol-pulse/modules/module-remap-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-remap-sink.c @@ -69,6 +69,8 @@ static int module_remap_sink_load(struct client *client, struct module *module) pw_properties_setf(data->capture_props, PW_KEY_NODE_GROUP, "remap-sink-%u", module->index); pw_properties_setf(data->playback_props, PW_KEY_NODE_GROUP, "remap-sink-%u", module->index); + pw_properties_setf(data->capture_props, "pulse.module.id", "%u", module->index); + pw_properties_setf(data->playback_props, "pulse.module.id", "%u", module->index); f = open_memstream(&args, &size); fprintf(f, "{"); diff --git a/src/modules/module-protocol-pulse/modules/module-remap-source.c b/src/modules/module-protocol-pulse/modules/module-remap-source.c index a0777d166..aee0173d1 100644 --- a/src/modules/module-protocol-pulse/modules/module-remap-source.c +++ b/src/modules/module-protocol-pulse/modules/module-remap-source.c @@ -69,6 +69,8 @@ static int module_remap_source_load(struct client *client, struct module *module pw_properties_setf(data->capture_props, PW_KEY_NODE_GROUP, "remap-source-%u", module->index); pw_properties_setf(data->playback_props, PW_KEY_NODE_GROUP, "remap-source-%u", module->index); + pw_properties_setf(data->capture_props, "pulse.module.id", "%u", module->index); + pw_properties_setf(data->playback_props, "pulse.module.id", "%u", module->index); f = open_memstream(&args, &size); fprintf(f, "{"); diff --git a/src/modules/module-protocol-pulse/modules/module-roc-sink.c b/src/modules/module-protocol-pulse/modules/module-roc-sink.c index 8aa56ab7f..1caead5e8 100644 --- a/src/modules/module-protocol-pulse/modules/module-roc-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-roc-sink.c @@ -71,18 +71,12 @@ static int module_roc_sink_load(struct client *client, struct module *module) char *args; size_t size; + pw_properties_setf(data->sink_props, "pulse.module.id", + "%u", module->index); + f = open_memstream(&args, &size); fprintf(f, "{"); - /* Can't just serialise this dict because the "null" method gets - * interpreted as a JSON null */ - if ((str = pw_properties_get(data->roc_props, "local.ip"))) - fprintf(f, " local.ip = \"%s\"", str); - if ((str = pw_properties_get(data->roc_props, "remote.ip"))) - fprintf(f, " remote.ip = \"%s\"", str); - if ((str = pw_properties_get(data->roc_props, "remote.source.port"))) - fprintf(f, " remote.source.port = \"%s\"", str); - if ((str = pw_properties_get(data->roc_props, "remote.repair.port"))) - fprintf(f, " remote.repair.port = \"%s\"", str); + pw_properties_serialize_dict(f, &data->roc_props->dict, 0); fprintf(f, " } sink.props = {"); pw_properties_serialize_dict(f, &data->sink_props->dict, 0); fprintf(f, " } }"); diff --git a/src/modules/module-protocol-pulse/modules/module-roc-source.c b/src/modules/module-protocol-pulse/modules/module-roc-source.c index 5c09684e7..9399aa469 100644 --- a/src/modules/module-protocol-pulse/modules/module-roc-source.c +++ b/src/modules/module-protocol-pulse/modules/module-roc-source.c @@ -71,20 +71,12 @@ static int module_roc_source_load(struct client *client, struct module *module) char *args; size_t size; + pw_properties_setf(data->source_props, "pulse.module.id", + "%u", module->index); + f = open_memstream(&args, &size); fprintf(f, "{"); - /* Can't just serialise this dict because the "null" method gets - * interpreted as a JSON null */ - if ((str = pw_properties_get(data->roc_props, "local.ip"))) - fprintf(f, " local.ip = \"%s\"", str); - if ((str = pw_properties_get(data->roc_props, "local.source.port"))) - fprintf(f, " local.source.port = \"%s\"", str); - if ((str = pw_properties_get(data->roc_props, "local.repair.port"))) - fprintf(f, " local.repair.port = \"%s\"", str); - if ((str = pw_properties_get(data->roc_props, "sess.latency.msec"))) - fprintf(f, " sess.latency.msec = \"%s\"", str); - if ((str = pw_properties_get(data->roc_props, "resampler.profile"))) - fprintf(f, " resampler.profile = \"%s\"", str); + pw_properties_serialize_dict(f, &data->roc_props->dict, 0); fprintf(f, " } source.props = {"); pw_properties_serialize_dict(f, &data->source_props->dict, 0); fprintf(f, " } }"); diff --git a/src/modules/module-protocol-pulse/modules/module-tunnel-sink.c b/src/modules/module-protocol-pulse/modules/module-tunnel-sink.c index a3cc07f1b..29eead8ec 100644 --- a/src/modules/module-protocol-pulse/modules/module-tunnel-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-tunnel-sink.c @@ -73,6 +73,9 @@ static int module_tunnel_sink_load(struct client *client, struct module *module) server = pw_properties_get(module->props, "server"); + pw_properties_setf(data->stream_props, "pulse.module.id", + "%u", module->index); + f = open_memstream(&args, &size); fprintf(f, "{"); pw_properties_serialize_dict(f, &module->props->dict, 0); diff --git a/src/modules/module-protocol-pulse/modules/module-tunnel-source.c b/src/modules/module-protocol-pulse/modules/module-tunnel-source.c index f9bf48b47..25e384055 100644 --- a/src/modules/module-protocol-pulse/modules/module-tunnel-source.c +++ b/src/modules/module-protocol-pulse/modules/module-tunnel-source.c @@ -71,6 +71,9 @@ static int module_tunnel_source_load(struct client *client, struct module *modul size_t size; const char *server; + pw_properties_setf(data->stream_props, "pulse.module.id", + "%u", module->index); + server = pw_properties_get(module->props, "server"); f = open_memstream(&args, &size); diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index 44e2c9bdb..27ed94e81 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -3555,6 +3555,9 @@ static int fill_sink_info(struct client *client, struct message *m, snprintf(monitor_name, size, "%s.monitor", name); if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL) + module_id = id_to_index(manager, (uint32_t)atoi(str)); + if (module_id == SPA_ID_INVALID && + (str = spa_dict_lookup(info->props, "pulse.module.id")) != NULL) module_id = (uint32_t)atoi(str); if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_ID)) != NULL) card_id = (uint32_t)atoi(str); @@ -3600,7 +3603,7 @@ static int fill_sink_info(struct client *client, struct message *m, TAG_STRING, desc, TAG_SAMPLE_SPEC, &dev_info.ss, TAG_CHANNEL_MAP, &dev_info.map, - TAG_U32, id_to_index(manager, module_id), /* module index */ + TAG_U32, module_id, /* module index */ TAG_CVOLUME, &dev_info.volume_info.volume, TAG_BOOLEAN, dev_info.volume_info.mute, TAG_U32, o->index, /* monitor source index */ @@ -3759,6 +3762,9 @@ static int fill_source_info(struct client *client, struct message *m, snprintf(monitor_desc, size, "Monitor of %s", desc); if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL) + module_id = id_to_index(manager, (uint32_t)atoi(str)); + if (module_id == SPA_ID_INVALID && + (str = spa_dict_lookup(info->props, "pulse.module.id")) != NULL) module_id = (uint32_t)atoi(str); if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_ID)) != NULL) card_id = (uint32_t)atoi(str); @@ -3803,7 +3809,7 @@ static int fill_source_info(struct client *client, struct message *m, TAG_STRING, is_monitor ? monitor_desc : desc, TAG_SAMPLE_SPEC, &dev_info.ss, TAG_CHANNEL_MAP, &dev_info.map, - TAG_U32, id_to_index(manager, module_id), /* module index */ + TAG_U32, module_id, /* module index */ TAG_CVOLUME, &dev_info.volume_info.volume, TAG_BOOLEAN, dev_info.volume_info.mute, TAG_U32, is_monitor ? o->index : SPA_ID_INVALID,/* monitor of sink */ @@ -3907,7 +3913,11 @@ static int fill_sink_input_info(struct client *client, struct message *m, return -ENOENT; if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL) + module_id = id_to_index(manager, (uint32_t)atoi(str)); + if (module_id == SPA_ID_INVALID && + (str = spa_dict_lookup(info->props, "pulse.module.id")) != NULL) module_id = (uint32_t)atoi(str); + if (!pw_manager_object_is_virtual(o) && (str = spa_dict_lookup(info->props, PW_KEY_CLIENT_ID)) != NULL) client_id = (uint32_t)atoi(str); @@ -3928,7 +3938,7 @@ static int fill_sink_input_info(struct client *client, struct message *m, message_put(m, TAG_U32, o->index, /* sink_input index */ TAG_STRING, get_media_name(info), - TAG_U32, id_to_index(manager, module_id), /* module index */ + TAG_U32, module_id, /* module index */ TAG_U32, id_to_index(manager, client_id), /* client index */ TAG_U32, peer_index, /* sink index */ TAG_SAMPLE_SPEC, &dev_info.ss, @@ -3983,7 +3993,11 @@ static int fill_source_output_info(struct client *client, struct message *m, return -ENOENT; if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL) + module_id = id_to_index(manager, (uint32_t)atoi(str)); + if (module_id == SPA_ID_INVALID && + (str = spa_dict_lookup(info->props, "pulse.module.id")) != NULL) module_id = (uint32_t)atoi(str); + if (!pw_manager_object_is_virtual(o) && (str = spa_dict_lookup(info->props, PW_KEY_CLIENT_ID)) != NULL) client_id = (uint32_t)atoi(str); @@ -4004,7 +4018,7 @@ static int fill_source_output_info(struct client *client, struct message *m, message_put(m, TAG_U32, o->index, /* source_output index */ TAG_STRING, get_media_name(info), - TAG_U32, id_to_index(manager, module_id), /* module index */ + TAG_U32, module_id, /* module index */ TAG_U32, id_to_index(manager, client_id), /* client index */ TAG_U32, peer_index, /* source index */ TAG_SAMPLE_SPEC, &dev_info.ss,