mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
sink, source: Add pa_sink/source_get_description()
This commit is contained in:
parent
8d00e420f7
commit
85d0b0bd51
22 changed files with 96 additions and 123 deletions
|
|
@ -197,14 +197,12 @@ static void reserve_done(struct userdata *u) {
|
|||
}
|
||||
|
||||
static void reserve_update(struct userdata *u) {
|
||||
const char *description;
|
||||
pa_assert(u);
|
||||
|
||||
if (!u->sink || !u->reserve)
|
||||
return;
|
||||
|
||||
if ((description = pa_proplist_gets(u->sink->proplist, PA_PROP_DEVICE_DESCRIPTION)))
|
||||
pa_reserve_wrapper_set_application_device_name(u->reserve, description);
|
||||
pa_reserve_wrapper_set_application_device_name(u->reserve, pa_sink_get_description(u->sink));
|
||||
}
|
||||
|
||||
static int reserve_init(struct userdata *u, const char *dname) {
|
||||
|
|
|
|||
|
|
@ -172,14 +172,12 @@ static void reserve_done(struct userdata *u) {
|
|||
}
|
||||
|
||||
static void reserve_update(struct userdata *u) {
|
||||
const char *description;
|
||||
pa_assert(u);
|
||||
|
||||
if (!u->source || !u->reserve)
|
||||
return;
|
||||
|
||||
if ((description = pa_proplist_gets(u->source->proplist, PA_PROP_DEVICE_DESCRIPTION)))
|
||||
pa_reserve_wrapper_set_application_device_name(u->reserve, description);
|
||||
pa_reserve_wrapper_set_application_device_name(u->reserve, pa_source_get_description(u->source));
|
||||
}
|
||||
|
||||
static int reserve_init(struct userdata *u, const char *dname) {
|
||||
|
|
|
|||
|
|
@ -1462,14 +1462,11 @@ 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 *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, "%s (echo cancelled with %s)", z ? z : dest->name,
|
||||
y ? y : u->sink_input->sink->name);
|
||||
pa_proplist_setf(pl, PA_PROP_DEVICE_DESCRIPTION, "%s (echo cancelled with %s)",
|
||||
pa_source_get_description(dest), pa_sink_get_description(u->sink_input->sink));
|
||||
|
||||
pa_source_update_proplist(u->source, PA_UPDATE_REPLACE, pl);
|
||||
pa_proplist_free(pl);
|
||||
|
|
@ -1490,14 +1487,11 @@ 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 *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, "%s (echo cancelled with %s)", z ? z : dest->name,
|
||||
y ? y : u->source_output->source->name);
|
||||
pa_proplist_setf(pl, PA_PROP_DEVICE_DESCRIPTION, "%s (echo cancelled with %s)", pa_sink_get_description(dest),
|
||||
pa_source_get_description(u->source_output->source));
|
||||
|
||||
pa_sink_update_proplist(u->sink, PA_UPDATE_REPLACE, pl);
|
||||
pa_proplist_free(pl);
|
||||
|
|
@ -1789,14 +1783,9 @@ int pa__init(pa_module*m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if ((u->source_auto_desc = !pa_proplist_contains(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION))) {
|
||||
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);
|
||||
if ((u->source_auto_desc = !pa_proplist_contains(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION)))
|
||||
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);
|
||||
}
|
||||
pa_source_get_description(source_master), pa_sink_get_description(sink_master));
|
||||
|
||||
u->source = pa_source_new(m->core, &source_data, (source_master->flags & (PA_SOURCE_LATENCY | PA_SOURCE_DYNAMIC_LATENCY))
|
||||
| (u->use_volume_sharing ? PA_SOURCE_SHARE_VOLUME_WITH_MASTER : 0));
|
||||
|
|
@ -1840,14 +1829,9 @@ int pa__init(pa_module*m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if ((u->sink_auto_desc = !pa_proplist_contains(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION))) {
|
||||
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);
|
||||
if ((u->sink_auto_desc = !pa_proplist_contains(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION)))
|
||||
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);
|
||||
}
|
||||
pa_sink_get_description(sink_master), pa_source_get_description(source_master));
|
||||
|
||||
u->sink = pa_sink_new(m->core, &sink_data, (sink_master->flags & (PA_SINK_LATENCY | PA_SINK_DYNAMIC_LATENCY))
|
||||
| (u->use_volume_sharing ? PA_SINK_SHARE_VOLUME_WITH_MASTER : 0));
|
||||
|
|
|
|||
|
|
@ -297,13 +297,10 @@ static struct service *get_service(struct userdata *u, pa_object *device) {
|
|||
s->userdata = u;
|
||||
s->device = device;
|
||||
|
||||
if (pa_sink_isinstance(device)) {
|
||||
if (!(n = pa_proplist_gets(PA_SINK(device)->proplist, PA_PROP_DEVICE_DESCRIPTION)))
|
||||
n = PA_SINK(device)->name;
|
||||
} else {
|
||||
if (!(n = pa_proplist_gets(PA_SOURCE(device)->proplist, PA_PROP_DEVICE_DESCRIPTION)))
|
||||
n = PA_SOURCE(device)->name;
|
||||
}
|
||||
if (pa_sink_isinstance(device))
|
||||
n = pa_sink_get_description(PA_SINK(device));
|
||||
else
|
||||
n = pa_source_get_description(PA_SOURCE(device));
|
||||
|
||||
hn = pa_get_host_name_malloc();
|
||||
un = pa_get_user_name_malloc();
|
||||
|
|
|
|||
|
|
@ -833,10 +833,10 @@ static void update_description(struct userdata *u) {
|
|||
char *e;
|
||||
|
||||
if (first) {
|
||||
e = pa_sprintf_malloc("%s %s", t, pa_strnull(pa_proplist_gets(o->sink->proplist, PA_PROP_DEVICE_DESCRIPTION)));
|
||||
e = pa_sprintf_malloc("%s %s", t, pa_sink_get_description(o->sink));
|
||||
first = false;
|
||||
} else
|
||||
e = pa_sprintf_malloc("%s, %s", t, pa_strnull(pa_proplist_gets(o->sink->proplist, PA_PROP_DEVICE_DESCRIPTION)));
|
||||
e = pa_sprintf_malloc("%s, %s", t, pa_sink_get_description(o->sink));
|
||||
|
||||
pa_xfree(t);
|
||||
t = e;
|
||||
|
|
@ -857,7 +857,7 @@ static int output_create_sink_input(struct output *o) {
|
|||
pa_sink_input_new_data_init(&data);
|
||||
pa_sink_input_new_data_set_sink(&data, o->sink, false);
|
||||
data.driver = __FILE__;
|
||||
pa_proplist_setf(data.proplist, PA_PROP_MEDIA_NAME, "Simultaneous output on %s", pa_strnull(pa_proplist_gets(o->sink->proplist, PA_PROP_DEVICE_DESCRIPTION)));
|
||||
pa_proplist_setf(data.proplist, PA_PROP_MEDIA_NAME, "Simultaneous output on %s", pa_sink_get_description(o->sink));
|
||||
pa_proplist_sets(data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
pa_sink_input_new_data_set_sample_spec(&data, &o->userdata->sink->sample_spec);
|
||||
pa_sink_input_new_data_set_channel_map(&data, &o->userdata->sink->channel_map);
|
||||
|
|
|
|||
|
|
@ -367,13 +367,13 @@ static void dump_database_helper(struct userdata *u, uint32_t role_index, const
|
|||
if (sink_mode) {
|
||||
pa_sink *s;
|
||||
if (PA_INVALID_INDEX != u->preferred_sinks[role_index] && (s = pa_idxset_get_by_index(u->core->sinks, u->preferred_sinks[role_index])))
|
||||
pa_log_debug(" %s %s (%s)", human, pa_strnull(pa_proplist_gets(s->proplist, PA_PROP_DEVICE_DESCRIPTION)), s->name);
|
||||
pa_log_debug(" %s %s (%s)", human, pa_sink_get_description(s), s->name);
|
||||
else
|
||||
pa_log_debug(" %s No sink specified", human);
|
||||
} else {
|
||||
pa_source *s;
|
||||
if (PA_INVALID_INDEX != u->preferred_sources[role_index] && (s = pa_idxset_get_by_index(u->core->sources, u->preferred_sources[role_index])))
|
||||
pa_log_debug(" %s %s (%s)", human, pa_strnull(pa_proplist_gets(s->proplist, PA_PROP_DEVICE_DESCRIPTION)), s->name);
|
||||
pa_log_debug(" %s %s (%s)", human, pa_source_get_description(s), s->name);
|
||||
else
|
||||
pa_log_debug(" %s No source specified", human);
|
||||
}
|
||||
|
|
@ -819,8 +819,8 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
|
|||
|
||||
if (!entry->user_set_description) {
|
||||
pa_xfree(entry->description);
|
||||
entry->description = pa_xstrdup(pa_proplist_gets(sink->proplist, PA_PROP_DEVICE_DESCRIPTION));
|
||||
} else if (!pa_streq(entry->description, pa_proplist_gets(sink->proplist, PA_PROP_DEVICE_DESCRIPTION))) {
|
||||
entry->description = pa_xstrdup(pa_sink_get_description(sink));
|
||||
} else if (!pa_streq(entry->description, pa_sink_get_description(sink))) {
|
||||
/* Warning: If two modules fight over the description, this could cause an infinite loop.
|
||||
by changing the description here, we retrigger this subscription callback. The only thing stopping us from
|
||||
looping is the fact that the string comparison will fail on the second iteration. If another module tries to manage
|
||||
|
|
@ -849,8 +849,8 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
|
|||
|
||||
if (!entry->user_set_description) {
|
||||
pa_xfree(entry->description);
|
||||
entry->description = pa_xstrdup(pa_proplist_gets(source->proplist, PA_PROP_DEVICE_DESCRIPTION));
|
||||
} else if (!pa_streq(entry->description, pa_proplist_gets(source->proplist, PA_PROP_DEVICE_DESCRIPTION))) {
|
||||
entry->description = pa_xstrdup(pa_source_get_description(source));
|
||||
} else if (!pa_streq(entry->description, pa_source_get_description(source))) {
|
||||
/* Warning: If two modules fight over the description, this could cause an infinite loop.
|
||||
by changing the description here, we retrigger this subscription callback. The only thing stopping us from
|
||||
looping is the fact that the string comparison will fail on the second iteration. If another module tries to manage
|
||||
|
|
|
|||
|
|
@ -1084,7 +1084,6 @@ int pa__init(pa_module*m) {
|
|||
pa_sample_spec ss;
|
||||
pa_channel_map map;
|
||||
pa_modargs *ma;
|
||||
const char *z;
|
||||
pa_sink *master;
|
||||
pa_sink_input_new_data sink_input_data;
|
||||
pa_sink_new_data sink_data;
|
||||
|
|
@ -1176,8 +1175,7 @@ int pa__init(pa_module*m) {
|
|||
pa_sink_new_data_set_sample_spec(&sink_data, &ss);
|
||||
pa_sink_new_data_set_channel_map(&sink_data, &map);
|
||||
|
||||
z = pa_proplist_gets(master->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "FFT based equalizer on %s", z ? z : master->name);
|
||||
pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "FFT based equalizer on %s", pa_sink_get_description(master));
|
||||
|
||||
pa_proplist_sets(sink_data.proplist, PA_PROP_DEVICE_MASTER_DEVICE, master->name);
|
||||
pa_proplist_sets(sink_data.proplist, PA_PROP_DEVICE_CLASS, "filter");
|
||||
|
|
|
|||
|
|
@ -655,13 +655,11 @@ static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
|
|||
pa_sink_set_asyncmsgq(u->sink, NULL);
|
||||
|
||||
if (u->auto_desc && dest) {
|
||||
const char *z;
|
||||
pa_proplist *pl;
|
||||
|
||||
pl = pa_proplist_new();
|
||||
z = pa_proplist_gets(dest->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_setf(pl, PA_PROP_DEVICE_DESCRIPTION, "LADSPA Plugin %s on %s",
|
||||
pa_proplist_gets(u->sink->proplist, "device.ladspa.name"), z ? z : dest->name);
|
||||
pa_proplist_gets(u->sink->proplist, "device.ladspa.name"), pa_sink_get_description(dest));
|
||||
|
||||
pa_sink_update_proplist(u->sink, PA_UPDATE_REPLACE, pl);
|
||||
pa_proplist_free(pl);
|
||||
|
|
@ -1228,12 +1226,9 @@ int pa__init(pa_module*m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if ((u->auto_desc = !pa_proplist_contains(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION))) {
|
||||
const char *z;
|
||||
|
||||
z = pa_proplist_gets(master->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "LADSPA Plugin %s on %s", d->Name, z ? z : master->name);
|
||||
}
|
||||
if ((u->auto_desc = !pa_proplist_contains(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION)))
|
||||
pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION,
|
||||
"LADSPA Plugin %s on %s", d->Name, pa_sink_get_description(master));
|
||||
|
||||
u->sink = pa_sink_new(m->core, &sink_data,
|
||||
(master->flags & (PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY)) | PA_SINK_SHARE_VOLUME_WITH_MASTER);
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ static void source_output_moving_cb(pa_source_output *o, pa_source *dest) {
|
|||
pa_assert_se(u = o->userdata);
|
||||
|
||||
p = pa_proplist_new();
|
||||
pa_proplist_setf(p, PA_PROP_MEDIA_NAME, "Loopback of %s", pa_strnull(pa_proplist_gets(dest->proplist, PA_PROP_DEVICE_DESCRIPTION)));
|
||||
pa_proplist_setf(p, PA_PROP_MEDIA_NAME, "Loopback of %s", pa_source_get_description(dest));
|
||||
|
||||
if ((n = pa_proplist_gets(dest->proplist, PA_PROP_DEVICE_ICON_NAME)))
|
||||
pa_proplist_sets(p, PA_PROP_MEDIA_ICON_NAME, n);
|
||||
|
|
@ -684,7 +684,7 @@ static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
|
|||
pa_assert_se(u = i->userdata);
|
||||
|
||||
p = pa_proplist_new();
|
||||
pa_proplist_setf(p, PA_PROP_MEDIA_NAME, "Loopback to %s", pa_strnull(pa_proplist_gets(dest->proplist, PA_PROP_DEVICE_DESCRIPTION)));
|
||||
pa_proplist_setf(p, PA_PROP_MEDIA_NAME, "Loopback to %s", pa_sink_get_description(dest));
|
||||
|
||||
if ((n = pa_proplist_gets(dest->proplist, PA_PROP_DEVICE_ICON_NAME)))
|
||||
pa_proplist_sets(p, PA_PROP_MEDIA_ICON_NAME, n);
|
||||
|
|
@ -968,7 +968,7 @@ int pa__init(pa_module *m) {
|
|||
|
||||
if (!pa_proplist_contains(u->source_output->proplist, PA_PROP_MEDIA_NAME))
|
||||
pa_proplist_setf(u->source_output->proplist, PA_PROP_MEDIA_NAME, "Loopback to %s",
|
||||
pa_strnull(pa_proplist_gets(u->sink_input->sink->proplist, PA_PROP_DEVICE_DESCRIPTION)));
|
||||
pa_sink_get_description(u->sink_input->sink));
|
||||
|
||||
if (!pa_proplist_contains(u->source_output->proplist, PA_PROP_MEDIA_ICON_NAME)
|
||||
&& (n = pa_proplist_gets(u->sink_input->sink->proplist, PA_PROP_DEVICE_ICON_NAME)))
|
||||
|
|
@ -976,7 +976,7 @@ int pa__init(pa_module *m) {
|
|||
|
||||
if (!pa_proplist_contains(u->sink_input->proplist, PA_PROP_MEDIA_NAME))
|
||||
pa_proplist_setf(u->sink_input->proplist, PA_PROP_MEDIA_NAME, "Loopback from %s",
|
||||
pa_strnull(pa_proplist_gets(u->source_output->source->proplist, PA_PROP_DEVICE_DESCRIPTION)));
|
||||
pa_source_get_description(u->source_output->source));
|
||||
|
||||
if (source && !pa_proplist_contains(u->sink_input->proplist, PA_PROP_MEDIA_ICON_NAME)
|
||||
&& (n = pa_proplist_gets(u->source_output->source->proplist, PA_PROP_DEVICE_ICON_NAME)))
|
||||
|
|
|
|||
|
|
@ -303,12 +303,10 @@ static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
|
|||
pa_sink_set_asyncmsgq(u->sink, NULL);
|
||||
|
||||
if (u->auto_desc && dest) {
|
||||
const char *k;
|
||||
pa_proplist *pl;
|
||||
|
||||
pl = pa_proplist_new();
|
||||
k = pa_proplist_gets(dest->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_setf(pl, PA_PROP_DEVICE_DESCRIPTION, "Remapped %s", k ? k : dest->name);
|
||||
pa_proplist_setf(pl, PA_PROP_DEVICE_DESCRIPTION, "Remapped %s", pa_sink_get_description(dest));
|
||||
|
||||
pa_sink_update_proplist(u->sink, PA_UPDATE_REPLACE, pl);
|
||||
pa_proplist_free(pl);
|
||||
|
|
@ -384,12 +382,8 @@ int pa__init(pa_module*m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if ((u->auto_desc = !pa_proplist_contains(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION))) {
|
||||
const char *k;
|
||||
|
||||
k = pa_proplist_gets(master->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Remapped %s", k ? k : master->name);
|
||||
}
|
||||
if ((u->auto_desc = !pa_proplist_contains(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION)))
|
||||
pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Remapped %s", pa_sink_get_description(master));
|
||||
|
||||
u->sink = pa_sink_new(m->core, &sink_data, master->flags & (PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY));
|
||||
pa_sink_new_data_done(&sink_data);
|
||||
|
|
|
|||
|
|
@ -248,12 +248,10 @@ static void source_output_moving_cb(pa_source_output *o, pa_source *dest) {
|
|||
pa_source_set_asyncmsgq(u->source, NULL);
|
||||
|
||||
if (u->auto_desc && dest) {
|
||||
const char *k;
|
||||
pa_proplist *pl;
|
||||
|
||||
pl = pa_proplist_new();
|
||||
k = pa_proplist_gets(dest->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_setf(pl, PA_PROP_DEVICE_DESCRIPTION, "Remapped %s", k ? k : dest->name);
|
||||
pa_proplist_setf(pl, PA_PROP_DEVICE_DESCRIPTION, "Remapped %s", pa_source_get_description(dest));
|
||||
|
||||
pa_source_update_proplist(u->source, PA_UPDATE_REPLACE, pl);
|
||||
pa_proplist_free(pl);
|
||||
|
|
@ -329,12 +327,8 @@ int pa__init(pa_module*m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if ((u->auto_desc = !pa_proplist_contains(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION))) {
|
||||
const char *k;
|
||||
|
||||
k = pa_proplist_gets(master->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_setf(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Remapped %s", k ? k : master->name);
|
||||
}
|
||||
if ((u->auto_desc = !pa_proplist_contains(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION)))
|
||||
pa_proplist_setf(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Remapped %s", pa_source_get_description(master));
|
||||
|
||||
u->source = pa_source_new(m->core, &source_data, master->flags & (PA_SOURCE_LATENCY|PA_SOURCE_DYNAMIC_LATENCY));
|
||||
pa_source_new_data_done(&source_data);
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ static void append_variant_item_display_name(DBusMessage *m, DBusMessageIter *it
|
|||
|
||||
pa_assert(sink || source);
|
||||
|
||||
display_name = pa_strna(pa_proplist_gets(sink ? sink->proplist : source->proplist, PA_PROP_DEVICE_DESCRIPTION));
|
||||
display_name = sink ? pa_sink_get_description(sink) : pa_source_get_description(source);
|
||||
append_variant_string(m, iter, display_name);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -431,13 +431,11 @@ static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
|
|||
pa_sink_set_asyncmsgq(u->sink, NULL);
|
||||
|
||||
if (u->auto_desc && dest) {
|
||||
const char *z;
|
||||
pa_proplist *pl;
|
||||
|
||||
pl = pa_proplist_new();
|
||||
z = pa_proplist_gets(dest->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_setf(pl, PA_PROP_DEVICE_DESCRIPTION, "Virtual Sink %s on %s",
|
||||
pa_proplist_gets(u->sink->proplist, "device.vsink.name"), z ? z : dest->name);
|
||||
pa_proplist_gets(u->sink->proplist, "device.vsink.name"), pa_sink_get_description(dest));
|
||||
|
||||
pa_sink_update_proplist(u->sink, PA_UPDATE_REPLACE, pl);
|
||||
pa_proplist_free(pl);
|
||||
|
|
@ -536,12 +534,9 @@ int pa__init(pa_module*m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if ((u->auto_desc = !pa_proplist_contains(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION))) {
|
||||
const char *z;
|
||||
|
||||
z = pa_proplist_gets(master->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Virtual Sink %s on %s", sink_data.name, z ? z : master->name);
|
||||
}
|
||||
if ((u->auto_desc = !pa_proplist_contains(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION)))
|
||||
pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION,
|
||||
"Virtual Sink %s on %s", sink_data.name, pa_sink_get_description(master));
|
||||
|
||||
u->sink = pa_sink_new(m->core, &sink_data, (master->flags & (PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY))
|
||||
| (use_volume_sharing ? PA_SINK_SHARE_VOLUME_WITH_MASTER : 0));
|
||||
|
|
@ -574,7 +569,8 @@ int pa__init(pa_module*m) {
|
|||
sink_input_data.module = m;
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, master, false);
|
||||
sink_input_data.origin_sink = u->sink;
|
||||
pa_proplist_setf(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Sink Stream from %s", pa_proplist_gets(u->sink->proplist, PA_PROP_DEVICE_DESCRIPTION));
|
||||
pa_proplist_setf(sink_input_data.proplist, PA_PROP_MEDIA_NAME,
|
||||
"Virtual Sink Stream from %s", pa_sink_get_description(u->sink));
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);
|
||||
pa_sink_input_new_data_set_channel_map(&sink_input_data, &map);
|
||||
|
|
|
|||
|
|
@ -452,13 +452,11 @@ static void source_output_moving_cb(pa_source_output *o, pa_source *dest) {
|
|||
pa_source_set_asyncmsgq(u->source, NULL);
|
||||
|
||||
if (u->auto_desc && dest) {
|
||||
const char *z;
|
||||
pa_proplist *pl;
|
||||
|
||||
pl = pa_proplist_new();
|
||||
z = pa_proplist_gets(dest->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_setf(pl, PA_PROP_DEVICE_DESCRIPTION, "Virtual Source %s on %s",
|
||||
pa_proplist_gets(u->source->proplist, "device.vsource.name"), z ? z : dest->name);
|
||||
pa_proplist_gets(u->source->proplist, "device.vsource.name"), pa_source_get_description(dest));
|
||||
|
||||
pa_source_update_proplist(u->source, PA_UPDATE_REPLACE, pl);
|
||||
pa_proplist_free(pl);
|
||||
|
|
@ -545,12 +543,9 @@ int pa__init(pa_module*m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if ((u->auto_desc = !pa_proplist_contains(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION))) {
|
||||
const char *z;
|
||||
|
||||
z = pa_proplist_gets(master->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_setf(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Virtual Source %s on %s", source_data.name, z ? z : master->name);
|
||||
}
|
||||
if ((u->auto_desc = !pa_proplist_contains(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION)))
|
||||
pa_proplist_setf(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION,
|
||||
"Virtual Source %s on %s", source_data.name, pa_source_get_description(master));
|
||||
|
||||
u->source = pa_source_new(m->core, &source_data, (master->flags & (PA_SOURCE_LATENCY|PA_SOURCE_DYNAMIC_LATENCY))
|
||||
| (use_volume_sharing ? PA_SOURCE_SHARE_VOLUME_WITH_MASTER : 0));
|
||||
|
|
@ -584,7 +579,8 @@ int pa__init(pa_module*m) {
|
|||
pa_source_output_new_data_set_source(&source_output_data, master, false);
|
||||
source_output_data.destination_source = u->source;
|
||||
|
||||
pa_proplist_setf(source_output_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Source Stream of %s", pa_proplist_gets(u->source->proplist, PA_PROP_DEVICE_DESCRIPTION));
|
||||
pa_proplist_setf(source_output_data.proplist, PA_PROP_MEDIA_NAME,
|
||||
"Virtual Source Stream of %s", pa_source_get_description(u->source));
|
||||
pa_proplist_sets(source_output_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
pa_source_output_new_data_set_sample_spec(&source_output_data, &ss);
|
||||
pa_source_output_new_data_set_channel_map(&source_output_data, &map);
|
||||
|
|
@ -620,12 +616,9 @@ int pa__init(pa_module*m) {
|
|||
pa_proplist_sets(sink_data.proplist, PA_PROP_DEVICE_CLASS, "uplink sink");
|
||||
pa_proplist_sets(sink_data.proplist, "device.uplink_sink.name", sink_data.name);
|
||||
|
||||
if ((u->auto_desc = !pa_proplist_contains(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION))) {
|
||||
const char *z;
|
||||
|
||||
z = pa_proplist_gets(master->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Uplink Sink %s on %s", sink_data.name, z ? z : master->name);
|
||||
}
|
||||
if ((u->auto_desc = !pa_proplist_contains(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION)))
|
||||
pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION,
|
||||
"Uplink Sink %s on %s", sink_data.name, pa_source_get_description(master));
|
||||
|
||||
u->sink_memblockq = pa_memblockq_new("module-virtual-source sink_memblockq", 0, MEMBLOCKQ_MAXLENGTH, 0, &ss, 1, 1, 0, NULL);
|
||||
if (!u->sink_memblockq) {
|
||||
|
|
|
|||
|
|
@ -443,13 +443,11 @@ static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
|
|||
pa_sink_set_asyncmsgq(u->sink, NULL);
|
||||
|
||||
if (u->auto_desc && dest) {
|
||||
const char *z;
|
||||
pa_proplist *pl;
|
||||
|
||||
pl = pa_proplist_new();
|
||||
z = pa_proplist_gets(dest->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_setf(pl, PA_PROP_DEVICE_DESCRIPTION, "Virtual Surround Sink %s on %s",
|
||||
pa_proplist_gets(u->sink->proplist, "device.vsurroundsink.name"), z ? z : dest->name);
|
||||
pa_proplist_gets(u->sink->proplist, "device.vsurroundsink.name"), pa_sink_get_description(dest));
|
||||
|
||||
pa_sink_update_proplist(u->sink, PA_UPDATE_REPLACE, pl);
|
||||
pa_proplist_free(pl);
|
||||
|
|
@ -638,12 +636,9 @@ int pa__init(pa_module*m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if ((u->auto_desc = !pa_proplist_contains(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION))) {
|
||||
const char *z;
|
||||
|
||||
z = pa_proplist_gets(master->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Virtual Surround Sink %s on %s", sink_data.name, z ? z : master->name);
|
||||
}
|
||||
if ((u->auto_desc = !pa_proplist_contains(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION)))
|
||||
pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION,
|
||||
"Virtual Surround Sink %s on %s", sink_data.name, pa_sink_get_description(master));
|
||||
|
||||
u->sink = pa_sink_new(m->core, &sink_data, (master->flags & (PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY))
|
||||
| (use_volume_sharing ? PA_SINK_SHARE_VOLUME_WITH_MASTER : 0));
|
||||
|
|
@ -676,7 +671,8 @@ int pa__init(pa_module*m) {
|
|||
sink_input_data.module = m;
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, master, false);
|
||||
sink_input_data.origin_sink = u->sink;
|
||||
pa_proplist_setf(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Surround Sink Stream from %s", pa_proplist_gets(u->sink->proplist, PA_PROP_DEVICE_DESCRIPTION));
|
||||
pa_proplist_setf(sink_input_data.proplist, PA_PROP_MEDIA_NAME,
|
||||
"Virtual Surround Sink Stream from %s", pa_sink_get_description(u->sink));
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
pa_sink_input_new_data_set_sample_spec(&sink_input_data, &sink_input_ss);
|
||||
pa_sink_input_new_data_set_channel_map(&sink_input_data, &sink_input_map);
|
||||
|
|
|
|||
|
|
@ -183,13 +183,13 @@ char *pa_card_list_to_string(pa_core *c) {
|
|||
if (!pa_idxset_isempty(card->sinks)) {
|
||||
pa_strbuf_puts(s, "\tsinks:\n");
|
||||
PA_IDXSET_FOREACH(sink, card->sinks, sidx)
|
||||
pa_strbuf_printf(s, "\t\t%s/#%u: %s\n", sink->name, sink->index, pa_strna(pa_proplist_gets(sink->proplist, PA_PROP_DEVICE_DESCRIPTION)));
|
||||
pa_strbuf_printf(s, "\t\t%s/#%u: %s\n", sink->name, sink->index, pa_sink_get_description(sink));
|
||||
}
|
||||
|
||||
if (!pa_idxset_isempty(card->sources)) {
|
||||
pa_strbuf_puts(s, "\tsources:\n");
|
||||
PA_IDXSET_FOREACH(source, card->sources, sidx)
|
||||
pa_strbuf_printf(s, "\t\t%s/#%u: %s\n", source->name, source->index, pa_strna(pa_proplist_gets(source->proplist, PA_PROP_DEVICE_DESCRIPTION)));
|
||||
pa_strbuf_printf(s, "\t\t%s/#%u: %s\n", source->name, source->index, pa_source_get_description(source));
|
||||
}
|
||||
|
||||
append_port_list(s, card->ports);
|
||||
|
|
|
|||
|
|
@ -475,7 +475,7 @@ static void handle_listen(struct connection *c) {
|
|||
PA_IDXSET_FOREACH(sink, c->protocol->core->sinks, idx) {
|
||||
char *t, *m;
|
||||
|
||||
t = escape_html(pa_strna(pa_proplist_gets(sink->proplist, PA_PROP_DEVICE_DESCRIPTION)));
|
||||
t = escape_html(pa_sink_get_description(sink));
|
||||
m = pa_sample_spec_to_mime_type_mimefy(&sink->sample_spec, &sink->channel_map);
|
||||
|
||||
pa_ioline_printf(c->line,
|
||||
|
|
@ -497,7 +497,7 @@ static void handle_listen(struct connection *c) {
|
|||
if (source->monitor_of)
|
||||
continue;
|
||||
|
||||
t = escape_html(pa_strna(pa_proplist_gets(source->proplist, PA_PROP_DEVICE_DESCRIPTION)));
|
||||
t = escape_html(pa_source_get_description(source));
|
||||
m = pa_sample_spec_to_mime_type_mimefy(&source->sample_spec, &source->channel_map);
|
||||
|
||||
pa_ioline_printf(c->line,
|
||||
|
|
|
|||
|
|
@ -3125,7 +3125,7 @@ static void sink_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_sin
|
|||
t,
|
||||
PA_TAG_U32, sink->index,
|
||||
PA_TAG_STRING, sink->name,
|
||||
PA_TAG_STRING, pa_strnull(pa_proplist_gets(sink->proplist, PA_PROP_DEVICE_DESCRIPTION)),
|
||||
PA_TAG_STRING, pa_sink_get_description(sink),
|
||||
PA_TAG_SAMPLE_SPEC, &fixed_ss,
|
||||
PA_TAG_CHANNEL_MAP, &sink->channel_map,
|
||||
PA_TAG_U32, sink->module ? sink->module->index : PA_INVALID_INDEX,
|
||||
|
|
@ -3195,7 +3195,7 @@ static void source_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_s
|
|||
t,
|
||||
PA_TAG_U32, source->index,
|
||||
PA_TAG_STRING, source->name,
|
||||
PA_TAG_STRING, pa_strnull(pa_proplist_gets(source->proplist, PA_PROP_DEVICE_DESCRIPTION)),
|
||||
PA_TAG_STRING, pa_source_get_description(source),
|
||||
PA_TAG_SAMPLE_SPEC, &fixed_ss,
|
||||
PA_TAG_CHANNEL_MAP, &source->channel_map,
|
||||
PA_TAG_U32, source->module ? source->module->index : PA_INVALID_INDEX,
|
||||
|
|
|
|||
|
|
@ -1377,6 +1377,20 @@ void pa_sink_render_full(pa_sink *s, size_t length, pa_memchunk *result) {
|
|||
pa_sink_unref(s);
|
||||
}
|
||||
|
||||
/* Called from the main thread. */
|
||||
const char *pa_sink_get_description(pa_sink *s) {
|
||||
const char *description;
|
||||
|
||||
pa_assert(s);
|
||||
|
||||
description = pa_proplist_gets(s->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
|
||||
if (!description || !*description)
|
||||
description = s->name;
|
||||
|
||||
return description;
|
||||
}
|
||||
|
||||
/* Called from main thread */
|
||||
int pa_sink_update_rate(pa_sink *s, uint32_t rate, bool passthrough) {
|
||||
int ret = -1;
|
||||
|
|
|
|||
|
|
@ -411,6 +411,7 @@ unsigned pa_device_init_priority(pa_proplist *p);
|
|||
|
||||
/**** May be called by everyone, from main context */
|
||||
|
||||
const char *pa_sink_get_description(pa_sink *s);
|
||||
int pa_sink_update_rate(pa_sink *s, uint32_t rate, bool passthrough);
|
||||
void pa_sink_set_latency_offset(pa_sink *s, int64_t offset);
|
||||
|
||||
|
|
|
|||
|
|
@ -2596,6 +2596,20 @@ void pa_source_set_fixed_latency_within_thread(pa_source *s, pa_usec_t latency)
|
|||
pa_source_invalidate_requested_latency(s, false);
|
||||
}
|
||||
|
||||
/* Called from the main thread. */
|
||||
const char *pa_source_get_description(pa_source *s) {
|
||||
const char *description;
|
||||
|
||||
pa_assert(s);
|
||||
|
||||
description = pa_proplist_gets(s->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
|
||||
if (!description || !*description)
|
||||
description = s->name;
|
||||
|
||||
return description;
|
||||
}
|
||||
|
||||
/* Called from main thread */
|
||||
void pa_source_set_latency_offset(pa_source *s, int64_t offset) {
|
||||
pa_source_assert_ref(s);
|
||||
|
|
|
|||
|
|
@ -344,6 +344,7 @@ void pa_source_update_flags(pa_source *s, pa_source_flags_t mask, pa_source_flag
|
|||
|
||||
/*** May be called by everyone, from main context */
|
||||
|
||||
const char *pa_source_get_description(pa_source *s);
|
||||
void pa_source_set_latency_offset(pa_source *s, int64_t offset);
|
||||
|
||||
/* The returned value is supposed to be in the time domain of the sound card! */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue