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);
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)))
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);
}
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);
}
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);
}