From ac3d66f978f4276317e11ba9f1f156926a90b30c Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Tue, 22 Nov 2011 13:24:22 +0530 Subject: [PATCH] echo-cancel: Use more human-friendly descriptions This makes what devices are being cancelled clearer in the UI (at the cost of being somewhat less clear when multiple devices of the same name are plugged, but at least that's a much smaller set than everyone). --- src/modules/echo-cancel/module-echo-cancel.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index c063734..b810a4e 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -1433,13 +1433,14 @@ static void source_output_moving_cb(pa_source_output *o, pa_source *dest) { pa_source_set_asyncmsgq(u->source, NULL); if (u->source_auto_desc && dest) { - const char *z; + const char *y, *z; pa_proplist *pl; pl = pa_proplist_new(); + y = pa_proplist_gets(u->sink_input->sink->proplist, PA_PROP_DEVICE_DESCRIPTION); z = pa_proplist_gets(dest->proplist, PA_PROP_DEVICE_DESCRIPTION); - pa_proplist_setf(pl, PA_PROP_DEVICE_DESCRIPTION, "Echo-Cancel Source %s on %s", - pa_proplist_gets(u->source->proplist, "device.echo-cancel.name"), z ? z : dest->name); + pa_proplist_setf(pl, PA_PROP_DEVICE_DESCRIPTION, "%s (echo cancelled with %s)", z ? z : dest->name, + y ? y : u->sink_input->sink->name); pa_source_update_proplist(u->source, PA_UPDATE_REPLACE, pl); pa_proplist_free(pl); @@ -1460,13 +1461,14 @@ static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) { pa_sink_set_asyncmsgq(u->sink, NULL); if (u->sink_auto_desc && dest) { - const char *z; + const char *y, *z; pa_proplist *pl; pl = pa_proplist_new(); + y = pa_proplist_gets(u->source_output->source->proplist, PA_PROP_DEVICE_DESCRIPTION); z = pa_proplist_gets(dest->proplist, PA_PROP_DEVICE_DESCRIPTION); - pa_proplist_setf(pl, PA_PROP_DEVICE_DESCRIPTION, "Echo-Cancel Sink %s on %s", - pa_proplist_gets(u->sink->proplist, "device.echo-cancel.name"), z ? z : dest->name); + pa_proplist_setf(pl, PA_PROP_DEVICE_DESCRIPTION, "%s (echo cancelled with %s)", z ? z : dest->name, + y ? y : u->source_output->source->name); pa_sink_update_proplist(u->sink, PA_UPDATE_REPLACE, pl); pa_proplist_free(pl); @@ -1709,7 +1711,6 @@ int pa__init(pa_module*m) { pa_proplist_sets(source_data.proplist, PA_PROP_DEVICE_CLASS, "filter"); if (!u->autoloaded) pa_proplist_sets(source_data.proplist, PA_PROP_DEVICE_INTENDED_ROLES, "phone"); - pa_proplist_sets(source_data.proplist, "device.echo-cancel.name", source_data.name); if (pa_modargs_get_proplist(ma, "source_properties", source_data.proplist, PA_UPDATE_REPLACE) < 0) { pa_log("Invalid properties"); @@ -1718,10 +1719,12 @@ int pa__init(pa_module*m) { } if ((u->source_auto_desc = !pa_proplist_contains(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION))) { - const char *z; + const char *y, *z; + y = pa_proplist_gets(sink_master->proplist, PA_PROP_DEVICE_DESCRIPTION); z = pa_proplist_gets(source_master->proplist, PA_PROP_DEVICE_DESCRIPTION); - pa_proplist_setf(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Echo-Cancel Source %s on %s", source_data.name, z ? z : source_master->name); + pa_proplist_setf(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "%s (echo cancelled with %s)", + z ? z : source_master->name, y ? y : sink_master->name); } u->source = pa_source_new(m->core, &source_data, (source_master->flags & (PA_SOURCE_LATENCY | PA_SOURCE_DYNAMIC_LATENCY)) @@ -1759,7 +1762,6 @@ int pa__init(pa_module*m) { pa_proplist_sets(sink_data.proplist, PA_PROP_DEVICE_CLASS, "filter"); if (!u->autoloaded) pa_proplist_sets(sink_data.proplist, PA_PROP_DEVICE_INTENDED_ROLES, "phone"); - pa_proplist_sets(sink_data.proplist, "device.echo-cancel.name", sink_data.name); if (pa_modargs_get_proplist(ma, "sink_properties", sink_data.proplist, PA_UPDATE_REPLACE) < 0) { pa_log("Invalid properties"); @@ -1768,10 +1770,12 @@ int pa__init(pa_module*m) { } if ((u->sink_auto_desc = !pa_proplist_contains(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION))) { - const char *z; + const char *y, *z; + y = pa_proplist_gets(source_master->proplist, PA_PROP_DEVICE_DESCRIPTION); z = pa_proplist_gets(sink_master->proplist, PA_PROP_DEVICE_DESCRIPTION); - pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Echo-Cancel Sink %s on %s", sink_data.name, z ? z : sink_master->name); + pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "%s (echo cancelled with %s)", + z ? z : sink_master->name, y ? y : source_master->name); } u->sink = pa_sink_new(m->core, &sink_data, (sink_master->flags & (PA_SINK_LATENCY | PA_SINK_DYNAMIC_LATENCY)) -- 2.7.4