summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorColin Guthrie <cguthrie@mandriva.org>2009-06-29 20:10:04 +0100
committerColin Guthrie <cguthrie@mandriva.org>2009-11-11 17:44:22 +0000
commit58bc037884878da69302be3084b05e1f7fa3f426 (patch)
tree8948dc81e9a83d0efb720ec6025b23eca18bc19f /src
parent276e9534b5183e92cc046f69a8812375f00c3bac (diff)
device-manager: Only store and save details for non-monitor sources
Diffstat (limited to 'src')
-rw-r--r--src/modules/module-device-manager.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/modules/module-device-manager.c b/src/modules/module-device-manager.c
index 3ebdd485..77b6f2fe 100644
--- a/src/modules/module-device-manager.c
+++ b/src/modules/module-device-manager.c
@@ -168,8 +168,8 @@ static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) {
static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata) {
struct userdata *u = userdata;
- struct entry entry, *old;
- char *name;
+ struct entry entry, *old = NULL;
+ char *name = NULL;
pa_datum key, data;
pa_assert(c);
@@ -205,6 +205,9 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
if (!(source = pa_idxset_get_by_index(c->sources, idx)))
return;
+ if (source->monitor_of)
+ return;
+
name = pa_sprintf_malloc("source:%s", source->name);
if ((old = read_entry(u, name)))
@@ -251,7 +254,7 @@ static pa_hook_result_t sink_new_hook_callback(pa_core *c, pa_sink_new_data *new
if ((e = read_entry(u, name))) {
if (strncmp(e->description, pa_proplist_gets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION), sizeof(e->description)) != 0) {
- pa_log_info("Restoring description for sink %s.", name);
+ pa_log_info("Restoring description for sink %s.", new_data->name);
pa_proplist_sets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION, e->description);
}
@@ -276,7 +279,8 @@ static pa_hook_result_t source_new_hook_callback(pa_core *c, pa_source_new_data
if ((e = read_entry(u, name))) {
if (strncmp(e->description, pa_proplist_gets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION), sizeof(e->description)) != 0) {
- pa_log_info("Restoring description for sink %s.", name);
+ /* NB, We cannot detect if we are a monitor here... this could mess things up a bit... */
+ pa_log_info("Restoring description for sink %s.", new_data->name);
pa_proplist_sets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION, e->description);
}
@@ -325,6 +329,11 @@ static void apply_entry(struct userdata *u, const char *name, struct entry *e) {
continue;
}
+ if (source->monitor_of) {
+ pa_log_warn("Cowardly refusing to set the description for monitor source %s.", source->name);
+ continue;
+ }
+
pa_log_info("Setting description for source %s.", source->name);
pa_source_set_description(source, e->description);
}