Skip to content
Snippets Groups Projects
Commit d6f6c3d6 authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

softdsp-endpoint: give a proper name to the endpoint based on alsa properties

parent 39b5bc8b
No related branches found
No related tags found
No related merge requests found
......@@ -47,7 +47,7 @@ on_node_added(WpRemotePipewire *rp, guint id, guint parent_id, gconstpointer p,
struct impl *impl = d;
const struct spa_dict *props = p;
g_autoptr (WpCore) core = wp_module_get_core (impl->module);
const gchar *name, *media_class;
const gchar *media_class;
GVariantBuilder b;
g_autoptr (GVariant) endpoint_props = NULL;
......@@ -55,7 +55,6 @@ on_node_added(WpRemotePipewire *rp, guint id, guint parent_id, gconstpointer p,
g_return_if_fail(props);
/* Get the name and media_class */
name = spa_dict_lookup(props, "node.name");
media_class = spa_dict_lookup(props, "media.class");
/* Make sure the media class is non-dsp audio */
......@@ -66,9 +65,6 @@ on_node_added(WpRemotePipewire *rp, guint id, guint parent_id, gconstpointer p,
/* Set the properties */
g_variant_builder_init (&b, G_VARIANT_TYPE_VARDICT);
g_variant_builder_add (&b, "{sv}",
"name", g_variant_new_take_string (g_strdup_printf (
"Endpoint %u: %s", id, name)));
g_variant_builder_add (&b, "{sv}",
"media-class", g_variant_new_string (media_class));
g_variant_builder_add (&b, "{sv}",
......
......@@ -352,11 +352,22 @@ on_proxy_node_created(GObject *initable, GAsyncResult *res, gpointer data)
{
WpPwAudioSoftdspEndpoint *self = data;
GVariantDict d;
g_autofree gchar *name;
const struct spa_dict *props;
/* Get the proxy node */
self->proxy_node = wp_proxy_node_new_finish(initable, res, NULL);
g_return_if_fail (self->proxy_node);
/* Give a proper name to this endpoint based on ALSA properties */
props = wp_proxy_node_get_info (self->proxy_node)->props;
name = g_strdup_printf ("%s on %s (%s / node %d)",
spa_dict_lookup (props, "alsa.pcm.name"),
spa_dict_lookup (props, "alsa.card.name"),
spa_dict_lookup (props, "alsa.device"),
wp_proxy_node_get_info (self->proxy_node)->id);
g_object_set (self, "name", name, NULL);
/* Emit the audio DSP node */
emit_audio_dsp_node(self);
......@@ -705,8 +716,6 @@ endpoint_factory (WpFactory * factory, GType type, GVariant * properties,
g_return_if_fail (core);
/* Get the properties */
if (!g_variant_lookup (properties, "name", "&s", &name))
return;
if (!g_variant_lookup (properties, "media-class", "&s", &media_class))
return;
if (!g_variant_lookup (properties, "global-id", "u", &global_id))
......@@ -716,7 +725,6 @@ endpoint_factory (WpFactory * factory, GType type, GVariant * properties,
g_async_initable_new_async (
endpoint_get_type (), G_PRIORITY_DEFAULT, NULL, ready, user_data,
"core", core,
"name", name,
"media-class", media_class,
"global-id", global_id,
NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment