[pulseaudio-commits] src/modules src/pulsecore
Tanu Kaskinen
tanuk at kemper.freedesktop.org
Fri Mar 14 07:19:13 PDT 2014
src/modules/alsa/alsa-sink.c | 2 +-
src/modules/alsa/alsa-source.c | 2 +-
src/modules/alsa/alsa-util.c | 4 ++--
src/modules/alsa/alsa-util.h | 2 +-
src/modules/alsa/module-alsa-card.c | 2 +-
src/pulsecore/card.c | 2 +-
src/pulsecore/sink.c | 15 ++++++++++-----
src/pulsecore/sink.h | 2 +-
src/pulsecore/source.c | 2 +-
9 files changed, 19 insertions(+), 14 deletions(-)
New commits:
commit fe6e41d7d27790338eb57073e42bfa8776112dd0
Author: Pete Beardmore <pete.beardmore at msn.com>
Date: Thu Mar 13 10:14:40 2014 +0000
alsa: Use card description in default sink/source prefix when available
When given an explicit device.description in card_properties, prefer
this information over other default prefixes (e.g. 'Built-in Audio')
when constructing sink/source descriptions.
For example, if I manually configure the card description to be
"FooBar", I then expect that the sinks and created by the card also
have "FooBar" in their description instead of generic "Built-in
Audio".
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index ccf1137..400f972 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -2278,7 +2278,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
pa_proplist_sets(data.proplist, key, pa_proplist_gets(mapping->proplist, key));
}
- pa_alsa_init_description(data.proplist);
+ pa_alsa_init_description(data.proplist, card);
if (u->control_device)
pa_alsa_init_proplist_ctl(data.proplist, u->control_device);
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 2e93e0f..425f4f0 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1984,7 +1984,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
pa_proplist_sets(data.proplist, key, pa_proplist_gets(mapping->proplist, key));
}
- pa_alsa_init_description(data.proplist);
+ pa_alsa_init_description(data.proplist, card);
if (u->control_device)
pa_alsa_init_proplist_ctl(data.proplist, u->control_device);
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index 73b1332..dca1f2e 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -868,11 +868,11 @@ void pa_alsa_refcnt_dec(void) {
}
}
-bool pa_alsa_init_description(pa_proplist *p) {
+bool pa_alsa_init_description(pa_proplist *p, pa_card *card) {
const char *d, *k;
pa_assert(p);
- if (pa_device_init_description(p))
+ if (pa_device_init_description(p, card))
return true;
if (!(d = pa_proplist_gets(p, "alsa.card_name")))
diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h
index 0e3ae69..bb2ad4e 100644
--- a/src/modules/alsa/alsa-util.h
+++ b/src/modules/alsa/alsa-util.h
@@ -118,7 +118,7 @@ void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *
void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card);
void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm);
void pa_alsa_init_proplist_ctl(pa_proplist *p, const char *name);
-bool pa_alsa_init_description(pa_proplist *p);
+bool pa_alsa_init_description(pa_proplist *p, pa_card *card);
int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents);
diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index cf54c0f..63ff6e6 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -704,7 +704,7 @@ int pa__init(pa_module *m) {
pa_alsa_init_proplist_card(m->core, data.proplist, u->alsa_card_index);
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, u->device_id);
- pa_alsa_init_description(data.proplist);
+ pa_alsa_init_description(data.proplist, NULL);
set_card_name(&data, u->modargs, u->device_id);
/* We need to give pa_modargs_get_value_boolean() a pointer to a local
diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
index 9a29aeb..eca1e60 100644
--- a/src/pulsecore/card.c
+++ b/src/pulsecore/card.c
@@ -201,7 +201,7 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
c->userdata = NULL;
c->set_profile = NULL;
- pa_device_init_description(c->proplist);
+ pa_device_init_description(c->proplist, c);
pa_device_init_icon(c->proplist, true);
pa_device_init_intended_roles(c->proplist);
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 47ee0aa..08143e9 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -231,7 +231,7 @@ pa_sink* pa_sink_new(
if (data->card)
pa_proplist_update(data->proplist, PA_UPDATE_MERGE, data->card->proplist);
- pa_device_init_description(data->proplist);
+ pa_device_init_description(data->proplist, data->card);
pa_device_init_icon(data->proplist, true);
pa_device_init_intended_roles(data->proplist);
@@ -3441,16 +3441,21 @@ bool pa_device_init_icon(pa_proplist *p, bool is_sink) {
return true;
}
-bool pa_device_init_description(pa_proplist *p) {
+bool pa_device_init_description(pa_proplist *p, pa_card *card) {
const char *s, *d = NULL, *k;
pa_assert(p);
if (pa_proplist_contains(p, PA_PROP_DEVICE_DESCRIPTION))
return true;
- if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_FORM_FACTOR)))
- if (pa_streq(s, "internal"))
- d = _("Built-in Audio");
+ if (card)
+ if ((s = pa_proplist_gets(card->proplist, PA_PROP_DEVICE_DESCRIPTION)))
+ d = s;
+
+ if (!d)
+ if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_FORM_FACTOR)))
+ if (pa_streq(s, "internal"))
+ d = _("Built-in Audio");
if (!d)
if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_CLASS)))
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index c7cb5f8..87b464e 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.h
@@ -399,7 +399,7 @@ void pa_sink_mute_changed(pa_sink *s, bool new_muted);
void pa_sink_update_flags(pa_sink *s, pa_sink_flags_t mask, pa_sink_flags_t value);
-bool pa_device_init_description(pa_proplist *p);
+bool pa_device_init_description(pa_proplist *p, pa_card *card);
bool pa_device_init_icon(pa_proplist *p, bool is_sink);
bool pa_device_init_intended_roles(pa_proplist *p);
unsigned pa_device_init_priority(pa_proplist *p);
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 853bb6c..2a600e2 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -218,7 +218,7 @@ pa_source* pa_source_new(
if (data->card)
pa_proplist_update(data->proplist, PA_UPDATE_MERGE, data->card->proplist);
- pa_device_init_description(data->proplist);
+ pa_device_init_description(data->proplist, data->card);
pa_device_init_icon(data->proplist, false);
pa_device_init_intended_roles(data->proplist);
More information about the pulseaudio-commits
mailing list