[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.13-259-g43762ed

Lennart Poettering gitmailer-noreply at 0pointer.de
Thu Jan 15 10:20:58 PST 2009


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  615e05584e3fbc154cab3c6c7f8148b83b298739 (commit)

- Log -----------------------------------------------------------------
43762ed... flat-volume: use pa_sink_get_volume(s, TRUE) to work with slaved sink
a861ffa... Merge commit 'e0f8ffe41f99789fafac575e944acf02e940bbf7'
d2757c9... redirect folks to the ALSA developers not me when their sound drivers are broken
e0f8ffe... match: add "key" argument to match different properties
e97ed21... match: can now change properties also
6ec0162... sink: add a virtual_volume to sink
-----------------------------------------------------------------------

Summary of changes:
 src/modules/module-alsa-sink.c   |    6 ++-
 src/modules/module-alsa-source.c |    6 ++-
 src/modules/module-flat-volume.c |   10 +++---
 src/modules/module-match.c       |   66 ++++++++++++++++++++++++++++++-------
 src/pulsecore/sink.c             |   22 ++++++++----
 src/pulsecore/sink.h             |    2 +
 6 files changed, 82 insertions(+), 30 deletions(-)

-----------------------------------------------------------------------

commit 6ec01626869763720c88b7eea605c14dc7c6ab91
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Mon Nov 10 16:59:09 2008 +0200

    sink: add a virtual_volume to sink

diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 48c8f79..809e827 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -192,6 +192,8 @@ pa_sink* pa_sink_new(
 
     s->volume = data->volume;
     s->base_volume = PA_VOLUME_NORM;
+    s->virtual_volume = s->volume;
+
     s->muted = data->muted;
     s->refresh_volume = s->refresh_muted = FALSE;
 
@@ -856,24 +858,26 @@ void pa_sink_set_volume(pa_sink *s, const pa_cvolume *volume) {
     pa_assert(pa_cvolume_compatible(volume, &s->sample_spec));
 
     data.sink = s;
-    data.volume = *volume;
+    data.virtual_volume = data.volume = *volume;
 
-    changed = !pa_cvolume_equal(&data.volume, &s->volume);
+    changed = !pa_cvolume_equal(&data.virtual_volume, &s->virtual_volume) ||
+        !pa_cvolume_equal(&data.volume, &s->volume);
 
     if (changed) {
         if (pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SINK_SET_VOLUME], &data) < 0)
             return;
 
-        changed = !pa_cvolume_equal(&data.volume, &s->volume);
+        changed = !pa_cvolume_equal(&data.virtual_volume, &s->virtual_volume); /* from client-side view */
     }
 
     s->volume = data.volume;
+    s->virtual_volume = data.virtual_volume;
 
     if (s->set_volume && s->set_volume(s) < 0)
         s->set_volume = NULL;
 
     if (!s->set_volume)
-        pa_sink_set_soft_volume(s, volume);
+        pa_sink_set_soft_volume(s, &s->volume);
 
     if (changed)
         pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
@@ -896,19 +900,21 @@ const pa_cvolume *pa_sink_get_volume(pa_sink *s, pa_bool_t force_refresh) {
     pa_assert(PA_SINK_IS_LINKED(s->state));
 
     if (s->refresh_volume || force_refresh) {
-        struct pa_cvolume old_volume = s->volume;
+        struct pa_cvolume old_volume = s->virtual_volume;
 
         if (s->get_volume && s->get_volume(s) < 0)
             s->get_volume = NULL;
 
-        if (!s->get_volume)
+        if (!s->get_volume) {
             pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_VOLUME, &s->volume, 0, NULL);
+            s->virtual_volume = s->volume;
+        }
 
-        if (!pa_cvolume_equal(&old_volume, &s->volume))
+        if (!pa_cvolume_equal(&old_volume, &s->virtual_volume))
             pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
     }
 
-    return &s->volume;
+    return &s->virtual_volume;
 }
 
 /* Called from main thread */
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index 092e30f..fb5e1e8 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.h
@@ -79,6 +79,7 @@ struct pa_sink {
     pa_source *monitor_source;
 
     pa_cvolume volume;
+    pa_cvolume virtual_volume;
     pa_bool_t muted;
 
     pa_volume_t base_volume;  /* shall be constant */
@@ -211,6 +212,7 @@ void pa_sink_new_data_done(pa_sink_new_data *data);
 typedef struct pa_sink_set_volume_data {
   pa_sink *sink;
   pa_cvolume volume;
+  pa_cvolume virtual_volume;
 } pa_sink_set_volume_data;
 
 /* To be called exclusively by the sink driver, from main context */

commit e97ed21892402a09873b61a5cc200ce61c187488
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Mon Nov 17 21:09:42 2008 +0200

    match: can now change properties also

diff --git a/src/modules/module-match.c b/src/modules/module-match.c
index 769a6b5..5c36fe0 100644
--- a/src/modules/module-match.c
+++ b/src/modules/module-match.c
@@ -63,6 +63,7 @@ static const char* const valid_modargs[] = {
 struct rule {
     regex_t regex;
     pa_volume_t volume;
+    pa_proplist *proplist;
     struct rule *next;
 };
 
@@ -95,11 +96,12 @@ static int load_rules(struct userdata *u, const char *filename) {
 
     while (!feof(f)) {
         char *d, *v;
-        pa_volume_t volume;
+        pa_volume_t volume = PA_VOLUME_NORM;
         uint32_t k;
         regex_t regex;
         char ln[256];
         struct rule *rule;
+        pa_proplist *proplist = NULL;
 
         if (!fgets(ln, sizeof(ln), f))
             break;
@@ -121,14 +123,33 @@ static int load_rules(struct userdata *u, const char *filename) {
         }
 
         *d = 0;
-        if (pa_atou(v, &k) < 0) {
-            pa_log("[%s:%u] failed to parse volume", filename, n);
-            goto finish;
+        if (pa_atou(v, &k) >= 0) {
+            volume = (pa_volume_t) k;
+        } else if (*v == '"') {
+            char *e;
+
+            e = strchr(v+1, '"');
+            if (!e) {
+                pa_log(__FILE__ ": [%s:%u] failed to parse line - missing role closing quote", filename, n);
+                goto finish;
+            }
+
+            *e = '\0';
+            e = pa_sprintf_malloc("media.role=\"%s\"", v+1);
+            proplist = pa_proplist_from_string(e);
+            pa_xfree(e);
+        } else {
+            char *e;
+
+            e = v+strspn(v, WHITESPACE);
+            if (!*e) {
+                pa_log(__FILE__ ": [%s:%u] failed to parse line - missing end of property list", filename, n);
+                goto finish;
+            }
+            *e = '\0';
+            proplist = pa_proplist_from_string(v);
         }
 
-        volume = (pa_volume_t) k;
-
-
         if (regcomp(&regex, ln, REG_EXTENDED|REG_NOSUB) != 0) {
             pa_log("[%s:%u] invalid regular expression", filename, n);
             goto finish;
@@ -136,6 +157,7 @@ static int load_rules(struct userdata *u, const char *filename) {
 
         rule = pa_xnew(struct rule, 1);
         rule->regex = regex;
+        rule->proplist = proplist;
         rule->volume = volume;
         rule->next = NULL;
 
@@ -180,12 +202,19 @@ static void callback(pa_core *c, pa_subscription_event_type_t t, uint32_t idx, v
     if (!(n = pa_proplist_gets(si->proplist, PA_PROP_MEDIA_NAME)))
         return;
 
+    pa_log_debug("Matching with %s", n);
+
     for (r = u->rules; r; r = r->next) {
         if (!regexec(&r->regex, n, 0, NULL, 0)) {
-            pa_cvolume cv;
-            pa_log_debug("changing volume of sink input '%s' to 0x%03x", n, r->volume);
-            pa_cvolume_set(&cv, si->sample_spec.channels, r->volume);
-            pa_sink_input_set_volume(si, &cv);
+            if (r->proplist) {
+                pa_log_debug("updating proplist of sink input '%s'", n);
+                pa_proplist_update(si->proplist, PA_UPDATE_MERGE, r->proplist);
+            } else {
+                pa_cvolume cv;
+                pa_log_debug("changing volume of sink input '%s' to 0x%03x", n, r->volume);
+                pa_cvolume_set(&cv, si->sample_spec.channels, r->volume);
+                pa_sink_input_set_volume(si, &cv);
+            }
         }
     }
 }
@@ -238,6 +267,8 @@ void pa__done(pa_module*m) {
         n = r->next;
 
         regfree(&r->regex);
+        if (r->proplist)
+            pa_proplist_free(r->proplist);
         pa_xfree(r);
     }
 

commit e0f8ffe41f99789fafac575e944acf02e940bbf7
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Mon Nov 17 21:37:25 2008 +0200

    match: add "key" argument to match different properties

diff --git a/src/modules/module-match.c b/src/modules/module-match.c
index 5c36fe0..8c825c4 100644
--- a/src/modules/module-match.c
+++ b/src/modules/module-match.c
@@ -48,7 +48,8 @@ PA_MODULE_AUTHOR("Lennart Poettering");
 PA_MODULE_DESCRIPTION("Playback stream expression matching module");
 PA_MODULE_VERSION(PACKAGE_VERSION);
 PA_MODULE_LOAD_ONCE(TRUE);
-PA_MODULE_USAGE("table=<filename>");
+PA_MODULE_USAGE("table=<filename> "
+                "key=<property_key>");
 
 #define WHITESPACE "\n\r \t"
 
@@ -57,6 +58,7 @@ PA_MODULE_USAGE("table=<filename>");
 
 static const char* const valid_modargs[] = {
     "table",
+    "key",
     NULL,
 };
 
@@ -69,6 +71,7 @@ struct rule {
 
 struct userdata {
     struct rule *rules;
+    char *property_key;
     pa_subscription *subscription;
 };
 
@@ -199,7 +202,7 @@ static void callback(pa_core *c, pa_subscription_event_type_t t, uint32_t idx, v
     if (!(si = pa_idxset_get_by_index(c->sink_inputs, idx)))
         return;
 
-    if (!(n = pa_proplist_gets(si->proplist, PA_PROP_MEDIA_NAME)))
+    if (!(n = pa_proplist_gets(si->proplist, u->property_key)))
         return;
 
     pa_log_debug("Matching with %s", n);
@@ -230,11 +233,14 @@ int pa__init(pa_module*m) {
         goto fail;
     }
 
+
     u = pa_xnew(struct userdata, 1);
     u->rules = NULL;
     u->subscription = NULL;
     m->userdata = u;
 
+    u->property_key = pa_xstrdup(pa_modargs_get_value(ma, "key", PA_PROP_MEDIA_NAME));
+
     if (load_rules(u, pa_modargs_get_value(ma, "table", NULL)) < 0)
         goto fail;
 
@@ -263,6 +269,9 @@ void pa__done(pa_module*m) {
     if (u->subscription)
         pa_subscription_free(u->subscription);
 
+    if (u->property_key)
+        pa_xfree(u->property_key);
+
     for (r = u->rules; r; r = n) {
         n = r->next;
 

commit d2757c9842312687f0cb07380a823ce39849a2b2
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jan 15 19:16:55 2009 +0100

    redirect folks to the ALSA developers not me when their sound drivers are broken

diff --git a/src/modules/module-alsa-sink.c b/src/modules/module-alsa-sink.c
index 6fa45e3..3fa0b5d 100644
--- a/src/modules/module-alsa-sink.c
+++ b/src/modules/module-alsa-sink.c
@@ -287,7 +287,8 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
 
             if (polled)
                 pa_log("ALSA woke us up to write new data to the device, but there was actually nothing to write! "
-                       "Most likely this is an ALSA driver bug. Please report this issue to the PulseAudio developers.");
+                       "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
+                       "We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail_update() returned 0.");
 
             break;
         }
@@ -409,7 +410,8 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
 
             if (polled)
                 pa_log("ALSA woke us up to write new data to the device, but there was actually nothing to write! "
-                       "Most likely this is an ALSA driver bug. Please report this issue to the PulseAudio developers.");
+                       "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
+                       "We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail_update() returned 0.");
 
             break;
         }
diff --git a/src/modules/module-alsa-source.c b/src/modules/module-alsa-source.c
index 768c8c1..22e9ebf 100644
--- a/src/modules/module-alsa-source.c
+++ b/src/modules/module-alsa-source.c
@@ -274,7 +274,8 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
 
             if (polled)
                 pa_log("ALSA woke us up to read new data from the device, but there was actually nothing to read! "
-                       "Most likely this is an ALSA driver bug. Please report this issue to the PulseAudio device.");
+                       "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
+                       "We were woken up with POLLIN set -- however a subsequent snd_pcm_avail_update() returned 0.");
 
             break;
         }
@@ -381,7 +382,8 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
 
             if (polled)
                 pa_log("ALSA woke us up to read new data from the device, but there was actually nothing to read! "
-                       "Most likely this is an ALSA driver bug. Please report this issue to the PulseAudio developers.");
+                       "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
+                       "We were woken up with POLLIN set -- however a subsequent snd_pcm_avail_update() returned 0.");
 
             return work_done;
         }

commit a861ffacc490c690da8f05077be1efb7d4e2895c
Merge: d2757c9... e0f8ffe...
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jan 15 19:19:45 2009 +0100

    Merge commit 'e0f8ffe41f99789fafac575e944acf02e940bbf7'


commit 43762ed620589a9007b0c6b77022eb2ea1c6d926
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Mon Nov 10 15:43:05 2008 +0200

    flat-volume: use pa_sink_get_volume(s, TRUE) to work with slaved sink

diff --git a/src/modules/module-flat-volume.c b/src/modules/module-flat-volume.c
index 9bc8055..fe6dc92 100644
--- a/src/modules/module-flat-volume.c
+++ b/src/modules/module-flat-volume.c
@@ -94,11 +94,11 @@ static void process_input_volume_change(
     }
 
     /* Set the master volume, and normalize inputs */
-    if (!pa_cvolume_equal(&max_volume, &sink->volume)) {
+    if (!pa_cvolume_equal(&max_volume, pa_sink_get_volume(sink, TRUE))) {
 
         pa_sink_set_volume(sink, &max_volume);
 
-        pa_log_debug("sink = %.2f (changed)", (double)pa_cvolume_avg(&sink->volume)/PA_VOLUME_NORM);
+        pa_log_debug("sink = %.2f (changed)", (double)pa_cvolume_avg(pa_sink_get_volume(sink, TRUE))/PA_VOLUME_NORM);
 
         /* Now, normalize each of the internal volume (client sink-input volume / sink master volume) */
         for (i = PA_SINK_INPUT(pa_idxset_first(sink->inputs, &idx)); i; i = PA_SINK_INPUT(pa_idxset_next(sink->inputs, &idx))) {
@@ -116,7 +116,7 @@ static void process_input_volume_change(
             pa_asyncmsgq_post(i->sink->asyncmsgq, PA_MSGOBJECT(i), PA_SINK_INPUT_MESSAGE_SET_VOLUME, pa_xnewdup(struct pa_cvolume, &i->volume, 1), 0, NULL, pa_xfree);
         }
     } else
-        pa_log_debug("sink = %.2f", (double)pa_cvolume_avg(&sink->volume)/PA_VOLUME_NORM);
+        pa_log_debug("sink = %.2f", (double)pa_cvolume_avg(pa_sink_get_volume(sink, TRUE))/PA_VOLUME_NORM);
 
     /* and this one */
 
@@ -170,9 +170,9 @@ static void subscribe_callback(pa_core *core, pa_subscription_event_type_t t, ui
         return;
 
     pa_log_debug("Sink volume changed");
-    pa_log_debug("sink = %.2f", (double)pa_cvolume_avg(pa_sink_get_volume(sink, FALSE)) / PA_VOLUME_NORM);
+    pa_log_debug("sink = %.2f", (double)pa_cvolume_avg(pa_sink_get_volume(sink, TRUE)) / PA_VOLUME_NORM);
 
-    sink_volume = *pa_sink_get_volume(sink, FALSE);
+    sink_volume = *pa_sink_get_volume(sink, TRUE);
 
     for (i = PA_SINK_INPUT(pa_idxset_first(sink->inputs, &iidx)); i; i = PA_SINK_INPUT(pa_idxset_next(sink->inputs, &iidx))) {
         pa_cvolume si_volume;

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list