else if ((r = pa_proplist_gets(p, PA_PROP_MEDIA_NAME)))
return pa_sprintf_malloc("%s-by-media-name:%s", prefix, r);
- return NULL;
+ return pa_sprintf_malloc("%s-fallback:%s", prefix, r);
}
-static struct entry* read_entry(struct userdata *u, char *name) {
+static struct entry* read_entry(struct userdata *u, const char *name) {
datum key, data;
struct entry *e;
pa_assert(u);
pa_assert(name);
- key.dptr = name;
+ key.dptr = (char*) name;
key.dsize = (int) strlen(name);
data = gdbm_fetch(u->gdbm_file, key);
if (pa_cvolume_equal(pa_cvolume_remap(&old->volume, &old->channel_map, &entry.channel_map), &entry.volume) &&
!old->muted == !entry.muted &&
- strcmp(old->device, entry.device) == 0) {
+ strncmp(old->device, entry.device, sizeof(entry.device)) == 0) {
pa_xfree(old);
pa_xfree(name);
pa_sink *s;
if (u->restore_device &&
- (s = pa_namereg_get(c, e->device, PA_NAMEREG_SINK, TRUE))) {
+ (s = pa_namereg_get(c, e->device, PA_NAMEREG_SINK))) {
if (!new_data->sink) {
pa_log_info("Restoring device for stream %s.", name);
if (u->restore_volume) {
- if (!new_data->volume_is_set) {
+ if (!new_data->virtual_volume_is_set) {
pa_log_info("Restoring volume for sink input %s.", name);
- pa_sink_input_new_data_set_volume(new_data, pa_cvolume_remap(&e->volume, &e->channel_map, &new_data->channel_map));
+ pa_sink_input_new_data_set_virtual_volume(new_data, pa_cvolume_remap(&e->volume, &e->channel_map, &new_data->channel_map));
} else
pa_log_debug("Not restoring volume for sink input %s, because already set.", name);
}
if (u->restore_device &&
!new_data->direct_on_input &&
- (s = pa_namereg_get(c, e->device, PA_NAMEREG_SOURCE, TRUE))) {
+ (s = pa_namereg_get(c, e->device, PA_NAMEREG_SOURCE))) {
if (!new_data->source) {
pa_log_info("Restoring device for stream %s.", name);
new_data->source = s;
} else
- pa_log_info("Not restroing device for stream %s, because already set", name);
+ pa_log_info("Not restoring device for stream %s, because already set", name);
}
pa_xfree(e);
}
if (u->restore_device &&
- (s = pa_namereg_get(u->core, e->device, PA_NAMEREG_SOURCE, TRUE))) {
+ (s = pa_namereg_get(u->core, e->device, PA_NAMEREG_SOURCE))) {
pa_log_info("Restoring device for stream %s.", name);
pa_sink_input_move_to(si, s);
}
if (u->restore_device &&
- (s = pa_namereg_get(u->core, e->device, PA_NAMEREG_SOURCE, TRUE))) {
+ (s = pa_namereg_get(u->core, e->device, PA_NAMEREG_SOURCE))) {
pa_log_info("Restoring device for stream %s.", name);
pa_source_output_move_to(so, s);
if (!fname)
goto fail;
- if (!(u->gdbm_file = gdbm_open(fname, 0, GDBM_WRCREAT, 0600, NULL))) {
+ if (!(u->gdbm_file = gdbm_open(fname, 0, GDBM_WRCREAT|GDBM_NOLOCK, 0600, NULL))) {
pa_log("Failed to open volume database '%s': %s", fname, gdbm_strerror(gdbm_errno));
pa_xfree(fname);
goto fail;