[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v1.0-dev-149-ge2df844

Colin Guthrie gitmailer-noreply at 0pointer.de
Fri Mar 11 06:23:13 PST 2011


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  4cd90d9e32ca9a23e3c0f7615974ea0c55ff3e49 (commit)

- Log -----------------------------------------------------------------
e2df844 build: Use silent rules for generating files
b3721a1 Fixup #include directives according to Coding Style
ecf09f2 Fix up according to Coding Style
5715b2a alsa-mixer: When figuring out the max_dB of a path, use only channels that are used by the path elements.
064780d alsa-mixer: Implement support for setting element specific upper limits for volume.
68e6340 dbus: Always accept mono volumes when setting device or stream volume.
6c5e3af dbusiface-stream: Fix crash when there's no resampling used.
9738134 alsa-card: Print the profile set configuration when loading the card.
00a05a8 alsa-mixer: Add a default case for a switch, so that the compiler won't complain about unhandled cases.
983d4c2 pacat: Fix memory leak when draining the context.
e01a28c alsa-mixer: Use decibel fixes when getting and setting decibel volumes.
4842077 alsa-mixer: Add DecibelFix section to the profile set config file format.
-----------------------------------------------------------------------

Summary of changes:
 man/Makefile.am                                    |    4 +-
 src/Makefile.am                                    |   20 +-
 src/modules/alsa/alsa-mixer.c                      |  578 +++++++++++++++++---
 src/modules/alsa/alsa-mixer.h                      |   28 +-
 src/modules/alsa/alsa-source.c                     |    2 +-
 src/modules/alsa/alsa-util.c                       |    2 +-
 .../alsa/mixer/paths/analog-output.conf.common     |    1 +
 src/modules/alsa/mixer/profile-sets/default.conf   |   61 ++-
 src/modules/alsa/module-alsa-card.c                |    9 +
 src/modules/bluetooth/bluetooth-util.c             |    7 +-
 src/modules/bluetooth/module-bluetooth-device.c    |   27 +-
 src/modules/dbus/iface-device.c                    |    9 +-
 src/modules/dbus/iface-stream.c                    |   14 +-
 src/modules/echo-cancel/adrian.c                   |   12 +-
 src/modules/echo-cancel/module-echo-cancel.c       |   23 +-
 src/modules/echo-cancel/speex.c                    |   14 +-
 src/modules/jack/module-jackdbus-detect.c          |   30 +-
 src/modules/module-augment-properties.c            |    4 +-
 src/modules/module-combine.c                       |    2 +-
 src/modules/module-console-kit.c                   |    2 +-
 src/modules/module-detect.c                        |    2 +-
 src/modules/module-device-manager.c                |    6 +-
 src/modules/module-loopback.c                      |    4 +-
 src/modules/module-pipe-sink.c                     |    2 +-
 src/modules/module-rygel-media-server.c            |   15 +-
 src/modules/module-solaris.c                       |    4 +-
 src/modules/module-tunnel.c                        |    5 +-
 src/modules/module-udev-detect.c                   |    3 +-
 src/modules/module-virtual-sink.c                  |    2 +-
 src/modules/module-virtual-source.c                |    4 +-
 src/modules/oss/module-oss.c                       |    2 +-
 src/modules/raop/base64.c                          |   12 +-
 src/modules/raop/raop_client.c                     |   33 +-
 src/modules/rtp/rtsp_client.c                      |    6 +-
 src/pulse/browser.c                                |    2 +-
 src/pulse/context.c                                |   13 +-
 src/pulse/ext-device-manager.c                     |    5 +-
 src/pulse/ext-stream-restore.c                     |    5 +-
 src/pulse/glib-mainloop.c                          |    2 +-
 src/pulse/introspect.c                             |    3 +-
 src/pulse/scache.c                                 |    4 +-
 src/pulse/stream.c                                 |    6 +-
 src/pulse/subscribe.c                              |    1 -
 src/pulsecore/asyncq.c                             |    5 +-
 src/pulsecore/core-util.c                          |   13 +-
 src/pulsecore/cpu-arm.c                            |   36 +-
 src/pulsecore/cpu-x86.c                            |   26 +-
 src/pulsecore/database-simple.c                    |    2 +-
 src/pulsecore/ipacl.c                              |    2 +-
 src/pulsecore/memblock.c                           |    8 +-
 src/pulsecore/memblockq.c                          |    4 +-
 src/pulsecore/poll.c                               |    4 +-
 src/pulsecore/poll.h                               |    7 +-
 src/pulsecore/protocol-esound.c                    |    3 +-
 src/pulsecore/protocol-native.c                    |    8 +-
 src/pulsecore/remap.c                              |   18 +-
 src/pulsecore/remap_mmx.c                          |    8 +-
 src/pulsecore/remap_sse.c                          |    6 +-
 src/pulsecore/resampler.c                          |    8 +-
 src/pulsecore/sample-util.c                        |    4 +-
 src/pulsecore/sconv-s16le.c                        |    3 +-
 src/pulsecore/sconv.c                              |    6 +-
 src/pulsecore/sconv_sse.c                          |   29 +-
 src/pulsecore/semaphore-osx.c                      |    3 +-
 src/pulsecore/semaphore-win32.c                    |    3 +-
 src/pulsecore/sink-input.c                         |    8 +-
 src/pulsecore/sink.c                               |   32 +-
 src/pulsecore/sndfile-util.c                       |   11 +-
 src/pulsecore/sound-file-stream.c                  |    2 +-
 src/pulsecore/source.c                             |   32 +-
 src/pulsecore/source.h                             |    2 +-
 src/pulsecore/strbuf.c                             |    2 +-
 src/pulsecore/svolume_arm.c                        |   36 +-
 src/pulsecore/svolume_c.c                          |   73 +--
 src/pulsecore/svolume_mmx.c                        |   44 +-
 src/pulsecore/svolume_sse.c                        |   42 +-
 src/pulsecore/usergroup.c                          |   16 +-
 src/pulsecore/x11prop.c                            |    3 +-
 src/tests/cpulimit-test.c                          |    2 +-
 src/tests/usergroup-test.c                         |   18 +-
 src/utils/pacat.c                                  |    4 +-
 src/utils/pacmd.c                                  |    3 +-
 src/utils/pax11publish.c                           |    2 +-
 83 files changed, 959 insertions(+), 569 deletions(-)

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

commit 4842077a1e62af4f6be22fc5479a0a3eef7e6045
Author: Tanu Kaskinen <tanu.kaskinen at digia.com>
Date:   Fri Mar 11 13:34:24 2011 +0200

    alsa-mixer: Add DecibelFix section to the profile set config file format.
    
    This commit only implements the parser, the decibel fix data is not yet used
    for anything.

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index fa07674..c0bbaa0 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -2640,6 +2640,15 @@ static void profile_free(pa_alsa_profile *p) {
     pa_xfree(p);
 }
 
+static void decibel_fix_free(pa_alsa_decibel_fix *db_fix) {
+    pa_assert(db_fix);
+
+    pa_xfree(db_fix->name);
+    pa_xfree(db_fix->db_values);
+
+    pa_xfree(db_fix);
+}
+
 void pa_alsa_profile_set_free(pa_alsa_profile_set *ps) {
     pa_assert(ps);
 
@@ -2661,6 +2670,15 @@ void pa_alsa_profile_set_free(pa_alsa_profile_set *ps) {
         pa_hashmap_free(ps->mappings, NULL, NULL);
     }
 
+    if (ps->decibel_fixes) {
+        pa_alsa_decibel_fix *db_fix;
+
+        while ((db_fix = pa_hashmap_steal_first(ps->decibel_fixes)))
+            decibel_fix_free(db_fix);
+
+        pa_hashmap_free(ps->decibel_fixes, NULL, NULL);
+    }
+
     pa_xfree(ps);
 }
 
@@ -2705,6 +2723,26 @@ static pa_alsa_profile *profile_get(pa_alsa_profile_set *ps, const char *name) {
     return p;
 }
 
+static pa_alsa_decibel_fix *decibel_fix_get(pa_alsa_profile_set *ps, const char *name) {
+    pa_alsa_decibel_fix *db_fix;
+
+    if (!pa_startswith(name, "DecibelFix "))
+        return NULL;
+
+    name += 11;
+
+    if ((db_fix = pa_hashmap_get(ps->decibel_fixes, name)))
+        return db_fix;
+
+    db_fix = pa_xnew0(pa_alsa_decibel_fix, 1);
+    db_fix->profile_set = ps;
+    db_fix->name = pa_xstrdup(name);
+
+    pa_hashmap_put(ps->decibel_fixes, db_fix->name, db_fix);
+
+    return db_fix;
+}
+
 static int mapping_parse_device_strings(
         const char *filename,
         unsigned line,
@@ -2975,6 +3013,130 @@ static int profile_parse_skip_probe(
     return 0;
 }
 
+static int decibel_fix_parse_db_values(
+        const char *filename,
+        unsigned line,
+        const char *section,
+        const char *lvalue,
+        const char *rvalue,
+        void *data,
+        void *userdata) {
+
+    pa_alsa_profile_set *ps = userdata;
+    pa_alsa_decibel_fix *db_fix;
+    char **items;
+    char *item;
+    long *db_values;
+    unsigned n = 8; /* Current size of the db_values table. */
+    unsigned min_step = 0;
+    unsigned max_step = 0;
+    unsigned i = 0; /* Index to the items table. */
+    unsigned prev_step = 0;
+    double prev_db = 0;
+
+    pa_assert(filename);
+    pa_assert(section);
+    pa_assert(lvalue);
+    pa_assert(rvalue);
+    pa_assert(ps);
+
+    if (!(db_fix = decibel_fix_get(ps, section))) {
+        pa_log("[%s:%u] %s invalid in section %s", filename, line, lvalue, section);
+        return -1;
+    }
+
+    if (!(items = pa_split_spaces_strv(rvalue))) {
+        pa_log("[%s:%u] Value missing", pa_strnull(filename), line);
+        return -1;
+    }
+
+    db_values = pa_xnew(long, n);
+
+    while ((item = items[i++])) {
+        char *s = item; /* Step value string. */
+        char *d = item; /* dB value string. */
+        uint32_t step;
+        double db;
+
+        /* Move d forward until it points to a colon or to the end of the item. */
+        for (; *d && *d != ':'; ++d);
+
+        if (d == s) {
+            /* item started with colon. */
+            pa_log("[%s:%u] No step value found in %s", filename, line, item);
+            goto fail;
+        }
+
+        if (!*d || !*(d + 1)) {
+            /* No colon found, or it was the last character in item. */
+            pa_log("[%s:%u] No dB value found in %s", filename, line, item);
+            goto fail;
+        }
+
+        /* pa_atou() needs a null-terminating string. Let's replace the colon
+         * with a zero byte. */
+        *d++ = '\0';
+
+        if (pa_atou(s, &step) < 0) {
+            pa_log("[%s:%u] Invalid step value: %s", filename, line, s);
+            goto fail;
+        }
+
+        if (pa_atod(d, &db) < 0) {
+            pa_log("[%s:%u] Invalid dB value: %s", filename, line, d);
+            goto fail;
+        }
+
+        if (step <= prev_step && i != 1) {
+            pa_log("[%s:%u] Step value %u not greater than the previous value %u", filename, line, step, prev_step);
+            goto fail;
+        }
+
+        if (db < prev_db && i != 1) {
+            pa_log("[%s:%u] Decibel value %0.2f less than the previous value %0.2f", filename, line, db, prev_db);
+            goto fail;
+        }
+
+        if (i == 1) {
+            min_step = step;
+            db_values[0] = (long) (db * 100.0);
+            prev_step = step;
+            prev_db = db;
+        } else {
+            /* Interpolate linearly. */
+            double db_increment = (db - prev_db) / (step - prev_step);
+
+            for (; prev_step < step; ++prev_step, prev_db += db_increment) {
+
+                /* Reallocate the db_values table if it's about to overflow. */
+                if (prev_step + 1 - min_step == n) {
+                    n *= 2;
+                    db_values = pa_xrenew(long, db_values, n);
+                }
+
+                db_values[prev_step + 1 - min_step] = (long) ((prev_db + db_increment) * 100.0);
+            }
+        }
+
+        max_step = step;
+    }
+
+    db_fix->min_step = min_step;
+    db_fix->max_step = max_step;
+    pa_xfree(db_fix->db_values);
+    db_fix->db_values = db_values;
+
+    pa_xstrfreev(items);
+
+    return 0;
+
+fail:
+    pa_xstrfreev(items);
+    pa_xfree(db_values);
+
+    return -1;
+}
+
 static int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus) {
 
     static const struct description_map well_known_descriptions[] = {
@@ -3012,7 +3174,7 @@ static int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus) {
 
     if ((m->input_path_names && m->input_element) ||
         (m->output_path_names && m->output_element)) {
-        pa_log("Mapping %s must have either mixer path or mixer elment, not both.", m->name);
+        pa_log("Mapping %s must have either mixer path or mixer element, not both.", m->name);
         return -1;
     }
 
@@ -3257,10 +3419,52 @@ void pa_alsa_profile_dump(pa_alsa_profile *p) {
             pa_log_debug("Output %s", m->name);
 }
 
+static int decibel_fix_verify(pa_alsa_decibel_fix *db_fix) {
+    pa_assert(db_fix);
+
+    /* Check that the dB mapping has been configured. Since "db-values" is
+     * currently the only option in the DecibelFix section, and decibel fix
+     * objects don't get created if a DecibelFix section is empty, this is
+     * actually a redundant check. Having this may prevent future bugs,
+     * however. */
+    if (!db_fix->db_values) {
+        pa_log("Decibel fix for element %s lacks the dB values.", db_fix->name);
+        return -1;
+    }
+
+    return 0;
+}
+
+void pa_alsa_decibel_fix_dump(pa_alsa_decibel_fix *db_fix) {
+    char *db_values = NULL;
+
+    pa_assert(db_fix);
+
+    if (db_fix->db_values) {
+        pa_strbuf *buf;
+        long i;
+        long max_i = db_fix->max_step - db_fix->min_step;
+
+        buf = pa_strbuf_new();
+        pa_strbuf_printf(buf, "[%li]:%0.2f", db_fix->min_step, db_fix->db_values[0] / 100.0);
+
+        for (i = 1; i <= max_i; ++i)
+            pa_strbuf_printf(buf, " [%li]:%0.2f", i + db_fix->min_step, db_fix->db_values[i] / 100.0);
+
+        db_values = pa_strbuf_tostring_free(buf);
+    }
+
+    pa_log_debug("Decibel fix %s, min_step=%li, max_step=%li, db_values=%s",
+                 db_fix->name, db_fix->min_step, db_fix->max_step, pa_strnull(db_values));
+
+    pa_xfree(db_values);
+}
+
 pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel_map *bonus) {
     pa_alsa_profile_set *ps;
     pa_alsa_profile *p;
     pa_alsa_mapping *m;
+    pa_alsa_decibel_fix *db_fix;
     char *fn;
     int r;
     void *state;
@@ -3286,12 +3490,16 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel
         { "input-mappings",         profile_parse_mappings,       NULL, NULL },
         { "output-mappings",        profile_parse_mappings,       NULL, NULL },
         { "skip-probe",             profile_parse_skip_probe,     NULL, NULL },
+
+        /* [DecibelFix ...] */
+        { "db-values",              decibel_fix_parse_db_values,  NULL, NULL },
         { NULL, NULL, NULL, NULL }
     };
 
     ps = pa_xnew0(pa_alsa_profile_set, 1);
     ps->mappings = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
     ps->profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+    ps->decibel_fixes = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
 
     items[0].data = &ps->auto_profiles;
 
@@ -3321,6 +3529,10 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel
         if (profile_verify(p) < 0)
             goto fail;
 
+    PA_HASHMAP_FOREACH(db_fix, ps->decibel_fixes, state)
+        if (decibel_fix_verify(db_fix) < 0)
+            goto fail;
+
     return ps;
 
 fail:
@@ -3501,23 +3713,28 @@ void pa_alsa_profile_set_probe(
 void pa_alsa_profile_set_dump(pa_alsa_profile_set *ps) {
     pa_alsa_profile *p;
     pa_alsa_mapping *m;
+    pa_alsa_decibel_fix *db_fix;
     void *state;
 
     pa_assert(ps);
 
-    pa_log_debug("Profile set %p, auto_profiles=%s, probed=%s, n_mappings=%u, n_profiles=%u",
+    pa_log_debug("Profile set %p, auto_profiles=%s, probed=%s, n_mappings=%u, n_profiles=%u, n_decibel_fixes=%u",
                  (void*)
                  ps,
                  pa_yes_no(ps->auto_profiles),
                  pa_yes_no(ps->probed),
                  pa_hashmap_size(ps->mappings),
-                 pa_hashmap_size(ps->profiles));
+                 pa_hashmap_size(ps->profiles),
+                 pa_hashmap_size(ps->decibel_fixes));
 
     PA_HASHMAP_FOREACH(m, ps->mappings, state)
         pa_alsa_mapping_dump(m);
 
     PA_HASHMAP_FOREACH(p, ps->profiles, state)
         pa_alsa_profile_dump(p);
+
+    PA_HASHMAP_FOREACH(db_fix, ps->decibel_fixes, state)
+        pa_alsa_decibel_fix_dump(db_fix);
 }
 
 void pa_alsa_add_ports(pa_hashmap **p, pa_alsa_path_set *ps) {
diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h
index 0fcfc0a..75da138 100644
--- a/src/modules/alsa/alsa-mixer.h
+++ b/src/modules/alsa/alsa-mixer.h
@@ -46,6 +46,7 @@ typedef struct pa_alsa_path pa_alsa_path;
 typedef struct pa_alsa_path_set pa_alsa_path_set;
 typedef struct pa_alsa_mapping pa_alsa_mapping;
 typedef struct pa_alsa_profile pa_alsa_profile;
+typedef struct pa_alsa_decibel_fix pa_alsa_decibel_fix;
 typedef struct pa_alsa_profile_set pa_alsa_profile_set;
 typedef struct pa_alsa_port_data pa_alsa_port_data;
 
@@ -266,9 +267,26 @@ struct pa_alsa_profile {
     pa_idxset *output_mappings;
 };
 
+struct pa_alsa_decibel_fix {
+    pa_alsa_profile_set *profile_set;
+
+    char *name; /* Alsa volume element name. */
+    long min_step;
+    long max_step;
+
+    /* An array that maps alsa volume element steps to decibels. The steps can
+     * be used as indices to this array, after substracting min_step from the
+     * real value.
+     *
+     * The values are actually stored as integers representing millibels,
+     * because that's the format the alsa API uses. */
+    long *db_values;
+};
+
 struct pa_alsa_profile_set {
     pa_hashmap *mappings;
     pa_hashmap *profiles;
+    pa_hashmap *decibel_fixes;
 
     pa_bool_t auto_profiles;
     pa_bool_t probed:1;
@@ -276,6 +294,7 @@ struct pa_alsa_profile_set {
 
 void pa_alsa_mapping_dump(pa_alsa_mapping *m);
 void pa_alsa_profile_dump(pa_alsa_profile *p);
+void pa_alsa_decibel_fix_dump(pa_alsa_decibel_fix *db_fix);
 
 pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel_map *bonus);
 void pa_alsa_profile_set_probe(pa_alsa_profile_set *ps, const char *dev_id, const pa_sample_spec *ss, unsigned default_n_fragments, unsigned default_fragment_size_msec);
diff --git a/src/modules/alsa/mixer/profile-sets/default.conf b/src/modules/alsa/mixer/profile-sets/default.conf
index cf207bd..9f7b5f2 100644
--- a/src/modules/alsa/mixer/profile-sets/default.conf
+++ b/src/modules/alsa/mixer/profile-sets/default.conf
@@ -16,17 +16,27 @@
 
 ; Default profile definitions for the ALSA backend of PulseAudio. This
 ; is used as fallback for all cards that have no special mapping
-; assigned. (and should be good enough for the vast majority of
-; cards).  Use the udev property PULSE_PROFILE_SET to assign a
-; different profile set than this one to a device.  So what is this
-; about? Simply, what we do here is map ALSA devices to how they are
-; exposed in PA. We say which ALSA device string to use to open a
-; device, which channel mapping to use then, and which mixer path to
-; use. This is encoded in a 'mapping'. Multiple of these mappings can
-; be bound together in a 'profile' which is then directly exposed in
-; the UI as a card profile. Each mapping assigned to a profile will
-; result in one sink/source to be created if the profile is selected
-; for the card.
+; assigned (and should be good enough for the vast majority of
+; cards). If you want to assign a different profile set than this one
+; to a device, either set the udev property PULSE_PROFILE_SET for the
+; card, or use the "profile_set" module argument when loading
+; module-alsa-card.
+;
+; So what is this about? Simply, what we do here is map ALSA devices
+; to how they are exposed in PA. We say which ALSA device string to
+; use to open a device, which channel mapping to use then, and which
+; mixer path to use. This is encoded in a 'mapping'. Multiple of these
+; mappings can be bound together in a 'profile' which is then directly
+; exposed in the UI as a card profile. Each mapping assigned to a
+; profile will result in one sink/source to be created if the profile
+; is selected for the card.
+;
+; Additionally, the path set configuration files can describe the
+; decibel values assigned to the steps of the volume elements. This
+; can be used to work around situations when the alsa driver doesn't
+; provide any decibel information, or when the information is
+; incorrect.
+
 
 ; [General]
 ; auto-profiles = no | yes                  # Instead of defining all profiles manually, autogenerate
@@ -55,6 +65,35 @@
 ; skip-probe = no | yes                     # Skip probing for availability? If this is yes then this profile
 ;                                           # will be assumed as working without probing. Makes initialization
 ;                                           # a bit faster but only works if the card is really known well.
+;
+; [DecibelFix element]                      # Decibel fixes can be used to work around missing or incorrect dB
+;                                           # information from alsa. A decibel fix is a table that maps volume steps
+;                                           # to decibel values for one volume element. The "element" part in the
+;                                           # section title is the name of the volume element.
+;                                           #
+;                                           # NOTE: This feature is meant just as a help for figuring out the correct
+;                                           # decibel values. Pulseaudio is not the correct place to maintain the
+;                                           # decibel mappings!
+;                                           #
+;                                           # If you need this feature, then you should make sure that when you have
+;                                           # the correct values figured out, the alsa driver developers get informed
+;                                           # too, so that they can fix the driver.
+;
+; db-values = ...                           # The option value consists of pairs of step numbers and decibel values.
+;                                           # The pairs are separated with whitespace, and steps are separated from
+;                                           # the corresponding decibel values with a colon. The values must be in an
+;                                           # increasing order. Here's an example of a valid string:
+;                                           #
+;                                           #     "0:-40.50  1:-38.70  3:-33.00  11:0"
+;                                           #
+;                                           # The lowest step imposes a lower limit for hardware volume and the
+;                                           # highest step correspondingly imposes a higher limit. That means that
+;                                           # that the mixer will never be set outside those values - the rest of the
+;                                           # volume scale is done using software volume.
+;                                           #
+;                                           # As can be seen in the example, you don't need to specify a dB value for
+;                                           # each step. The dB values for skipped steps will be linearly interpolated
+;                                           # using the nearest steps that are given.
 
 [General]
 auto-profiles = yes
diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index 3f8576d..c2e5ffa 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -400,6 +400,14 @@ int pa__init(pa_module *m) {
     if (reserve)
         pa_reserve_wrapper_unref(reserve);
 
+    if (!pa_hashmap_isempty(u->profile_set->decibel_fixes))
+        pa_log_warn("Card %s uses decibel fixes (i.e. overrides the decibel information for some alsa volume elements). "
+                    "Please note that this feature is meant just as a help for figuring out the correct decibel values. "
+                    "Pulseaudio is not the correct place to maintain the decibel mappings! The fixed decibel values "
+                    "should be sent to ALSA developers so that they can fix the driver. If it turns out that this feature "
+                    "is abused (i.e. fixes are not pushed to ALSA), the decibel fix feature may be removed in some future "
+                    "Pulseaudio version.", u->card->name);
+
     return 0;
 
 fail:

commit e01a28cd53925e5a351ac18f8fbbb8a696139a03
Author: Tanu Kaskinen <tanu.kaskinen at digia.com>
Date:   Fri Mar 11 13:37:17 2011 +0200

    alsa-mixer: Use decibel fixes when getting and setting decibel volumes.

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index c0bbaa0..340e063 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -491,6 +491,15 @@ static void option_free(pa_alsa_option *o) {
     pa_xfree(o);
 }
 
+static void decibel_fix_free(pa_alsa_decibel_fix *db_fix) {
+    pa_assert(db_fix);
+
+    pa_xfree(db_fix->name);
+    pa_xfree(db_fix->db_values);
+
+    pa_xfree(db_fix);
+}
+
 static void element_free(pa_alsa_element *e) {
     pa_alsa_option *o;
     pa_assert(e);
@@ -500,6 +509,9 @@ static void element_free(pa_alsa_element *e) {
         option_free(o);
     }
 
+    if (e->db_fix)
+        decibel_fix_free(e->db_fix);
+
     pa_xfree(e->alsa_name);
     pa_xfree(e);
 }
@@ -593,14 +605,60 @@ static int element_get_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann
             long value = 0;
 
             if (e->direction == PA_ALSA_DIRECTION_OUTPUT) {
-                if (snd_mixer_selem_has_playback_channel(me, c))
-                    r = snd_mixer_selem_get_playback_dB(me, c, &value);
-                else
+                if (snd_mixer_selem_has_playback_channel(me, c)) {
+                    if (e->db_fix) {
+                        if ((r = snd_mixer_selem_get_playback_volume(me, c, &value)) >= 0) {
+                            /* If the channel volume is outside the limits set
+                             * by the dB fix, we clamp the hw volume to be
+                             * within the limits. */
+                            if (value < e->db_fix->min_step) {
+                                value = e->db_fix->min_step;
+                                snd_mixer_selem_set_playback_volume(me, c, value);
+                                pa_log_debug("Playback volume for element %s channel %i was below the dB fix limit. "
+                                             "Volume reset to %0.2f dB.", e->alsa_name, c,
+                                             e->db_fix->db_values[value - e->db_fix->min_step] / 100.0);
+                            } else if (value > e->db_fix->max_step) {
+                                value = e->db_fix->max_step;
+                                snd_mixer_selem_set_playback_volume(me, c, value);
+                                pa_log_debug("Playback volume for element %s channel %i was over the dB fix limit. "
+                                             "Volume reset to %0.2f dB.", e->alsa_name, c,
+                                             e->db_fix->db_values[value - e->db_fix->min_step] / 100.0);
+                            }
+
+                            /* Volume step -> dB value conversion. */
+                            value = e->db_fix->db_values[value - e->db_fix->min_step];
+                        }
+                    } else
+                        r = snd_mixer_selem_get_playback_dB(me, c, &value);
+                } else
                     r = -1;
             } else {
-                if (snd_mixer_selem_has_capture_channel(me, c))
-                    r = snd_mixer_selem_get_capture_dB(me, c, &value);
-                else
+                if (snd_mixer_selem_has_capture_channel(me, c)) {
+                    if (e->db_fix) {
+                        if ((r = snd_mixer_selem_get_capture_volume(me, c, &value)) >= 0) {
+                            /* If the channel volume is outside the limits set
+                             * by the dB fix, we clamp the hw volume to be
+                             * within the limits. */
+                            if (value < e->db_fix->min_step) {
+                                value = e->db_fix->min_step;
+                                snd_mixer_selem_set_capture_volume(me, c, value);
+                                pa_log_debug("Capture volume for element %s channel %i was below the dB fix limit. "
+                                             "Volume reset to %0.2f dB.", e->alsa_name, c,
+                                             e->db_fix->db_values[value - e->db_fix->min_step] / 100.0);
+                            } else if (value > e->db_fix->max_step) {
+                                value = e->db_fix->max_step;
+                                snd_mixer_selem_set_capture_volume(me, c, value);
+                                pa_log_debug("Capture volume for element %s channel %i was over the dB fix limit. "
+                                             "Volume reset to %0.2f dB.", e->alsa_name, c,
+                                             e->db_fix->db_values[value - e->db_fix->min_step] / 100.0);
+                            }
+
+                            /* Volume step -> dB value conversion. */
+                            value = e->db_fix->db_values[value - e->db_fix->min_step];
+                        }
+                    } else
+                        r = snd_mixer_selem_get_capture_dB(me, c, &value);
+                } else
                     r = -1;
             }
 
@@ -760,6 +818,37 @@ int pa_alsa_path_get_mute(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t *muted) {
     return 0;
 }
 
+/* Finds the closest item in db_fix->db_values and returns the corresponding
+ * step. *db_value is replaced with the value from the db_values table.
+ * Rounding is done based on the rounding parameter: -1 means rounding down and
+ * +1 means rounding up. */
+static long decibel_fix_get_step(pa_alsa_decibel_fix *db_fix, long *db_value, int rounding) {
+    unsigned i = 0;
+    unsigned max_i = 0;
+
+    pa_assert(db_fix);
+    pa_assert(db_value);
+    pa_assert(rounding != 0);
+
+    max_i = db_fix->max_step - db_fix->min_step;
+
+    if (rounding > 0) {
+        for (i = 0; i < max_i; i++) {
+            if (db_fix->db_values[i] >= *db_value)
+                break;
+        }
+    } else {
+        for (i = 0; i < max_i; i++) {
+            if (db_fix->db_values[i + 1] > *db_value)
+                break;
+        }
+    }
+
+    *db_value = db_fix->db_values[i];
+
+    return i + db_fix->min_step;
+}
+
 static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, pa_bool_t write_to_hw) {
 
     snd_mixer_selem_id_t *sid;
@@ -807,29 +896,49 @@ static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann
             int rounding = value > 0 ? -1 : +1;
 
             if (e->direction == PA_ALSA_DIRECTION_OUTPUT) {
-                /* If we call set_play_volume() without checking first
-                 * if the channel is available, ALSA behaves ver
+                /* If we call set_playback_volume() without checking first
+                 * if the channel is available, ALSA behaves very
                  * strangely and doesn't fail the call */
                 if (snd_mixer_selem_has_playback_channel(me, c)) {
-                    if (write_to_hw) {
-                        if ((r = snd_mixer_selem_set_playback_dB(me, c, value, rounding)) >= 0)
-                            r = snd_mixer_selem_get_playback_dB(me, c, &value);
+                    if (e->db_fix) {
+                        if (write_to_hw)
+                            r = snd_mixer_selem_set_playback_volume(me, c, decibel_fix_get_step(e->db_fix, &value, rounding));
+                        else {
+                            decibel_fix_get_step(e->db_fix, &value, rounding);
+                            r = 0;
+                        }
+
                     } else {
-                        long alsa_val;
-                        if ((r = snd_mixer_selem_ask_playback_dB_vol(me, value, rounding, &alsa_val)) >= 0)
-                            r = snd_mixer_selem_ask_playback_vol_dB(me, alsa_val, &value);
+                        if (write_to_hw) {
+                            if ((r = snd_mixer_selem_set_playback_dB(me, c, value, rounding)) >= 0)
+                                r = snd_mixer_selem_get_playback_dB(me, c, &value);
+                        } else {
+                            long alsa_val;
+                            if ((r = snd_mixer_selem_ask_playback_dB_vol(me, value, rounding, &alsa_val)) >= 0)
+                                r = snd_mixer_selem_ask_playback_vol_dB(me, alsa_val, &value);
+                        }
                     }
                 } else
                     r = -1;
             } else {
                 if (snd_mixer_selem_has_capture_channel(me, c)) {
-                    if (write_to_hw) {
-                        if ((r = snd_mixer_selem_set_capture_dB(me, c, value, rounding)) >= 0)
-                            r = snd_mixer_selem_get_capture_dB(me, c, &value);
+                    if (e->db_fix) {
+                        if (write_to_hw)
+                            r = snd_mixer_selem_set_capture_volume(me, c, decibel_fix_get_step(e->db_fix, &value, rounding));
+                        else {
+                            decibel_fix_get_step(e->db_fix, &value, rounding);
+                            r = 0;
+                        }
+
                     } else {
-                        long alsa_val;
-                        if ((r = snd_mixer_selem_ask_capture_dB_vol(me, value, rounding, &alsa_val)) >= 0)
-                            r = snd_mixer_selem_ask_capture_vol_dB(me, alsa_val, &value);
+                        if (write_to_hw) {
+                            if ((r = snd_mixer_selem_set_capture_dB(me, c, value, rounding)) >= 0)
+                                r = snd_mixer_selem_get_capture_dB(me, c, &value);
+                        } else {
+                            long alsa_val;
+                            if ((r = snd_mixer_selem_ask_capture_dB_vol(me, value, rounding, &alsa_val)) >= 0)
+                                r = snd_mixer_selem_ask_capture_vol_dB(me, alsa_val, &value);
+                        }
                     }
                 } else
                     r = -1;
@@ -1013,9 +1122,19 @@ static int element_zero_volume(pa_alsa_element *e, snd_mixer_t *m) {
     }
 
     if (e->direction == PA_ALSA_DIRECTION_OUTPUT)
-        r = snd_mixer_selem_set_playback_dB_all(me, 0, +1);
+        if (e->db_fix) {
+            long value = 0;
+
+            r = snd_mixer_selem_set_playback_volume_all(me, decibel_fix_get_step(e->db_fix, &value, +1));
+        } else
+            r = snd_mixer_selem_set_playback_dB_all(me, 0, +1);
     else
-        r = snd_mixer_selem_set_capture_dB_all(me, 0, +1);
+        if (e->db_fix) {
+            long value = 0;
+
+            r = snd_mixer_selem_set_capture_volume_all(me, decibel_fix_get_step(e->db_fix, &value, +1));
+        } else
+            r = snd_mixer_selem_set_capture_dB_all(me, 0, +1);
 
     if (r < 0)
         pa_log_warn("Failed to set volume to 0dB of %s: %s", e->alsa_name, pa_alsa_strerror(errno));
@@ -1230,26 +1349,6 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
             e->direction_try_other = FALSE;
 
             if (e->direction == PA_ALSA_DIRECTION_OUTPUT)
-                e->has_dB = snd_mixer_selem_get_playback_dB_range(me, &min_dB, &max_dB) >= 0;
-            else
-                e->has_dB = snd_mixer_selem_get_capture_dB_range(me, &min_dB, &max_dB) >= 0;
-
-            if (e->has_dB) {
-#ifdef HAVE_VALGRIND_MEMCHECK_H
-                VALGRIND_MAKE_MEM_DEFINED(&min_dB, sizeof(min_dB));
-                VALGRIND_MAKE_MEM_DEFINED(&max_dB, sizeof(max_dB));
-#endif
-
-                e->min_dB = ((double) min_dB) / 100.0;
-                e->max_dB = ((double) max_dB) / 100.0;
-
-                if (min_dB >= max_dB) {
-                    pa_log_warn("Your kernel driver is broken: it reports a volume range from %0.2f dB to %0.2f dB which makes no sense.", e->min_dB, e->max_dB);
-                    e->has_dB = FALSE;
-                }
-            }
-
-            if (e->direction == PA_ALSA_DIRECTION_OUTPUT)
                 r = snd_mixer_selem_get_playback_volume_range(me, &e->min_volume, &e->max_volume);
             else
                 r = snd_mixer_selem_get_capture_volume_range(me, &e->min_volume, &e->max_volume);
@@ -1259,7 +1358,6 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
                 return -1;
             }
 
-
             if (e->min_volume >= e->max_volume) {
                 pa_log_warn("Your kernel driver is broken: it reports a volume range from %li to %li which makes no sense.", e->min_volume, e->max_volume);
                 e->volume_use = PA_ALSA_VOLUME_IGNORE;
@@ -1268,6 +1366,45 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
                 pa_bool_t is_mono;
                 pa_channel_position_t p;
 
+                if (e->db_fix &&
+                        ((e->min_volume > e->db_fix->min_step) ||
+                         (e->max_volume < e->db_fix->max_step))) {
+                    pa_log_warn("The step range of the decibel fix for element %s (%li-%li) doesn't fit to the "
+                                "real hardware range (%li-%li). Disabling the decibel fix.", e->alsa_name,
+                                e->db_fix->min_step, e->db_fix->max_step,
+                                e->min_volume, e->max_volume);
+
+                    decibel_fix_free(e->db_fix);
+                    e->db_fix = NULL;
+                }
+
+                if (e->db_fix) {
+                    e->has_dB = TRUE;
+                    e->min_volume = e->db_fix->min_step;
+                    e->max_volume = e->db_fix->max_step;
+                    min_dB = e->db_fix->db_values[0];
+                    max_dB = e->db_fix->db_values[e->db_fix->max_step - e->db_fix->min_step];
+                } else if (e->direction == PA_ALSA_DIRECTION_OUTPUT)
+                    e->has_dB = snd_mixer_selem_get_playback_dB_range(me, &min_dB, &max_dB) >= 0;
+                else
+                    e->has_dB = snd_mixer_selem_get_capture_dB_range(me, &min_dB, &max_dB) >= 0;
+
+                if (e->has_dB) {
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+                    VALGRIND_MAKE_MEM_DEFINED(&min_dB, sizeof(min_dB));
+                    VALGRIND_MAKE_MEM_DEFINED(&max_dB, sizeof(max_dB));
+#endif
+
+                    e->min_dB = ((double) min_dB) / 100.0;
+                    e->max_dB = ((double) max_dB) / 100.0;
+
+                    if (min_dB >= max_dB) {
+                        pa_assert(!e->db_fix);
+                        pa_log_warn("Your kernel driver is broken: it reports a volume range from %0.2f dB to %0.2f dB which makes no sense.", e->min_dB, e->max_dB);
+                        e->has_dB = FALSE;
+                    }
+                }
+
                 if (e->direction == PA_ALSA_DIRECTION_OUTPUT)
                     is_mono = snd_mixer_selem_is_playback_mono(me) > 0;
                 else
@@ -2401,8 +2538,12 @@ void pa_alsa_path_set_set_callback(pa_alsa_path_set *ps, snd_mixer_t *m, snd_mix
 pa_alsa_path_set *pa_alsa_path_set_new(pa_alsa_mapping *m, pa_alsa_direction_t direction) {
     pa_alsa_path_set *ps;
     char **pn = NULL, **en = NULL, **ie;
+    pa_alsa_decibel_fix *db_fix;
+    void *state;
 
     pa_assert(m);
+    pa_assert(m->profile_set);
+    pa_assert(m->profile_set->decibel_fixes);
     pa_assert(direction == PA_ALSA_DIRECTION_OUTPUT || direction == PA_ALSA_DIRECTION_INPUT);
 
     if (m->direction != PA_ALSA_DIRECTION_ANY && m->direction != direction)
@@ -2444,7 +2585,7 @@ pa_alsa_path_set *pa_alsa_path_set_new(pa_alsa_mapping *m, pa_alsa_direction_t d
             pa_xfree(fn);
         }
 
-        return ps;
+        goto finish;
     }
 
     if (direction == PA_ALSA_DIRECTION_OUTPUT)
@@ -2485,6 +2626,28 @@ pa_alsa_path_set *pa_alsa_path_set_new(pa_alsa_mapping *m, pa_alsa_direction_t d
         ps->last_path = p;
     }
 
+finish:
+    /* Assign decibel fixes to elements. */
+    PA_HASHMAP_FOREACH(db_fix, m->profile_set->decibel_fixes, state) {
+        pa_alsa_path *p;
+
+        PA_LLIST_FOREACH(p, ps->paths) {
+            pa_alsa_element *e;
+
+            PA_LLIST_FOREACH(e, p->elements) {
+                if (e->volume_use != PA_ALSA_VOLUME_IGNORE && pa_streq(db_fix->name, e->alsa_name)) {
+                    /* The profile set that contains the dB fix may be freed
+                     * before the element, so we have to copy the dB fix
+                     * object. */
+                    e->db_fix = pa_xnewdup(pa_alsa_decibel_fix, db_fix, 1);
+                    e->db_fix->profile_set = NULL;
+                    e->db_fix->name = pa_xstrdup(db_fix->name);
+                    e->db_fix->db_values = pa_xmemdup(db_fix->db_values, (db_fix->max_step - db_fix->min_step + 1) * sizeof(long));
+                }
+            }
+        }
+    }
+
     return ps;
 }
 
@@ -2640,15 +2803,6 @@ static void profile_free(pa_alsa_profile *p) {
     pa_xfree(p);
 }
 
-static void decibel_fix_free(pa_alsa_decibel_fix *db_fix) {
-    pa_assert(db_fix);
-
-    pa_xfree(db_fix->name);
-    pa_xfree(db_fix->db_values);
-
-    pa_xfree(db_fix);
-}
-
 void pa_alsa_profile_set_free(pa_alsa_profile_set *ps) {
     pa_assert(ps);
 
diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h
index 75da138..8ec5dca 100644
--- a/src/modules/alsa/alsa-mixer.h
+++ b/src/modules/alsa/alsa-mixer.h
@@ -119,9 +119,9 @@ struct pa_alsa_option {
     pa_alsa_required_t required_absent;
 };
 
-/* And element wraps one specific ALSA element. A series of elements *
-make up a path (see below). If the element is an enumeration or switch
-* element it may includes a list of options. */
+/* An element wraps one specific ALSA element. A series of elements
+ * make up a path (see below). If the element is an enumeration or switch
+ * element it may include a list of options. */
 struct pa_alsa_element {
     pa_alsa_path *path;
     PA_LLIST_FIELDS(pa_alsa_element);
@@ -150,6 +150,8 @@ struct pa_alsa_element {
     pa_channel_position_mask_t merged_mask;
 
     PA_LLIST_HEAD(pa_alsa_option, options);
+
+    pa_alsa_decibel_fix *db_fix;
 };
 
 /* A path wraps a series of elements into a single entity which can be

commit 983d4c238da96e4ca12283f51ccd0b6bd7005592
Author: Tanu Kaskinen <tanu.kaskinen at digia.com>
Date:   Fri Mar 11 13:37:49 2011 +0200

    pacat: Fix memory leak when draining the context.

diff --git a/src/utils/pacat.c b/src/utils/pacat.c
index 6cd01d2..749593e 100644
--- a/src/utils/pacat.c
+++ b/src/utils/pacat.c
@@ -105,6 +105,7 @@ static void context_drain_complete(pa_context*c, void *userdata) {
 
 /* Stream draining complete */
 static void stream_drain_complete(pa_stream*s, int success, void *userdata) {
+    pa_operation *o = NULL;
 
     if (!success) {
         pa_log(_("Failed to drain stream: %s"), pa_strerror(pa_context_errno(context)));
@@ -118,9 +119,10 @@ static void stream_drain_complete(pa_stream*s, int success, void *userdata) {
     pa_stream_unref(stream);
     stream = NULL;
 
-    if (!pa_context_drain(context, context_drain_complete, NULL))
+    if (!(o = pa_context_drain(context, context_drain_complete, NULL)))
         pa_context_disconnect(context);
     else {
+        pa_operation_unref(o);
         if (verbose)
             pa_log(_("Draining connection to server."));
     }

commit 00a05a82729c03e4ec521460f928ef540e302a6f
Author: Tanu Kaskinen <tanu.kaskinen at digia.com>
Date:   Fri Mar 11 13:38:05 2011 +0200

    alsa-mixer: Add a default case for a switch, so that the compiler won't complain about unhandled cases.

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 340e063..9a7e045 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -1243,21 +1243,23 @@ static int check_required(pa_alsa_element *e, snd_mixer_elem_t *me) {
 
     if (e->required_any != PA_ALSA_REQUIRED_IGNORE) {
         switch (e->required_any) {
-        case PA_ALSA_REQUIRED_VOLUME:
-            e->path->req_any_present |= (e->volume_use != PA_ALSA_VOLUME_IGNORE);
-            break;
-        case PA_ALSA_REQUIRED_SWITCH:
-            e->path->req_any_present |= (e->switch_use != PA_ALSA_SWITCH_IGNORE);
-            break;
-        case PA_ALSA_REQUIRED_ENUMERATION:
-            e->path->req_any_present |= (e->enumeration_use != PA_ALSA_ENUMERATION_IGNORE);
-            break;
-        case PA_ALSA_REQUIRED_ANY:
-            e->path->req_any_present |=
-                (e->volume_use != PA_ALSA_VOLUME_IGNORE) ||
-                (e->switch_use != PA_ALSA_SWITCH_IGNORE) ||
-                (e->enumeration_use != PA_ALSA_ENUMERATION_IGNORE);
-            break;
+            case PA_ALSA_REQUIRED_VOLUME:
+                e->path->req_any_present |= (e->volume_use != PA_ALSA_VOLUME_IGNORE);
+                break;
+            case PA_ALSA_REQUIRED_SWITCH:
+                e->path->req_any_present |= (e->switch_use != PA_ALSA_SWITCH_IGNORE);
+                break;
+            case PA_ALSA_REQUIRED_ENUMERATION:
+                e->path->req_any_present |= (e->enumeration_use != PA_ALSA_ENUMERATION_IGNORE);
+                break;
+            case PA_ALSA_REQUIRED_ANY:
+                e->path->req_any_present |=
+                    (e->volume_use != PA_ALSA_VOLUME_IGNORE) ||
+                    (e->switch_use != PA_ALSA_SWITCH_IGNORE) ||
+                    (e->enumeration_use != PA_ALSA_ENUMERATION_IGNORE);
+                break;
+            default:
+                pa_assert_not_reached();
         }
     }
 

commit 973813485f171ec8db069926366790711a3c46d5
Author: Tanu Kaskinen <tanu.kaskinen at digia.com>
Date:   Fri Mar 11 13:39:50 2011 +0200

    alsa-card: Print the profile set configuration when loading the card.

diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index c2e5ffa..e60aa5e 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -342,6 +342,7 @@ int pa__init(pa_module *m) {
         goto fail;
 
     pa_alsa_profile_set_probe(u->profile_set, u->device_id, &m->core->default_sample_spec, m->core->default_n_fragments, m->core->default_fragment_size_msec);
+    pa_alsa_profile_set_dump(u->profile_set);
 
     pa_card_new_data_init(&data);
     data.driver = __FILE__;

commit 6c5e3af27591aa5ebbb332b80b6809cb320f7ae9
Author: Tanu Kaskinen <tanu.kaskinen at digia.com>
Date:   Fri Mar 11 13:40:20 2011 +0200

    dbusiface-stream: Fix crash when there's no resampling used.

diff --git a/src/modules/dbus/iface-stream.c b/src/modules/dbus/iface-stream.c
index a9eb373..6b46fa9 100644
--- a/src/modules/dbus/iface-stream.c
+++ b/src/modules/dbus/iface-stream.c
@@ -490,6 +490,9 @@ static void handle_get_resample_method(DBusConnection *conn, DBusMessage *msg, v
     else
         resample_method = pa_resample_method_to_string(s->source_output->actual_resample_method);
 
+    if (!resample_method)
+        resample_method = "";
+
     pa_dbus_send_basic_variant_reply(conn, msg, DBUS_TYPE_STRING, &resample_method);
 }
 
@@ -560,6 +563,8 @@ static void handle_get_all(DBusConnection *conn, DBusMessage *msg, void *userdat
         client_path = pa_dbusiface_core_get_client_path(s->core, client);
     for (i = 0; i < channel_map->channels; ++i)
         channels[i] = channel_map->map[i];
+    if (!resample_method)
+        resample_method = "";
 
     pa_assert_se((reply = dbus_message_new_method_return(msg)));
 

commit 68e6340394d66d9d41bf094440d950dd62adba62
Author: Tanu Kaskinen <tanu.kaskinen at digia.com>
Date:   Fri Mar 11 13:40:34 2011 +0200

    dbus: Always accept mono volumes when setting device or stream volume.
    
    pa_sink_set_volume() and friends accept mono volumes too, so no need to impose
    unneeded restrictions in the D-Bus API.

diff --git a/src/modules/dbus/iface-device.c b/src/modules/dbus/iface-device.c
index a8652df..c5ba88e 100644
--- a/src/modules/dbus/iface-device.c
+++ b/src/modules/dbus/iface-device.c
@@ -422,21 +422,20 @@ static void handle_set_volume(DBusConnection *conn, DBusMessage *msg, DBusMessag
     pa_assert(iter);
     pa_assert(d);
 
-    pa_cvolume_init(&new_vol);
-
     device_channels = (d->type == DEVICE_TYPE_SINK) ? d->sink->channel_map.channels : d->source->channel_map.channels;
 
-    new_vol.channels = device_channels;
-
     dbus_message_iter_recurse(iter, &array_iter);
     dbus_message_iter_get_fixed_array(&array_iter, &volume, &n_volume_entries);
 
-    if (n_volume_entries != device_channels) {
+    if (n_volume_entries != device_channels && n_volume_entries != 1) {
         pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_ARGS,
                            "Expected %u volume entries, got %i.", device_channels, n_volume_entries);
         return;
     }
 
+    pa_cvolume_init(&new_vol);
+    new_vol.channels = n_volume_entries;
+
     for (i = 0; i < n_volume_entries; ++i) {
         if (!PA_VOLUME_IS_VALID(volume[i])) {
             pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_ARGS, "Too large volume value: %u", volume[i]);
diff --git a/src/modules/dbus/iface-stream.c b/src/modules/dbus/iface-stream.c
index 6b46fa9..e3464fd 100644
--- a/src/modules/dbus/iface-stream.c
+++ b/src/modules/dbus/iface-stream.c
@@ -381,21 +381,20 @@ static void handle_set_volume(DBusConnection *conn, DBusMessage *msg, DBusMessag
         return;
     }
 
-    pa_cvolume_init(&new_vol);
-
     stream_channels = s->sink_input->channel_map.channels;
 
-    new_vol.channels = stream_channels;
-
     dbus_message_iter_recurse(iter, &array_iter);
     dbus_message_iter_get_fixed_array(&array_iter, &volume, &n_volume_entries);
 
-    if (n_volume_entries != stream_channels) {
+    if (n_volume_entries != stream_channels && n_volume_entries != 1) {
         pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_ARGS,
                            "Expected %u volume entries, got %u.", stream_channels, n_volume_entries);
         return;
     }
 
+    pa_cvolume_init(&new_vol);
+    new_vol.channels = n_volume_entries;
+
     for (i = 0; i < n_volume_entries; ++i) {
         if (!PA_VOLUME_IS_VALID(volume[i])) {
             pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_ARGS, "Invalid volume: %u", volume[i]);

commit 064780d9dea6a79c4c3adb07f530e2e6d5c68c0f
Author: Tanu Kaskinen <tanu.kaskinen at digia.com>
Date:   Fri Mar 11 13:40:51 2011 +0200

    alsa-mixer: Implement support for setting element specific upper limits for volume.
    
    This feature is mainly useful in embedded systems that have built-in speakers.
    In such situations the full audio path is known beforehand, so it's possible to
    know what is the maximum sensible volume, and any higher volume can be
    disabled.
    
    The volume limit is set in path configuration files in the [Element] section,
    using option "volume-limit". The value is the desired maximum volume step of
    the volume element.

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 9a7e045..41997a7 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -895,6 +895,9 @@ static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann
             long value = to_alsa_dB(f);
             int rounding = value > 0 ? -1 : +1;
 
+            if (e->volume_limit >= 0 && value > (e->max_dB * 100))
+                value = e->max_dB * 100;
+
             if (e->direction == PA_ALSA_DIRECTION_OUTPUT) {
                 /* If we call set_playback_volume() without checking first
                  * if the channel is available, ALSA behaves very
@@ -1284,6 +1287,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
 
     pa_assert(m);
     pa_assert(e);
+    pa_assert(e->path);
 
     SELEM_INIT(sid, e->alsa_name);
 
@@ -1407,6 +1411,36 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
                     }
                 }
 
+                if (e->volume_limit >= 0) {
+                    if (e->volume_limit <= e->min_volume || e->volume_limit > e->max_volume)
+                        pa_log_warn("Volume limit for element %s of path %s is invalid: %li isn't within the valid range "
+                                    "%li-%li. The volume limit is ignored.",
+                                    e->alsa_name, e->path->name, e->volume_limit, e->min_volume + 1, e->max_volume);
+
+                    else {
+                        e->max_volume = e->volume_limit;
+
+                        if (e->has_dB) {
+                            if (e->db_fix) {
+                                e->db_fix->max_step = e->max_volume;
+                                e->max_dB = ((double) e->db_fix->db_values[e->db_fix->max_step - e->db_fix->min_step]) / 100.0;
+
+                            } else {
+                                if (e->direction == PA_ALSA_DIRECTION_OUTPUT)
+                                    r = snd_mixer_selem_ask_playback_vol_dB(me, e->max_volume, &max_dB);
+                                else
+                                    r = snd_mixer_selem_ask_capture_vol_dB(me, e->max_volume, &max_dB);
+
+                                if (r < 0) {
+                                    pa_log_warn("Failed to get dB value of %s: %s", e->alsa_name, pa_alsa_strerror(r));
+                                    e->has_dB = FALSE;
+                                } else
+                                    e->max_dB = ((double) max_dB) / 100.0;
+                            }
+                        }
+                    }
+                }
+
                 if (e->direction == PA_ALSA_DIRECTION_OUTPUT)
                     is_mono = snd_mixer_selem_is_playback_mono(me) > 0;
                 else
@@ -1530,6 +1564,7 @@ static pa_alsa_element* element_get(pa_alsa_path *p, const char *section, pa_boo
     e->path = p;
     e->alsa_name = pa_xstrdup(section);
     e->direction = p->direction;
+    e->volume_limit = -1;
 
     PA_LLIST_INSERT_AFTER(pa_alsa_element, p->elements, p->last_element, e);
 
@@ -1864,6 +1899,33 @@ static int element_parse_direction_try_other(
     return 0;
 }
 
+static int element_parse_volume_limit(
+        const char *filename,
+        unsigned line,
+        const char *section,
+        const char *lvalue,
+        const char *rvalue,
+        void *data,
+        void *userdata) {
+
+    pa_alsa_path *p = userdata;
+    pa_alsa_element *e;
+    uint32_t volume_limit;
+
+    if (!(e = element_get(p, section, TRUE))) {
+        pa_log("[%s:%u] volume-limit makes no sense in '%s'", filename, line, section);
+        return -1;
+    }
+
+    if (pa_atou(rvalue, &volume_limit) < 0 || volume_limit > LONG_MAX) {
+        pa_log("[%s:%u] Invalid value for volume-limit", filename, line);
+        return -1;
+    }
+
+    e->volume_limit = volume_limit;
+    return 0;
+}
+
 static pa_channel_position_mask_t parse_mask(const char *m) {
     pa_channel_position_mask_t v;
 
@@ -2141,6 +2203,7 @@ pa_alsa_path* pa_alsa_path_new(const char *fname, pa_alsa_direction_t direction)
         { "required-absent",     element_parse_required,            NULL, NULL },
         { "direction",           element_parse_direction,           NULL, NULL },
         { "direction-try-other", element_parse_direction_try_other, NULL, NULL },
+        { "volume-limit",        element_parse_volume_limit,        NULL, NULL },
         { NULL, NULL, NULL, NULL }
     };
 
@@ -2191,6 +2254,7 @@ pa_alsa_path* pa_alsa_path_synthesize(const char*element, pa_alsa_direction_t di
     e->path = p;
     e->alsa_name = pa_xstrdup(element);
     e->direction = direction;
+    e->volume_limit = -1;
 
     e->switch_use = PA_ALSA_SWITCH_MUTE;
     e->volume_use = PA_ALSA_VOLUME_MERGE;
@@ -2454,11 +2518,12 @@ void pa_alsa_element_dump(pa_alsa_element *e) {
     pa_alsa_option *o;
     pa_assert(e);
 
-    pa_log_debug("Element %s, direction=%i, switch=%i, volume=%i, enumeration=%i, required=%i, required_any=%i, required_absent=%i, mask=0x%llx, n_channels=%u, override_map=%s",
+    pa_log_debug("Element %s, direction=%i, switch=%i, volume=%i, volume_limit=%li, enumeration=%i, required=%i, required_any=%i, required_absent=%i, mask=0x%llx, n_channels=%u, override_map=%s",
                  e->alsa_name,
                  e->direction,
                  e->switch_use,
                  e->volume_use,
+                 e->volume_limit,
                  e->enumeration_use,
                  e->required,
                  e->required_any,
@@ -2619,6 +2684,7 @@ pa_alsa_path_set *pa_alsa_path_set_new(pa_alsa_mapping *m, pa_alsa_direction_t d
             e->alsa_name = pa_xstrdup(*je);
             e->direction = direction;
             e->required_absent = PA_ALSA_REQUIRED_ANY;
+            e->volume_limit = -1;
 
             PA_LLIST_INSERT_AFTER(pa_alsa_element, p->elements, p->last_element, e);
             p->last_element = e;
diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h
index 8ec5dca..c24a896 100644
--- a/src/modules/alsa/alsa-mixer.h
+++ b/src/modules/alsa/alsa-mixer.h
@@ -142,6 +142,7 @@ struct pa_alsa_element {
 
     pa_bool_t has_dB:1;
     long min_volume, max_volume;
+    long volume_limit; /* -1 for no configured limit */
     double min_dB, max_dB;
 
     pa_channel_position_mask_t masks[SND_MIXER_SCHN_LAST][2];
diff --git a/src/modules/alsa/mixer/paths/analog-output.conf.common b/src/modules/alsa/mixer/paths/analog-output.conf.common
index ffd1b41..c7c4435 100644
--- a/src/modules/alsa/mixer/paths/analog-output.conf.common
+++ b/src/modules/alsa/mixer/paths/analog-output.conf.common
@@ -82,6 +82,7 @@
 ; volume = ignore | merge | off | zero   # What to do with this volume: ignore it, merge it into the device
 ;                                        # volume slider, always set it to the lowest value possible, or always
 ;                                        # set it to 0 dB (for whatever that means)
+; volume-limit = <volume step>           # Limit the maximum volume by disabling the volume steps above <volume step>.
 ; enumeration = ignore | select          # What to do with this enumeration, ignore it or make it selectable
 ;                                        # via device ports. If set to 'select' you need to define an Option section
 ;                                        # for each of the items you want to expose

commit 5715b2af3091f9be9a656dfa9b8cb778caf1c03e
Author: Tanu Kaskinen <tanu.kaskinen at digia.com>
Date:   Fri Mar 11 13:41:28 2011 +0200

    alsa-mixer: When figuring out the max_dB of a path, use only channels that are used by the path elements.
    
    Without this, p->max_dB could never be less than 0 dB, because the loop at the
    end of pa_alsa_path_probe() would reset p->max_dB to 0 as soon as the loop
    encountered a channel that wasn't touched by any element.
    
    There was a similar issue for p->min_dB too (it could never be more than 0 dB),
    which is also fixed by this patch.

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 41997a7..3eef5f9 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -2400,6 +2400,7 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t ignore_dB) {
     pa_alsa_element *e;
     double min_dB[PA_CHANNEL_POSITION_MAX], max_dB[PA_CHANNEL_POSITION_MAX];
     pa_channel_position_t t;
+    pa_channel_position_mask_t path_volume_channels = 0;
 
     pa_assert(p);
     pa_assert(m);
@@ -2436,6 +2437,7 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t ignore_dB) {
                         if (PA_CHANNEL_POSITION_MASK(t) & e->merged_mask) {
                             min_dB[t] = e->min_dB;
                             max_dB[t] = e->max_dB;
+                            path_volume_channels |= PA_CHANNEL_POSITION_MASK(t);
                         }
 
                     p->has_dB = TRUE;
@@ -2446,6 +2448,7 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t ignore_dB) {
                             if (PA_CHANNEL_POSITION_MASK(t) & e->merged_mask) {
                                 min_dB[t] += e->min_dB;
                                 max_dB[t] += e->max_dB;
+                                path_volume_channels |= PA_CHANNEL_POSITION_MASK(t);
                             }
                     } else {
                         /* Hmm, there's another element before us
@@ -2484,11 +2487,13 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t ignore_dB) {
     p->max_dB = -INFINITY;
 
     for (t = 0; t < PA_CHANNEL_POSITION_MAX; t++) {
-        if (p->min_dB > min_dB[t])
-            p->min_dB = min_dB[t];
+        if (path_volume_channels & PA_CHANNEL_POSITION_MASK(t)) {
+            if (p->min_dB > min_dB[t])
+                p->min_dB = min_dB[t];
 
-        if (p->max_dB < max_dB[t])
-            p->max_dB = max_dB[t];
+            if (p->max_dB < max_dB[t])
+                p->max_dB = max_dB[t];
+        }
     }
 
     return 0;

commit ecf09f2cd6bf2f46b0d2402c700ab618c090bd4c
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Wed Mar 2 12:41:26 2011 +0100

    Fix up according to Coding Style
    
    Only whitespace changes in here

diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 45a7af3..6d18e60 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -796,7 +796,7 @@ static void update_smoother(struct userdata *u) {
 }
 
 static pa_usec_t source_get_latency(struct userdata *u) {
-   int64_t delay;
+    int64_t delay;
     pa_usec_t now1, now2;
 
     pa_assert(u);
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index 786e664..6435db0 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -362,7 +362,7 @@ int pa_alsa_set_hw_params(
     pa_log_debug("Set neither period nor buffer size.");
 
     /* Last chance, set nothing */
-    if  ((ret = snd_pcm_hw_params(pcm_handle, hwparams)) < 0) {
+    if ((ret = snd_pcm_hw_params(pcm_handle, hwparams)) < 0) {
         pa_log_info("snd_pcm_hw_params failed: %s", pa_alsa_strerror(ret));
         goto finish;
     }
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 47e0fd5..e6f6e17 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -590,7 +590,7 @@ static void list_devices_reply(DBusPendingCall *pending, void *userdata) {
 
 finish:
     if (paths)
-        dbus_free_string_array (paths);
+        dbus_free_string_array(paths);
 
     dbus_message_unref(r);
 
@@ -598,8 +598,7 @@ finish:
     pa_dbus_pending_free(p);
 }
 
-static void register_endpoint(pa_bluetooth_discovery *y, const char *path, const char *endpoint, const char *uuid)
-{
+static void register_endpoint(pa_bluetooth_discovery *y, const char *path, const char *endpoint, const char *uuid) {
     DBusMessage *m;
     DBusMessageIter i, d;
     uint8_t codec = 0;
@@ -699,7 +698,7 @@ static void list_adapters_reply(DBusPendingCall *pending, void *userdata) {
 
 finish:
     if (paths)
-        dbus_free_string_array (paths);
+        dbus_free_string_array(paths);
 
     dbus_message_unref(r);
 
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index dc09ffc..936d3c7 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -857,8 +857,7 @@ static int stop_stream_fd(struct userdata *u) {
     return r;
 }
 
-static void bt_transport_release(struct userdata *u)
-{
+static void bt_transport_release(struct userdata *u) {
     const char *accesstype = "rw";
     const pa_bluetooth_transport *t;
 
@@ -891,8 +890,7 @@ static void bt_transport_release(struct userdata *u)
     }
 }
 
-static int bt_transport_acquire(struct userdata *u, pa_bool_t start)
-{
+static int bt_transport_acquire(struct userdata *u, pa_bool_t start) {
     const char *accesstype = "rw";
     const pa_bluetooth_transport *t;
 
@@ -1679,8 +1677,8 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
                  dbus_message_get_path(m),
                  dbus_message_get_member(m));
 
-   if (!dbus_message_has_path(m, u->path))
-       goto fail;
+    if (!dbus_message_has_path(m, u->path))
+        goto fail;
 
     if (dbus_message_is_signal(m, "org.bluez.Headset", "SpeakerGainChanged") ||
         dbus_message_is_signal(m, "org.bluez.Headset", "MicrophoneGainChanged")) {
@@ -2007,8 +2005,7 @@ static void shutdown_bt(struct userdata *u) {
     }
 }
 
-static int bt_transport_config_a2dp(struct userdata *u)
-{
+static int bt_transport_config_a2dp(struct userdata *u) {
     const pa_bluetooth_transport *t;
     struct a2dp_info *a2dp = &u->a2dp;
     sbc_capabilities_raw_t *config;
@@ -2112,8 +2109,7 @@ static int bt_transport_config_a2dp(struct userdata *u)
     return 0;
 }
 
-static int bt_transport_config(struct userdata *u)
-{
+static int bt_transport_config(struct userdata *u) {
     if (u->profile == PROFILE_HSP || u->profile == PROFILE_HFGW) {
         u->block_size = u->link_mtu;
         return 0;
@@ -2122,8 +2118,7 @@ static int bt_transport_config(struct userdata *u)
     return bt_transport_config_a2dp(u);
 }
 
-static int parse_transport_property(struct userdata *u, DBusMessageIter *i)
-{
+static int parse_transport_property(struct userdata *u, DBusMessageIter *i) {
     const char *key;
     DBusMessageIter variant_i;
 
@@ -2168,8 +2163,7 @@ static int parse_transport_property(struct userdata *u, DBusMessageIter *i)
 }
 
 /* Run from main thread */
-static int bt_transport_open(struct userdata *u)
-{
+static int bt_transport_open(struct userdata *u) {
     DBusMessage *m, *r;
     DBusMessageIter arg_i, element_i;
     DBusError err;
@@ -2855,10 +2849,7 @@ void pa__done(pa_module *m) {
             speaker = pa_sprintf_malloc("type='signal',sender='org.bluez',interface='org.bluez.Headset',member='SpeakerGainChanged',path='%s'", u->path);
             mike = pa_sprintf_malloc("type='signal',sender='org.bluez',interface='org.bluez.Headset',member='MicrophoneGainChanged',path='%s'", u->path);
 
-            pa_dbus_remove_matches(pa_dbus_connection_get(u->connection),
-                                   speaker,
-                                   mike,
-                                   NULL);
+            pa_dbus_remove_matches(pa_dbus_connection_get(u->connection), speaker, mike, NULL);
 
             pa_xfree(speaker);
             pa_xfree(mike);
diff --git a/src/modules/echo-cancel/adrian.c b/src/modules/echo-cancel/adrian.c
index 446966f..08df2ed 100644
--- a/src/modules/echo-cancel/adrian.c
+++ b/src/modules/echo-cancel/adrian.c
@@ -42,7 +42,7 @@ static const char* const valid_modargs[] = {
 };
 
 static void pa_adrian_ec_fixate_spec(pa_sample_spec *source_ss, pa_channel_map *source_map,
-				    pa_sample_spec *sink_ss, pa_channel_map *sink_map)
+                                    pa_sample_spec *sink_ss, pa_channel_map *sink_map)
 {
     source_ss->format = PA_SAMPLE_S16NE;
     source_ss->channels = 1;
@@ -87,19 +87,18 @@ pa_bool_t pa_adrian_ec_init(pa_core *c, pa_echo_canceller *ec,
 
     ec->params.priv.adrian.aec = AEC_init(rate, have_vector);
     if (!ec->params.priv.adrian.aec)
-	goto fail;
+        goto fail;
 
     pa_modargs_free(ma);
     return TRUE;
 
 fail:
     if (ma)
-	pa_modargs_free(ma);
+        pa_modargs_free(ma);
     return FALSE;
 }
 
-void pa_adrian_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out)
-{
+void pa_adrian_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) {
     unsigned int i;
 
     for (i = 0; i < ec->params.priv.adrian.blocksize; i += 2) {
@@ -110,8 +109,7 @@ void pa_adrian_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *
     }
 }
 
-void pa_adrian_ec_done(pa_echo_canceller *ec)
-{
+void pa_adrian_ec_done(pa_echo_canceller *ec) {
     pa_xfree(ec->params.priv.adrian.aec);
     ec->params.priv.adrian.aec = NULL;
 }
diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c
index 0108c31..0834cc1 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -290,7 +290,7 @@ static void time_callback(pa_mainloop_api *a, pa_time_event *e, const struct tim
          * canceler does not work in this case. */
         pa_asyncmsgq_post(u->asyncmsgq, PA_MSGOBJECT(u->source_output), SOURCE_OUTPUT_MESSAGE_APPLY_DIFF_TIME,
             NULL, diff_time, NULL, NULL);
-        //new_rate = base_rate - ((pa_usec_to_bytes (-diff_time, &u->source_output->sample_spec) / fs) * PA_USEC_PER_SEC) / u->adjust_time;
+        //new_rate = base_rate - ((pa_usec_to_bytes(-diff_time, &u->source_output->sample_spec) / fs) * PA_USEC_PER_SEC) / u->adjust_time;
         new_rate = base_rate;
     }
     else {
@@ -301,7 +301,7 @@ static void time_callback(pa_mainloop_api *a, pa_time_event *e, const struct tim
         }
 
         /* recording behind playback, we need to slowly adjust the rate to match */
-        //new_rate = base_rate + ((pa_usec_to_bytes (diff_time, &u->source_output->sample_spec) / fs) * PA_USEC_PER_SEC) / u->adjust_time;
+        //new_rate = base_rate + ((pa_usec_to_bytes(diff_time, &u->source_output->sample_spec) / fs) * PA_USEC_PER_SEC) / u->adjust_time;
 
         /* assume equal samplerates for now */
         new_rate = base_rate;
@@ -404,7 +404,7 @@ static int source_set_state_cb(pa_source *s, pa_source_state_t state) {
         if (u->active_mask == 3)
             pa_core_rttime_restart(u->core, u->time_event, pa_rtclock_now() + u->adjust_time);
 
-        pa_atomic_store (&u->request_resync, 1);
+        pa_atomic_store(&u->request_resync, 1);
         pa_source_output_cork(u->source_output, FALSE);
     } else if (state == PA_SOURCE_SUSPENDED) {
         u->active_mask &= ~1;
@@ -432,7 +432,7 @@ static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state) {
         if (u->active_mask == 3)
             pa_core_rttime_restart(u->core, u->time_event, pa_rtclock_now() + u->adjust_time);
 
-        pa_atomic_store (&u->request_resync, 1);
+        pa_atomic_store(&u->request_resync, 1);
         pa_sink_input_cork(u->sink_input, FALSE);
     } else if (state == PA_SINK_SUSPENDED) {
         u->active_mask &= ~2;
@@ -597,7 +597,7 @@ static void apply_diff_time(struct userdata *u, int64_t diff_time) {
     int64_t diff;
 
     if (diff_time < 0) {
-        diff = pa_usec_to_bytes (-diff_time, &u->source_output->sample_spec);
+        diff = pa_usec_to_bytes(-diff_time, &u->source_output->sample_spec);
 
         if (diff > 0) {
             /* add some extra safety samples to compensate for jitter in the
@@ -610,7 +610,7 @@ static void apply_diff_time(struct userdata *u, int64_t diff_time) {
             u->source_skip = 0;
         }
     } else if (diff_time > 0) {
-        diff = pa_usec_to_bytes (diff_time, &u->source_output->sample_spec);
+        diff = pa_usec_to_bytes(diff_time, &u->source_output->sample_spec);
 
         if (diff > 0) {
             pa_log("playback too far ahead (%lld), drop source %lld", (long long) diff_time, (long long) diff);
@@ -660,7 +660,7 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk)
     u->in_push = FALSE;
 
     if (pa_atomic_cmpxchg (&u->request_resync, 1, 0)) {
-        do_resync (u);
+        do_resync(u);
     }
 
     pa_memblockq_push_align(u->source_memblockq, chunk);
@@ -770,7 +770,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk
 
     if (i->thread_info.underrun_for > 0) {
         pa_log_debug("Handling end of underrun.");
-        pa_atomic_store (&u->request_resync, 1);
+        pa_atomic_store(&u->request_resync, 1);
     }
 
     /* let source thread handle the chunk. pass the sample count as well so that
@@ -926,7 +926,7 @@ static void sink_input_update_max_rewind_cb(pa_sink_input *i, size_t nbytes) {
 
     pa_log_debug("Sink input update max rewind %lld", (long long) nbytes);
 
-    pa_memblockq_set_maxrewind (u->sink_memblockq, nbytes);
+    pa_memblockq_set_maxrewind(u->sink_memblockq, nbytes);
     pa_sink_set_max_rewind_within_thread(u->sink, nbytes);
 }
 
@@ -1300,8 +1300,7 @@ static void sink_input_mute_changed_cb(pa_sink_input *i) {
     pa_sink_mute_changed(u->sink, i->muted);
 }
 
-static pa_echo_canceller_method_t get_ec_method_from_string(const char *method)
-{
+static pa_echo_canceller_method_t get_ec_method_from_string(const char *method) {
     if (strcmp(method, "speex") == 0)
         return PA_ECHO_CANCELLER_SPEEX;
     else if (strcmp(method, "adrian") == 0)
@@ -1615,7 +1614,7 @@ int pa__init(pa_module*m) {
 
     return 0;
 
- fail:
+fail:
     if (ma)
         pa_modargs_free(ma);
 
diff --git a/src/modules/echo-cancel/speex.c b/src/modules/echo-cancel/speex.c
index 7851510..ce361fc 100644
--- a/src/modules/echo-cancel/speex.c
+++ b/src/modules/echo-cancel/speex.c
@@ -40,7 +40,7 @@ static const char* const valid_modargs[] = {
 };
 
 static void pa_speex_ec_fixate_spec(pa_sample_spec *source_ss, pa_channel_map *source_map,
-				    pa_sample_spec *sink_ss, pa_channel_map *sink_map)
+                                    pa_sample_spec *sink_ss, pa_channel_map *sink_map)
 {
     source_ss->format = PA_SAMPLE_S16NE;
 
@@ -91,7 +91,7 @@ pa_bool_t pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec,
     ec->params.priv.speex.state = speex_echo_state_init_mc (framelen, (rate * filter_size_ms) / 1000, source_ss->channels, source_ss->channels);
 
     if (!ec->params.priv.speex.state)
-	goto fail;
+        goto fail;
 
     speex_echo_ctl(ec->params.priv.speex.state, SPEEX_ECHO_SET_SAMPLING_RATE, &rate);
 
@@ -100,17 +100,15 @@ pa_bool_t pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec,
 
 fail:
     if (ma)
-	pa_modargs_free(ma);
+        pa_modargs_free(ma);
     return FALSE;
 }
 
-void pa_speex_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out)
-{
+void pa_speex_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) {
     speex_echo_cancellation(ec->params.priv.speex.state, (const spx_int16_t *) rec, (const spx_int16_t *) play, (spx_int16_t *) out);
 }
 
-void pa_speex_ec_done(pa_echo_canceller *ec)
-{
-    speex_echo_state_destroy (ec->params.priv.speex.state);
+void pa_speex_ec_done(pa_echo_canceller *ec) {
+    speex_echo_state_destroy(ec->params.priv.speex.state);
     ec->params.priv.speex.state = NULL;
 }
diff --git a/src/modules/jack/module-jackdbus-detect.c b/src/modules/jack/module-jackdbus-detect.c
index f635b23..c3dd7bb 100644
--- a/src/modules/jack/module-jackdbus-detect.c
+++ b/src/modules/jack/module-jackdbus-detect.c
@@ -84,8 +84,7 @@ struct userdata {
 };
 
 
-static void ensure_ports_stopped(struct userdata* u)
-{
+static void ensure_ports_stopped(struct userdata* u) {
     int i;
     pa_assert(u);
 
@@ -97,8 +96,7 @@ static void ensure_ports_stopped(struct userdata* u)
         }
 }
 
-static void ensure_ports_started(struct userdata* u)
-{
+static void ensure_ports_started(struct userdata* u) {
     int i;
     pa_assert(u);
 
@@ -120,8 +118,7 @@ static void ensure_ports_started(struct userdata* u)
 }
 
 
-static pa_bool_t check_service_started(struct userdata* u)
-{
+static pa_bool_t check_service_started(struct userdata* u) {
     DBusError error;
     DBusMessage *m = NULL, *reply = NULL;
     pa_bool_t new_status = FALSE;
@@ -169,8 +166,7 @@ finish:
     return new_status;
 }
 
-static DBusHandlerResult dbus_filter_handler(DBusConnection *c,	DBusMessage *s,	void *userdata)
-{
+static DBusHandlerResult dbus_filter_handler(DBusConnection *c, DBusMessage *s, void *userdata) {
     struct userdata *u = NULL;
     DBusError error;
 
@@ -182,13 +178,11 @@ static DBusHandlerResult dbus_filter_handler(DBusConnection *c,	DBusMessage *s,
 
     if (dbus_message_is_signal(s, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
         const char *name, *old, *new;
-        if (!dbus_message_get_args(
-			    s,
-			    &error,
-			    DBUS_TYPE_STRING, &name,
-			    DBUS_TYPE_STRING, &old,
-			    DBUS_TYPE_STRING, &new,
-			    DBUS_TYPE_INVALID))
+        if (!dbus_message_get_args(s, &error,
+                                   DBUS_TYPE_STRING, &name,
+                                   DBUS_TYPE_STRING, &old,
+                                   DBUS_TYPE_STRING, &new,
+                                   DBUS_TYPE_INVALID))
             goto finish;
         if (strcmp(name, JACK_SERVICE_NAME))
             goto finish;
@@ -211,8 +205,7 @@ finish:
     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
-int pa__init(pa_module *m)
-{
+int pa__init(pa_module *m) {
     DBusError error;
     pa_dbus_connection *connection = NULL;
     struct userdata *u = NULL;
@@ -275,8 +268,7 @@ fail:
     return -1;
 }
 
-void pa__done(pa_module *m)
-{
+void pa__done(pa_module *m) {
     struct userdata *u;
 
     pa_assert(m);
diff --git a/src/modules/module-augment-properties.c b/src/modules/module-augment-properties.c
index 8044b66..2961dd6 100644
--- a/src/modules/module-augment-properties.c
+++ b/src/modules/module-augment-properties.c
@@ -191,9 +191,7 @@ static void update_rule(struct rule *r) {
                     continue;
 
                 pa_xfree(fn);
-                fn = pa_sprintf_malloc(DESKTOPFILEDIR
-                                       PA_PATH_SEP "%s" PA_PATH_SEP "%s.desktop",
-                                       dir->d_name, r->process_name);
+                fn = pa_sprintf_malloc(DESKTOPFILEDIR PA_PATH_SEP "%s" PA_PATH_SEP "%s.desktop", dir->d_name, r->process_name);
 
                 if (stat(fn, &st) == 0) {
                     found = TRUE;
diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c
index 3104ed6..ab93c05 100644
--- a/src/modules/module-combine.c
+++ b/src/modules/module-combine.c
@@ -557,7 +557,7 @@ static int sink_input_process_msg(pa_msgobject *obj, int code, void *data, int64
     switch (code) {
 
         case PA_SINK_INPUT_MESSAGE_GET_LATENCY: {
-             pa_usec_t *r = data;
+            pa_usec_t *r = data;
 
             *r = pa_bytes_to_usec(pa_memblockq_get_length(o->memblockq), &o->sink_input->sample_spec);
 
diff --git a/src/modules/module-console-kit.c b/src/modules/module-console-kit.c
index 875852f..d52cc24 100644
--- a/src/modules/module-console-kit.c
+++ b/src/modules/module-console-kit.c
@@ -77,7 +77,7 @@ static void add_session(struct userdata *u, const char *id) {
     struct session *session;
     pa_client_new_data data;
 
-    dbus_error_init (&error);
+    dbus_error_init(&error);
 
     if (pa_hashmap_get(u->sessions, id)) {
         pa_log_warn("Duplicate session %s, ignoring.", id);
diff --git a/src/modules/module-detect.c b/src/modules/module-detect.c
index 1fe8eb8..2a90eb6 100644
--- a/src/modules/module-detect.c
+++ b/src/modules/module-detect.c
@@ -144,7 +144,7 @@ static int detect_oss(pa_core *c, int just_one) {
         line[strcspn(line, "\r\n")] = 0;
 
         if (!b) {
-             b = strcmp(line, "Audio devices:") == 0 || strcmp(line, "Installed devices:") == 0;
+            b = strcmp(line, "Audio devices:") == 0 || strcmp(line, "Installed devices:") == 0;
             continue;
         }
 
diff --git a/src/modules/module-device-manager.c b/src/modules/module-device-manager.c
index eda6787..73b86a2 100644
--- a/src/modules/module-device-manager.c
+++ b/src/modules/module-device-manager.c
@@ -1174,7 +1174,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
             goto fail;
 
         if (PA_INVALID_INDEX == (role_index = get_role_index(role)))
-           goto fail;
+            goto fail;
 
         /* Cycle through the devices given and make sure they exist */
         h = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
@@ -1209,9 +1209,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
             if (first) {
                 first = FALSE;
                 sink_mode = (0 == strncmp("sink:", s, 5));
-            } else if ((sink_mode && 0 != strncmp("sink:", s, 5))
-                       || (!sink_mode && 0 != strncmp("source:", s, 7)))
-            {
+            } else if ((sink_mode && 0 != strncmp("sink:", s, 5)) || (!sink_mode && 0 != strncmp("source:", s, 7))) {
                 while ((device = pa_hashmap_steal_first(h))) {
                     pa_xfree(device->device);
                     pa_xfree(device);
diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index 8cabf71..9a8640b 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -437,9 +437,9 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in
     switch (code) {
 
         case PA_SINK_INPUT_MESSAGE_GET_LATENCY: {
-             pa_usec_t *r = data;
+            pa_usec_t *r = data;
 
-             pa_sink_input_assert_io_context(u->sink_input);
+            pa_sink_input_assert_io_context(u->sink_input);
 
             *r = pa_bytes_to_usec(pa_memblockq_get_length(u->memblockq), &u->sink_input->sample_spec);
 
diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index 4ed91aa..b1158d3 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -362,7 +362,7 @@ void pa__done(pa_module*m) {
         pa_sink_unref(u->sink);
 
     if (u->memchunk.memblock)
-       pa_memblock_unref(u->memchunk.memblock);
+        pa_memblock_unref(u->memchunk.memblock);
 
     if (u->rtpoll_item)
         pa_rtpoll_item_free(u->rtpoll_item);
diff --git a/src/modules/module-rygel-media-server.c b/src/modules/module-rygel-media-server.c
index 76b485c..9d23e8a 100644
--- a/src/modules/module-rygel-media-server.c
+++ b/src/modules/module-rygel-media-server.c
@@ -723,10 +723,7 @@ static DBusHandlerResult root_handler(DBusConnection *c, DBusMessage *m, void *u
         const char *xml = ROOT_INTROSPECT_XML;
 
         pa_assert_se(r = dbus_message_new_method_return(m));
-        pa_assert_se(dbus_message_append_args(
-                             r,
-                             DBUS_TYPE_STRING, &xml,
-                             DBUS_TYPE_INVALID));
+        pa_assert_se(dbus_message_append_args(r, DBUS_TYPE_STRING, &xml, DBUS_TYPE_INVALID));
 
     } else
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@@ -938,10 +935,7 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag
             xml = pa_strbuf_tostring_free(sb);
 
             pa_assert_se(r = dbus_message_new_method_return(m));
-            pa_assert_se(dbus_message_append_args(
-                                 r,
-                                 DBUS_TYPE_STRING, &xml,
-                                 DBUS_TYPE_INVALID));
+            pa_assert_se(dbus_message_append_args(r, DBUS_TYPE_STRING, &xml, DBUS_TYPE_INVALID));
 
             pa_xfree(xml);
         } else
@@ -1012,10 +1006,7 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag
                 ITEM_INTROSPECT_XML;
 
             pa_assert_se(r = dbus_message_new_method_return(m));
-            pa_assert_se(dbus_message_append_args(
-                                 r,
-                                 DBUS_TYPE_STRING, &xml,
-                                 DBUS_TYPE_INVALID));
+            pa_assert_se(dbus_message_append_args(r, DBUS_TYPE_STRING, &xml, DBUS_TYPE_INVALID));
 
         } else
             return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c
index 5c1a86c..ee06b3b 100644
--- a/src/modules/module-solaris.c
+++ b/src/modules/module-solaris.c
@@ -307,8 +307,8 @@ static int auto_format(int fd, int mode, pa_sample_spec *ss) {
             info.record.encoding = AUDIO_ENCODING_LINEAR;
             break;
         default:
-             pa_log("AUDIO_SETINFO: Unsupported sample format.");
-             return -1;
+            pa_log("AUDIO_SETINFO: Unsupported sample format.");
+            return -1;
         }
     }
 
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index 176c2c0..f0c254b 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -379,7 +379,7 @@ static void command_stream_buffer_attr_changed(pa_pdispatch *pd, uint32_t comman
 
 /* Called from main context */
 static void command_started(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
-   struct userdata *u = userdata;
+    struct userdata *u = userdata;
 
     pa_assert(pd);
     pa_assert(t);
@@ -973,8 +973,7 @@ static void server_info_cb(pa_pdispatch *pd, uint32_t command,  uint32_t tag, pa
         pa_tagstruct_gets(t, &default_sink_name) < 0 ||
         pa_tagstruct_gets(t, &default_source_name) < 0 ||
         pa_tagstruct_getu32(t, &cookie) < 0 ||
-        (u->version >= 15 &&
-         pa_tagstruct_get_channel_map(t, &cm) < 0)) {
+        (u->version >= 15 && pa_tagstruct_get_channel_map(t, &cm) < 0)) {
 
         pa_log("Parse failure");
         goto fail;
diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c
index 1eaa84f..63ad195 100644
--- a/src/modules/module-udev-detect.c
+++ b/src/modules/module-udev-detect.c
@@ -442,8 +442,7 @@ static void process_device(struct userdata *u, struct udev_device *dev) {
 
     if (action && pa_streq(action, "remove"))
         remove_card(u, dev);
-    else if ((!action || pa_streq(action, "change")) &&
-             udev_device_get_property_value(dev, "SOUND_INITIALIZED"))
+    else if ((!action || pa_streq(action, "change")) && udev_device_get_property_value(dev, "SOUND_INITIALIZED"))
         card_changed(u, dev);
 
     /* For an explanation why we don't look for 'add' events here
diff --git a/src/modules/module-virtual-sink.c b/src/modules/module-virtual-sink.c
index 58ea932..cc13490 100644
--- a/src/modules/module-virtual-sink.c
+++ b/src/modules/module-virtual-sink.c
@@ -620,7 +620,7 @@ int pa__init(pa_module*m) {
 
     return 0;
 
- fail:
+fail:
     if (ma)
         pa_modargs_free(ma);
 
diff --git a/src/modules/module-virtual-source.c b/src/modules/module-virtual-source.c
index d7e1c21..b8f2ab0 100644
--- a/src/modules/module-virtual-source.c
+++ b/src/modules/module-virtual-source.c
@@ -715,7 +715,7 @@ int pa__init(pa_module*m) {
 
     return 0;
 
- fail:
+fail:
     if (ma)
         pa_modargs_free(ma);
 
@@ -763,7 +763,7 @@ void pa__done(pa_module*m) {
         pa_memblockq_free(u->memblockq);
 
     if (u->sink_memblockq)
-         pa_memblockq_free(u->sink_memblockq);
+        pa_memblockq_free(u->sink_memblockq);
 
     pa_xfree(u);
 }
diff --git a/src/modules/oss/module-oss.c b/src/modules/oss/module-oss.c
index c9dc4e7..84dbbda 100644
--- a/src/modules/oss/module-oss.c
+++ b/src/modules/oss/module-oss.c
@@ -169,7 +169,7 @@ static void trigger(struct userdata *u, pa_bool_t quick) {
     if (u->fd < 0)
         return;
 
-     pa_log_debug("trigger");
+    pa_log_debug("trigger");
 
     if (u->source && PA_SOURCE_IS_OPENED(u->source->thread_info.state))
         enable_bits |= PCM_ENABLE_INPUT;
diff --git a/src/modules/raop/base64.c b/src/modules/raop/base64.c
index 5b06103..37e4762 100644
--- a/src/modules/raop/base64.c
+++ b/src/modules/raop/base64.c
@@ -38,8 +38,7 @@
 static const char base64_chars[] =
     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
-static int pos(char c)
-{
+static int pos(char c) {
     if (c >= 'A' && c <= 'Z') return c - 'A' + 0;
     if (c >= 'a' && c <= 'z') return c - 'a' + 26;
     if (c >= '0' && c <= '9') return c - '0' + 52;
@@ -48,8 +47,7 @@ static int pos(char c)
     return -1;
 }
 
-int pa_base64_encode(const void *data, int size, char **str)
-{
+int pa_base64_encode(const void *data, int size, char **str) {
     char *s, *p;
     int i;
     int c;
@@ -84,8 +82,7 @@ int pa_base64_encode(const void *data, int size, char **str)
 
 #define DECODE_ERROR 0xffffffff
 
-static unsigned int token_decode(const char *token)
-{
+static unsigned int token_decode(const char *token) {
     int i;
     unsigned int val = 0;
     int marker = 0;
@@ -109,8 +106,7 @@ static unsigned int token_decode(const char *token)
     return (marker << 24) | val;
 }
 
-int pa_base64_decode(const char *str, void *data)
-{
+int pa_base64_decode(const char *str, void *data) {
     const char *p;
     unsigned char *q;
 
diff --git a/src/modules/raop/raop_client.c b/src/modules/raop/raop_client.c
index e3152dd..68ddabe 100644
--- a/src/modules/raop/raop_client.c
+++ b/src/modules/raop/raop_client.c
@@ -174,8 +174,7 @@ static int rsa_encrypt(uint8_t *text, int len, uint8_t *res) {
     return size;
 }
 
-static int aes_encrypt(pa_raop_client* c, uint8_t *data, int size)
-{
+static int aes_encrypt(pa_raop_client* c, uint8_t *data, int size) {
     uint8_t *buf;
     int i=0, j;
 
@@ -194,8 +193,7 @@ static int aes_encrypt(pa_raop_client* c, uint8_t *data, int size)
     return i;
 }
 
-static inline void rtrimchar(char *str, char rc)
-{
+static inline void rtrimchar(char *str, char rc) {
     char *sp = str + strlen(str) - 1;
     while (sp >= str && *sp == rc) {
         *sp = '\0';
@@ -232,8 +230,7 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata
     c->callback(c->fd, c->userdata);
 }
 
-static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* headers, void *userdata)
-{
+static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* headers, void *userdata) {
     pa_raop_client* c = userdata;
     pa_assert(c);
     pa_assert(rtsp);
@@ -368,8 +365,7 @@ static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* he
     }
 }
 
-pa_raop_client* pa_raop_client_new(pa_core *core, const char* host)
-{
+pa_raop_client* pa_raop_client_new(pa_core *core, const char* host) {
     pa_raop_client* c = pa_xnew0(pa_raop_client, 1);
 
     pa_assert(core);
@@ -387,8 +383,7 @@ pa_raop_client* pa_raop_client_new(pa_core *core, const char* host)
 }
 
 
-void pa_raop_client_free(pa_raop_client* c)
-{
+void pa_raop_client_free(pa_raop_client* c) {
     pa_assert(c);
 
     if (c->rtsp)
@@ -398,8 +393,7 @@ void pa_raop_client_free(pa_raop_client* c)
 }
 
 
-int pa_raop_connect(pa_raop_client* c)
-{
+int pa_raop_connect(pa_raop_client* c) {
     char *sci;
     struct {
         uint32_t a;
@@ -433,8 +427,7 @@ int pa_raop_connect(pa_raop_client* c)
 }
 
 
-int pa_raop_flush(pa_raop_client* c)
-{
+int pa_raop_flush(pa_raop_client* c) {
     pa_assert(c);
 
     pa_rtsp_flush(c->rtsp, c->seq, c->rtptime);
@@ -442,8 +435,7 @@ int pa_raop_flush(pa_raop_client* c)
 }
 
 
-int pa_raop_client_set_volume(pa_raop_client* c, pa_volume_t volume)
-{
+int pa_raop_client_set_volume(pa_raop_client* c, pa_volume_t volume) {
     int rv;
     double db;
     char *param;
@@ -465,8 +457,7 @@ int pa_raop_client_set_volume(pa_raop_client* c, pa_volume_t volume)
 }
 
 
-int pa_raop_client_encode_sample(pa_raop_client* c, pa_memchunk* raw, pa_memchunk* encoded)
-{
+int pa_raop_client_encode_sample(pa_raop_client* c, pa_memchunk* raw, pa_memchunk* encoded) {
     uint16_t len;
     size_t bufmax;
     uint8_t *bp, bpos;
@@ -548,16 +539,14 @@ int pa_raop_client_encode_sample(pa_raop_client* c, pa_memchunk* raw, pa_memchun
 }
 
 
-void pa_raop_client_set_callback(pa_raop_client* c, pa_raop_client_cb_t callback, void *userdata)
-{
+void pa_raop_client_set_callback(pa_raop_client* c, pa_raop_client_cb_t callback, void *userdata) {
     pa_assert(c);
 
     c->callback = callback;
     c->userdata = userdata;
 }
 
-void pa_raop_client_set_closed_callback(pa_raop_client* c, pa_raop_client_closed_cb_t callback, void *userdata)
-{
+void pa_raop_client_set_closed_callback(pa_raop_client* c, pa_raop_client_closed_cb_t callback, void *userdata) {
     pa_assert(c);
 
     c->closed_callback = callback;
diff --git a/src/modules/rtp/rtsp_client.c b/src/modules/rtp/rtsp_client.c
index 6094eb8..72702cb 100644
--- a/src/modules/rtp/rtsp_client.c
+++ b/src/modules/rtp/rtsp_client.c
@@ -372,8 +372,7 @@ void pa_rtsp_set_url(pa_rtsp_client* c, const char* url) {
     c->url = pa_xstrdup(url);
 }
 
-void pa_rtsp_add_header(pa_rtsp_client *c, const char* key, const char* value)
-{
+void pa_rtsp_add_header(pa_rtsp_client *c, const char* key, const char* value) {
     pa_assert(c);
     pa_assert(key);
     pa_assert(value);
@@ -381,8 +380,7 @@ void pa_rtsp_add_header(pa_rtsp_client *c, const char* key, const char* value)
     pa_headerlist_puts(c->headers, key, value);
 }
 
-void pa_rtsp_remove_header(pa_rtsp_client *c, const char* key)
-{
+void pa_rtsp_remove_header(pa_rtsp_client *c, const char* key) {
     pa_assert(c);
     pa_assert(key);
 
diff --git a/src/pulse/glib-mainloop.c b/src/pulse/glib-mainloop.c
index 6afb7a2..637c5ea 100644
--- a/src/pulse/glib-mainloop.c
+++ b/src/pulse/glib-mainloop.c
@@ -336,7 +336,7 @@ static void glib_time_restart(pa_time_event*e, const struct timeval *tv) {
             e->mainloop->cached_next_time_event = e;
     } else if (e->mainloop->cached_next_time_event == e)
         e->mainloop->cached_next_time_event = NULL;
- }
+}
 
 static void glib_time_free(pa_time_event *e) {
     g_assert(e);
diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index addc36a..ea468a5 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -790,7 +790,7 @@ void pa_command_overflow_or_underflow(pa_pdispatch *pd, uint32_t command, uint32
             s->underflow_callback(s, s->underflow_userdata);
     }
 
- finish:
+finish:
     pa_context_unref(c);
 }
 
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 02e9bf6..bb0f560 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -217,12 +217,12 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
 #ifdef OS_IS_WIN32
     r = mkdir(dir);
 #else
-    {
+{
     mode_t u;
     u = umask((~m) & 0777);
     r = mkdir(dir, m);
     umask(u);
-    }
+}
 #endif
 
     if (r < 0 && errno != EEXIST)
@@ -1043,8 +1043,7 @@ static int is_group(gid_t gid, const char *name) {
     int r = -1;
 
     errno = 0;
-    if (!(group = pa_getgrgid_malloc(gid)))
-    {
+    if (!(group = pa_getgrgid_malloc(gid))) {
         if (!errno)
             errno = ENOENT;
 
@@ -1110,8 +1109,7 @@ int pa_uid_in_group(uid_t uid, const char *name) {
     int r = -1;
 
     errno = 0;
-    if (!(group = pa_getgrnam_malloc(name)))
-    {
+    if (!(group = pa_getgrnam_malloc(name))) {
         if (!errno)
             errno = ENOENT;
         goto finish;
@@ -1146,8 +1144,7 @@ gid_t pa_get_gid_of_group(const char *name) {
     struct group *gr = NULL;
 
     errno = 0;
-    if (!(gr = pa_getgrnam_malloc(name)))
-    {
+    if (!(gr = pa_getgrnam_malloc(name))) {
         if (!errno)
             errno = ENOENT;
         goto finish;
diff --git a/src/pulsecore/cpu-arm.c b/src/pulsecore/cpu-arm.c
index 1d0d765..781ad37 100644
--- a/src/pulsecore/cpu-arm.c
+++ b/src/pulsecore/cpu-arm.c
@@ -39,22 +39,22 @@
 
 #define MAX_BUFFER  4096
 static char *
-get_cpuinfo_line (char *cpuinfo, const char *tag) {
+get_cpuinfo_line(char *cpuinfo, const char *tag) {
     char *line, *end, *colon;
 
-    if (!(line = strstr (cpuinfo, tag)))
+    if (!(line = strstr(cpuinfo, tag)))
         return NULL;
 
-    if (!(end = strchr (line, '\n')))
+    if (!(end = strchr(line, '\n')))
         return NULL;
 
-    if (!(colon = strchr (line, ':')))
+    if (!(colon = strchr(line, ':')))
         return NULL;
 
     if (++colon >= end)
         return NULL;
 
-    return pa_xstrndup (colon, end - colon);
+    return pa_xstrndup(colon, end - colon);
 }
 
 static char *get_cpuinfo(void) {
@@ -80,7 +80,7 @@ static char *get_cpuinfo(void) {
 }
 #endif /* defined (__arm__) && defined (__linux__) */
 
-pa_bool_t pa_cpu_init_arm (pa_cpu_arm_flag_t *flags) {
+pa_bool_t pa_cpu_init_arm(pa_cpu_arm_flag_t *flags) {
 #if defined (__arm__)
 #if defined (__linux__)
     char *cpuinfo, *line;
@@ -88,16 +88,16 @@ pa_bool_t pa_cpu_init_arm (pa_cpu_arm_flag_t *flags) {
 
     /* We need to read the CPU flags from /proc/cpuinfo because there is no user
      * space support to get the CPU features. This only works on linux AFAIK. */
-    if (!(cpuinfo = get_cpuinfo ())) {
-        pa_log ("Can't read cpuinfo");
+    if (!(cpuinfo = get_cpuinfo())) {
+        pa_log("Can't read cpuinfo");
         return;
     }
 
     *flags = 0;
 
     /* get the CPU architecture */
-    if ((line = get_cpuinfo_line (cpuinfo, "CPU architecture"))) {
-        arch = strtoul (line, NULL, 0);
+    if ((line = get_cpuinfo_line(cpuinfo, "CPU architecture"))) {
+        arch = strtoul(line, NULL, 0);
         if (arch >= 6)
             *flags |= PA_CPU_ARM_V6;
         if (arch >= 7)
@@ -106,18 +106,18 @@ pa_bool_t pa_cpu_init_arm (pa_cpu_arm_flag_t *flags) {
         pa_xfree(line);
     }
     /* get the CPU features */
-    if ((line = get_cpuinfo_line (cpuinfo, "Features"))) {
+    if ((line = get_cpuinfo_line(cpuinfo, "Features"))) {
         const char *state = NULL;
         char *current;
 
-        while ((current = pa_split_spaces (line, &state))) {
-            if (!strcmp (current, "vfp"))
+        while ((current = pa_split_spaces(line, &state))) {
+            if (!strcmp(current, "vfp"))
                 *flags |= PA_CPU_ARM_VFP;
-            else if (!strcmp (current, "edsp"))
+            else if (!strcmp(current, "edsp"))
                 *flags |= PA_CPU_ARM_EDSP;
-            else if (!strcmp (current, "neon"))
+            else if (!strcmp(current, "neon"))
                 *flags |= PA_CPU_ARM_NEON;
-            else if (!strcmp (current, "vfpv3"))
+            else if (!strcmp(current, "vfpv3"))
                 *flags |= PA_CPU_ARM_VFPV3;
 
             pa_xfree(current);
@@ -125,7 +125,7 @@ pa_bool_t pa_cpu_init_arm (pa_cpu_arm_flag_t *flags) {
     }
     pa_xfree(cpuinfo);
 
-    pa_log_info ("CPU flags: %s%s%s%s%s%s",
+    pa_log_info("CPU flags: %s%s%s%s%s%s",
           (*flags & PA_CPU_ARM_V6) ? "V6 " : "",
           (*flags & PA_CPU_ARM_V7) ? "V7 " : "",
           (*flags & PA_CPU_ARM_VFP) ? "VFP " : "",
@@ -134,7 +134,7 @@ pa_bool_t pa_cpu_init_arm (pa_cpu_arm_flag_t *flags) {
           (*flags & PA_CPU_ARM_VFPV3) ? "VFPV3 " : "");
 
     if (*flags & PA_CPU_ARM_V6)
-        pa_volume_func_init_arm (*flags);
+        pa_volume_func_init_arm(*flags);
 
     return TRUE;
 
diff --git a/src/pulsecore/cpu-x86.c b/src/pulsecore/cpu-x86.c
index 062a4c1..05a4b2f 100644
--- a/src/pulsecore/cpu-x86.c
+++ b/src/pulsecore/cpu-x86.c
@@ -31,9 +31,7 @@
 #include "cpu-x86.h"
 
 #if defined (__i386__) || defined (__amd64__)
-static void
-get_cpuid (uint32_t op, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
-{
+static void get_cpuid(uint32_t op, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d) {
     __asm__ __volatile__ (
         "  push %%"PA_REG_b"   \n\t"
         "  cpuid               \n\t"
@@ -46,7 +44,7 @@ get_cpuid (uint32_t op, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
 }
 #endif
 
-pa_bool_t pa_cpu_init_x86 (pa_cpu_x86_flag_t *flags) {
+pa_bool_t pa_cpu_init_x86(pa_cpu_x86_flag_t *flags) {
 #if defined (__i386__) || defined (__amd64__)
     uint32_t eax, ebx, ecx, edx;
     uint32_t level;
@@ -54,9 +52,9 @@ pa_bool_t pa_cpu_init_x86 (pa_cpu_x86_flag_t *flags) {
     *flags = 0;
 
     /* get standard level */
-    get_cpuid (0x00000000, &level, &ebx, &ecx, &edx);
+    get_cpuid(0x00000000, &level, &ebx, &ecx, &edx);
     if (level >= 1) {
-        get_cpuid (0x00000001, &eax, &ebx, &ecx, &edx);
+        get_cpuid(0x00000001, &eax, &ebx, &ecx, &edx);
 
         if (edx & (1<<15))
           *flags |= PA_CPU_X86_CMOV;
@@ -84,9 +82,9 @@ pa_bool_t pa_cpu_init_x86 (pa_cpu_x86_flag_t *flags) {
     }
 
     /* get extended level */
-    get_cpuid (0x80000000, &level, &ebx, &ecx, &edx);
+    get_cpuid(0x80000000, &level, &ebx, &ecx, &edx);
     if (level >= 0x80000001) {
-        get_cpuid (0x80000001, &eax, &ebx, &ecx, &edx);
+        get_cpuid(0x80000001, &eax, &ebx, &ecx, &edx);
 
         if (edx & (1<<22))
           *flags |= PA_CPU_X86_MMXEXT;
@@ -101,7 +99,7 @@ pa_bool_t pa_cpu_init_x86 (pa_cpu_x86_flag_t *flags) {
           *flags |= PA_CPU_X86_3DNOW;
     }
 
-    pa_log_info ("CPU flags: %s%s%s%s%s%s%s%s%s%s%s",
+    pa_log_info("CPU flags: %s%s%s%s%s%s%s%s%s%s%s",
     (*flags & PA_CPU_X86_CMOV) ? "CMOV " : "",
     (*flags & PA_CPU_X86_MMX) ? "MMX " : "",
     (*flags & PA_CPU_X86_SSE) ? "SSE " : "",
@@ -116,14 +114,14 @@ pa_bool_t pa_cpu_init_x86 (pa_cpu_x86_flag_t *flags) {
 
     /* activate various optimisations */
     if (*flags & PA_CPU_X86_MMX) {
-        pa_volume_func_init_mmx (*flags);
-        pa_remap_func_init_mmx (*flags);
+        pa_volume_func_init_mmx(*flags);
+        pa_remap_func_init_mmx(*flags);
     }
 
     if (*flags & (PA_CPU_X86_SSE | PA_CPU_X86_SSE2)) {
-        pa_volume_func_init_sse (*flags);
-        pa_remap_func_init_sse (*flags);
-        pa_convert_func_init_sse (*flags);
+        pa_volume_func_init_sse(*flags);
+        pa_remap_func_init_sse(*flags);
+        pa_convert_func_init_sse(*flags);
     }
 
     return TRUE;
diff --git a/src/pulsecore/database-simple.c b/src/pulsecore/database-simple.c
index 754930d..237d0bd 100644
--- a/src/pulsecore/database-simple.c
+++ b/src/pulsecore/database-simple.c
@@ -429,7 +429,7 @@ static int write_uint(FILE *f, const uint32_t num) {
     errno = 0;
 
     for (i = 0; i < 4; i++)
-         values[i] = (num >> (i*8)) & 0xFF;
+        values[i] = (num >> (i*8)) & 0xFF;
 
     items = fwrite(&values, sizeof(values), sizeof(uint8_t), f);
 
diff --git a/src/pulsecore/ipacl.c b/src/pulsecore/ipacl.c
index 0cbe34a..ba35640 100644
--- a/src/pulsecore/ipacl.c
+++ b/src/pulsecore/ipacl.c
@@ -212,7 +212,7 @@ int pa_ip_acl_check(pa_ip_acl *acl, int fd) {
                 return 1;
 #ifdef HAVE_IPV6
         } else if (e->family == AF_INET6) {
-            int i, bits ;
+            int i, bits;
             struct sockaddr_in6 *sai = (struct sockaddr_in6*) &sa;
 
             if (e->bits == 128)
diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index 454900d..ce8b254 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -531,9 +531,7 @@ static void memblock_free(pa_memblock *b) {
 
             pa_mutex_lock(import->mutex);
 
-            pa_assert_se(pa_hashmap_remove(
-                                 import->blocks,
-                                 PA_UINT32_TO_PTR(b->per_type.imported.id)));
+            pa_assert_se(pa_hashmap_remove(import->blocks, PA_UINT32_TO_PTR(b->per_type.imported.id)));
 
             pa_assert(segment->n_blocks >= 1);
             if (-- segment->n_blocks <= 0)
@@ -693,9 +691,7 @@ static void memblock_replace_import(pa_memblock *b) {
 
     pa_mutex_lock(import->mutex);
 
-    pa_assert_se(pa_hashmap_remove(
-                         import->blocks,
-                         PA_UINT32_TO_PTR(b->per_type.imported.id)));
+    pa_assert_se(pa_hashmap_remove(import->blocks, PA_UINT32_TO_PTR(b->per_type.imported.id)));
 
     memblock_make_local(b);
 
diff --git a/src/pulsecore/memblockq.c b/src/pulsecore/memblockq.c
index 11faeda..c76ca84 100644
--- a/src/pulsecore/memblockq.c
+++ b/src/pulsecore/memblockq.c
@@ -376,8 +376,8 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) {
             size_t d;
 
             pa_assert(bq->write_index + (int64_t)chunk.length > q->index &&
-                   bq->write_index + (int64_t)chunk.length < q->index + (int64_t)q->chunk.length &&
-                   bq->write_index < q->index);
+                      bq->write_index + (int64_t)chunk.length < q->index + (int64_t)q->chunk.length &&
+                      bq->write_index < q->index);
 
             /* The job overwrites the current entry at the end, so let's drop the beginning of this entry */
 
diff --git a/src/pulsecore/poll.c b/src/pulsecore/poll.c
index b993c47..df4feb0 100644
--- a/src/pulsecore/poll.c
+++ b/src/pulsecore/poll.c
@@ -105,7 +105,7 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) {
     tv.tv_sec = timeout / 1000;
     tv.tv_usec = (timeout % 1000) * 1000;
 
-    ready = select ((SELECT_TYPE_ARG1) maxfd + 1, SELECT_TYPE_ARG234 &rset,
+    ready = select((SELECT_TYPE_ARG1) maxfd + 1, SELECT_TYPE_ARG234 &rset,
                     SELECT_TYPE_ARG234 &wset, SELECT_TYPE_ARG234 &xset,
                     SELECT_TYPE_ARG5 (timeout == -1 ? NULL : &tv));
 
@@ -160,7 +160,7 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) {
         /* Linux alters the tv struct... but it shouldn't matter here ...
          * as we're going to be a little bit out anyway as we've just eaten
          * more than a couple of cpu cycles above */
-            ready = select ((SELECT_TYPE_ARG1) maxfd + 1, SELECT_TYPE_ARG234 &rset,
+            ready = select((SELECT_TYPE_ARG1) maxfd + 1, SELECT_TYPE_ARG234 &rset,
                             SELECT_TYPE_ARG234 &wset, SELECT_TYPE_ARG234 &xset,
                             SELECT_TYPE_ARG5 (timeout == -1 ? NULL : &tv));
         }
diff --git a/src/pulsecore/poll.h b/src/pulsecore/poll.h
index a137d97..dc741e5 100644
--- a/src/pulsecore/poll.h
+++ b/src/pulsecore/poll.h
@@ -43,12 +43,11 @@
 #define POLLNVAL        0x020           /* Invalid polling request.  */
 
 /* Data structure describing a polling request.  */
-struct pollfd
-  {
+struct pollfd {
     int fd;                     /* File descriptor to poll.  */
     short int events;           /* Types of events poller cares about.  */
     short int revents;          /* Types of events that actually occurred.  */
-  };
+};
 
 
 /* Poll the file descriptors described by the NFDS structures starting at
@@ -62,5 +61,5 @@ struct pollfd
 #if defined(HAVE_POLL_H) && !defined(OS_IS_DARWIN)
 #define pa_poll(fds,nfds,timeout) poll((fds),(nfds),(timeout))
 #else
-int pa_poll (struct pollfd *fds, unsigned long nfds, int timeout);
+int pa_poll(struct pollfd *fds, unsigned long nfds, int timeout);
 #endif
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index c812a3e..82007e8 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -1387,7 +1387,7 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int
 
             /* If more data is in queue, we rewind later instead. */
             if (s->seek_windex != -1)
-                 windex = PA_MIN(windex, s->seek_windex);
+                windex = PA_MIN(windex, s->seek_windex);
             if (pa_atomic_dec(&s->seek_or_post_in_queue) > 1)
                 s->seek_windex = windex;
             else {
@@ -1406,7 +1406,7 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int
             pa_sink_input *isync;
             void (*func)(pa_memblockq *bq);
 
-            switch  (code) {
+            switch (code) {
                 case SINK_INPUT_MESSAGE_FLUSH:
                     func = flush_write_no_account;
                     break;
@@ -4939,7 +4939,7 @@ pa_pstream* pa_native_connection_get_pstream(pa_native_connection *c) {
 }
 
 pa_client* pa_native_connection_get_client(pa_native_connection *c) {
-   pa_native_connection_assert_ref(c);
+    pa_native_connection_assert_ref(c);
 
-   return c->client;
+    return c->client;
 }
diff --git a/src/pulsecore/remap.c b/src/pulsecore/remap.c
index a0fc85b..b831f78 100644
--- a/src/pulsecore/remap.c
+++ b/src/pulsecore/remap.c
@@ -32,7 +32,7 @@
 
 #include "remap.h"
 
-static void remap_mono_to_stereo_c (pa_remap_t *m, void *dst, const void *src, unsigned n) {
+static void remap_mono_to_stereo_c(pa_remap_t *m, void *dst, const void *src, unsigned n) {
     unsigned i;
 
     switch (*m->format) {
@@ -85,7 +85,7 @@ static void remap_mono_to_stereo_c (pa_remap_t *m, void *dst, const void *src, u
     }
 }
 
-static void remap_channels_matrix_c (pa_remap_t *m, void *dst, const void *src, unsigned n) {
+static void remap_channels_matrix_c(pa_remap_t *m, void *dst, const void *src, unsigned n) {
     unsigned oc, ic, i;
     unsigned n_ic, n_oc;
 
@@ -97,7 +97,7 @@ static void remap_channels_matrix_c (pa_remap_t *m, void *dst, const void *src,
         {
             float *d, *s;
 
-            memset(dst, 0, n * sizeof (float) * n_oc);
+            memset(dst, 0, n * sizeof(float) * n_oc);
 
             for (oc = 0; oc < n_oc; oc++) {
 
@@ -128,7 +128,7 @@ static void remap_channels_matrix_c (pa_remap_t *m, void *dst, const void *src,
         {
             int16_t *d, *s;
 
-            memset(dst, 0, n * sizeof (int16_t) * n_oc);
+            memset(dst, 0, n * sizeof(int16_t) * n_oc);
 
             for (oc = 0; oc < n_oc; oc++) {
 
@@ -160,7 +160,7 @@ static void remap_channels_matrix_c (pa_remap_t *m, void *dst, const void *src,
 }
 
 /* set the function that will execute the remapping based on the matrices */
-static void init_remap_c (pa_remap_t *m) {
+static void init_remap_c(pa_remap_t *m) {
     unsigned n_oc, n_ic;
 
     n_oc = m->o_ss->channels;
@@ -181,17 +181,17 @@ static void init_remap_c (pa_remap_t *m) {
 /* default C implementation */
 static pa_init_remap_func_t remap_func = init_remap_c;
 
-void pa_init_remap (pa_remap_t *m) {
-    pa_assert (remap_func);
+void pa_init_remap(pa_remap_t *m) {
+    pa_assert(remap_func);
 
     m->do_remap = NULL;
 
     /* call the installed remap init function */
-    remap_func (m);
+    remap_func(m);
 
     if (m->do_remap == NULL) {
         /* nothing was installed, fallback to C version */
-        init_remap_c (m);
+        init_remap_c(m);
     }
 }
 
diff --git a/src/pulsecore/remap_mmx.c b/src/pulsecore/remap_mmx.c
index d358a58..37d72da 100644
--- a/src/pulsecore/remap_mmx.c
+++ b/src/pulsecore/remap_mmx.c
@@ -103,7 +103,7 @@
                 " emms                          \n\t"
 
 #if defined (__i386__) || defined (__amd64__)
-static void remap_mono_to_stereo_mmx (pa_remap_t *m, void *dst, const void *src, unsigned n) {
+static void remap_mono_to_stereo_mmx(pa_remap_t *m, void *dst, const void *src, unsigned n) {
     pa_reg_x86 temp, temp2;
 
     switch (*m->format) {
@@ -133,7 +133,7 @@ static void remap_mono_to_stereo_mmx (pa_remap_t *m, void *dst, const void *src,
 }
 
 /* set the function that will execute the remapping based on the matrices */
-static void init_remap_mmx (pa_remap_t *m) {
+static void init_remap_mmx(pa_remap_t *m) {
     unsigned n_oc, n_ic;
 
     n_oc = m->o_ss->channels;
@@ -148,13 +148,13 @@ static void init_remap_mmx (pa_remap_t *m) {
 }
 #endif /* defined (__i386__) || defined (__amd64__) */
 
-void pa_remap_func_init_mmx (pa_cpu_x86_flag_t flags) {
+void pa_remap_func_init_mmx(pa_cpu_x86_flag_t flags) {
 #if defined (__i386__) || defined (__amd64__)
 
     if (flags & PA_CPU_X86_MMX) {
         pa_log_info("Initialising MMX optimized remappers.");
 
-        pa_set_init_remap_func ((pa_init_remap_func_t) init_remap_mmx);
+        pa_set_init_remap_func((pa_init_remap_func_t) init_remap_mmx);
     }
 
 #endif /* defined (__i386__) || defined (__amd64__) */
diff --git a/src/pulsecore/remap_sse.c b/src/pulsecore/remap_sse.c
index 0ccf316..e1cb161 100644
--- a/src/pulsecore/remap_sse.c
+++ b/src/pulsecore/remap_sse.c
@@ -102,7 +102,7 @@
                 "4:                             \n\t"
 
 #if defined (__i386__) || defined (__amd64__)
-static void remap_mono_to_stereo_sse2 (pa_remap_t *m, void *dst, const void *src, unsigned n) {
+static void remap_mono_to_stereo_sse2(pa_remap_t *m, void *dst, const void *src, unsigned n) {
     pa_reg_x86 temp, temp2;
 
     switch (*m->format) {
@@ -132,7 +132,7 @@ static void remap_mono_to_stereo_sse2 (pa_remap_t *m, void *dst, const void *src
 }
 
 /* set the function that will execute the remapping based on the matrices */
-static void init_remap_sse2 (pa_remap_t *m) {
+static void init_remap_sse2(pa_remap_t *m) {
     unsigned n_oc, n_ic;
 
     n_oc = m->o_ss->channels;
@@ -147,7 +147,7 @@ static void init_remap_sse2 (pa_remap_t *m) {
 }
 #endif /* defined (__i386__) || defined (__amd64__) */
 
-void pa_remap_func_init_sse (pa_cpu_x86_flag_t flags) {
+void pa_remap_func_init_sse(pa_cpu_x86_flag_t flags) {
 #if defined (__i386__) || defined (__amd64__)
 
     if (flags & PA_CPU_X86_SSE2) {
diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index bed5a20..e520221 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -1022,7 +1022,7 @@ static void calc_map_table(pa_resampler *r) {
     pa_xfree(t);
 
     /* initialize the remapping function */
-    pa_init_remap (m);
+    pa_init_remap(m);
 }
 
 static pa_memchunk* convert_to_work_format(pa_resampler *r, pa_memchunk *input) {
@@ -1096,8 +1096,8 @@ static pa_memchunk *remap_channels(pa_resampler *r, pa_memchunk *input) {
 
     remap = &r->remap;
 
-    pa_assert (remap->do_remap);
-    remap->do_remap (remap, dst, src, n_frames);
+    pa_assert(remap->do_remap);
+    remap->do_remap(remap, dst, src, n_frames);
 
     pa_memblock_release(input->memblock);
     pa_memblock_release(r->buf2.memblock);
diff --git a/src/pulsecore/sample-util.c b/src/pulsecore/sample-util.c
index 74600de..ee1da60 100644
--- a/src/pulsecore/sample-util.c
+++ b/src/pulsecore/sample-util.c
@@ -752,7 +752,7 @@ void pa_volume_memchunk(
       return;
     }
 
-    do_volume = pa_get_volume_func (spec->format);
+    do_volume = pa_get_volume_func(spec->format);
     pa_assert(do_volume);
 
     calc_volume_table[spec->format] ((void *)linear, volume);
diff --git a/src/pulsecore/sconv_sse.c b/src/pulsecore/sconv_sse.c
index 2e74d74..ac57f01 100644
--- a/src/pulsecore/sconv_sse.c
+++ b/src/pulsecore/sconv_sse.c
@@ -170,7 +170,7 @@ static void pa_sconv_s16le_from_f32ne_sse2(unsigned n, const float *a, int16_t *
 #define SAMPLES 1019
 #define TIMES 1000
 
-static void run_test (void) {
+static void run_test(void) {
     int16_t samples[SAMPLES];
     int16_t samples_ref[SAMPLES];
     float floats[SAMPLES];
@@ -178,18 +178,18 @@ static void run_test (void) {
     pa_usec_t start, stop;
     pa_convert_func_t func;
 
-    printf ("checking SSE %zd\n", sizeof (samples));
+    printf("checking SSE %zd\n", sizeof(samples));
 
-    memset (samples_ref, 0, sizeof (samples_ref));
-    memset (samples, 0, sizeof (samples));
+    memset(samples_ref, 0, sizeof(samples_ref));
+    memset(samples, 0, sizeof(samples));
 
     for (i = 0; i < SAMPLES; i++) {
         floats[i] = (rand()/(RAND_MAX+2.2)) - 1.1;
     }
 
-    func = pa_get_convert_from_float32ne_function (PA_SAMPLE_S16LE);
-    func (SAMPLES, floats, samples_ref);
-    pa_sconv_s16le_from_f32ne_sse2 (SAMPLES, floats, samples);
+    func = pa_get_convert_from_float32ne_function(PA_SAMPLE_S16LE);
+    func(SAMPLES, floats, samples_ref);
+    pa_sconv_s16le_from_f32ne_sse2(SAMPLES, floats, samples);
 
     for (i = 0; i < SAMPLES; i++) {
         if (samples[i] != samples_ref[i]) {
@@ -200,14 +200,14 @@ static void run_test (void) {
 
     start = pa_rtclock_now();
     for (i = 0; i < TIMES; i++) {
-        pa_sconv_s16le_from_f32ne_sse2 (SAMPLES, floats, samples);
+        pa_sconv_s16le_from_f32ne_sse2(SAMPLES, floats, samples);
     }
     stop = pa_rtclock_now();
     pa_log_info("SSE: %llu usec.", (long long unsigned int)(stop - start));
 
     start = pa_rtclock_now();
     for (i = 0; i < TIMES; i++) {
-        func (SAMPLES, floats, samples_ref);
+        func(SAMPLES, floats, samples_ref);
     }
     stop = pa_rtclock_now();
     pa_log_info("ref: %llu usec.", (long long unsigned int)(stop - start));
@@ -216,19 +216,19 @@ static void run_test (void) {
 #endif /* defined (__i386__) || defined (__amd64__) */
 
 
-void pa_convert_func_init_sse (pa_cpu_x86_flag_t flags) {
+void pa_convert_func_init_sse(pa_cpu_x86_flag_t flags) {
 #if !defined(__APPLE__) && defined (__i386__) || defined (__amd64__)
 
 #ifdef RUN_TEST
-    run_test ();
+    run_test();
 #endif
 
     if (flags & PA_CPU_X86_SSE2) {
         pa_log_info("Initialising SSE2 optimized conversions.");
-        pa_set_convert_from_float32ne_function (PA_SAMPLE_S16LE, (pa_convert_func_t) pa_sconv_s16le_from_f32ne_sse2);
+        pa_set_convert_from_float32ne_function(PA_SAMPLE_S16LE, (pa_convert_func_t) pa_sconv_s16le_from_f32ne_sse2);
     } else {
         pa_log_info("Initialising SSE optimized conversions.");
-        pa_set_convert_from_float32ne_function (PA_SAMPLE_S16LE, (pa_convert_func_t) pa_sconv_s16le_from_f32ne_sse);
+        pa_set_convert_from_float32ne_function(PA_SAMPLE_S16LE, (pa_convert_func_t) pa_sconv_s16le_from_f32ne_sse);
     }
 
 #endif /* defined (__i386__) || defined (__amd64__) */
diff --git a/src/pulsecore/semaphore-osx.c b/src/pulsecore/semaphore-osx.c
index 73f4355..42afd15 100644
--- a/src/pulsecore/semaphore-osx.c
+++ b/src/pulsecore/semaphore-osx.c
@@ -30,8 +30,7 @@
 
 #include "semaphore.h"
 
-struct pa_semaphore
-{
+struct pa_semaphore {
     MPSemaphoreID sema;
 };
 
diff --git a/src/pulsecore/semaphore-win32.c b/src/pulsecore/semaphore-win32.c
index 9ffbde6..c2e00c6 100644
--- a/src/pulsecore/semaphore-win32.c
+++ b/src/pulsecore/semaphore-win32.c
@@ -30,8 +30,7 @@
 
 #include "semaphore.h"
 
-struct pa_semaphore
-{
+struct pa_semaphore {
     HANDLE sema;
 };
 
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index e0831f6..2bcf112 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -74,10 +74,10 @@ static int check_passthrough_connection(pa_sink_input_flags_t flags, pa_sink *de
         }
 
     } else {
-         if (flags & PA_SINK_INPUT_PASSTHROUGH) {
-             pa_log_warn("Cannot connect PASSTHROUGH sink input to sink without PASSTHROUGH capabilities");
-             return -PA_ERR_INVALID;
-         }
+        if (flags & PA_SINK_INPUT_PASSTHROUGH) {
+            pa_log_warn("Cannot connect PASSTHROUGH sink input to sink without PASSTHROUGH capabilities");
+            return -PA_ERR_INVALID;
+        }
     }
     return PA_OK;
 }
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 43cd0d1..839b7d4 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -2732,22 +2732,22 @@ void pa_sink_set_latency_range(pa_sink *s, pa_usec_t min_latency, pa_usec_t max_
 
 /* Called from main thread */
 void pa_sink_get_latency_range(pa_sink *s, pa_usec_t *min_latency, pa_usec_t *max_latency) {
-   pa_sink_assert_ref(s);
-   pa_assert_ctl_context();
-   pa_assert(min_latency);
-   pa_assert(max_latency);
-
-   if (PA_SINK_IS_LINKED(s->state)) {
-       pa_usec_t r[2] = { 0, 0 };
-
-       pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_LATENCY_RANGE, r, 0, NULL) == 0);
-
-       *min_latency = r[0];
-       *max_latency = r[1];
-   } else {
-       *min_latency = s->thread_info.min_latency;
-       *max_latency = s->thread_info.max_latency;
-   }
+    pa_sink_assert_ref(s);
+    pa_assert_ctl_context();
+    pa_assert(min_latency);
+    pa_assert(max_latency);
+
+    if (PA_SINK_IS_LINKED(s->state)) {
+        pa_usec_t r[2] = { 0, 0 };
+
+        pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_LATENCY_RANGE, r, 0, NULL) == 0);
+
+        *min_latency = r[0];
+        *max_latency = r[1];
+    } else {
+        *min_latency = s->thread_info.min_latency;
+        *max_latency = s->thread_info.max_latency;
+    }
 }
 
 /* Called from IO thread */
diff --git a/src/pulsecore/sndfile-util.c b/src/pulsecore/sndfile-util.c
index cadda93..292eb6e 100644
--- a/src/pulsecore/sndfile-util.c
+++ b/src/pulsecore/sndfile-util.c
@@ -52,7 +52,7 @@ int pa_sndfile_read_sample_spec(SNDFILE *sf, pa_sample_spec *ss) {
 
         case SF_FORMAT_PCM_24:
             ss->format = PA_SAMPLE_S24NE;
-	    break;
+            break;
 
         case SF_FORMAT_PCM_32:
             ss->format = PA_SAMPLE_S32NE;
@@ -109,9 +109,9 @@ int pa_sndfile_write_sample_spec(SF_INFO *sfi, pa_sample_spec *ss) {
 
         case PA_SAMPLE_S24LE:
         case PA_SAMPLE_S24BE:
-	    ss->format = PA_SAMPLE_S24NE;
-	    sfi->format |= SF_FORMAT_PCM_24;
-	    break;
+            ss->format = PA_SAMPLE_S24NE;
+            sfi->format |= SF_FORMAT_PCM_24;
+            break;
 
         case PA_SAMPLE_S24_32LE:
         case PA_SAMPLE_S24_32BE:
@@ -304,8 +304,7 @@ int pa_sndfile_write_channel_map(SNDFILE *sf, pa_channel_map *cm) {
         channels[c] = table[cm->map[c]];
     }
 
-    if (!sf_command(sf, SFC_SET_CHANNEL_MAP_INFO,
-                    channels, sizeof(channels[0]) * cm->channels)) {
+    if (!sf_command(sf, SFC_SET_CHANNEL_MAP_INFO, channels, sizeof(channels[0]) * cm->channels)) {
         pa_xfree(channels);
         return -1;
     }
diff --git a/src/pulsecore/sound-file-stream.c b/src/pulsecore/sound-file-stream.c
index 4037dca..1ec1942 100644
--- a/src/pulsecore/sound-file-stream.c
+++ b/src/pulsecore/sound-file-stream.c
@@ -200,7 +200,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t length, pa_memchunk *chunk
     }
 
     return -1;
- }
+}
 
 static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
     file_stream *u;
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index a553662..92fb80e 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -1402,22 +1402,22 @@ void pa_source_set_latency_range(pa_source *s, pa_usec_t min_latency, pa_usec_t
 
 /* Called from main thread */
 void pa_source_get_latency_range(pa_source *s, pa_usec_t *min_latency, pa_usec_t *max_latency) {
-   pa_source_assert_ref(s);
-   pa_assert_ctl_context();
-   pa_assert(min_latency);
-   pa_assert(max_latency);
-
-   if (PA_SOURCE_IS_LINKED(s->state)) {
-       pa_usec_t r[2] = { 0, 0 };
-
-       pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_GET_LATENCY_RANGE, r, 0, NULL) == 0);
-
-       *min_latency = r[0];
-       *max_latency = r[1];
-   } else {
-       *min_latency = s->thread_info.min_latency;
-       *max_latency = s->thread_info.max_latency;
-   }
+    pa_source_assert_ref(s);
+    pa_assert_ctl_context();
+    pa_assert(min_latency);
+    pa_assert(max_latency);
+
+    if (PA_SOURCE_IS_LINKED(s->state)) {
+        pa_usec_t r[2] = { 0, 0 };
+
+        pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_GET_LATENCY_RANGE, r, 0, NULL) == 0);
+
+        *min_latency = r[0];
+        *max_latency = r[1];
+    } else {
+        *min_latency = s->thread_info.min_latency;
+        *max_latency = s->thread_info.max_latency;
+    }
 }
 
 /* Called from IO thread, and from main thread before pa_source_put() is called */
diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h
index f3af159..9e8e2ad 100644
--- a/src/pulsecore/source.h
+++ b/src/pulsecore/source.h
@@ -156,7 +156,7 @@ struct pa_source {
         pa_usec_t max_latency; /* An upper limit for the latencies */
 
         pa_usec_t fixed_latency; /* for sources with PA_SOURCE_DYNAMIC_LATENCY this is 0 */
- } thread_info;
+} thread_info;
 
     void *userdata;
 };
diff --git a/src/pulsecore/strbuf.c b/src/pulsecore/strbuf.c
index 4fc82de..f131d5c 100644
--- a/src/pulsecore/strbuf.c
+++ b/src/pulsecore/strbuf.c
@@ -146,7 +146,7 @@ void pa_strbuf_putsn(pa_strbuf *sb, const char *t, size_t l) {
     pa_assert(t);
 
     if (!l)
-       return;
+        return;
 
     c = pa_xmalloc(PA_ALIGN(sizeof(struct chunk)) + l);
     c->length = l;
diff --git a/src/pulsecore/svolume_arm.c b/src/pulsecore/svolume_arm.c
index a028b82..7111306 100644
--- a/src/pulsecore/svolume_arm.c
+++ b/src/pulsecore/svolume_arm.c
@@ -43,9 +43,7 @@
     " addcs r0, %1                  \n\t" \
     " movcs r6, r0                  \n\t"
 
-static void
-pa_volume_s16ne_arm (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_s16ne_arm(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     int32_t *ve;
 
     /* Channels must be at least 4, and always a multiple of the original number.
@@ -134,7 +132,7 @@ pa_volume_s16ne_arm (int16_t *samples, int32_t *volumes, unsigned channels, unsi
 #define TIMES 1000
 #define PADDING 16
 
-static void run_test (void) {
+static void run_test(void) {
     int16_t samples[SAMPLES];
     int16_t samples_ref[SAMPLES];
     int16_t samples_orig[SAMPLES];
@@ -143,21 +141,21 @@ static void run_test (void) {
     pa_do_volume_func_t func;
     pa_usec_t start, stop;
 
-    func = pa_get_volume_func (PA_SAMPLE_S16NE);
+    func = pa_get_volume_func(PA_SAMPLE_S16NE);
 
-    printf ("checking ARM %zd\n", sizeof (samples));
+    printf("checking ARM %zd\n", sizeof(samples));
 
-    pa_random (samples, sizeof (samples));
-    memcpy (samples_ref, samples, sizeof (samples));
-    memcpy (samples_orig, samples, sizeof (samples));
+    pa_random(samples, sizeof(samples));
+    memcpy(samples_ref, samples, sizeof(samples));
+    memcpy(samples_orig, samples, sizeof(samples));
 
     for (i = 0; i < CHANNELS; i++)
         volumes[i] = PA_CLAMP_VOLUME(rand() >> 1);
     for (padding = 0; padding < PADDING; padding++, i++)
         volumes[i] = volumes[padding];
 
-    func (samples_ref, volumes, CHANNELS, sizeof (samples));
-    pa_volume_s16ne_arm (samples, volumes, CHANNELS, sizeof (samples));
+    func(samples_ref, volumes, CHANNELS, sizeof(samples));
+    pa_volume_s16ne_arm(samples, volumes, CHANNELS, sizeof(samples));
     for (i = 0; i < SAMPLES; i++) {
         if (samples[i] != samples_ref[i]) {
             printf ("%d: %04x != %04x (%04x * %04x)\n", i, samples[i], samples_ref[i],
@@ -167,16 +165,16 @@ static void run_test (void) {
 
     start = pa_rtclock_now();
     for (j = 0; j < TIMES; j++) {
-        memcpy (samples, samples_orig, sizeof (samples));
-        pa_volume_s16ne_arm (samples, volumes, CHANNELS, sizeof (samples));
+        memcpy(samples, samples_orig, sizeof(samples));
+        pa_volume_s16ne_arm(samples, volumes, CHANNELS, sizeof(samples));
     }
     stop = pa_rtclock_now();
     pa_log_info("ARM: %llu usec.", (long long unsigned int) (stop - start));
 
     start = pa_rtclock_now();
     for (j = 0; j < TIMES; j++) {
-        memcpy (samples_ref, samples_orig, sizeof (samples));
-        func (samples_ref, volumes, CHANNELS, sizeof (samples));
+        memcpy(samples_ref, samples_orig, sizeof(samples));
+        func(samples_ref, volumes, CHANNELS, sizeof(samples));
     }
     stop = pa_rtclock_now();
     pa_log_info("ref: %llu usec.", (long long unsigned int) (stop - start));
@@ -186,14 +184,14 @@ static void run_test (void) {
 #endif /* defined (__arm__) && defined (HAVE_ARMV6) */
 
 
-void pa_volume_func_init_arm (pa_cpu_arm_flag_t flags) {
+void pa_volume_func_init_arm(pa_cpu_arm_flag_t flags) {
 #if defined (__arm__) && defined (HAVE_ARMV6)
     pa_log_info("Initialising ARM optimized functions.");
 
 #ifdef RUN_TEST
-    run_test ();
+    run_test();
 #endif
 
-    pa_set_volume_func (PA_SAMPLE_S16NE,     (pa_do_volume_func_t) pa_volume_s16ne_arm);
+    pa_set_volume_func(PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_arm);
 #endif /* defined (__arm__) && defined (HAVE_ARMV6) */
 }
diff --git a/src/pulsecore/svolume_c.c b/src/pulsecore/svolume_c.c
index 5fc052b..dfe7ccb 100644
--- a/src/pulsecore/svolume_c.c
+++ b/src/pulsecore/svolume_c.c
@@ -32,9 +32,7 @@
 #include "sample-util.h"
 #include "endianmacros.h"
 
-static void
-pa_volume_u8_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_u8_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
     for (channel = 0; length; length--) {
@@ -53,9 +51,7 @@ pa_volume_u8_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned
     }
 }
 
-static void
-pa_volume_alaw_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_alaw_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
     for (channel = 0; length; length--) {
@@ -74,9 +70,7 @@ pa_volume_alaw_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigne
     }
 }
 
-static void
-pa_volume_ulaw_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_ulaw_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
     for (channel = 0; length; length--) {
@@ -95,12 +89,10 @@ pa_volume_ulaw_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigne
     }
 }
 
-static void
-pa_volume_s16ne_c (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_s16ne_c(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
-    length /= sizeof (int16_t);
+    length /= sizeof(int16_t);
 
     for (channel = 0; length; length--) {
         int32_t t, hi, lo;
@@ -124,12 +116,10 @@ pa_volume_s16ne_c (int16_t *samples, int32_t *volumes, unsigned channels, unsign
     }
 }
 
-static void
-pa_volume_s16re_c (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_s16re_c(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
-    length /= sizeof (int16_t);
+    length /= sizeof(int16_t);
 
     for (channel = 0; length; length--) {
         int32_t t, hi, lo;
@@ -147,12 +137,10 @@ pa_volume_s16re_c (int16_t *samples, int32_t *volumes, unsigned channels, unsign
     }
 }
 
-static void
-pa_volume_float32ne_c (float *samples, float *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_float32ne_c(float *samples, float *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
-    length /= sizeof (float);
+    length /= sizeof(float);
 
     for (channel = 0; length; length--) {
         *samples++ *= volumes[channel];
@@ -162,12 +150,10 @@ pa_volume_float32ne_c (float *samples, float *volumes, unsigned channels, unsign
     }
 }
 
-static void
-pa_volume_float32re_c (float *samples, float *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_float32re_c(float *samples, float *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
-    length /= sizeof (float);
+    length /= sizeof(float);
 
     for (channel = 0; length; length--) {
         float t;
@@ -181,12 +167,10 @@ pa_volume_float32re_c (float *samples, float *volumes, unsigned channels, unsign
     }
 }
 
-static void
-pa_volume_s32ne_c (int32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_s32ne_c(int32_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
-    length /= sizeof (int32_t);
+    length /= sizeof(int32_t);
 
     for (channel = 0; length; length--) {
         int64_t t;
@@ -201,12 +185,10 @@ pa_volume_s32ne_c (int32_t *samples, int32_t *volumes, unsigned channels, unsign
     }
 }
 
-static void
-pa_volume_s32re_c (int32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_s32re_c(int32_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
-    length /= sizeof (int32_t);
+    length /= sizeof(int32_t);
 
     for (channel = 0; length; length--) {
         int64_t t;
@@ -221,9 +203,7 @@ pa_volume_s32re_c (int32_t *samples, int32_t *volumes, unsigned channels, unsign
     }
 }
 
-static void
-pa_volume_s24ne_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_s24ne_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
     uint8_t *e;
 
@@ -242,9 +222,7 @@ pa_volume_s24ne_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsign
     }
 }
 
-static void
-pa_volume_s24re_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_s24re_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
     uint8_t *e;
 
@@ -263,12 +241,10 @@ pa_volume_s24re_c (uint8_t *samples, int32_t *volumes, unsigned channels, unsign
     }
 }
 
-static void
-pa_volume_s24_32ne_c (uint32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_s24_32ne_c(uint32_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
-    length /= sizeof (uint32_t);
+    length /= sizeof(uint32_t);
 
     for (channel = 0; length; length--) {
         int64_t t;
@@ -283,12 +259,10 @@ pa_volume_s24_32ne_c (uint32_t *samples, int32_t *volumes, unsigned channels, un
     }
 }
 
-static void
-pa_volume_s24_32re_c (uint32_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_s24_32re_c(uint32_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
-    length /= sizeof (uint32_t);
+    length /= sizeof(uint32_t);
 
     for (channel = 0; length; length--) {
         int64_t t;
@@ -303,8 +277,7 @@ pa_volume_s24_32re_c (uint32_t *samples, int32_t *volumes, unsigned channels, un
     }
 }
 
-static pa_do_volume_func_t do_volume_table[] =
-{
+static pa_do_volume_func_t do_volume_table[] = {
     [PA_SAMPLE_U8]        = (pa_do_volume_func_t) pa_volume_u8_c,
     [PA_SAMPLE_ALAW]      = (pa_do_volume_func_t) pa_volume_alaw_c,
     [PA_SAMPLE_ULAW]      = (pa_do_volume_func_t) pa_volume_ulaw_c,
diff --git a/src/pulsecore/svolume_mmx.c b/src/pulsecore/svolume_mmx.c
index 2ffd608..263790d 100644
--- a/src/pulsecore/svolume_mmx.c
+++ b/src/pulsecore/svolume_mmx.c
@@ -95,9 +95,7 @@
       " por %%mm4, "#s1"             \n\t" /* .. |  l  h |  */ \
       " por %%mm5, "#s2"             \n\t"
 
-static void
-pa_volume_s16ne_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_s16ne_mmx(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     pa_reg_x86 channel, temp;
 
     /* Channels must be at least 4, and always a multiple of the original number.
@@ -162,9 +160,7 @@ pa_volume_s16ne_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsi
     );
 }
 
-static void
-pa_volume_s16re_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_s16re_mmx(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     pa_reg_x86 channel, temp;
 
     /* Channels must be at least 4, and always a multiple of the original number.
@@ -247,7 +243,7 @@ pa_volume_s16re_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsi
 #define TIMES 1000
 #define PADDING 16
 
-static void run_test (void) {
+static void run_test(void) {
     int16_t samples[SAMPLES];
     int16_t samples_ref[SAMPLES];
     int16_t samples_orig[SAMPLES];
@@ -256,15 +252,15 @@ static void run_test (void) {
     pa_do_volume_func_t func;
     pa_usec_t start, stop;
 
-    func = pa_get_volume_func (PA_SAMPLE_S16NE);
+    func = pa_get_volume_func(PA_SAMPLE_S16NE);
 
-    printf ("checking MMX %zd\n", sizeof (samples));
+    printf("checking MMX %zd\n", sizeof(samples));
 
-    pa_random (samples, sizeof (samples));
+    pa_random(samples, sizeof(samples));
     /* for (i = 0; i < SAMPLES; i++)
        samples[i] = -1; */
-    memcpy (samples_ref, samples, sizeof (samples));
-    memcpy (samples_orig, samples, sizeof (samples));
+    memcpy(samples_ref, samples, sizeof(samples));
+    memcpy(samples_orig, samples, sizeof(samples));
 
     for (i = 0; i < CHANNELS; i++)
         volumes[i] = PA_CLAMP_VOLUME(rand() >> 1);
@@ -272,27 +268,27 @@ static void run_test (void) {
     for (padding = 0; padding < PADDING; padding++, i++)
         volumes[i] = volumes[padding];
 
-    func (samples_ref, volumes, CHANNELS, sizeof (samples));
-    pa_volume_s16ne_mmx (samples, volumes, CHANNELS, sizeof (samples));
+    func(samples_ref, volumes, CHANNELS, sizeof(samples));
+    pa_volume_s16ne_mmx(samples, volumes, CHANNELS, sizeof(samples));
     for (i = 0; i < SAMPLES; i++) {
         if (samples[i] != samples_ref[i]) {
-            printf ("%d: %04x != %04x (%04x * %08x)\n", i, samples[i], samples_ref[i],
+            printf("%d: %04x != %04x (%04x * %08x)\n", i, samples[i], samples_ref[i],
                   samples_orig[i], volumes[i % CHANNELS]);
         }
     }
 
     start = pa_rtclock_now();
     for (j = 0; j < TIMES; j++) {
-        memcpy (samples, samples_orig, sizeof (samples));
-        pa_volume_s16ne_mmx (samples, volumes, CHANNELS, sizeof (samples));
+        memcpy(samples, samples_orig, sizeof(samples));
+        pa_volume_s16ne_mmx(samples, volumes, CHANNELS, sizeof(samples));
     }
     stop = pa_rtclock_now();
     pa_log_info("MMX: %llu usec.", (long long unsigned int)(stop - start));
 
     start = pa_rtclock_now();
     for (j = 0; j < TIMES; j++) {
-        memcpy (samples_ref, samples_orig, sizeof (samples));
-        func (samples_ref, volumes, CHANNELS, sizeof (samples));
+        memcpy(samples_ref, samples_orig, sizeof(samples));
+        func(samples_ref, volumes, CHANNELS, sizeof(samples));
     }
     stop = pa_rtclock_now();
     pa_log_info("ref: %llu usec.", (long long unsigned int)(stop - start));
@@ -304,18 +300,18 @@ static void run_test (void) {
 #endif /* defined (__i386__) || defined (__amd64__) */
 
 
-void pa_volume_func_init_mmx (pa_cpu_x86_flag_t flags) {
+void pa_volume_func_init_mmx(pa_cpu_x86_flag_t flags) {
 #if defined (__i386__) || defined (__amd64__)
 
 #ifdef RUN_TEST
-    run_test ();
+    run_test();
 #endif
 
     if ((flags & PA_CPU_X86_MMX) && (flags & PA_CPU_X86_CMOV)) {
         pa_log_info("Initialising MMX optimized functions.");
 
-        pa_set_volume_func (PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_mmx);
-        pa_set_volume_func (PA_SAMPLE_S16RE, (pa_do_volume_func_t) pa_volume_s16re_mmx);
+        pa_set_volume_func(PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_mmx);
+        pa_set_volume_func(PA_SAMPLE_S16RE, (pa_do_volume_func_t) pa_volume_s16re_mmx);
     }
 #endif /* defined (__i386__) || defined (__amd64__) */
 }
diff --git a/src/pulsecore/svolume_sse.c b/src/pulsecore/svolume_sse.c
index ff2a12e..8682807 100644
--- a/src/pulsecore/svolume_sse.c
+++ b/src/pulsecore/svolume_sse.c
@@ -79,9 +79,7 @@
 
 static int channel_overread_table[8] = {8,8,8,12,8,10,12,14};
 
-static void
-pa_volume_s16ne_sse2 (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_s16ne_sse2(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     pa_reg_x86 channel, temp;
 
     /* Channels must be at least 8 and always a multiple of the original number.
@@ -161,9 +159,7 @@ pa_volume_s16ne_sse2 (int16_t *samples, int32_t *volumes, unsigned channels, uns
     );
 }
 
-static void
-pa_volume_s16re_sse2 (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
-{
+static void pa_volume_s16re_sse2(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     pa_reg_x86 channel, temp;
 
     /* Channels must be at least 8 and always a multiple of the original number.
@@ -259,7 +255,7 @@ pa_volume_s16re_sse2 (int16_t *samples, int32_t *volumes, unsigned channels, uns
 #define TIMES 1000
 #define PADDING 16
 
-static void run_test (void) {
+static void run_test(void) {
     int16_t samples[SAMPLES];
     int16_t samples_ref[SAMPLES];
     int16_t samples_orig[SAMPLES];
@@ -268,21 +264,21 @@ static void run_test (void) {
     pa_do_volume_func_t func;
     pa_usec_t start, stop;
 
-    func = pa_get_volume_func (PA_SAMPLE_S16NE);
+    func = pa_get_volume_func(PA_SAMPLE_S16NE);
 
-    printf ("checking SSE2 %zd\n", sizeof (samples));
+    printf("checking SSE2 %zd\n", sizeof(samples));
 
-    pa_random (samples, sizeof (samples));
-    memcpy (samples_ref, samples, sizeof (samples));
-    memcpy (samples_orig, samples, sizeof (samples));
+    pa_random(samples, sizeof(samples));
+    memcpy(samples_ref, samples, sizeof(samples));
+    memcpy(samples_orig, samples, sizeof(samples));
 
     for (i = 0; i < CHANNELS; i++)
         volumes[i] = PA_CLAMP_VOLUME(rand() >> 1);
     for (padding = 0; padding < PADDING; padding++, i++)
         volumes[i] = volumes[padding];
 
-    func (samples_ref, volumes, CHANNELS, sizeof (samples));
-    pa_volume_s16ne_sse2 (samples, volumes, CHANNELS, sizeof (samples));
+    func(samples_ref, volumes, CHANNELS, sizeof(samples));
+    pa_volume_s16ne_sse2(samples, volumes, CHANNELS, sizeof(samples));
     for (i = 0; i < SAMPLES; i++) {
         if (samples[i] != samples_ref[i]) {
             printf ("%d: %04x != %04x (%04x * %04x)\n", i, samples[i], samples_ref[i],
@@ -292,16 +288,16 @@ static void run_test (void) {
 
     start = pa_rtclock_now();
     for (j = 0; j < TIMES; j++) {
-        memcpy (samples, samples_orig, sizeof (samples));
-        pa_volume_s16ne_sse2 (samples, volumes, CHANNELS, sizeof (samples));
+        memcpy(samples, samples_orig, sizeof(samples));
+        pa_volume_s16ne_sse2(samples, volumes, CHANNELS, sizeof(samples));
     }
     stop = pa_rtclock_now();
     pa_log_info("SSE: %llu usec.", (long long unsigned int)(stop - start));
 
     start = pa_rtclock_now();
     for (j = 0; j < TIMES; j++) {
-        memcpy (samples_ref, samples_orig, sizeof (samples));
-        func (samples_ref, volumes, CHANNELS, sizeof (samples));
+        memcpy(samples_ref, samples_orig, sizeof(samples));
+        func(samples_ref, volumes, CHANNELS, sizeof (samples));
     }
     stop = pa_rtclock_now();
     pa_log_info("ref: %llu usec.", (long long unsigned int)(stop - start));
@@ -311,18 +307,18 @@ static void run_test (void) {
 #endif
 #endif /* defined (__i386__) || defined (__amd64__) */
 
-void pa_volume_func_init_sse (pa_cpu_x86_flag_t flags) {
+void pa_volume_func_init_sse(pa_cpu_x86_flag_t flags) {
 #if defined (__i386__) || defined (__amd64__)
 
 #ifdef RUN_TEST
-    run_test ();
+    run_test();
 #endif
 
     if (flags & PA_CPU_X86_SSE2) {
         pa_log_info("Initialising SSE2 optimized functions.");
 
-        pa_set_volume_func (PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_sse2);
-        pa_set_volume_func (PA_SAMPLE_S16RE, (pa_do_volume_func_t) pa_volume_s16re_sse2);
+        pa_set_volume_func(PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_sse2);
+        pa_set_volume_func(PA_SAMPLE_S16RE, (pa_do_volume_func_t) pa_volume_s16re_sse2);
     }
 #endif /* defined (__i386__) || defined (__amd64__) */
 }
diff --git a/src/pulsecore/usergroup.c b/src/pulsecore/usergroup.c
index 71b13bc..c244865 100644
--- a/src/pulsecore/usergroup.c
+++ b/src/pulsecore/usergroup.c
@@ -142,9 +142,7 @@ struct group *pa_getgrgid_malloc(gid_t gid) {
     getgr_buflen = buflen - sizeof(struct group);
     getgr_buf = (char *)buf + sizeof(struct group);
 
-    while ((err = getgrgid_r(gid, (struct group *)buf, getgr_buf,
-                    getgr_buflen, &result)) == ERANGE)
-    {
+    while ((err = getgrgid_r(gid, (struct group *)buf, getgr_buf, getgr_buflen, &result)) == ERANGE) {
         if (expand_buffer_trashcontents(&buf, &buflen))
             break;
 
@@ -203,9 +201,7 @@ struct group *pa_getgrnam_malloc(const char *name) {
     getgr_buflen = buflen - sizeof(struct group);
     getgr_buf = (char *)buf + sizeof(struct group);
 
-    while ((err = getgrnam_r(name, (struct group *)buf, getgr_buf,
-                    getgr_buflen, &result)) == ERANGE)
-    {
+    while ((err = getgrnam_r(name, (struct group *)buf, getgr_buf, getgr_buflen, &result)) == ERANGE) {
         if (expand_buffer_trashcontents(&buf, &buflen))
             break;
 
@@ -268,9 +264,7 @@ struct passwd *pa_getpwnam_malloc(const char *name) {
     getpw_buflen = buflen - sizeof(struct passwd);
     getpw_buf = (char *)buf + sizeof(struct passwd);
 
-    while ((err = getpwnam_r(name, (struct passwd *)buf, getpw_buf,
-                    getpw_buflen, &result)) == ERANGE)
-    {
+    while ((err = getpwnam_r(name, (struct passwd *)buf, getpw_buf, getpw_buflen, &result)) == ERANGE) {
         if (expand_buffer_trashcontents(&buf, &buflen))
             break;
 
@@ -329,9 +323,7 @@ struct passwd *pa_getpwuid_malloc(uid_t uid) {
     getpw_buflen = buflen - sizeof(struct passwd);
     getpw_buf = (char *)buf + sizeof(struct passwd);
 
-    while ((err = getpwuid_r(uid, (struct passwd *)buf, getpw_buf,
-                    getpw_buflen, &result)) == ERANGE)
-    {
+    while ((err = getpwuid_r(uid, (struct passwd *)buf, getpw_buf, getpw_buflen, &result)) == ERANGE) {
         if (expand_buffer_trashcontents(&buf, &buflen))
             break;
 
diff --git a/src/pulsecore/x11prop.c b/src/pulsecore/x11prop.c
index 4cb21da..8df3278 100644
--- a/src/pulsecore/x11prop.c
+++ b/src/pulsecore/x11prop.c
@@ -34,8 +34,7 @@
 
 #define PA_XCB_FORMAT 8
 
-static xcb_screen_t *screen_of_display(xcb_connection_t *xcb, int screen)
-{
+static xcb_screen_t *screen_of_display(xcb_connection_t *xcb, int screen) {
     const xcb_setup_t *s;
     xcb_screen_iterator_t iter;
 
diff --git a/src/tests/usergroup-test.c b/src/tests/usergroup-test.c
index a48b016..3948e0f 100644
--- a/src/tests/usergroup-test.c
+++ b/src/tests/usergroup-test.c
@@ -47,28 +47,24 @@ static int compare_group(const struct group *a, const struct group *b) {
     char **amem, **bmem;
 
     if (strcmp(a->gr_name, b->gr_name)) {
-        fprintf(stderr, "Group name mismatch: [%s] [%s]\n",
-                a->gr_name, b->gr_name);
+        fprintf(stderr, "Group name mismatch: [%s] [%s]\n", a->gr_name, b->gr_name);
         return 1;
     }
 
     if (strcmp(a->gr_passwd, b->gr_passwd)) {
-        fprintf(stderr, "Group password mismatch: [%s] [%s]\n",
-                a->gr_passwd, b->gr_passwd);
+        fprintf(stderr, "Group password mismatch: [%s] [%s]\n", a->gr_passwd, b->gr_passwd);
         return 1;
     }
 
     if (a->gr_gid != b->gr_gid) {
-        fprintf(stderr, "Gid mismatch: [%lu] [%lu]\n",
-                (unsigned long) a->gr_gid, (unsigned long) b->gr_gid);
+        fprintf(stderr, "Gid mismatch: [%lu] [%lu]\n", (unsigned long) a->gr_gid, (unsigned long) b->gr_gid);
         return 1;
     }
 
     /* XXX: Assuming the group ordering is identical. */
     for (amem = a->gr_mem, bmem = b->gr_mem; *amem && *bmem; ++amem, ++bmem) {
         if (strcmp(*amem, *bmem)) {
-            fprintf(stderr, "Group member mismatch: [%s] [%s]\n",
-                    *amem, *bmem);
+            fprintf(stderr, "Group member mismatch: [%s] [%s]\n", *amem, *bmem);
             return 1;
         }
     }
@@ -93,14 +89,12 @@ static int compare_passwd(const struct passwd *a, const struct passwd *b) {
     }
 
     if (a->pw_uid != b->pw_uid) {
-        fprintf(stderr, "pw_uid mismatch: [%lu] [%lu]\n",
-		(unsigned long) a->pw_uid, (unsigned long) b->pw_uid);
+        fprintf(stderr, "pw_uid mismatch: [%lu] [%lu]\n", (unsigned long) a->pw_uid, (unsigned long) b->pw_uid);
         return 1;
     }
 
     if (a->pw_gid != b->pw_gid) {
-        fprintf(stderr, "pw_gid mismatch: [%lu] [%lu]\n",
-		(unsigned long) a->pw_gid, (unsigned long) b->pw_gid);
+        fprintf(stderr, "pw_gid mismatch: [%lu] [%lu]\n", (unsigned long) a->pw_gid, (unsigned long) b->pw_gid);
         return 1;
     }
 
diff --git a/src/utils/pacmd.c b/src/utils/pacmd.c
index 143a948..4d07c4c 100644
--- a/src/utils/pacmd.c
+++ b/src/utils/pacmd.c
@@ -44,8 +44,7 @@
 #include <pulsecore/pid.h>
 
 int main(int argc, char*argv[]) {
-
-    pid_t pid ;
+    pid_t pid;
     int fd = -1;
     int ret = 1, i;
     struct sockaddr_un sa;

commit b3721a12c5c31ae55141ff46af0c553d060fe363
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Wed Mar 9 10:00:20 2011 +0100

    Fixup #include directives according to Coding Style
    
    Use #include "header.h" if functionality of header.h is implemented
    and #include <header.h> if functionality of header.h is used.

diff --git a/src/pulse/browser.c b/src/pulse/browser.c
index 4cf5d0c..d059228 100644
--- a/src/pulse/browser.c
+++ b/src/pulse/browser.c
@@ -20,7 +20,7 @@
 ***/
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
 #include <string.h>
diff --git a/src/pulse/context.c b/src/pulse/context.c
index 8f632b5..1480af5 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -53,6 +53,11 @@
 #include <pulse/i18n.h>
 #include <pulse/mainloop.h>
 #include <pulse/timeval.h>
+#include <pulse/fork-detect.h>
+#include <pulse/client-conf.h>
+#ifdef HAVE_X11
+#include <pulse/client-conf-x11.h>
+#endif
 
 #include <pulsecore/core-error.h>
 #include <pulsecore/native-common.h>
@@ -71,14 +76,6 @@
 #include <pulsecore/proplist-util.h>
 
 #include "internal.h"
-
-#include "client-conf.h"
-#include "fork-detect.h"
-
-#ifdef HAVE_X11
-#include "client-conf-x11.h"
-#endif
-
 #include "context.h"
 
 void pa_command_extension(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
diff --git a/src/pulse/ext-device-manager.c b/src/pulse/ext-device-manager.c
index 57cb57c..7b78c24 100644
--- a/src/pulse/ext-device-manager.c
+++ b/src/pulse/ext-device-manager.c
@@ -27,14 +27,13 @@
 #include <pulse/context.h>
 #include <pulse/gccmacro.h>
 #include <pulse/xmalloc.h>
+#include <pulse/fork-detect.h>
+#include <pulse/operation.h>
 
 #include <pulsecore/macro.h>
 #include <pulsecore/pstream-util.h>
 
 #include "internal.h"
-#include "operation.h"
-#include "fork-detect.h"
-
 #include "ext-device-manager.h"
 
 enum {
diff --git a/src/pulse/ext-stream-restore.c b/src/pulse/ext-stream-restore.c
index 10e9fd5..7bc1a61 100644
--- a/src/pulse/ext-stream-restore.c
+++ b/src/pulse/ext-stream-restore.c
@@ -25,14 +25,13 @@
 
 #include <pulse/context.h>
 #include <pulse/gccmacro.h>
+#include <pulse/fork-detect.h>
+#include <pulse/operation.h>
 
 #include <pulsecore/macro.h>
 #include <pulsecore/pstream-util.h>
 
 #include "internal.h"
-#include "operation.h"
-#include "fork-detect.h"
-
 #include "ext-stream-restore.h"
 
 enum {
diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
index 35e091a..ec27b92 100644
--- a/src/pulse/introspect.c
+++ b/src/pulse/introspect.c
@@ -29,14 +29,13 @@
 #include <pulse/context.h>
 #include <pulse/gccmacro.h>
 #include <pulse/xmalloc.h>
+#include <pulse/fork-detect.h>
 
 #include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
 #include <pulsecore/pstream-util.h>
 
 #include "internal.h"
-#include "fork-detect.h"
-
 #include "introspect.h"
 
 /*** Statistics ***/
diff --git a/src/pulse/scache.c b/src/pulse/scache.c
index cb8d7c5..6ed80a6 100644
--- a/src/pulse/scache.c
+++ b/src/pulse/scache.c
@@ -28,14 +28,14 @@
 #include <string.h>
 
 #include <pulse/utf8.h>
-#include <pulse/scache.h>
+#include <pulse/fork-detect.h>
 
 #include <pulsecore/pstream-util.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/proplist-util.h>
 
-#include "fork-detect.h"
 #include "internal.h"
+#include "scache.h"
 
 int pa_stream_connect_upload(pa_stream *s, size_t length) {
     pa_tagstruct *t;
diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index ea468a5..ef27fe5 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -29,10 +29,10 @@
 #include <string.h>
 
 #include <pulse/def.h>
-#include <pulse/stream.h>
 #include <pulse/timeval.h>
 #include <pulse/rtclock.h>
 #include <pulse/xmalloc.h>
+#include <pulse/fork-detect.h>
 
 #include <pulsecore/pstream-util.h>
 #include <pulsecore/log.h>
@@ -41,8 +41,8 @@
 #include <pulsecore/core-rtclock.h>
 #include <pulsecore/core-util.h>
 
-#include "fork-detect.h"
 #include "internal.h"
+#include "stream.h"
 
 #define AUTO_TIMING_INTERVAL_START_USEC (10*PA_USEC_PER_MSEC)
 #define AUTO_TIMING_INTERVAL_END_USEC (1500*PA_USEC_PER_MSEC)
diff --git a/src/pulse/subscribe.c b/src/pulse/subscribe.c
index 203bc92..52d0af3 100644
--- a/src/pulse/subscribe.c
+++ b/src/pulse/subscribe.c
@@ -31,7 +31,6 @@
 #include <pulsecore/pstream-util.h>
 
 #include "internal.h"
-
 #include "subscribe.h"
 
 void pa_command_subscribe_event(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
diff --git a/src/pulsecore/asyncq.c b/src/pulsecore/asyncq.c
index e62d0c1..8c2d58a 100644
--- a/src/pulsecore/asyncq.c
+++ b/src/pulsecore/asyncq.c
@@ -26,6 +26,8 @@
 #include <unistd.h>
 #include <errno.h>
 
+#include <pulse/xmalloc.h>
+
 #include <pulsecore/atomic.h>
 #include <pulsecore/log.h>
 #include <pulsecore/thread.h>
@@ -33,10 +35,9 @@
 #include <pulsecore/core-util.h>
 #include <pulsecore/llist.h>
 #include <pulsecore/flist.h>
-#include <pulse/xmalloc.h>
+#include <pulsecore/fdsem.h>
 
 #include "asyncq.h"
-#include "fdsem.h"
 
 #define ASYNCQ_SIZE 256
 
diff --git a/src/pulsecore/protocol-esound.c b/src/pulsecore/protocol-esound.c
index 045c5c9..66fd73c 100644
--- a/src/pulsecore/protocol-esound.c
+++ b/src/pulsecore/protocol-esound.c
@@ -55,8 +55,7 @@
 #include <pulsecore/macro.h>
 #include <pulsecore/thread-mq.h>
 #include <pulsecore/shared.h>
-
-#include "endianmacros.h"
+#include <pulsecore/endianmacros.h>
 
 #include "protocol-esound.h"
 
diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index e520221..312e75e 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -36,11 +36,11 @@
 #include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/strbuf.h>
+#include <pulsecore/remap.h>
 
 #include "ffmpeg/avcodec.h"
 
 #include "resampler.h"
-#include "remap.h"
 
 /* Number of samples of extra space we allow the resamplers to return */
 #define EXTRA_FRAMES 128
diff --git a/src/pulsecore/sample-util.c b/src/pulsecore/sample-util.c
index ee1da60..62b7c46 100644
--- a/src/pulsecore/sample-util.c
+++ b/src/pulsecore/sample-util.c
@@ -37,9 +37,9 @@
 #include <pulsecore/macro.h>
 #include <pulsecore/g711.h>
 #include <pulsecore/core-util.h>
+#include <pulsecore/endianmacros.h>
 
 #include "sample-util.h"
-#include "endianmacros.h"
 
 #define PA_SILENCE_MAX (PA_PAGE_SIZE*16)
 
diff --git a/src/pulsecore/sconv-s16le.c b/src/pulsecore/sconv-s16le.c
index 0fefdf1..43587f3 100644
--- a/src/pulsecore/sconv-s16le.c
+++ b/src/pulsecore/sconv-s16le.c
@@ -31,8 +31,7 @@
 #include <pulsecore/sconv.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/log.h>
-
-#include "endianmacros.h"
+#include <pulsecore/endianmacros.h>
 
 #include "sconv-s16le.h"
 
diff --git a/src/pulsecore/sconv.c b/src/pulsecore/sconv.c
index 301f08b..988d4b3 100644
--- a/src/pulsecore/sconv.c
+++ b/src/pulsecore/sconv.c
@@ -29,10 +29,10 @@
 
 #include <pulsecore/g711.h>
 #include <pulsecore/macro.h>
+#include <pulsecore/endianmacros.h>
 
-#include "endianmacros.h"
-#include "sconv-s16le.h"
-#include "sconv-s16be.h"
+#include <pulsecore/sconv-s16le.h>
+#include <pulsecore/sconv-s16be.h>
 
 #include "sconv.h"
 
diff --git a/src/pulsecore/sconv_sse.c b/src/pulsecore/sconv_sse.c
index ac57f01..26daa22 100644
--- a/src/pulsecore/sconv_sse.c
+++ b/src/pulsecore/sconv_sse.c
@@ -29,8 +29,7 @@
 
 #include <pulsecore/g711.h>
 #include <pulsecore/macro.h>
-
-#include "endianmacros.h"
+#include <pulsecore/endianmacros.h>
 
 #include "cpu-x86.h"
 #include "sconv.h"
diff --git a/src/pulsecore/svolume_arm.c b/src/pulsecore/svolume_arm.c
index 7111306..42e8cbf 100644
--- a/src/pulsecore/svolume_arm.c
+++ b/src/pulsecore/svolume_arm.c
@@ -29,11 +29,11 @@
 #include <pulsecore/macro.h>
 #include <pulsecore/g711.h>
 #include <pulsecore/core-util.h>
+#include <pulsecore/endianmacros.h>
 
 #include "cpu-arm.h"
 
 #include "sample-util.h"
-#include "endianmacros.h"
 
 #if defined (__arm__) && defined (HAVE_ARMV6)
 
diff --git a/src/pulsecore/svolume_c.c b/src/pulsecore/svolume_c.c
index dfe7ccb..e55d0d7 100644
--- a/src/pulsecore/svolume_c.c
+++ b/src/pulsecore/svolume_c.c
@@ -28,9 +28,9 @@
 #include <pulsecore/macro.h>
 #include <pulsecore/g711.h>
 #include <pulsecore/core-util.h>
+#include <pulsecore/endianmacros.h>
 
 #include "sample-util.h"
-#include "endianmacros.h"
 
 static void pa_volume_u8_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
diff --git a/src/pulsecore/svolume_mmx.c b/src/pulsecore/svolume_mmx.c
index 263790d..4f10954 100644
--- a/src/pulsecore/svolume_mmx.c
+++ b/src/pulsecore/svolume_mmx.c
@@ -31,11 +31,11 @@
 #include <pulsecore/macro.h>
 #include <pulsecore/g711.h>
 #include <pulsecore/core-util.h>
+#include <pulsecore/endianmacros.h>
 
 #include "cpu-x86.h"
 
 #include "sample-util.h"
-#include "endianmacros.h"
 
 #if defined (__i386__) || defined (__amd64__)
 /* in s: 2 int16_t samples
diff --git a/src/pulsecore/svolume_sse.c b/src/pulsecore/svolume_sse.c
index 8682807..ef07a24 100644
--- a/src/pulsecore/svolume_sse.c
+++ b/src/pulsecore/svolume_sse.c
@@ -31,11 +31,11 @@
 #include <pulsecore/macro.h>
 #include <pulsecore/g711.h>
 #include <pulsecore/core-util.h>
+#include <pulsecore/endianmacros.h>
 
 #include "cpu-x86.h"
 
 #include "sample-util.h"
-#include "endianmacros.h"
 
 #if defined (__i386__) || defined (__amd64__)
 
diff --git a/src/tests/cpulimit-test.c b/src/tests/cpulimit-test.c
index 282902a..5b11bc4 100644
--- a/src/tests/cpulimit-test.c
+++ b/src/tests/cpulimit-test.c
@@ -34,7 +34,7 @@
 #include <pulse/mainloop-signal.h>
 #endif
 
-#include "../daemon/cpulimit.h"
+#include <daemon/cpulimit.h>
 
 /* A simple example for testing the cpulimit subsystem */
 
diff --git a/src/utils/pax11publish.c b/src/utils/pax11publish.c
index a6f058a..6600363 100644
--- a/src/utils/pax11publish.c
+++ b/src/utils/pax11publish.c
@@ -33,6 +33,7 @@
 
 #include <pulse/util.h>
 #include <pulse/i18n.h>
+#include <pulse/client-conf.h>
 
 #include <pulsecore/core-util.h>
 #include <pulsecore/log.h>
@@ -40,7 +41,6 @@
 #include <pulsecore/native-common.h>
 #include <pulsecore/x11prop.h>
 
-#include "../pulse/client-conf.h"
 
 int main(int argc, char *argv[]) {
     const char *dname = NULL, *sink = NULL, *source = NULL, *server = NULL, *cookie_file = PA_NATIVE_COOKIE_FILE;

commit e2df84497629d61706c455ed2829db0bebb7e5a5
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Wed Mar 9 10:00:21 2011 +0100

    build: Use silent rules for generating files

diff --git a/man/Makefile.am b/man/Makefile.am
index 7793fe7..eca1fb9 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -36,7 +36,7 @@ noinst_DATA = \
 	default.pa.5.xml
 
 %.xml: %.xml.in Makefile
-	sed -e 's, at pulseconfdir\@,$(pulseconfdir),g' \
+	$(AM_V_GEN) sed -e 's, at pulseconfdir\@,$(pulseconfdir),g' \
 	    -e 's, at PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
             -e 's, at PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
 
@@ -66,7 +66,7 @@ CLEANFILES += \
 	$(dist_man_MANS)
 
 %: %.xml Makefile
-	perl $(srcdir)/xmltoman $< > $@ || rm -f $@
+	$(AM_V_GEN) perl $(srcdir)/xmltoman $< > $@ || rm -f $@
 
 endif
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 68eabd2..2ab6355 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1866,23 +1866,23 @@ module_rygel_media_server_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
 CLEANFILES += esdcompat client.conf default.pa system.pa daemon.conf start-pulseaudio-x11 start-pulseaudio-kde daemon/pulseaudio.desktop daemon/pulseaudio-kde.desktop
 
 esdcompat: daemon/esdcompat.in Makefile
-	sed -e 's, at PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
+	$(AM_V_GEN) sed -e 's, at PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
 		-e 's, at PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
 		-e 's, at PA_BINARY\@,$(PA_BINARY),g' < $< > $@
-	chmod +x esdcompat
+	$(AM_V_at) chmod +x esdcompat
 
 start-pulseaudio-x11: daemon/start-pulseaudio-x11.in Makefile
-	sed -e 's, at PA_BINARY\@,$(PA_BINARY),g' \
+	$(AM_V_GEN) sed -e 's, at PA_BINARY\@,$(PA_BINARY),g' \
 		-e 's, at PACTL_BINARY\@,$(bindir)/pactl,g' < $< > $@
-	chmod +x start-pulseaudio-x11
+	$(AM_V_at) chmod +x start-pulseaudio-x11
 
 start-pulseaudio-kde: daemon/start-pulseaudio-kde.in Makefile
-	sed -e 's, at PA_BINARY\@,$(PA_BINARY),g' \
+	$(AM_V_GEN) sed -e 's, at PA_BINARY\@,$(PA_BINARY),g' \
 		-e 's, at PACTL_BINARY\@,$(bindir)/pactl,g' < $< > $@
-	chmod +x start-pulseaudio-kde
+	$(AM_V_at) chmod +x start-pulseaudio-kde
 
 client.conf: pulse/client.conf.in Makefile
-	sed -e 's, at PA_BINARY\@,$(PA_BINARY),g' < $< > $@
+	$(AM_V_GEN) sed -e 's, at PA_BINARY\@,$(PA_BINARY),g' < $< > $@
 
 if OS_IS_WIN32
 default.pa: daemon/default.pa.win32
@@ -1891,17 +1891,17 @@ system.pa: daemon/default.pa.win32
 	cp $< $@
 else
 default.pa: daemon/default.pa.in Makefile
-	sed -e 's, at PA_BINARY\@,$(PA_BINARY),g' \
+	$(AM_V_GEN) sed -e 's, at PA_BINARY\@,$(PA_BINARY),g' \
             -e 's, at PA_DLSEARCHPATH\@,$(modlibexecdir),g' \
 	    -e 's, at PA_SOEXT\@,.so,g' < $< > $@
 system.pa: daemon/system.pa.in Makefile
-	sed -e 's, at PA_BINARY\@,$(PA_BINARY),g' \
+	$(AM_V_GEN) sed -e 's, at PA_BINARY\@,$(PA_BINARY),g' \
             -e 's, at PA_DLSEARCHPATH\@,$(modlibexecdir),g' \
 	    -e 's, at PA_SOEXT\@,.so,g' < $< > $@
 endif
 
 daemon.conf: daemon/daemon.conf.in Makefile
-	sed -e 's, at PA_DLSEARCHPATH\@,$(modlibexecdir),g' \
+	$(AM_V_GEN) sed -e 's, at PA_DLSEARCHPATH\@,$(modlibexecdir),g' \
 		-e 's, at PA_DEFAULT_CONFIG_FILE\@,$(DEFAULT_CONFIG_DIR),g' < $< > $@
 
 install-exec-hook:

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list