summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/daemon/caps.c18
-rw-r--r--src/daemon/caps.h6
-rw-r--r--src/daemon/cmdline.c36
-rw-r--r--src/daemon/cmdline.h6
-rw-r--r--src/daemon/cpulimit.c22
-rw-r--r--src/daemon/cpulimit.h6
-rw-r--r--src/daemon/daemon-conf.c16
-rw-r--r--src/daemon/daemon-conf.h4
-rw-r--r--src/daemon/dumpmodules.c22
-rw-r--r--src/daemon/main.c60
-rw-r--r--src/modules/alsa-util.c28
-rw-r--r--src/modules/alsa-util.h6
-rw-r--r--src/modules/dbus-util.c6
-rw-r--r--src/modules/dbus-util.h6
-rw-r--r--src/modules/module-alsa-sink.c54
-rw-r--r--src/modules/module-alsa-source.c58
-rw-r--r--src/modules/module-cli.c14
-rw-r--r--src/modules/module-combine.c70
-rw-r--r--src/modules/module-detect.c36
-rw-r--r--src/modules/module-esound-compat-spawnfd.c6
-rw-r--r--src/modules/module-esound-compat-spawnpid.c6
-rw-r--r--src/modules/module-esound-sink.c58
-rw-r--r--src/modules/module-hal-detect.c12
-rw-r--r--src/modules/module-jack-sink.c70
-rw-r--r--src/modules/module-jack-source.c70
-rw-r--r--src/modules/module-lirc.c42
-rw-r--r--src/modules/module-match.c26
-rw-r--r--src/modules/module-mmkbd-evdev.c26
-rw-r--r--src/modules/module-native-protocol-fd.c10
-rw-r--r--src/modules/module-null-sink.c24
-rw-r--r--src/modules/module-oss-mmap.c86
-rw-r--r--src/modules/module-oss.c70
-rw-r--r--src/modules/module-pipe-sink.c36
-rw-r--r--src/modules/module-pipe-source.c30
-rw-r--r--src/modules/module-protocol-stub.c36
-rw-r--r--src/modules/module-rescue-streams.c22
-rw-r--r--src/modules/module-sine.c18
-rw-r--r--src/modules/module-solaris.c36
-rw-r--r--src/modules/module-tunnel.c86
-rw-r--r--src/modules/module-volume-restore.c64
-rw-r--r--src/modules/module-waveout.c22
-rw-r--r--src/modules/module-x11-bell.c18
-rw-r--r--src/modules/module-x11-publish.c26
-rw-r--r--src/modules/module-zeroconf-publish.c108
-rw-r--r--src/modules/oss-util.c44
-rw-r--r--src/modules/oss-util.h6
-rw-r--r--src/pulse/browser.c62
-rw-r--r--src/pulse/browser.h8
-rw-r--r--src/pulse/cdecl.h6
-rw-r--r--src/pulse/channelmap.c110
-rw-r--r--src/pulse/channelmap.h20
-rw-r--r--src/pulse/client-conf-x11.c4
-rw-r--r--src/pulse/client-conf.c16
-rw-r--r--src/pulse/context.c156
-rw-r--r--src/pulse/context.h10
-rw-r--r--src/pulse/def.h16
-rw-r--r--src/pulse/error.c6
-rw-r--r--src/pulse/error.h6
-rw-r--r--src/pulse/glib-mainloop.c98
-rw-r--r--src/pulse/glib-mainloop.h6
-rw-r--r--src/pulse/internal.h20
-rw-r--r--src/pulse/introspect.c118
-rw-r--r--src/pulse/introspect.h24
-rw-r--r--src/pulse/mainloop-api.c6
-rw-r--r--src/pulse/mainloop-api.h8
-rw-r--r--src/pulse/mainloop-signal.c20
-rw-r--r--src/pulse/mainloop-signal.h6
-rw-r--r--src/pulse/mainloop.c96
-rw-r--r--src/pulse/mainloop.h8
-rw-r--r--src/pulse/operation.c20
-rw-r--r--src/pulse/operation.h6
-rw-r--r--src/pulse/pulseaudio.h12
-rw-r--r--src/pulse/sample.c12
-rw-r--r--src/pulse/sample.h6
-rw-r--r--src/pulse/scache.c24
-rw-r--r--src/pulse/scache.h6
-rw-r--r--src/pulse/simple.c68
-rw-r--r--src/pulse/simple.h6
-rw-r--r--src/pulse/stream.c238
-rw-r--r--src/pulse/stream.h20
-rw-r--r--src/pulse/subscribe.c10
-rw-r--r--src/pulse/subscribe.h6
-rw-r--r--src/pulse/thread-mainloop.c16
-rw-r--r--src/pulse/thread-mainloop.h10
-rw-r--r--src/pulse/timeval.c12
-rw-r--r--src/pulse/timeval.h6
-rw-r--r--src/pulse/utf8.c2
-rw-r--r--src/pulse/utf8.h6
-rw-r--r--src/pulse/util.c30
-rw-r--r--src/pulse/util.h6
-rw-r--r--src/pulse/volume.c14
-rw-r--r--src/pulse/volume.h6
-rw-r--r--src/pulse/xmalloc.c20
-rw-r--r--src/pulse/xmalloc.h6
-rw-r--r--src/pulsecore/anotify.c18
-rw-r--r--src/pulsecore/anotify.h6
-rw-r--r--src/pulsecore/atomic.h6
-rw-r--r--src/pulsecore/authkey-prop.c10
-rw-r--r--src/pulsecore/authkey-prop.h6
-rw-r--r--src/pulsecore/authkey.c26
-rw-r--r--src/pulsecore/authkey.h6
-rw-r--r--src/pulsecore/autoload.c30
-rw-r--r--src/pulsecore/autoload.h8
-rw-r--r--src/pulsecore/avahi-wrap.c34
-rw-r--r--src/pulsecore/avahi-wrap.h6
-rw-r--r--src/pulsecore/cli-command.c48
-rw-r--r--src/pulsecore/cli-command.h6
-rw-r--r--src/pulsecore/cli-text.c46
-rw-r--r--src/pulsecore/cli-text.h6
-rw-r--r--src/pulsecore/cli.c14
-rw-r--r--src/pulsecore/cli.h6
-rw-r--r--src/pulsecore/client.c8
-rw-r--r--src/pulsecore/client.h6
-rw-r--r--src/pulsecore/conf-parser.c34
-rw-r--r--src/pulsecore/core-def.h6
-rw-r--r--src/pulsecore/core-error.c6
-rw-r--r--src/pulsecore/core-error.h6
-rw-r--r--src/pulsecore/core-scache.c28
-rw-r--r--src/pulsecore/core-scache.h10
-rw-r--r--src/pulsecore/core-subscribe.c32
-rw-r--r--src/pulsecore/core-subscribe.h6
-rw-r--r--src/pulsecore/core-util.c154
-rw-r--r--src/pulsecore/core-util.h6
-rw-r--r--src/pulsecore/core.c18
-rw-r--r--src/pulsecore/core.h8
-rw-r--r--src/pulsecore/creds.h6
-rw-r--r--src/pulsecore/dynarray.c6
-rw-r--r--src/pulsecore/dynarray.h6
-rw-r--r--src/pulsecore/endianmacros.h6
-rw-r--r--src/pulsecore/esound.h6
-rw-r--r--src/pulsecore/flist.c22
-rw-r--r--src/pulsecore/flist.h6
-rw-r--r--src/pulsecore/g711.h2
-rw-r--r--src/pulsecore/gccmacro.h6
-rw-r--r--src/pulsecore/hashmap.c30
-rw-r--r--src/pulsecore/hashmap.h6
-rw-r--r--src/pulsecore/hook-list.c30
-rw-r--r--src/pulsecore/hook-list.h6
-rw-r--r--src/pulsecore/idxset.c50
-rw-r--r--src/pulsecore/idxset.h6
-rw-r--r--src/pulsecore/inet_ntop.c6
-rw-r--r--src/pulsecore/inet_pton.c6
-rw-r--r--src/pulsecore/iochannel.c66
-rw-r--r--src/pulsecore/iochannel.h6
-rw-r--r--src/pulsecore/ioline.c70
-rw-r--r--src/pulsecore/ioline.h6
-rw-r--r--src/pulsecore/ipacl.c36
-rw-r--r--src/pulsecore/ipacl.h6
-rw-r--r--src/pulsecore/llist.h12
-rw-r--r--src/pulsecore/log.c30
-rw-r--r--src/pulsecore/log.h6
-rw-r--r--src/pulsecore/mcalign.c34
-rw-r--r--src/pulsecore/mcalign.h10
-rw-r--r--src/pulsecore/memblock.c94
-rw-r--r--src/pulsecore/memblock.h10
-rw-r--r--src/pulsecore/memblockq.c80
-rw-r--r--src/pulsecore/memblockq.h20
-rw-r--r--src/pulsecore/memchunk.c10
-rw-r--r--src/pulsecore/memchunk.h6
-rw-r--r--src/pulsecore/modargs.c22
-rw-r--r--src/pulsecore/modargs.h6
-rw-r--r--src/pulsecore/modinfo.c6
-rw-r--r--src/pulsecore/modinfo.h6
-rw-r--r--src/pulsecore/module.c38
-rw-r--r--src/pulsecore/module.h8
-rw-r--r--src/pulsecore/mutex-posix.c6
-rw-r--r--src/pulsecore/mutex-win32.c6
-rw-r--r--src/pulsecore/mutex.h6
-rw-r--r--src/pulsecore/namereg.c60
-rw-r--r--src/pulsecore/namereg.h6
-rw-r--r--src/pulsecore/native-common.h18
-rw-r--r--src/pulsecore/once-posix.c30
-rw-r--r--src/pulsecore/once-win32.c8
-rw-r--r--src/pulsecore/once.h6
-rw-r--r--src/pulsecore/packet.c14
-rw-r--r--src/pulsecore/packet.h6
-rw-r--r--src/pulsecore/parseaddr.c22
-rw-r--r--src/pulsecore/parseaddr.h6
-rw-r--r--src/pulsecore/pdispatch.c40
-rw-r--r--src/pulsecore/pdispatch.h6
-rw-r--r--src/pulsecore/pid.c36
-rw-r--r--src/pulsecore/pid.h6
-rw-r--r--src/pulsecore/pipe.c6
-rw-r--r--src/pulsecore/pipe.h6
-rw-r--r--src/pulsecore/play-memblockq.c18
-rw-r--r--src/pulsecore/play-memblockq.h6
-rw-r--r--src/pulsecore/play-memchunk.c18
-rw-r--r--src/pulsecore/play-memchunk.h6
-rw-r--r--src/pulsecore/poll.c6
-rw-r--r--src/pulsecore/poll.h6
-rw-r--r--src/pulsecore/props.c12
-rw-r--r--src/pulsecore/props.h6
-rw-r--r--src/pulsecore/protocol-cli.c10
-rw-r--r--src/pulsecore/protocol-cli.h6
-rw-r--r--src/pulsecore/protocol-esound.c152
-rw-r--r--src/pulsecore/protocol-esound.h6
-rw-r--r--src/pulsecore/protocol-http.c28
-rw-r--r--src/pulsecore/protocol-http.h6
-rw-r--r--src/pulsecore/protocol-native.c274
-rw-r--r--src/pulsecore/protocol-native.h6
-rw-r--r--src/pulsecore/protocol-simple.c54
-rw-r--r--src/pulsecore/protocol-simple.h6
-rw-r--r--src/pulsecore/pstream-util.c6
-rw-r--r--src/pulsecore/pstream-util.h6
-rw-r--r--src/pulsecore/pstream.c146
-rw-r--r--src/pulsecore/pstream.h6
-rw-r--r--src/pulsecore/queue.c8
-rw-r--r--src/pulsecore/queue.h6
-rw-r--r--src/pulsecore/random.c6
-rw-r--r--src/pulsecore/random.h8
-rw-r--r--src/pulsecore/refcnt.h6
-rw-r--r--src/pulsecore/resampler.c104
-rw-r--r--src/pulsecore/resampler.h6
-rw-r--r--src/pulsecore/sample-util.c138
-rw-r--r--src/pulsecore/sample-util.h6
-rw-r--r--src/pulsecore/sconv-s16be.c6
-rw-r--r--src/pulsecore/sconv-s16be.h6
-rw-r--r--src/pulsecore/sconv-s16le.c14
-rw-r--r--src/pulsecore/sconv-s16le.h6
-rw-r--r--src/pulsecore/sconv.c16
-rw-r--r--src/pulsecore/sconv.h6
-rw-r--r--src/pulsecore/shm.c46
-rw-r--r--src/pulsecore/shm.h6
-rw-r--r--src/pulsecore/sink-input.c100
-rw-r--r--src/pulsecore/sink-input.h22
-rw-r--r--src/pulsecore/sink.c98
-rw-r--r--src/pulsecore/sink.h12
-rw-r--r--src/pulsecore/sioman.c8
-rw-r--r--src/pulsecore/sioman.h6
-rw-r--r--src/pulsecore/socket-client.c68
-rw-r--r--src/pulsecore/socket-client.h6
-rw-r--r--src/pulsecore/socket-server.c66
-rw-r--r--src/pulsecore/socket-server.h6
-rw-r--r--src/pulsecore/socket-util.c20
-rw-r--r--src/pulsecore/socket-util.h6
-rw-r--r--src/pulsecore/sound-file-stream.c28
-rw-r--r--src/pulsecore/sound-file-stream.h6
-rw-r--r--src/pulsecore/sound-file.c18
-rw-r--r--src/pulsecore/sound-file.h6
-rw-r--r--src/pulsecore/source-output.c64
-rw-r--r--src/pulsecore/source-output.h12
-rw-r--r--src/pulsecore/source.c54
-rw-r--r--src/pulsecore/source.h16
-rw-r--r--src/pulsecore/strbuf.c18
-rw-r--r--src/pulsecore/strbuf.h6
-rw-r--r--src/pulsecore/strlist.c14
-rw-r--r--src/pulsecore/strlist.h6
-rw-r--r--src/pulsecore/tagstruct.c48
-rw-r--r--src/pulsecore/tagstruct.h6
-rw-r--r--src/pulsecore/thread-posix.c36
-rw-r--r--src/pulsecore/thread-win32.c6
-rw-r--r--src/pulsecore/thread.h6
-rw-r--r--src/pulsecore/tokenizer.c8
-rw-r--r--src/pulsecore/tokenizer.h6
-rw-r--r--src/pulsecore/x11prop.c4
-rw-r--r--src/pulsecore/x11wrap.c26
-rw-r--r--src/pulsecore/x11wrap.h6
-rw-r--r--src/tests/channelmap-test.c10
-rw-r--r--src/tests/cpulimit-test.c14
-rw-r--r--src/tests/flist-test.c10
-rw-r--r--src/tests/get-binary-name-test.c6
-rw-r--r--src/tests/hook-list-test.c4
-rw-r--r--src/tests/interpol-test.c30
-rw-r--r--src/tests/ipacl-test.c14
-rw-r--r--src/tests/mainloop-test.c8
-rw-r--r--src/tests/mcalign-test.c10
-rw-r--r--src/tests/memblock-test.c36
-rw-r--r--src/tests/memblockq-test.c30
-rw-r--r--src/tests/pacat-simple.c16
-rw-r--r--src/tests/parec-simple.c10
-rw-r--r--src/tests/strlist-test.c6
-rw-r--r--src/tests/sync-playback.c28
-rw-r--r--src/tests/thread-mainloop-test.c14
-rw-r--r--src/tests/thread-test.c32
-rw-r--r--src/tests/utf8-test.c4
-rw-r--r--src/tests/voltest.c2
-rw-r--r--src/utils/pabrowse.c18
-rw-r--r--src/utils/pacat.c86
-rw-r--r--src/utils/pacmd.c40
-rw-r--r--src/utils/pactl.c76
-rw-r--r--src/utils/padsp.c278
-rw-r--r--src/utils/paplay.c48
-rw-r--r--src/utils/pax11publish.c24
283 files changed, 3742 insertions, 3742 deletions
diff --git a/src/daemon/caps.c b/src/daemon/caps.c
index cebdaebc..db4bd919 100644
--- a/src/daemon/caps.c
+++ b/src/daemon/caps.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -50,7 +50,7 @@ int setresuid(uid_t r, uid_t e, uid_t s);
/* Drop root rights when called SUID root */
void pa_drop_root(void) {
uid_t uid = getuid();
-
+
if (uid == 0 || geteuid() != 0)
return;
@@ -96,13 +96,13 @@ int pa_limit_caps(void) {
if (cap_set_proc(caps) < 0)
goto fail;
- pa_log_info("dropped capabilities successfully.");
-
+ pa_log_info("dropped capabilities successfully.");
+
r = 0;
fail:
cap_free (caps);
-
+
return r;
}
@@ -124,12 +124,12 @@ int pa_drop_caps(void) {
pa_log("failed to drop capabilities: %s", pa_cstrerror(errno));
goto fail;
}
-
+
r = 0;
fail:
cap_free (caps);
-
+
return r;
}
diff --git a/src/daemon/caps.h b/src/daemon/caps.h
index 8a618286..34da1af6 100644
--- a/src/daemon/caps.h
+++ b/src/daemon/caps.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/daemon/cmdline.c b/src/daemon/cmdline.c
index d368b644..c3cb9209 100644
--- a/src/daemon/cmdline.c
+++ b/src/daemon/cmdline.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -100,7 +100,7 @@ void pa_cmdline_help(const char *argv0) {
e++;
else
e = argv0;
-
+
printf("%s [options]\n\n"
"COMMANDS:\n"
" -h, --help Show this help\n"
@@ -124,7 +124,7 @@ void pa_cmdline_help(const char *argv0) {
" --scache-idle-time=SECS Unload autoloaded samples when idle and\n"
" this time passed\n"
" --log-level[=LEVEL] Increase or set verbosity level\n"
- " -v Increase the verbosity level\n"
+ " -v Increase the verbosity level\n"
" --log-target={auto,syslog,stderr} Specify the log target\n"
" -p, --dl-search-path=PATH Set the search path for dynamic shared\n"
" objects (plugins)\n"
@@ -143,7 +143,7 @@ void pa_cmdline_help(const char *argv0) {
" -F, --file=FILENAME Run the specified script\n"
" -C Open a command line on the running TTY\n"
" after startup\n\n"
-
+
" -n Don't load default script file\n", e);
}
@@ -156,7 +156,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
if (conf->script_commands)
pa_strbuf_puts(buf, conf->script_commands);
-
+
while ((c = getopt_long(argc, argv, "L:F:ChDnp:kv", long_options, NULL)) != -1) {
switch (c) {
case ARG_HELP:
@@ -184,21 +184,21 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
case ARG_CHECK:
conf->cmd = PA_CMD_CHECK;
break;
-
+
case ARG_LOAD:
case 'L':
pa_strbuf_printf(buf, "load-module %s\n", optarg);
break;
-
+
case ARG_FILE:
case 'F':
pa_strbuf_printf(buf, ".include %s\n", optarg);
break;
-
+
case 'C':
pa_strbuf_puts(buf, "load-module module-cli exit_on_eof=1\n");
break;
-
+
case ARG_DAEMONIZE:
case 'D':
if ((conf->daemonize = optarg ? pa_parse_boolean(optarg) : 1) < 0) {
@@ -226,7 +226,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
if (conf->log_level < PA_LOG_LEVEL_MAX-1)
conf->log_level++;
}
-
+
break;
case ARG_HIGH_PRIORITY:
@@ -249,13 +249,13 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
goto fail;
}
break;
-
+
case 'p':
case ARG_DL_SEARCH_PATH:
pa_xfree(conf->dl_search_path);
conf->dl_search_path = *optarg ? pa_xstrdup(optarg) : NULL;
break;
-
+
case 'n':
pa_xfree(conf->default_script_file);
conf->default_script_file = NULL;
@@ -307,7 +307,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
goto fail;
}
break;
-
+
default:
goto fail;
}
@@ -322,12 +322,12 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
}
*d = optind;
-
+
return 0;
-
+
fail:
if (buf)
pa_strbuf_free(buf);
-
+
return -1;
}
diff --git a/src/daemon/cmdline.h b/src/daemon/cmdline.h
index 25453e55..fdfbc0b6 100644
--- a/src/daemon/cmdline.h
+++ b/src/daemon/cmdline.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/daemon/cpulimit.c b/src/daemon/cpulimit.c
index d7466b06..808cb4d4 100644
--- a/src/daemon/cpulimit.c
+++ b/src/daemon/cpulimit.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -80,7 +80,7 @@ static pa_io_event *io_event = NULL;
static struct sigaction sigaction_prev;
/* Nonzero after pa_cpu_limit_init() */
-static int installed = 0;
+static int installed = 0;
/* The current state of operation */
static enum {
@@ -131,24 +131,24 @@ static void signal_handler(int sig) {
snprintf(t, sizeof(t), "Using %0.1f%% CPU\n", (double)CPUTIME_INTERVAL_SOFT/(now-last_time)*100);
write_err(t);
#endif
-
+
if (CPUTIME_INTERVAL_SOFT >= ((now-last_time)*(double)CPUTIME_PERCENT/100)) {
static const char c = 'X';
write_err("Soft CPU time limit exhausted, terminating.\n");
-
+
/* Try a soft cleanup */
write(the_pipe[1], &c, sizeof(c));
phase = PHASE_SOFT;
reset_cpu_time(CPUTIME_INTERVAL_HARD);
-
+
} else {
/* Everything's fine */
reset_cpu_time(CPUTIME_INTERVAL_SOFT);
last_time = now;
}
-
+
} else if (phase == PHASE_SOFT) {
write_err("Hard CPU time limit exhausted, terminating forcibly.\n");
_exit(1); /* Forced exit */
@@ -167,7 +167,7 @@ static void callback(pa_mainloop_api*m, pa_io_event*e, int fd, pa_io_event_flags
int pa_cpu_limit_init(pa_mainloop_api *m) {
struct sigaction sa;
assert(m && !api && !io_event && the_pipe[0] == -1 && the_pipe[1] == -1 && !installed);
-
+
time(&last_time);
/* Prepare the main loop pipe */
@@ -191,7 +191,7 @@ int pa_cpu_limit_init(pa_mainloop_api *m) {
sa.sa_handler = signal_handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART;
-
+
if (sigaction(SIGXCPU, &sa, &sigaction_prev) < 0) {
pa_cpu_limit_done();
return -1;
@@ -200,7 +200,7 @@ int pa_cpu_limit_init(pa_mainloop_api *m) {
installed = 1;
reset_cpu_time(CPUTIME_INTERVAL_SOFT);
-
+
return 0;
}
diff --git a/src/daemon/cpulimit.h b/src/daemon/cpulimit.h
index 21bdd17b..bb11f794 100644
--- a/src/daemon/cpulimit.h
+++ b/src/daemon/cpulimit.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index dd478126..319cf0c7 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -231,7 +231,7 @@ static int parse_rlimit(const char *filename, unsigned line, const char *lvalue,
int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
int r = -1;
FILE *f = NULL;
-
+
pa_config_item table[] = {
{ "daemonize", pa_config_parse_bool, NULL },
{ "fail", pa_config_parse_bool, NULL },
@@ -266,7 +266,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
#endif
{ NULL, NULL, NULL },
};
-
+
table[0].data = &c->daemonize;
table[1].data = &c->fail;
table[2].data = &c->high_priority;
@@ -301,8 +301,8 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
table[24].data = &c->rlimit_memlock;
#endif
#endif
-
-
+
+
pa_xfree(c->config_file);
c->config_file = NULL;
@@ -316,11 +316,11 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
}
r = f ? pa_config_parse(c->config_file, f, table, NULL) : 0;
-
+
finish:
if (f)
fclose(f);
-
+
return r;
}
@@ -354,7 +354,7 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
pa_strbuf_printf(s, "### Read from configuration file: %s ###\n", c->config_file);
assert(c->log_level <= PA_LOG_LEVEL_MAX);
-
+
pa_strbuf_printf(s, "daemonize = %i\n", !!c->daemonize);
pa_strbuf_printf(s, "fail = %i\n", !!c->fail);
pa_strbuf_printf(s, "high-priority = %i\n", !!c->high_priority);
@@ -385,6 +385,6 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
pa_strbuf_printf(s, "rlimit-memlock = %li\n", c->rlimit_memlock.is_set ? (long int) c->rlimit_memlock.value : -1);
#endif
#endif
-
+
return pa_strbuf_tostring_free(s);
}
diff --git a/src/daemon/daemon-conf.h b/src/daemon/daemon-conf.h
index b4b833ad..b7fcf23b 100644
--- a/src/daemon/daemon-conf.h
+++ b/src/daemon/daemon-conf.h
@@ -66,7 +66,7 @@ typedef struct pa_daemon_conf {
pa_log_level_t log_level;
int resample_method;
char *config_file;
-
+
#ifdef HAVE_SYS_RESOURCE_H
pa_rlimit rlimit_as, rlimit_core, rlimit_data, rlimit_fsize, rlimit_nofile, rlimit_stack;
#ifdef RLIMIT_NPROC
@@ -76,7 +76,7 @@ typedef struct pa_daemon_conf {
pa_rlimit rlimit_memlock;
#endif
#endif
-
+
} pa_daemon_conf;
/* Allocate a new structure and fill it with sane defaults */
diff --git a/src/daemon/dumpmodules.c b/src/daemon/dumpmodules.c
index 06734ea6..8509924a 100644
--- a/src/daemon/dumpmodules.c
+++ b/src/daemon/dumpmodules.c
@@ -45,14 +45,14 @@ static void short_info(const char *name, PA_GCC_UNUSED const char *path, pa_modi
static void long_info(const char *name, const char *path, pa_modinfo *i) {
static int nl = 0;
assert(name && i);
-
+
if (nl)
printf("\n");
nl = 1;
printf("Name: %s\n", name);
-
+
if (!i->description && !i->version && !i->author && !i->usage)
printf("No module information available\n");
else {
@@ -65,14 +65,14 @@ static void long_info(const char *name, const char *path, pa_modinfo *i) {
if (i->usage)
printf("Usage: %s\n", i->usage);
}
-
+
if (path)
printf("Path: %s\n", path);
}
static void show_info(const char *name, const char *path, void (*info)(const char *name, const char *path, pa_modinfo*i)) {
pa_modinfo *i;
-
+
if ((i = pa_modinfo_get_by_name(path ? path : name))) {
info(name, path, i);
pa_modinfo_free(i);
@@ -86,10 +86,10 @@ static int is_preloaded(const char *name) {
for (l = lt_preloaded_symbols; l->name; l++) {
char buf[64], *e;
-
+
if (l->address)
continue;
-
+
snprintf(buf, sizeof(buf), "%s", l->name);
if ((e = strrchr(buf, '.')))
*e = 0;
@@ -112,7 +112,7 @@ static int callback(const char *path, lt_ptr data) {
if (is_preloaded(e))
return 0;
-
+
show_info(e, path, c->log_level >= PA_LOG_INFO ? long_info : short_info);
return 0;
}
@@ -127,20 +127,20 @@ void pa_dump_modules(pa_daemon_conf *c, int argc, char * const argv[]) {
for (l = lt_preloaded_symbols; l->name; l++) {
char buf[64], *e;
-
+
if (l->address)
continue;
if (strlen(l->name) <= sizeof(PREFIX)-1 || strncmp(l->name, PREFIX, sizeof(PREFIX)-1))
continue;
-
+
snprintf(buf, sizeof(buf), "%s", l->name);
if ((e = strrchr(buf, '.')))
*e = 0;
-
+
show_info(buf, NULL, c->log_level >= PA_LOG_INFO ? long_info : short_info);
}
-
+
lt_dlforeachfile(NULL, callback, c);
}
}
diff --git a/src/daemon/main.c b/src/daemon/main.c
index 5d77282c..b7266b7e 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -125,7 +125,7 @@ static void signal_callback(pa_mainloop_api*m, PA_GCC_UNUSED pa_signal_event *e,
pa_module_load(userdata, "module-cli", NULL);
break;
#endif
-
+
#ifdef SIGUSR2
case SIGUSR2:
pa_module_load(userdata, "module-cli-protocol-unix", NULL);
@@ -170,7 +170,7 @@ static int change_user(void) {
/* This function is called only in system-wide mode. It creates a
* runtime dir in /var/run/ with proper UID/GID and drops privs
* afterwards. */
-
+
if (!(pw = getpwnam(PA_SYSTEM_USER))) {
pa_log("Failed to find user '%s'.", PA_SYSTEM_USER);
return -1;
@@ -197,7 +197,7 @@ static int change_user(void) {
pa_log("Failed to create '%s': %s", PA_SYSTEM_RUNTIME_PATH, pa_cstrerror(errno));
return -1;
}
-
+
if (initgroups(PA_SYSTEM_USER, gr->gr_gid) != 0) {
pa_log("Failed to change group list: %s", pa_cstrerror(errno));
return -1;
@@ -265,7 +265,7 @@ static int create_runtime_dir(void) {
/* This function is called only when the daemon is started in
* per-user mode. We create the runtime directory somewhere in
* /tmp/ with the current UID/GID */
-
+
if (pa_make_secure_dir(fn, 0700, (uid_t)-1, (gid_t)-1) < 0) {
pa_log("Failed to create '%s': %s", fn, pa_cstrerror(errno));
return -1;
@@ -311,7 +311,7 @@ int main(int argc, char *argv[]) {
pa_daemon_conf *conf = NULL;
pa_mainloop *mainloop = NULL;
- char *s;
+ char *s;
int r, retval = 1, d = 0;
int daemon_pipe[2] = { -1, -1 };
int suid_root, real_root;
@@ -333,7 +333,7 @@ int main(int argc, char *argv[]) {
#ifdef HAVE_GETUID
real_root = getuid() == 0;
suid_root = !real_root && geteuid() == 0;
-
+
if (suid_root && (pa_own_uid_in_group(PA_REALTIME_GROUP, &gid) <= 0 || gid >= 1000)) {
pa_log_warn("WARNING: called SUID root, but not in group '"PA_REALTIME_GROUP"'.");
pa_drop_root();
@@ -342,9 +342,9 @@ int main(int argc, char *argv[]) {
real_root = 0;
suid_root = 0;
#endif
-
+
LTDL_SET_PRELOADED_SYMBOLS();
-
+
r = lt_dlinit();
assert(r == 0);
@@ -356,11 +356,11 @@ int main(int argc, char *argv[]) {
#endif
pa_random_seed();
-
+
pa_log_set_ident("pulseaudio");
-
+
conf = pa_daemon_conf_new();
-
+
if (pa_daemon_conf_load(conf, NULL) < 0)
goto finish;
@@ -429,9 +429,9 @@ int main(int argc, char *argv[]) {
pa_log("failed to kill daemon.");
else
retval = 0;
-
+
goto finish;
-
+
default:
assert(conf->cmd == PA_CMD_DAEMON);
}
@@ -457,7 +457,7 @@ int main(int argc, char *argv[]) {
pa_log("failed to create pipe.");
goto finish;
}
-
+
if ((child = fork()) < 0) {
pa_log("fork() failed: %s", pa_cstrerror(errno));
goto finish;
@@ -478,7 +478,7 @@ int main(int argc, char *argv[]) {
pa_log("daemon startup failed.");
else
pa_log_info("daemon startup successful.");
-
+
goto finish;
}
@@ -517,7 +517,7 @@ int main(int argc, char *argv[]) {
#ifdef SIGTSTP
signal(SIGTSTP, SIG_IGN);
#endif
-
+
#ifdef TIOCNOTTY
if ((tty_fd = open("/dev/tty", O_RDWR)) >= 0) {
ioctl(tty_fd, TIOCNOTTY, (char*) 0);
@@ -528,13 +528,13 @@ int main(int argc, char *argv[]) {
chdir("/");
umask(0022);
-
+
if (conf->system_instance) {
if (change_user() < 0)
goto finish;
} else if (create_runtime_dir() < 0)
goto finish;
-
+
if (conf->use_pid_file) {
if (pa_pid_file_create() < 0) {
pa_log("pa_pid_file_create() failed.");
@@ -551,7 +551,7 @@ int main(int argc, char *argv[]) {
#ifdef HAVE_SYS_RESOURCE_H
set_all_rlimits(conf);
#endif
-
+
#ifdef SIGPIPE
signal(SIGPIPE, SIG_IGN);
#endif
@@ -580,7 +580,7 @@ int main(int argc, char *argv[]) {
#ifdef SIGHUP
pa_signal_new(SIGHUP, signal_callback, c);
#endif
-
+
#ifdef OS_IS_WIN32
timer = pa_mainloop_get_api(mainloop)->time_new(
pa_mainloop_get_api(mainloop), pa_gettimeofday(&tv), message_cb, NULL);
@@ -596,7 +596,7 @@ int main(int argc, char *argv[]) {
r = pa_cpu_limit_init(pa_mainloop_get_api(mainloop));
assert(r == 0);
}
-
+
buf = pa_strbuf_new();
if (conf->default_script_file)
r = pa_cli_command_execute_file(c, conf->default_script_file, buf, &conf->fail);
@@ -605,7 +605,7 @@ int main(int argc, char *argv[]) {
r = pa_cli_command_execute(c, conf->script_commands, buf, &conf->fail);
pa_log_error("%s", s = pa_strbuf_tostring_free(buf));
pa_xfree(s);
-
+
if (r < 0 && conf->fail) {
pa_log("failed to initialize daemon.");
#ifdef HAVE_FORK
@@ -652,11 +652,11 @@ int main(int argc, char *argv[]) {
if (!conf->no_cpu_limit)
pa_cpu_limit_done();
-
+
pa_signal_done();
-
+
pa_log_info("Daemon terminated.");
-
+
finish:
if (mainloop)
@@ -667,7 +667,7 @@ finish:
if (valid_pid_file)
pa_pid_file_remove();
-
+
close_pipe(daemon_pipe);
#ifdef OS_IS_WIN32
@@ -675,6 +675,6 @@ finish:
#endif
lt_dlexit();
-
+
return retval;
}
diff --git a/src/modules/alsa-util.c b/src/modules/alsa-util.c
index d8b6c5cc..8023d3ad 100644
--- a/src/modules/alsa-util.c
+++ b/src/modules/alsa-util.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -270,7 +270,7 @@ static int set_format(snd_pcm_t *pcm_handle, snd_pcm_hw_params_t *hwparams, pa_s
};
int i, ret;
-
+
assert(pcm_handle);
assert(f);
@@ -290,12 +290,12 @@ static int set_format(snd_pcm_t *pcm_handle, snd_pcm_hw_params_t *hwparams, pa_s
if ((ret = snd_pcm_hw_params_set_format(pcm_handle, hwparams, format_trans[*f])) >= 0)
return ret;
-
+
try_auto:
for (i = 0; try_order[i] != PA_SAMPLE_INVALID; i++) {
*f = try_order[i];
-
+
if ((ret = snd_pcm_hw_params_set_format(pcm_handle, hwparams, format_trans[*f])) >= 0)
return ret;
}
@@ -312,14 +312,14 @@ int pa_alsa_set_hw_params(snd_pcm_t *pcm_handle, pa_sample_spec *ss, uint32_t *p
unsigned int c = ss->channels;
pa_sample_format_t f = ss->format;
snd_pcm_hw_params_t *hwparams;
-
+
assert(pcm_handle);
assert(ss);
assert(periods);
assert(period_size);
buffer_size = *periods * *period_size;
-
+
if ((ret = snd_pcm_hw_params_malloc(&hwparams)) < 0 ||
(ret = snd_pcm_hw_params_any(pcm_handle, hwparams)) < 0 ||
(ret = snd_pcm_hw_params_set_rate_resample(pcm_handle, hwparams, 0)) < 0 ||
@@ -359,25 +359,25 @@ int pa_alsa_set_hw_params(snd_pcm_t *pcm_handle, pa_sample_spec *ss, uint32_t *p
pa_log_warn("device doesn't support sample format %s, changed to %s.", pa_sample_format_to_string(ss->format), pa_sample_format_to_string(f));
ss->format = f;
}
-
+
if ((ret = snd_pcm_prepare(pcm_handle)) < 0)
goto finish;
if ((ret = snd_pcm_hw_params_get_buffer_size(hwparams, &buffer_size)) < 0 ||
(ret = snd_pcm_hw_params_get_period_size(hwparams, period_size, NULL)) < 0)
goto finish;
-
+
assert(buffer_size > 0);
assert(*period_size > 0);
*periods = buffer_size / *period_size;
assert(*periods > 0);
-
+
ret = 0;
-
+
finish:
if (hwparams)
snd_pcm_hw_params_free(hwparams);
-
+
return ret;
}
@@ -419,7 +419,7 @@ snd_mixer_elem_t *pa_alsa_find_elem(snd_mixer_t *mixer, const char *name, const
if (fallback) {
snd_mixer_selem_id_set_name(sid, fallback);
-
+
if (!(elem = snd_mixer_find_selem(mixer, sid)))
pa_log_warn("Cannot find fallback mixer control \"%s\".", snd_mixer_selem_id_get_name(sid));
}
diff --git a/src/modules/alsa-util.h b/src/modules/alsa-util.h
index 215844b4..675856c6 100644
--- a/src/modules/alsa-util.h
+++ b/src/modules/alsa-util.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/modules/dbus-util.c b/src/modules/dbus-util.c
index 165ccff6..ee9062d1 100644
--- a/src/modules/dbus-util.c
+++ b/src/modules/dbus-util.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/modules/dbus-util.h b/src/modules/dbus-util.h
index 7a9871a4..73501c29 100644
--- a/src/modules/dbus-util.h
+++ b/src/modules/dbus-util.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/modules/module-alsa-sink.c b/src/modules/module-alsa-sink.c
index 6ff9a6e4..2fea5891 100644
--- a/src/modules/module-alsa-sink.c
+++ b/src/modules/module-alsa-sink.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -95,13 +95,13 @@ static void update_usage(struct userdata *u) {
static void clear_up(struct userdata *u) {
assert(u);
-
+
if (u->sink) {
pa_sink_disconnect(u->sink);
pa_sink_unref(u->sink);
u->sink = NULL;
}
-
+
if (u->pcm_fdl)
pa_alsa_fdlist_free(u->pcm_fdl);
if (u->mixer_fdl)
@@ -113,7 +113,7 @@ static void clear_up(struct userdata *u) {
snd_mixer_close(u->mixer_handle);
u->mixer_handle = NULL;
}
-
+
if (u->pcm_handle) {
snd_pcm_drop(u->pcm_handle);
snd_pcm_close(u->pcm_handle);
@@ -126,7 +126,7 @@ static int xrun_recovery(struct userdata *u) {
assert(u);
pa_log_info("*** ALSA-XRUN (playback) ***");
-
+
if ((ret = snd_pcm_prepare(u->pcm_handle)) < 0) {
pa_log("snd_pcm_prepare() failed: %s", snd_strerror(-ret));
@@ -142,11 +142,11 @@ static void do_write(struct userdata *u) {
assert(u);
update_usage(u);
-
+
for (;;) {
pa_memchunk *memchunk = NULL;
snd_pcm_sframes_t frames;
-
+
if (u->memchunk.memblock)
memchunk = &u->memchunk;
else {
@@ -155,7 +155,7 @@ static void do_write(struct userdata *u) {
else
memchunk = &u->memchunk;
}
-
+
assert(memchunk->memblock && memchunk->memblock->data && memchunk->length && memchunk->memblock->length && (memchunk->length % u->frame_size) == 0);
if ((frames = snd_pcm_writei(u->pcm_handle, (uint8_t*) memchunk->memblock->data + memchunk->index, memchunk->length / u->frame_size)) < 0) {
@@ -165,7 +165,7 @@ static void do_write(struct userdata *u) {
if (frames == -EPIPE) {
if (xrun_recovery(u) < 0)
return;
-
+
continue;
}
@@ -187,7 +187,7 @@ static void do_write(struct userdata *u) {
memchunk->index = memchunk->length = 0;
}
}
-
+
break;
}
}
@@ -229,7 +229,7 @@ static pa_usec_t sink_get_latency_cb(pa_sink *s) {
struct userdata *u = s->userdata;
snd_pcm_sframes_t frames;
int err;
-
+
assert(s && u && u->sink);
if ((err = snd_pcm_delay(u->pcm_handle, &frames)) < 0) {
@@ -292,14 +292,14 @@ static int sink_set_hw_volume_cb(pa_sink *s) {
for (i = 0; i < s->hw_volume.channels; i++) {
long alsa_vol;
-
+
assert(snd_mixer_selem_has_playback_channel(u->mixer_elem, i));
vol = s->hw_volume.values[i];
if (vol > PA_VOLUME_NORM)
vol = PA_VOLUME_NORM;
-
+
alsa_vol = (long) roundf(((float) vol * (u->hw_volume_max - u->hw_volume_min)) / PA_VOLUME_NORM) + u->hw_volume_min;
if ((err = snd_mixer_selem_set_playback_volume(u->mixer_elem, i, alsa_vol)) < 0)
@@ -367,7 +367,7 @@ int pa__init(pa_core *c, pa_module*m) {
const char *name;
char *name_buf = NULL;
int namereg_fail;
-
+
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("failed to parse module arguments");
goto fail;
@@ -380,7 +380,7 @@ int pa__init(pa_core *c, pa_module*m) {
}
frame_size = pa_frame_size(&ss);
-
+
/* Fix latency to 100ms */
periods = 8;
fragsize = pa_bytes_per_second(&ss)/128;
@@ -390,11 +390,11 @@ int pa__init(pa_core *c, pa_module*m) {
goto fail;
}
period_size = fragsize/frame_size;
-
+
u = pa_xnew0(struct userdata, 1);
m->userdata = u;
u->module = m;
-
+
snd_config_update_free_global();
if ((err = snd_pcm_open(&u->pcm_handle, dev = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0) {
pa_log("Error opening PCM device %s: %s", dev, snd_strerror(err));
@@ -415,7 +415,7 @@ int pa__init(pa_core *c, pa_module*m) {
if (ss.channels != map.channels)
/* Seems ALSA didn't like the channel number, so let's fix the channel map */
pa_channel_map_init_auto(&map, ss.channels, PA_CHANNEL_MAP_ALSA);
-
+
if ((err = snd_mixer_open(&u->mixer_handle, 0)) < 0) {
pa_log("Error opening mixer: %s", snd_strerror(err));
goto fail;
@@ -486,7 +486,7 @@ int pa__init(pa_core *c, pa_module*m) {
snd_mixer_elem_set_callback_private(u->mixer_elem, u);
} else
u->mixer_fdl = NULL;
-
+
u->frame_size = frame_size;
u->fragment_size = period_size * frame_size;
@@ -499,7 +499,7 @@ int pa__init(pa_core *c, pa_module*m) {
u->memchunk.memblock = NULL;
u->memchunk.index = u->memchunk.length = 0;
-
+
ret = 0;
/* Get initial mixer settings */
@@ -507,21 +507,21 @@ int pa__init(pa_core *c, pa_module*m) {
u->sink->get_hw_volume(u->sink);
if (u->sink->get_hw_mute)
u->sink->get_hw_mute(u->sink);
-
+
finish:
pa_xfree(name_buf);
-
+
if (ma)
pa_modargs_free(ma);
if (pcm_info)
snd_pcm_info_free(pcm_info);
-
+
return ret;
fail:
-
+
if (u)
pa__done(c, m);
@@ -541,7 +541,7 @@ void pa__done(pa_core *c, pa_module*m) {
pa_memblock_unref(u->memchunk.memblock);
if (u->silence.memblock)
pa_memblock_unref(u->silence.memblock);
-
+
pa_xfree(u);
}
diff --git a/src/modules/module-alsa-source.c b/src/modules/module-alsa-source.c
index aa0666f1..596998d1 100644
--- a/src/modules/module-alsa-source.c
+++ b/src/modules/module-alsa-source.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -96,13 +96,13 @@ static void update_usage(struct userdata *u) {
static void clear_up(struct userdata *u) {
assert(u);
-
+
if (u->source) {
pa_source_disconnect(u->source);
pa_source_unref(u->source);
u->source = NULL;
}
-
+
if (u->pcm_fdl)
pa_alsa_fdlist_free(u->pcm_fdl);
if (u->mixer_fdl)
@@ -114,7 +114,7 @@ static void clear_up(struct userdata *u) {
snd_mixer_close(u->mixer_handle);
u->mixer_handle = NULL;
}
-
+
if (u->pcm_handle) {
snd_pcm_drop(u->pcm_handle);
snd_pcm_close(u->pcm_handle);
@@ -127,7 +127,7 @@ static int xrun_recovery(struct userdata *u) {
assert(u);
pa_log_info("*** ALSA-XRUN (capture) ***");
-
+
if ((ret = snd_pcm_prepare(u->pcm_handle)) < 0) {
pa_log("snd_pcm_prepare() failed: %s", snd_strerror(-ret));
@@ -144,17 +144,17 @@ static void do_read(struct userdata *u) {
assert(u);
update_usage(u);
-
+
for (;;) {
pa_memchunk post_memchunk;
snd_pcm_sframes_t frames;
size_t l;
-
+
if (!u->memchunk.memblock) {
u->memchunk.memblock = pa_memblock_new(u->source->core->mempool, u->memchunk.length = u->fragment_size);
u->memchunk.index = 0;
}
-
+
assert(u->memchunk.memblock);
assert(u->memchunk.length);
assert(u->memchunk.memblock->data);
@@ -164,11 +164,11 @@ static void do_read(struct userdata *u) {
if ((frames = snd_pcm_readi(u->pcm_handle, (uint8_t*) u->memchunk.memblock->data + u->memchunk.index, u->memchunk.length / u->frame_size)) < 0) {
if (frames == -EAGAIN)
return;
-
+
if (frames == -EPIPE) {
if (xrun_recovery(u) < 0)
return;
-
+
continue;
}
@@ -180,7 +180,7 @@ static void do_read(struct userdata *u) {
}
l = frames * u->frame_size;
-
+
post_memchunk = u->memchunk;
post_memchunk.length = l;
@@ -188,13 +188,13 @@ static void do_read(struct userdata *u) {
u->memchunk.index += l;
u->memchunk.length -= l;
-
+
if (u->memchunk.length == 0) {
pa_memblock_unref(u->memchunk.memblock);
u->memchunk.memblock = NULL;
u->memchunk.index = u->memchunk.length = 0;
}
-
+
break;
}
}
@@ -223,7 +223,7 @@ static int mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) {
u->source->get_hw_volume(u->source);
if (u->source->get_hw_mute)
u->source->get_hw_mute(u->source);
-
+
pa_subscription_post(u->source->core,
PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE,
u->source->index);
@@ -256,14 +256,14 @@ static int source_get_hw_volume_cb(pa_source *s) {
for (i = 0;i < s->hw_volume.channels;i++) {
long set_vol;
-
+
assert(snd_mixer_selem_has_capture_channel(u->mixer_elem, i));
-
+
if ((err = snd_mixer_selem_get_capture_volume(u->mixer_elem, i, &vol)) < 0)
goto fail;
set_vol = (long) roundf(((float) s->hw_volume.values[i] * (u->hw_volume_max - u->hw_volume_min)) / PA_VOLUME_NORM) + u->hw_volume_min;
-
+
/* Try to avoid superfluous volume changes */
if (set_vol != vol)
s->hw_volume.values[i] = (pa_volume_t) roundf(((float) (vol - u->hw_volume_min) * PA_VOLUME_NORM) / (u->hw_volume_max - u->hw_volume_min));
@@ -361,7 +361,7 @@ int pa__init(pa_core *c, pa_module*m) {
const char *name;
char *name_buf = NULL;
int namereg_fail;
-
+
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("failed to parse module arguments");
goto fail;
@@ -378,17 +378,17 @@ int pa__init(pa_core *c, pa_module*m) {
/* Fix latency to 100ms */
periods = 12;
fragsize = pa_bytes_per_second(&ss)/128;
-
+
if (pa_modargs_get_value_u32(ma, "fragments", &periods) < 0 || pa_modargs_get_value_u32(ma, "fragment_size", &fragsize) < 0) {
pa_log("failed to parse buffer metrics");
goto fail;
}
period_size = fragsize/frame_size;
-
+
u = pa_xnew0(struct userdata, 1);
m->userdata = u;
u->module = m;
-
+
snd_config_update_free_global();
if ((err = snd_pcm_open(&u->pcm_handle, dev = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK)) < 0) {
pa_log("Error opening PCM device %s: %s", dev, snd_strerror(err));
@@ -427,7 +427,7 @@ int pa__init(pa_core *c, pa_module*m) {
name = name_buf = pa_sprintf_malloc("alsa_input.%s", dev);
namereg_fail = 0;
}
-
+
if (!(u->source = pa_source_new(c, __FILE__, name, namereg_fail, &ss, &map))) {
pa_log("Failed to create source object");
goto fail;
@@ -490,7 +490,7 @@ int pa__init(pa_core *c, pa_module*m) {
u->memchunk.index = u->memchunk.length = 0;
snd_pcm_start(u->pcm_handle);
-
+
ret = 0;
/* Get initial mixer settings */
@@ -507,11 +507,11 @@ finish:
if (pcm_info)
snd_pcm_info_free(pcm_info);
-
+
return ret;
fail:
-
+
if (u)
pa__done(c, m);
@@ -526,10 +526,10 @@ void pa__done(pa_core *c, pa_module*m) {
return;
clear_up(u);
-
+
if (u->memchunk.memblock)
pa_memblock_unref(u->memchunk.memblock);
-
+
pa_xfree(u);
}
diff --git a/src/modules/module-cli.c b/src/modules/module-cli.c
index d5374838..b5c27299 100644
--- a/src/modules/module-cli.c
+++ b/src/modules/module-cli.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -48,7 +48,7 @@ static const char* const valid_modargs[] = {
static void eof_and_unload_cb(pa_cli*c, void *userdata) {
pa_module *m = userdata;
-
+
assert(c);
assert(m);
@@ -68,7 +68,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_iochannel *io;
pa_modargs *ma;
int exit_on_eof = 0;
-
+
assert(c);
assert(m);
@@ -81,7 +81,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("failed to parse module arguments.");
goto fail;
}
-
+
if (pa_modargs_get_value_boolean(ma, "exit_on_eof", &exit_on_eof) < 0) {
pa_log("exit_on_eof= expects boolean argument.");
goto fail;
@@ -102,7 +102,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_cli_set_eof_callback(m->userdata, exit_on_eof ? eof_and_exit_cb : eof_and_unload_cb, m);
pa_modargs_free(ma);
-
+
return 0;
fail:
diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c
index f3bb3fd3..6bc958aa 100644
--- a/src/modules/module-combine.c
+++ b/src/modules/module-combine.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -91,7 +91,7 @@ struct userdata {
struct output *master;
pa_time_event *time_event;
uint32_t adjust_time;
-
+
PA_LLIST_HEAD(struct output, outputs);
};
@@ -110,9 +110,9 @@ static void adjust_rates(struct userdata *u) {
for (o = u->outputs; o; o = o->next) {
uint32_t sink_latency = o->sink_input->sink ? pa_sink_get_latency(o->sink_input->sink) : 0;
-
+
o->total_latency = sink_latency + pa_sink_input_get_latency(o->sink_input);
-
+
if (sink_latency > max_sink_latency)
max_sink_latency = sink_latency;
@@ -123,14 +123,14 @@ static void adjust_rates(struct userdata *u) {
assert(min_total_latency != (pa_usec_t) -1);
target_latency = max_sink_latency > min_total_latency ? max_sink_latency : min_total_latency;
-
+
pa_log_info("[%s] target latency is %0.0f usec.", u->sink->name, (float) target_latency);
base_rate = u->sink->sample_spec.rate;
for (o = u->outputs; o; o = o->next) {
- uint32_t r = base_rate;
-
+ uint32_t r = base_rate;
+
if (o->total_latency < target_latency)
r -= (uint32_t) (((((double) target_latency - o->total_latency))/u->adjust_time)*r/ 1000000);
else if (o->total_latency > target_latency)
@@ -151,7 +151,7 @@ static void request_memblock(struct userdata *u) {
assert(u && u->sink);
update_usage(u);
-
+
if (pa_sink_render(u->sink, RENDER_SIZE, &chunk) < 0)
return;
@@ -179,10 +179,10 @@ static int sink_input_peek_cb(pa_sink_input *i, pa_memchunk *chunk) {
if (pa_memblockq_peek(o->memblockq, chunk) >= 0)
return 0;
-
+
/* Try harder */
request_memblock(o->userdata);
-
+
return pa_memblockq_peek(o->memblockq, chunk);
}
@@ -204,7 +204,7 @@ static void sink_input_kill_cb(pa_sink_input *i) {
static pa_usec_t sink_input_get_latency_cb(pa_sink_input *i) {
struct output *o = i->userdata;
assert(i && o && o->sink_input);
-
+
return pa_bytes_to_usec(pa_memblockq_get_length(o->memblockq), &i->sample_spec);
}
@@ -220,11 +220,11 @@ static pa_usec_t sink_get_latency_cb(pa_sink *s) {
static void sink_notify(pa_sink *s) {
struct userdata *u;
struct output *o;
-
+
assert(s);
u = s->userdata;
assert(u);
-
+
for (o = u->outputs; o; o = o->next)
pa_sink_notify(o->sink_input->sink);
}
@@ -233,12 +233,12 @@ static struct output *output_new(struct userdata *u, pa_sink *sink, int resample
struct output *o = NULL;
char t[256];
pa_sink_input_new_data data;
-
+
assert(u && sink && u->sink);
-
+
o = pa_xmalloc(sizeof(struct output));
o->userdata = u;
-
+
o->counter = 0;
o->memblockq = pa_memblockq_new(
0,
@@ -258,7 +258,7 @@ static struct output *output_new(struct userdata *u, pa_sink *sink, int resample
pa_sink_input_new_data_set_sample_spec(&data, &u->sink->sample_spec);
pa_sink_input_new_data_set_channel_map(&data, &u->sink->channel_map);
data.module = u->module;
-
+
if (!(o->sink_input = pa_sink_input_new(u->core, &data, PA_SINK_INPUT_VARIABLE_RATE)))
goto fail;
@@ -267,7 +267,7 @@ static struct output *output_new(struct userdata *u, pa_sink *sink, int resample
o->sink_input->drop = sink_input_drop_cb;
o->sink_input->kill = sink_input_kill_cb;
o->sink_input->userdata = o;
-
+
PA_LLIST_PREPEND(struct output, u->outputs, o);
u->n_outputs++;
return o;
@@ -282,7 +282,7 @@ fail:
if (o->memblockq)
pa_memblockq_free(o->memblockq);
-
+
pa_xfree(o);
}
@@ -302,17 +302,17 @@ static void output_free(struct output *o) {
static void clear_up(struct userdata *u) {
struct output *o;
assert(u);
-
+
if (u->time_event) {
u->core->mainloop->time_free(u->time_event);
u->time_event = NULL;
}
-
+
while ((o = u->outputs))
output_free(o);
u->master = NULL;
-
+
if (u->sink) {
pa_sink_disconnect(u->sink);
pa_sink_unref(u->sink);
@@ -331,7 +331,7 @@ int pa__init(pa_core *c, pa_module*m) {
int resample_method = -1;
pa_sample_spec ss;
pa_channel_map map;
-
+
assert(c && m);
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
@@ -345,7 +345,7 @@ int pa__init(pa_core *c, pa_module*m) {
goto fail;
}
}
-
+
u = pa_xnew(struct userdata, 1);
m->userdata = u;
u->sink = NULL;
@@ -361,7 +361,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("failed to parse adjust_time value");
goto fail;
}
-
+
if (!(master_name = pa_modargs_get_value(ma, "master", NULL)) || !(slaves = pa_modargs_get_value(ma, "slaves", NULL))) {
pa_log("no master or slave sinks specified");
goto fail;
@@ -392,7 +392,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("channel map and sample specification don't match.");
goto fail;
}
-
+
if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
pa_log("failed to create sink");
goto fail;
@@ -403,16 +403,16 @@ int pa__init(pa_core *c, pa_module*m) {
u->sink->get_latency = sink_get_latency_cb;
u->sink->notify = sink_notify;
u->sink->userdata = u;
-
+
if (!(u->master = output_new(u, master_sink, resample_method))) {
pa_log("failed to create master sink input on sink '%s'.", u->sink->name);
goto fail;
}
-
+
split_state = NULL;
while ((n = pa_split(slaves, ",", &split_state))) {
pa_sink *slave_sink;
-
+
if (!(slave_sink = pa_namereg_get(c, n, PA_NAMEREG_SINK, 1))) {
pa_log("invalid slave sink '%s'", n);
goto fail;
@@ -425,7 +425,7 @@ int pa__init(pa_core *c, pa_module*m) {
goto fail;
}
}
-
+
if (u->n_outputs <= 1)
pa_log_warn("WARNING: no slave sinks specified.");
@@ -434,13 +434,13 @@ int pa__init(pa_core *c, pa_module*m) {
tv.tv_sec += u->adjust_time;
u->time_event = c->mainloop->time_new(c->mainloop, &tv, time_callback, u);
}
-
+
pa_modargs_free(ma);
- return 0;
+ return 0;
fail:
pa_xfree(n);
-
+
if (ma)
pa_modargs_free(ma);
diff --git a/src/modules/module-detect.c b/src/modules/module-detect.c
index 84ccd14c..3057f70d 100644
--- a/src/modules/module-detect.c
+++ b/src/modules/module-detect.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -58,7 +58,7 @@ static int detect_alsa(pa_core *c, int just_one) {
if (errno != ENOENT)
pa_log_error("open(\"/proc/asound/devices\") failed: %s", pa_cstrerror(errno));
-
+
return -1;
}
@@ -66,7 +66,7 @@ static int detect_alsa(pa_core *c, int just_one) {
char line[64], args[64];
unsigned device, subdevice;
int is_sink;
-
+
if (!fgets(line, sizeof(line), f))
break;
@@ -81,7 +81,7 @@ static int detect_alsa(pa_core *c, int just_one) {
if (just_one && is_sink && n_sink >= 1)
continue;
-
+
if (just_one && !is_sink && n_source >= 1)
continue;
@@ -105,7 +105,7 @@ static int detect_alsa(pa_core *c, int just_one) {
}
fclose(f);
-
+
return n;
}
#endif
@@ -114,7 +114,7 @@ static int detect_alsa(pa_core *c, int just_one) {
static int detect_oss(pa_core *c, int just_one) {
FILE *f;
int n = 0, b = 0;
-
+
if (!(f = fopen("/dev/sndstat", "r")) &&
!(f = fopen("/proc/sndstat", "r")) &&
!(f = fopen("/proc/asound/oss/sndstat", "r"))) {
@@ -128,7 +128,7 @@ static int detect_oss(pa_core *c, int just_one) {
while (!feof(f)) {
char line[64], args[64];
unsigned device;
-
+
if (!fgets(line, sizeof(line), f))
break;
@@ -141,20 +141,20 @@ static int detect_oss(pa_core *c, int just_one) {
if (line[0] == 0)
break;
-
+
if (sscanf(line, "%u: ", &device) == 1) {
if (device == 0)
snprintf(args, sizeof(args), "device=/dev/dsp");
else
snprintf(args, sizeof(args), "device=/dev/dsp%u", device);
-
+
if (!pa_module_load(c, "module-oss", args))
continue;
-
+
} else if (sscanf(line, "pcm%u: ", &device) == 1) {
/* FreeBSD support, the devices are named /dev/dsp0.0, dsp0.1 and so on */
snprintf(args, sizeof(args), "device=/dev/dsp%u.0", device);
-
+
if (!pa_module_load(c, "module-oss", args))
continue;
}
@@ -219,7 +219,7 @@ int pa__init(pa_core *c, pa_module*m) {
"just-one",
NULL
};
-
+
assert(c);
assert(m);
@@ -227,14 +227,14 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("Failed to parse module arguments");
goto fail;
}
-
+
if (pa_modargs_get_value_boolean(ma, "just-one", &just_one) < 0) {
pa_log("just_one= expects a boolean argument.");
goto fail;
}
#if HAVE_ALSA
- if ((n = detect_alsa(c, just_one)) <= 0)
+ if ((n = detect_alsa(c, just_one)) <= 0)
#endif
#if HAVE_OSS
if ((n = detect_oss(c, just_one)) <= 0)
@@ -251,7 +251,7 @@ int pa__init(pa_core *c, pa_module*m) {
}
pa_log_info("loaded %i modules.", n);
-
+
/* We were successful and can unload ourselves now. */
pa_module_unload_request(m);
@@ -262,7 +262,7 @@ int pa__init(pa_core *c, pa_module*m) {
fail:
if (ma)
pa_modargs_free(ma);
-
+
return -1;
}
diff --git a/src/modules/module-esound-compat-spawnfd.c b/src/modules/module-esound-compat-spawnfd.c
index 263e81f9..fbb6bd6d 100644
--- a/src/modules/module-esound-compat-spawnfd.c
+++ b/src/modules/module-esound-compat-spawnfd.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/modules/module-esound-compat-spawnpid.c b/src/modules/module-esound-compat-spawnpid.c
index 7a662c2d..a7196313 100644
--- a/src/modules/module-esound-compat-spawnpid.c
+++ b/src/modules/module-esound-compat-spawnpid.c
@@ -1,17 +1,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/modules/module-esound-sink.c b/src/modules/module-esound-sink.c
index 6d4a8489..62600682 100644
--- a/src/modules/module-esound-sink.c
+++ b/src/modules/module-esound-sink.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -69,7 +69,7 @@ struct userdata {
void *write_data;
size_t write_length, write_index;
-
+
void *read_data;
size_t read_length, read_index;
@@ -135,7 +135,7 @@ static int do_write(struct userdata *u) {
u->write_index += r;
assert(u->write_index <= u->write_length);
-
+
if (u->write_index == u->write_length) {
free(u->write_data);
u->write_data = NULL;
@@ -143,13 +143,13 @@ static int do_write(struct userdata *u) {
}
} else if (u->state == STATE_RUNNING) {
pa_module_set_used(u->module, pa_sink_used_by(u->sink));
-
+
if (!u->memchunk.length)
if (pa_sink_render(u->sink, 8192, &u->memchunk) < 0)
return 0;
assert(u->memchunk.memblock && u->memchunk.length);
-
+
if ((r = pa_iochannel_write(u->io, (uint8_t*) u->memchunk.memblock->data + u->memchunk.index, u->memchunk.length)) < 0) {
pa_log("write() failed: %s", pa_cstrerror(errno));
return -1;
@@ -157,13 +157,13 @@ static int do_write(struct userdata *u) {
u->memchunk.index += r;
u->memchunk.length -= r;
-
+
if (u->memchunk.length <= 0) {
pa_memblock_unref(u->memchunk.memblock);
u->memchunk.memblock = NULL;
}
}
-
+
return 0;
}
@@ -191,7 +191,7 @@ static int handle_response(struct userdata *u) {
assert(u->read_length >= sizeof(int32_t));
u->read_index = 0;
u->read_length = sizeof(int32_t);
-
+
break;
case STATE_LATENCY: {
@@ -220,10 +220,10 @@ static int handle_response(struct userdata *u) {
pa_xfree(u->read_data);
u->read_data = NULL;
u->read_index = u->read_length = 0;
-
+
break;
}
-
+
default:
abort();
}
@@ -233,18 +233,18 @@ static int handle_response(struct userdata *u) {
static int do_read(struct userdata *u) {
assert(u);
-
+
if (!pa_iochannel_is_readable(u->io))
return 0;
-
+
if (u->state == STATE_AUTH || u->state == STATE_LATENCY) {
ssize_t r;
-
+
if (!u->read_data)
return 0;
-
+
assert(u->read_index < u->read_length);
-
+
if ((r = pa_iochannel_read(u->io, (uint8_t*) u->read_data + u->read_index, u->read_length - u->read_index)) <= 0) {
pa_log("read() failed: %s", r < 0 ? pa_cstrerror(errno) : "EOF");
cancel(u);
@@ -265,7 +265,7 @@ static void do_work(struct userdata *u) {
assert(u);
u->core->mainloop->defer_enable(u->defer_event, 0);
-
+
if (do_read(u) < 0 || do_write(u) < 0)
cancel(u);
}
@@ -304,13 +304,13 @@ static void on_connection(PA_GCC_UNUSED pa_socket_client *c, pa_iochannel*io, vo
pa_socket_client_unref(u->client);
u->client = NULL;
-
+
if (!io) {
pa_log("connection failed: %s", pa_cstrerror(errno));
cancel(u);
return;
}
-
+
u->io = io;
pa_iochannel_set_callback(u->io, io_callback, u);
}
@@ -321,9 +321,9 @@ int pa__init(pa_core *c, pa_module*m) {
pa_sample_spec ss;
pa_modargs *ma = NULL;
char *t;
-
+
assert(c && m);
-
+
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("failed to parse module arguments");
goto fail;
@@ -340,7 +340,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("esound sample type support is limited to mono/stereo and U8 or S16NE sample data");
goto fail;
}
-
+
u = pa_xmalloc0(sizeof(struct userdata));
u->core = c;
u->module = m;
@@ -378,7 +378,7 @@ int pa__init(pa_core *c, pa_module*m) {
/* Reserve space for the response */
u->read_data = pa_xmalloc(u->read_length = sizeof(int32_t));
-
+
u->sink->notify = notify_cb;
u->sink->get_latency = get_latency_cb;
u->sink->userdata = u;
@@ -392,15 +392,15 @@ int pa__init(pa_core *c, pa_module*m) {
u->defer_event = c->mainloop->defer_new(c->mainloop, defer_callback, u);
c->mainloop->defer_enable(u->defer_event, 0);
-
+
pa_modargs_free(ma);
-
+
return 0;
fail:
if (ma)
pa_modargs_free(ma);
-
+
pa__done(c, m);
return -1;
@@ -415,13 +415,13 @@ void pa__done(pa_core *c, pa_module*m) {
u->module = NULL;
cancel(u);
-
+
if (u->memchunk.memblock)
pa_memblock_unref(u->memchunk.memblock);
if (u->client)
pa_socket_client_unref(u->client);
-
+
pa_xfree(u->read_data);
pa_xfree(u->write_data);
diff --git a/src/modules/module-hal-detect.c b/src/modules/module-hal-detect.c
index 8232cd38..eb275ff0 100644
--- a/src/modules/module-hal-detect.c
+++ b/src/modules/module-hal-detect.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -58,7 +58,7 @@ typedef enum {
#endif
#ifdef HAVE_OSS
CAP_OSS,
-#endif
+#endif
CAP_MAX
} capability_t;
@@ -181,7 +181,7 @@ static pa_module* hal_device_load_alsa(struct userdata *u, const char *udi,
module_name = "module-alsa-source";
snprintf(args, sizeof(args), "device=hw:%u source_name=alsa_input.%s", card, strip_udi(udi));
}
-
+
return pa_module_load(u->core, module_name, args);
}
@@ -198,7 +198,7 @@ static dbus_bool_t hal_device_is_oss_pcm(LibHalContext *ctx, const char *udi,
type = libhal_device_get_property_string(ctx, udi, "oss.type", error);
if (!type || dbus_error_is_set(error))
return FALSE;
-
+
if (!strcmp(type, "pcm")) {
char *e;
diff --git a/src/modules/module-jack-sink.c b/src/modules/module-jack-sink.c
index 47f77bab..6175536c 100644
--- a/src/modules/module-jack-sink.c
+++ b/src/modules/module-jack-sink.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -75,7 +75,7 @@ struct userdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
-
+
void * buffer[PA_CHANNELS_MAX];
jack_nframes_t frames_requested;
int quit_requested;
@@ -100,7 +100,7 @@ static const char* const valid_modargs[] = {
static void stop_sink(struct userdata *u) {
assert (u);
-
+
jack_client_close(u->client);
u->client = NULL;
u->core->mainloop->io_free(u->io_event);
@@ -114,7 +114,7 @@ static void stop_sink(struct userdata *u) {
static void io_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event_flags_t flags, void *userdata) {
struct userdata *u = userdata;
char x;
-
+
assert(m);
assert(e);
assert(flags == PA_IO_EVENT_INPUT);
@@ -122,39 +122,39 @@ static void io_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event_
assert(u->pipe_fds[0] == fd);
pa_read(fd, &x, 1, &u->pipe_fd_type);
-
+
if (u->quit_requested) {
stop_sink(u);
u->quit_requested = 0;
return;
}
-
+
pthread_mutex_lock(&u->mutex);
if (u->frames_requested > 0) {
unsigned fs;
jack_nframes_t frame_idx;
pa_memchunk chunk;
-
+
fs = pa_frame_size(&u->sink->sample_spec);
pa_sink_render_full(u->sink, u->frames_requested * fs, &chunk);
for (frame_idx = 0; frame_idx < u->frames_requested; frame_idx ++) {
unsigned c;
-
+
for (c = 0; c < u->channels; c++) {
float *s = ((float*) ((uint8_t*) chunk.memblock->data + chunk.index)) + (frame_idx * u->channels) + c;
float *d = ((float*) u->buffer[c]) + frame_idx;
-
+
*d = *s;
}
}
-
+
pa_memblock_unref(chunk.memblock);
u->frames_requested = 0;
-
+
pthread_cond_signal(&u->cond);
}
@@ -183,36 +183,36 @@ static int jack_process(jack_nframes_t nframes, void *arg) {
if (jack_transport_query(u->client, NULL) == JackTransportRolling) {
unsigned c;
-
+
pthread_mutex_lock(&u->mutex);
-
+
u->frames_requested = nframes;
-
+
for (c = 0; c < u->channels; c++) {
u->buffer[c] = jack_port_get_buffer(u->port[c], nframes);
assert(u->buffer[c]);
}
-
+
request_render(u);
-
+
pthread_cond_wait(&u->cond, &u->mutex);
u->frames_in_buffer = nframes;
u->timestamp = jack_get_current_transport_frame(u->client);
-
+
pthread_mutex_unlock(&u->mutex);
}
-
+
return 0;
}
static pa_usec_t sink_get_latency_cb(pa_sink *s) {
struct userdata *u;
jack_nframes_t n, l, d;
-
+
assert(s);
u = s->userdata;
-
+
if (jack_transport_query(u->client, NULL) != JackTransportRolling)
return 0;
@@ -226,7 +226,7 @@ static pa_usec_t sink_get_latency_cb(pa_sink *s) {
if (d >= l)
return 0;
-
+
return pa_bytes_to_usec((l - d) * pa_frame_size(&s->sample_spec), &s->sample_spec);
}
@@ -246,12 +246,12 @@ int pa__init(pa_core *c, pa_module*m) {
unsigned i;
const char **ports = NULL, **p;
char *t;
-
+
assert(c);
assert(m);
jack_set_error_function(jack_error_func);
-
+
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("failed to parse module arguments.");
goto fail;
@@ -261,7 +261,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("failed to parse connect= argument.");
goto fail;
}
-
+
server_name = pa_modargs_get_value(ma, "server_name", NULL);
client_name = pa_modargs_get_value(ma, "client_name", "PulseAudio");
@@ -274,28 +274,28 @@ int pa__init(pa_core *c, pa_module*m) {
pthread_mutex_init(&u->mutex, NULL);
pthread_cond_init(&u->cond, NULL);
-
+
if (pipe(u->pipe_fds) < 0) {
pa_log("pipe() failed: %s", pa_cstrerror(errno));
goto fail;
}
pa_make_nonblock_fd(u->pipe_fds[1]);
-
+
if (!(u->client = jack_client_open(client_name, server_name ? JackServerName : JackNullOption, &status, server_name))) {
pa_log("jack_client_open() failed.");
goto fail;
}
ports = jack_get_ports(u->client, NULL, NULL, JackPortIsPhysical|JackPortIsInput);
-
+
channels = 0;
for (p = ports; *p; p++)
channels++;
if (!channels)
channels = c->default_sample_spec.channels;
-
+
if (pa_modargs_get_value_u32(ma, "channels", &channels) < 0 || channels <= 0 || channels >= PA_CHANNELS_MAX) {
pa_log("failed to parse channels= argument.");
goto fail;
@@ -306,7 +306,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("failed to parse channel_map= argument.");
goto fail;
}
-
+
pa_log_info("Successfully connected as '%s'", jack_get_client_name(u->client));
ss.channels = u->channels = channels;
@@ -350,7 +350,7 @@ int pa__init(pa_core *c, pa_module*m) {
}
pa_log_info("connecting %s to %s", jack_port_name(u->port[i]), *p);
-
+
if (jack_connect(u->client, jack_port_name(u->port[i]), *p)) {
pa_log("failed to connect %s to %s, leaving unconnected.", jack_port_name(u->port[i]), *p);
break;
@@ -360,10 +360,10 @@ int pa__init(pa_core *c, pa_module*m) {
}
u->io_event = c->mainloop->io_new(c->mainloop, u->pipe_fds[0], PA_IO_EVENT_INPUT, io_event_cb, u);
-
+
free(ports);
pa_modargs_free(ma);
-
+
return 0;
fail:
@@ -371,7 +371,7 @@ fail:
pa_modargs_free(ma);
free(ports);
-
+
pa__done(c, m);
return -1;
diff --git a/src/modules/module-jack-source.c b/src/modules/module-jack-source.c
index 62a99108..8d891ce6 100644
--- a/src/modules/module-jack-source.c
+++ b/src/modules/module-jack-source.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -75,7 +75,7 @@ struct userdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
-
+
void * buffer[PA_CHANNELS_MAX];
jack_nframes_t frames_posted;
int quit_requested;
@@ -100,7 +100,7 @@ static const char* const valid_modargs[] = {
static void stop_source(struct userdata *u) {
assert (u);
-
+
jack_client_close(u->client);
u->client = NULL;
u->core->mainloop->io_free(u->io_event);
@@ -114,39 +114,39 @@ static void stop_source(struct userdata *u) {
static void io_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event_flags_t flags, void *userdata) {
struct userdata *u = userdata;
char x;
-
+
assert(m);
assert(flags == PA_IO_EVENT_INPUT);
assert(u);
assert(u->pipe_fds[0] == fd);
pa_read(fd, &x, 1, &u->pipe_fd_type);
-
+
if (u->quit_requested) {
stop_source(u);
u->quit_requested = 0;
return;
}
-
+
pthread_mutex_lock(&u->mutex);
if (u->frames_posted > 0) {
unsigned fs;
jack_nframes_t frame_idx;
pa_memchunk chunk;
-
+
fs = pa_frame_size(&u->source->sample_spec);
chunk.memblock = pa_memblock_new(u->core->mempool, chunk.length = u->frames_posted * fs);
chunk.index = 0;
-
+
for (frame_idx = 0; frame_idx < u->frames_posted; frame_idx ++) {
unsigned c;
-
+
for (c = 0; c < u->channels; c++) {
float *s = ((float*) u->buffer[c]) + frame_idx;
float *d = ((float*) ((uint8_t*) chunk.memblock->data + chunk.index)) + (frame_idx * u->channels) + c;
-
+
*d = *s;
}
}
@@ -155,7 +155,7 @@ static void io_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event_
pa_memblock_unref(chunk.memblock);
u->frames_posted = 0;
-
+
pthread_cond_signal(&u->cond);
}
@@ -184,36 +184,36 @@ static int jack_process(jack_nframes_t nframes, void *arg) {
if (jack_transport_query(u->client, NULL) == JackTransportRolling) {
unsigned c;
-
+
pthread_mutex_lock(&u->mutex);
-
+
u->frames_posted = nframes;
-
+
for (c = 0; c < u->channels; c++) {
u->buffer[c] = jack_port_get_buffer(u->port[c], nframes);
assert(u->buffer[c]);
}
-
+
request_post(u);
-
+
pthread_cond_wait(&u->cond, &u->mutex);
u->frames_in_buffer = nframes;
u->timestamp = jack_get_current_transport_frame(u->client);
-
+
pthread_mutex_unlock(&u->mutex);
}
-
+
return 0;
}
static pa_usec_t source_get_latency_cb(pa_source *s) {
struct userdata *u;
jack_nframes_t n, l, d;
-
+
assert(s);
u = s->userdata;
-
+
if (jack_transport_query(u->client, NULL) != JackTransportRolling)
return 0;
@@ -224,7 +224,7 @@ static pa_usec_t source_get_latency_cb(pa_source *s) {
d = n - u->timestamp;
l = jack_port_get_total_latency(u->client, u->port[0]);
-
+
return pa_bytes_to_usec((l + d) * pa_frame_size(&s->sample_spec), &s->sample_spec);
}
@@ -244,12 +244,12 @@ int pa__init(pa_core *c, pa_module*m) {
unsigned i;
const char **ports = NULL, **p;
char *t;
-
+
assert(c);
assert(m);
jack_set_error_function(jack_error_func);
-
+
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("failed to parse module arguments.");
goto fail;
@@ -259,7 +259,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("failed to parse connect= argument.");
goto fail;
}
-
+
server_name = pa_modargs_get_value(ma, "server_name", NULL);
client_name = pa_modargs_get_value(ma, "client_name", "PulseAudio");
@@ -272,28 +272,28 @@ int pa__init(pa_core *c, pa_module*m) {
pthread_mutex_init(&u->mutex, NULL);
pthread_cond_init(&u->cond, NULL);
-
+
if (pipe(u->pipe_fds) < 0) {
pa_log("pipe() failed: %s", pa_cstrerror(errno));
goto fail;
}
pa_make_nonblock_fd(u->pipe_fds[1]);
-
+
if (!(u->client = jack_client_open(client_name, server_name ? JackServerName : JackNullOption, &status, server_name))) {
pa_log("jack_client_open() failed.");
goto fail;
}
ports = jack_get_ports(u->client, NULL, NULL, JackPortIsPhysical|JackPortIsOutput);
-
+
channels = 0;
for (p = ports; *p; p++)
channels++;
if (!channels)
channels = c->default_sample_spec.channels;
-
+
if (pa_modargs_get_value_u32(ma, "channels", &channels) < 0 || channels <= 0 || channels >= PA_CHANNELS_MAX) {
pa_log("failed to parse channels= argument.");
goto fail;
@@ -304,7 +304,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("failed to parse channel_map= argument.");
goto fail;
}
-
+
pa_log_info("Successfully connected as '%s'", jack_get_client_name(u->client));
ss.channels = u->channels = channels;
@@ -348,7 +348,7 @@ int pa__init(pa_core *c, pa_module*m) {
}
pa_log_info("connecting %s to %s", jack_port_name(u->port[i]), *p);
-
+
if (jack_connect(u->client, *p, jack_port_name(u->port[i]))) {
pa_log("failed to connect %s to %s, leaving unconnected.", jack_port_name(u->port[i]), *p);
break;
@@ -358,10 +358,10 @@ int pa__init(pa_core *c, pa_module*m) {
}
u->io_event = c->mainloop->io_new(c->mainloop, u->pipe_fds[0], PA_IO_EVENT_INPUT, io_event_cb, u);
-
+
free(ports);
pa_modargs_free(ma);
-
+
return 0;
fail:
@@ -369,7 +369,7 @@ fail:
pa_modargs_free(ma);
free(ports);
-
+
pa__done(c, m);
return -1;
diff --git a/src/modules/module-lirc.c b/src/modules/module-lirc.c
index 18b2ddf1..f32667ee 100644
--- a/src/modules/module-lirc.c
+++ b/src/modules/module-lirc.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -73,20 +73,20 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC
pa_log("lost connection to LIRC daemon.");
goto fail;
}
-
+
if (events & PA_IO_EVENT_INPUT) {
char *c;
-
+
if (lirc_nextcode(&code) != 0 || !code) {
pa_log("lirc_nextcode() failed.");
goto fail;
}
-
+
c = pa_xstrdup(code);
c[strcspn(c, "\n\r")] = 0;
pa_log_debug("raw IR code '%s'", c);
pa_xfree(c);
-
+
while (lirc_code2char(u->config, code, &name) == 0 && name) {
enum {
INVALID,
@@ -96,9 +96,9 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC
RESET,
MUTE_TOGGLE
} volchange = INVALID;
-
+
pa_log_info("translated IR code '%s'", name);
-
+
if (strcasecmp(name, "volume-up") == 0)
volchange = UP;
else if (strcasecmp(name, "volume-down") == 0)
@@ -109,12 +109,12 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC
volchange = MUTE_TOGGLE;
else if (strcasecmp(name, "reset") == 0)
volchange = RESET;
-
+
if (volchange == INVALID)
pa_log_warn("recieved unknown IR code '%s'", name);
else {
pa_sink *s;
-
+
if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK, 1)))
pa_log("failed to get sink '%s'", u->sink_name);
else {
@@ -134,7 +134,7 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC
pa_sink_set_volume(s, PA_MIXER_HARDWARE, &cv);
break;
-
+
case DOWN:
for (i = 0; i < cv.channels; i++) {
if (cv.values[i] >= DELTA)
@@ -142,18 +142,18 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC
else
cv.values[i] = PA_VOLUME_MUTED;
}
-
+
pa_sink_set_volume(s, PA_MIXER_HARDWARE, &cv);
break;
-
+
case MUTE:
pa_sink_set_mute(s, PA_MIXER_HARDWARE, 0);
break;
-
+
case RESET:
pa_sink_set_mute(s, PA_MIXER_HARDWARE, 1);
break;
-
+
case MUTE_TOGGLE:
pa_sink_set_mute(s, PA_MIXER_HARDWARE, !pa_sink_get_mute(s, PA_MIXER_HARDWARE));
@@ -170,7 +170,7 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC
pa_xfree(code);
return;
-
+
fail:
u->module->core->mainloop->io_free(u->io);
u->io = NULL;
@@ -179,7 +179,7 @@ fail:
free(code);
}
-
+
int pa__init(pa_core *c, pa_module*m) {
pa_modargs *ma = NULL;
struct userdata *u;
@@ -189,7 +189,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("module-lirc may no be loaded twice.");
return -1;
}
-
+
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments");
goto fail;
@@ -212,13 +212,13 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("lirc_readconfig() failed.");
goto fail;
}
-
+
u->io = c->mainloop->io_new(c->mainloop, u->lirc_fd, PA_IO_EVENT_INPUT|PA_IO_EVENT_HANGUP, io_callback, u);
lirc_in_use = 1;
pa_modargs_free(ma);
-
+
return 0;
fail:
diff --git a/src/modules/module-match.c b/src/modules/module-match.c
index eb5de64e..d0e82ba3 100644
--- a/src/modules/module-match.c
+++ b/src/modules/module-match.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -88,7 +88,7 @@ static int load_rules(struct userdata *u, const char *filename) {
}
pa_lock_fd(fileno(f), 1);
-
+
while (!feof(f)) {
char *d, *v;
pa_volume_t volume;
@@ -96,12 +96,12 @@ static int load_rules(struct userdata *u, const char *filename) {
regex_t regex;
char ln[256];
struct rule *rule;
-
+
if (!fgets(ln, sizeof(ln), f))
break;
n++;
-
+
pa_strip_nl(ln);
if (ln[0] == '#' || !*ln )
@@ -110,7 +110,7 @@ static int load_rules(struct userdata *u, const char *filename) {
d = ln+strcspn(ln, WHITESPACE);
v = d+strspn(d, WHITESPACE);
-
+
if (!*v) {
pa_log(__FILE__ ": [%s:%u] failed to parse line - too few words", filename, n);
goto finish;
@@ -124,7 +124,7 @@ static int load_rules(struct userdata *u, const char *filename) {
volume = (pa_volume_t) k;
-
+
if (regcomp(&regex, ln, REG_EXTENDED|REG_NOSUB) != 0) {
pa_log("[%s:%u] invalid regular expression", filename, n);
goto finish;
@@ -140,12 +140,12 @@ static int load_rules(struct userdata *u, const char *filename) {
else
u->rules = rule;
end = rule;
-
+
*d = 0;
}
ret = 0;
-
+
finish:
if (f) {
pa_lock_fd(fileno(f), 0);
@@ -172,7 +172,7 @@ static void callback(pa_core *c, pa_subscription_event_type_t t, uint32_t idx, v
if (!si->name)
return;
-
+
for (r = u->rules; r; r = r->next) {
if (!regexec(&r->regex, si->name, 0, NULL, 0)) {
pa_cvolume cv;
@@ -197,7 +197,7 @@ int pa__init(pa_core *c, pa_module*m) {
u->rules = NULL;
u->subscription = NULL;
m->userdata = u;
-
+
if (load_rules(u, pa_modargs_get_value(ma, "table", NULL)) < 0)
goto fail;
@@ -224,7 +224,7 @@ void pa__done(pa_core *c, pa_module*m) {
if (u->subscription)
pa_subscription_free(u->subscription);
-
+
for (r = u->rules; r; r = n) {
n = r->next;
diff --git a/src/modules/module-mmkbd-evdev.c b/src/modules/module-mmkbd-evdev.c
index 37234d92..baf688f1 100644
--- a/src/modules/module-mmkbd-evdev.c
+++ b/src/modules/module-mmkbd-evdev.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -85,7 +85,7 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC
pa_log("lost connection to evdev device.");
goto fail;
}
-
+
if (events & PA_IO_EVENT_INPUT) {
struct input_event ev;
@@ -107,15 +107,15 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC
if (volchange != INVALID) {
pa_sink *s;
-
+
if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK, 1)))
pa_log("failed to get sink '%s'", u->sink_name);
else {
int i;
pa_cvolume cv = *pa_sink_get_volume(s, PA_MIXER_HARDWARE);
-
+
#define DELTA (PA_VOLUME_NORM/20)
-
+
switch (volchange) {
case UP:
for (i = 0; i < cv.channels; i++) {
@@ -127,7 +127,7 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC
pa_sink_set_volume(s, PA_MIXER_HARDWARE, &cv);
break;
-
+
case DOWN:
for (i = 0; i < cv.channels; i++) {
if (cv.values[i] >= DELTA)
@@ -135,10 +135,10 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC
else
cv.values[i] = PA_VOLUME_MUTED;
}
-
+
pa_sink_set_volume(s, PA_MIXER_HARDWARE, &cv);
break;
-
+
case MUTE_TOGGLE:
pa_sink_set_mute(s, PA_MIXER_HARDWARE, !pa_sink_get_mute(s, PA_MIXER_HARDWARE));
@@ -153,7 +153,7 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC
}
return;
-
+
fail:
u->module->core->mainloop->io_free(u->io);
u->io = NULL;
@@ -162,7 +162,7 @@ fail:
}
#define test_bit(bit, array) (array[bit/8] & (1<<(bit%8)))
-
+
int pa__init(pa_core *c, pa_module*m) {
pa_modargs *ma = NULL;
struct userdata *u;
@@ -226,7 +226,7 @@ int pa__init(pa_core *c, pa_module*m) {
u->io = c->mainloop->io_new(c->mainloop, u->fd, PA_IO_EVENT_INPUT|PA_IO_EVENT_HANGUP, io_callback, u);
pa_modargs_free(ma);
-
+
return 0;
fail:
diff --git a/src/modules/module-native-protocol-fd.c b/src/modules/module-native-protocol-fd.c
index dd3b4abe..907aab27 100644
--- a/src/modules/module-native-protocol-fd.c
+++ b/src/modules/module-native-protocol-fd.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -61,7 +61,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("invalid file descriptor.");
goto finish;
}
-
+
io = pa_iochannel_new(c->mainloop, fd, fd);
if (!(m->userdata = pa_protocol_native_new_iochannel(c, io, m, ma))) {
@@ -74,7 +74,7 @@ int pa__init(pa_core *c, pa_module*m) {
finish:
if (ma)
pa_modargs_free(ma);
-
+
return r;
}
diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c
index 50e58853..fc9107a3 100644
--- a/src/modules/module-null-sink.c
+++ b/src/modules/module-null-sink.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -115,10 +115,10 @@ int pa__init(pa_core *c, pa_module*m) {
pa_sample_spec ss;
pa_channel_map map;
pa_modargs *ma = NULL;
-
+
assert(c);
assert(m);
-
+
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("failed to parse module arguments.");
goto fail;
@@ -129,12 +129,12 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("invalid sample format specification or channel map.");
goto fail;
}
-
+
u = pa_xnew0(struct userdata, 1);
u->core = c;
u->module = m;
m->userdata = u;
-
+
if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
pa_log("failed to create sink.");
goto fail;
@@ -147,19 +147,19 @@ int pa__init(pa_core *c, pa_module*m) {
u->n_bytes = 0;
pa_gettimeofday(&u->start_time);
-
+
u->time_event = c->mainloop->time_new(c->mainloop, &u->start_time, time_callback, u);
u->block_size = pa_bytes_per_second(&ss) / 10;
-
+
pa_modargs_free(ma);
-
+
return 0;
fail:
if (ma)
pa_modargs_free(ma);
-
+
pa__done(c, m);
return -1;
@@ -171,7 +171,7 @@ void pa__done(pa_core *c, pa_module*m) {
if (!(u = m->userdata))
return;
-
+
pa_sink_disconnect(u->sink);
pa_sink_unref(u->sink);
diff --git a/src/modules/module-oss-mmap.c b/src/modules/module-oss-mmap.c
index 5ab08287..7bf6cbbd 100644
--- a/src/modules/module-oss-mmap.c
+++ b/src/modules/module-oss-mmap.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -113,7 +113,7 @@ static const char* const valid_modargs[] = {
#define DEFAULT_FRAGSIZE 1024
static void update_usage(struct userdata *u) {
- pa_module_set_used(u->module,
+ pa_module_set_used(u->module,
(u->sink ? pa_sink_used_by(u->sink) : 0) +
(u->source ? pa_source_used_by(u->source) : 0));
}
@@ -126,7 +126,7 @@ static void clear_up(struct userdata *u) {
pa_sink_unref(u->sink);
u->sink = NULL;
}
-
+
if (u->source) {
pa_source_disconnect(u->source);
pa_source_unref(u->source);
@@ -137,12 +137,12 @@ static void clear_up(struct userdata *u) {
munmap(u->in_mmap, u->in_mmap_length);
u->in_mmap = NULL;
}
-
+
if (u->out_mmap && u->out_mmap != MAP_FAILED) {
munmap(u->out_mmap, u->out_mmap_length);
u->out_mmap = NULL;
}
-
+
if (u->io_event) {
u->core->mainloop->io_free(u->io_event);
u->io_event = NULL;
@@ -156,13 +156,13 @@ static void clear_up(struct userdata *u) {
static void out_fill_memblocks(struct userdata *u, unsigned n) {
assert(u && u->out_memblocks);
-
+
while (n > 0) {
pa_memchunk chunk;
-
+
if (u->out_memblocks[u->out_current])
pa_memblock_unref_fixed(u->out_memblocks[u->out_current]);
-
+
chunk.memblock = u->out_memblocks[u->out_current] =
pa_memblock_new_fixed(
u->core->mempool,
@@ -172,13 +172,13 @@ static void out_fill_memblocks(struct userdata *u, unsigned n) {
assert(chunk.memblock);
chunk.length = chunk.memblock->length;
chunk.index = 0;
-
+
pa_sink_render_into_full(u->sink, &chunk);
-
+
u->out_current++;
while (u->out_current >= u->out_fragments)
u->out_current -= u->out_fragments;
-
+
n--;
}
}
@@ -188,7 +188,7 @@ static void do_write(struct userdata *u) {
assert(u && u->sink);
update_usage(u);
-
+
if (ioctl(u->fd, SNDCTL_DSP_GETOPTR, &info) < 0) {
pa_log("SNDCTL_DSP_GETOPTR: %s", pa_cstrerror(errno));
@@ -199,31 +199,31 @@ static void do_write(struct userdata *u) {
info.blocks += u->out_blocks_saved;
u->out_blocks_saved = 0;
-
+
if (!info.blocks)
return;
-
+
out_fill_memblocks(u, info.blocks);
}
static void in_post_memblocks(struct userdata *u, unsigned n) {
assert(u && u->in_memblocks);
-
+
while (n > 0) {
pa_memchunk chunk;
-
+
if (!u->in_memblocks[u->in_current]) {
chunk.memblock = u->in_memblocks[u->in_current] = pa_memblock_new_fixed(u->core->mempool, (uint8_t*) u->in_mmap+u->in_fragment_size*u->in_current, u->in_fragment_size, 1);
chunk.length = chunk.memblock->length;
chunk.index = 0;
-
+
pa_source_post(u->source, &chunk);
}
u->in_current++;
while (u->in_current >= u->in_fragments)
u->in_current -= u->in_fragments;
-
+
n--;
}
}
@@ -234,7 +234,7 @@ static void in_clear_memblocks(struct userdata*u, unsigned n) {
if (n > u->in_fragments)
n = u->in_fragments;
-
+
while (n > 0) {
if (u->in_memblocks[i]) {
pa_memblock_unref_fixed(u->in_memblocks[i]);
@@ -254,7 +254,7 @@ static void do_read(struct userdata *u) {
assert(u && u->source);
update_usage(u);
-
+
if (ioctl(u->fd, SNDCTL_DSP_GETIPTR, &info) < 0) {
pa_log("SNDCTL_DSP_GETIPTR: %s", pa_cstrerror(errno));
@@ -265,10 +265,10 @@ static void do_read(struct userdata *u) {
info.blocks += u->in_blocks_saved;
u->in_blocks_saved = 0;
-
+
if (!info.blocks)
return;
-
+
in_post_memblocks(u, info.blocks);
in_clear_memblocks(u, u->in_fragments/2);
}
@@ -311,7 +311,7 @@ static pa_usec_t sink_get_latency_cb(pa_sink *s) {
n = bpos - info.ptr;
/* pa_log("n = %u, bpos = %u, ptr = %u, total=%u, fragsize = %u, n_frags = %u\n", n, bpos, (unsigned) info.ptr, total, u->out_fragment_size, u->out_fragments); */
-
+
return pa_bytes_to_usec(n, &s->sample_spec);
}
@@ -337,7 +337,7 @@ static pa_usec_t source_get_latency_cb(pa_source *s) {
n = (u->in_fragments * u->in_fragment_size) - bpos + info.ptr;
/* pa_log("n = %u, bpos = %u, ptr = %u, total=%u, fragsize = %u, n_frags = %u\n", n, bpos, (unsigned) info.ptr, total, u->in_fragment_size, u->in_fragments); */
-
+
return pa_bytes_to_usec(n, &s->sample_spec);
}
@@ -416,7 +416,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("failed to parse module arguments.");
goto fail;
}
-
+
if (pa_modargs_get_value_boolean(ma, "record", &record) < 0 || pa_modargs_get_value_boolean(ma, "playback", &playback) < 0) {
pa_log("record= and playback= expect numeric arguments.");
goto fail;
@@ -460,7 +460,7 @@ int pa__init(pa_core *c, pa_module*m) {
if (nfrags >= 2 && frag_size >= 1)
if (pa_oss_set_fragments(u->fd, nfrags, frag_size) < 0)
goto fail;
-
+
if (pa_oss_auto_format(u->fd, &u->sample_spec) < 0)
goto fail;
@@ -491,7 +491,7 @@ int pa__init(pa_core *c, pa_module*m) {
if (!(u->source = pa_source_new(c, __FILE__, name, namereg_fail, &u->sample_spec, &map)))
goto fail;
-
+
u->source->userdata = u;
u->source->get_latency = source_get_latency_cb;
u->source->get_hw_volume = source_get_hw_volume;
@@ -504,22 +504,22 @@ int pa__init(pa_core *c, pa_module*m) {
hwdesc[0] ? ")" : ""));
pa_xfree(t);
u->source->is_hardware = 1;
-
+
u->in_memblocks = pa_xnew0(pa_memblock*, u->in_fragments);
-
+
enable_bits |= PCM_ENABLE_INPUT;
}
}
pa_xfree(name_buf);
name_buf = NULL;
-
+
if (mode != O_RDONLY) {
if (ioctl(u->fd, SNDCTL_DSP_GETOSPACE, &info) < 0) {
pa_log("SNDCTL_DSP_GETOSPACE: %s", pa_cstrerror(errno));
goto fail;
}
-
+
pa_log_info("output -- %u fragments of size %u.", info.fragstotal, info.fragsize);
u->out_mmap_length = (u->out_fragment_size = info.fragsize) * (u->out_fragments = info.fragstotal);
@@ -540,7 +540,7 @@ int pa__init(pa_core *c, pa_module*m) {
name = name_buf = pa_sprintf_malloc("oss_output.%s", pa_path_get_filename(p));
namereg_fail = 0;
}
-
+
if (!(u->sink = pa_sink_new(c, __FILE__, name, namereg_fail, &u->sample_spec, &map)))
goto fail;
@@ -555,28 +555,28 @@ int pa__init(pa_core *c, pa_module*m) {
hwdesc[0] ? hwdesc : "",
hwdesc[0] ? ")" : ""));
pa_xfree(t);
-
+
u->sink->is_hardware = 1;
u->out_memblocks = pa_xmalloc0(sizeof(struct memblock *)*u->out_fragments);
-
+
enable_bits |= PCM_ENABLE_OUTPUT;
}
}
pa_xfree(name_buf);
name_buf = NULL;
-
+
zero = 0;
if (ioctl(u->fd, SNDCTL_DSP_SETTRIGGER, &zero) < 0) {
pa_log("SNDCTL_DSP_SETTRIGGER: %s", pa_cstrerror(errno));
goto fail;
}
-
+
if (ioctl(u->fd, SNDCTL_DSP_SETTRIGGER, &enable_bits) < 0) {
pa_log("SNDCTL_DSP_SETTRIGGER: %s", pa_cstrerror(errno));
goto fail;
}
-
+
assert(u->source || u->sink);
u->io_event = c->mainloop->io_new(c->mainloop, u->fd, (u->source ? PA_IO_EVENT_INPUT : 0) | (u->sink ? PA_IO_EVENT_OUTPUT : 0), io_callback, u);
@@ -589,7 +589,7 @@ int pa__init(pa_core *c, pa_module*m) {
source_get_hw_volume(u->source);
if (u->sink)
sink_get_hw_volume(u->sink);
-
+
return 0;
fail:
@@ -599,13 +599,13 @@ fail:
pa_modargs_free(ma);
pa_xfree(name_buf);
-
+
return -1;
}
void pa__done(pa_core *c, pa_module*m) {
struct userdata *u;
-
+
assert(c);
assert(m);
@@ -629,6 +629,6 @@ void pa__done(pa_core *c, pa_module*m) {
pa_memblock_unref_fixed(u->in_memblocks[i]);
pa_xfree(u->in_memblocks);
}
-
+
pa_xfree(u);
}
diff --git a/src/modules/module-oss.c b/src/modules/module-oss.c
index b71581d9..b8ced86f 100644
--- a/src/modules/module-oss.c
+++ b/src/modules/module-oss.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -100,20 +100,20 @@ static const char* const valid_modargs[] = {
#define DEFAULT_DEVICE "/dev/dsp"
static void update_usage(struct userdata *u) {
- pa_module_set_used(u->module,
+ pa_module_set_used(u->module,
(u->sink ? pa_sink_used_by(u->sink) : 0) +
(u->source ? pa_source_used_by(u->source) : 0));
}
static void clear_up(struct userdata *u) {
assert(u);
-
+
if (u->sink) {
pa_sink_disconnect(u->sink);
pa_sink_unref(u->sink);
u->sink = NULL;
}
-
+
if (u->source) {
pa_source_disconnect(u->source);
pa_source_unref(u->source);
@@ -131,7 +131,7 @@ static void do_write(struct userdata *u) {
ssize_t r;
size_t l;
int loop = 0;
-
+
assert(u);
if (!u->sink || !pa_iochannel_is_writable(u->io))
@@ -140,10 +140,10 @@ static void do_write(struct userdata *u) {
update_usage(u);
l = u->out_fragment_size;
-
+
if (u->use_getospace) {
audio_buf_info info;
-
+
if (ioctl(u->fd, SNDCTL_DSP_GETOSPACE, &info) < 0)
u->use_getospace = 0;
else {
@@ -156,15 +156,15 @@ static void do_write(struct userdata *u) {
do {
memchunk = &u->memchunk;
-
+
if (!memchunk->length)
if (pa_sink_render(u->sink, l, memchunk) < 0)
memchunk = &u->silence;
-
+
assert(memchunk->memblock);
assert(memchunk->memblock->data);
assert(memchunk->length);
-
+
if ((r = pa_iochannel_write(u->io, (uint8_t*) memchunk->memblock->data + memchunk->index, memchunk->length)) < 0) {
pa_log("write() failed: %s", pa_cstrerror(errno));
@@ -172,13 +172,13 @@ static void do_write(struct userdata *u) {
pa_module_unload_request(u->module);
break;
}
-
+
if (memchunk == &u->silence)
assert(r % u->sample_size == 0);
else {
u->memchunk.index += r;
u->memchunk.length -= r;
-
+
if (u->memchunk.length <= 0) {
pa_memblock_unref(u->memchunk.memblock);
u->memchunk.memblock = NULL;
@@ -195,7 +195,7 @@ static void do_read(struct userdata *u) {
size_t l;
int loop = 0;
assert(u);
-
+
if (!u->source || !pa_iochannel_is_readable(u->io) || !pa_idxset_size(u->source->outputs))
return;
@@ -205,7 +205,7 @@ static void do_read(struct userdata *u) {
if (u->use_getispace) {
audio_buf_info info;
-
+
if (ioctl(u->fd, SNDCTL_DSP_GETISPACE, &info) < 0)
u->use_getispace = 0;
else {
@@ -215,7 +215,7 @@ static void do_read(struct userdata *u) {
}
}
}
-
+
do {
memchunk.memblock = pa_memblock_new(u->core->mempool, l);
assert(memchunk.memblock);
@@ -228,11 +228,11 @@ static void do_read(struct userdata *u) {
}
break;
}
-
+
assert(r <= (ssize_t) memchunk.memblock->length);
memchunk.length = memchunk.memblock->length = r;
memchunk.index = 0;
-
+
pa_source_post(u->source, &memchunk);
pa_memblock_unref(memchunk.memblock);
@@ -280,12 +280,12 @@ static pa_usec_t source_get_latency_cb(pa_source *s) {
if (!u->use_getispace)
return 0;
-
+
if (ioctl(u->fd, SNDCTL_DSP_GETISPACE, &info) < 0) {
u->use_getispace = 0;
return 0;
}
-
+
if (info.bytes <= 0)
return 0;
@@ -355,7 +355,7 @@ int pa__init(pa_core *c, pa_module*m) {
const char *name;
char *name_buf = NULL;
int namereg_fail;
-
+
assert(c);
assert(m);
@@ -363,7 +363,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("failed to parse module arguments.");
goto fail;
}
-
+
if (pa_modargs_get_value_boolean(ma, "record", &record) < 0 || pa_modargs_get_value_boolean(ma, "playback", &playback) < 0) {
pa_log("record= and playback= expect numeric argument.");
goto fail;
@@ -381,11 +381,11 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("failed to parse sample specification or channel map");
goto fail;
}
-
+
/* Fix latency to 100ms */
nfrags = 12;
frag_size = pa_bytes_per_second(&ss)/128;
-
+
if (pa_modargs_get_value_s32(ma, "fragments", &nfrags) < 0 || pa_modargs_get_value_s32(ma, "fragment_size", &frag_size) < 0) {
pa_log("failed to parse fragments arguments");
goto fail;
@@ -398,12 +398,12 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log_info("hardware name is '%s'.", hwdesc);
else
hwdesc[0] = 0;
-
+
pa_log_info("device opened in %s mode.", mode == O_WRONLY ? "O_WRONLY" : (mode == O_RDONLY ? "O_RDONLY" : "O_RDWR"));
if (nfrags >= 2 && frag_size >= 1)
- if (pa_oss_set_fragments(fd, nfrags, frag_size) < 0)
- goto fail;
+ if (pa_oss_set_fragments(fd, nfrags, frag_size) < 0)
+ goto fail;
if (pa_oss_auto_format(fd, &ss) < 0)
goto fail;
@@ -418,7 +418,7 @@ int pa__init(pa_core *c, pa_module*m) {
u = pa_xmalloc(sizeof(struct userdata));
u->core = c;
u->use_getospace = u->use_getispace = 0;
-
+
if (ioctl(fd, SNDCTL_DSP_GETISPACE, &info) >= 0) {
pa_log_info("input -- %u fragments of size %u.", info.fragstotal, info.fragsize);
in_frag_size = info.fragsize;
@@ -438,7 +438,7 @@ int pa__init(pa_core *c, pa_module*m) {
name = name_buf = pa_sprintf_malloc("oss_input.%s", pa_path_get_filename(p));
namereg_fail = 0;
}
-
+
if (!(u->source = pa_source_new(c, __FILE__, name, namereg_fail, &ss, &map)))
goto fail;
@@ -468,7 +468,7 @@ int pa__init(pa_core *c, pa_module*m) {
name = name_buf = pa_sprintf_malloc("oss_output.%s", pa_path_get_filename(p));
namereg_fail = 0;
}
-
+
if (!(u->sink = pa_sink_new(c, __FILE__, name, namereg_fail, &ss, &map)))
goto fail;
@@ -489,7 +489,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_xfree(name_buf);
name_buf = NULL;
-
+
assert(u->source || u->sink);
u->io = pa_iochannel_new(c->mainloop, u->source ? fd : -1, u->sink ? fd : -1);
@@ -539,13 +539,13 @@ fail:
pa_modargs_free(ma);
pa_xfree(name_buf);
-
+
return -1;
}
void pa__done(pa_core *c, pa_module*m) {
struct userdata *u;
-
+
assert(c);
assert(m);
@@ -553,7 +553,7 @@ void pa__done(pa_core *c, pa_module*m) {
return;
clear_up(u);
-
+
if (u->memchunk.memblock)
pa_memblock_unref(u->memchunk.memblock);
if (u->silence.memblock)
diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index 4aee849b..72400313 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -63,7 +63,7 @@ struct userdata {
pa_core *core;
char *filename;
-
+
pa_sink *sink;
pa_iochannel *io;
pa_defer_event *defer_event;
@@ -87,18 +87,18 @@ static void do_write(struct userdata *u) {
assert(u);
u->core->mainloop->defer_enable(u->defer_event, 0);
-
+
if (!pa_iochannel_is_writable(u->io))
return;
pa_module_set_used(u->module, pa_sink_used_by(u->sink));
-
+
if (!u->memchunk.length)
if (pa_sink_render(u->sink, PIPE_BUF, &u->memchunk) < 0)
return;
assert(u->memchunk.memblock && u->memchunk.length);
-
+
if ((r = pa_iochannel_write(u->io, (uint8_t*) u->memchunk.memblock->data + u->memchunk.index, u->memchunk.length)) < 0) {
pa_log("write(): %s", pa_cstrerror(errno));
return;
@@ -106,7 +106,7 @@ static void do_write(struct userdata *u) {
u->memchunk.index += r;
u->memchunk.length -= r;
-
+
if (u->memchunk.length <= 0) {
pa_memblock_unref(u->memchunk.memblock);
u->memchunk.memblock = NULL;
@@ -149,9 +149,9 @@ int pa__init(pa_core *c, pa_module*m) {
pa_channel_map map;
pa_modargs *ma = NULL;
char *t;
-
+
assert(c && m);
-
+
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("failed to parse module arguments");
goto fail;
@@ -162,7 +162,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("invalid sample format specification");
goto fail;
}
-
+
mkfifo(p = pa_modargs_get_value(ma, "file", DEFAULT_FIFO_NAME), 0777);
if ((fd = open(p, O_RDWR)) < 0) {
@@ -171,7 +171,7 @@ int pa__init(pa_core *c, pa_module*m) {
}
pa_fd_set_cloexec(fd, 1);
-
+
if (fstat(fd, &st) < 0) {
pa_log("fstat('%s'): %s", p, pa_cstrerror(errno));
goto fail;
@@ -187,7 +187,7 @@ int pa__init(pa_core *c, pa_module*m) {
u->core = c;
u->module = m;
m->userdata = u;
-
+
if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
pa_log("failed to create sink.");
goto fail;
@@ -211,13 +211,13 @@ int pa__init(pa_core *c, pa_module*m) {
c->mainloop->defer_enable(u->defer_event, 0);
pa_modargs_free(ma);
-
+
return 0;
fail:
if (ma)
pa_modargs_free(ma);
-
+
if (fd >= 0)
close(fd);
@@ -232,10 +232,10 @@ void pa__done(pa_core *c, pa_module*m) {
if (!(u = m->userdata))
return;
-
+
if (u->memchunk.memblock)
pa_memblock_unref(u->memchunk.memblock);
-
+
pa_sink_disconnect(u->sink);
pa_sink_unref(u->sink);
pa_iochannel_free(u->io);
@@ -244,6 +244,6 @@ void pa__done(pa_core *c, pa_module*m) {
assert(u->filename);
unlink(u->filename);
pa_xfree(u->filename);
-
+
pa_xfree(u);
}
diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c
index c251f7ac..f53f6a63 100644
--- a/src/modules/module-pipe-source.c
+++ b/src/modules/module-pipe-source.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -63,7 +63,7 @@ struct userdata {
pa_core *core;
char *filename;
-
+
pa_source *source;
pa_iochannel *io;
pa_module *module;
@@ -127,9 +127,9 @@ int pa__init(pa_core *c, pa_module*m) {
pa_channel_map map;
pa_modargs *ma = NULL;
char *t;
-
+
assert(c && m);
-
+
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("failed to parse module arguments");
goto fail;
@@ -140,7 +140,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("invalid sample format specification or channel map");
goto fail;
}
-
+
mkfifo(p = pa_modargs_get_value(ma, "file", DEFAULT_FIFO_NAME), 0777);
if ((fd = open(p, O_RDWR)) < 0) {
@@ -149,7 +149,7 @@ int pa__init(pa_core *c, pa_module*m) {
}
pa_fd_set_cloexec(fd, 1);
-
+
if (fstat(fd, &st) < 0) {
pa_log("fstat('%s'): %s", p, pa_cstrerror(errno));
goto fail;
@@ -164,7 +164,7 @@ int pa__init(pa_core *c, pa_module*m) {
u->filename = pa_xstrdup(p);
u->core = c;
-
+
if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map))) {
pa_log("failed to create source.");
goto fail;
@@ -180,18 +180,18 @@ int pa__init(pa_core *c, pa_module*m) {
u->chunk.memblock = NULL;
u->chunk.index = u->chunk.length = 0;
-
+
u->module = m;
m->userdata = u;
pa_modargs_free(ma);
-
+
return 0;
fail:
if (ma)
pa_modargs_free(ma);
-
+
if (fd >= 0)
close(fd);
@@ -206,10 +206,10 @@ void pa__done(pa_core *c, pa_module*m) {
if (!(u = m->userdata))
return;
-
+
if (u->chunk.memblock)
pa_memblock_unref(u->chunk.memblock);
-
+
pa_source_disconnect(u->source);
pa_source_unref(u->source);
pa_iochannel_free(u->io);
@@ -217,6 +217,6 @@ void pa__done(pa_core *c, pa_module*m) {
assert(u->filename);
unlink(u->filename);
pa_xfree(u->filename);
-
+
pa_xfree(u);
}
diff --git a/src/modules/module-protocol-stub.c b/src/modules/module-protocol-stub.c
index df58958a..93fb2a36 100644
--- a/src/modules/module-protocol-stub.c
+++ b/src/modules/module-protocol-stub.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -85,13 +85,13 @@
"record=<enable record?> "
SOCKET_USAGE)
#elif defined(USE_PROTOCOL_CLI)
- #include <pulsecore/protocol-cli.h>
+ #include <pulsecore/protocol-cli.h>
#define protocol_new pa_protocol_cli_new
#define protocol_free pa_protocol_cli_free
#define TCPWRAP_SERVICE "pulseaudio-cli"
#define IPV4_PORT 4712
#define UNIX_SOCKET "cli"
- #define MODULE_ARGUMENTS
+ #define MODULE_ARGUMENTS
#ifdef USE_TCP_SOCKETS
#include "module-cli-protocol-tcp-symdef.h"
#else
@@ -106,7 +106,7 @@
#define TCPWRAP_SERVICE "pulseaudio-http"
#define IPV4_PORT 4714
#define UNIX_SOCKET "http"
- #define MODULE_ARGUMENTS
+ #define MODULE_ARGUMENTS
#ifdef USE_TCP_SOCKETS
#include "module-http-protocol-tcp-symdef.h"
#else
@@ -129,16 +129,16 @@
#endif
#if defined(HAVE_CREDS) && !defined(USE_TCP_SOCKETS)
- #define MODULE_ARGUMENTS MODULE_ARGUMENTS_COMMON "auth-group", "auth-group-enable",
+ #define MODULE_ARGUMENTS MODULE_ARGUMENTS_COMMON "auth-group", "auth-group-enable",
#define AUTH_USAGE "auth-group=<system group to allow access> auth-group-enable=<enable auth by UNIX group?> "
#elif defined(USE_TCP_SOCKETS)
- #define MODULE_ARGUMENTS MODULE_ARGUMENTS_COMMON "auth-ip-acl",
+ #define MODULE_ARGUMENTS MODULE_ARGUMENTS_COMMON "auth-ip-acl",
#define AUTH_USAGE "auth-ip-acl=<IP address ACL to allow access> "
#else
#define MODULE_ARGUMENTS MODULE_ARGUMENTS_COMMON
#define AUTH_USAGE
#endif
-
+
PA_MODULE_DESCRIPTION("Native protocol "SOCKET_DESCRIPTION)
PA_MODULE_USAGE("auth-anonymous=<don't check for cookies?> "
"cookie=<path to cookie file> "
@@ -160,7 +160,7 @@
#endif
#if defined(USE_TCP_SOCKETS)
- #define MODULE_ARGUMENTS MODULE_ARGUMENTS_COMMON "auth-ip-acl",
+ #define MODULE_ARGUMENTS MODULE_ARGUMENTS_COMMON "auth-ip-acl",
#define AUTH_USAGE "auth-ip-acl=<IP address ACL to allow access> "
#else
#define MODULE_ARGUMENTS MODULE_ARGUMENTS_COMMON
@@ -175,7 +175,7 @@
AUTH_USAGE
SOCKET_USAGE)
#else
- #error "Broken build system"
+ #error "Broken build system"
#endif
PA_MODULE_AUTHOR("Lennart Poettering")
@@ -266,21 +266,21 @@ int pa__init(pa_core *c, pa_module*m) {
/* This socket doesn't reside in our own runtime dir but in
* /tmp/.esd/, hence we have to create the dir first */
-
+
if (pa_make_secure_parent_dir(u->socket_path, c->is_system_instance ? 0755 : 0700, (uid_t)-1, (gid_t)-1) < 0) {
pa_log("Failed to create socket directory: %s\n", pa_cstrerror(errno));
goto fail;
}
#endif
-
+
if ((r = pa_unix_socket_remove_stale(tmp)) < 0) {
pa_log("Failed to remove stale UNIX socket '%s': %s", tmp, pa_cstrerror(errno));
goto fail;
}
-
+
if (r)
pa_log("Removed stale UNIX socket '%s'.", tmp);
-
+
if (!(s = pa_socket_server_new_unix(c->mainloop, tmp)))
goto fail;
@@ -332,7 +332,7 @@ fail:
void pa__done(pa_core *c, pa_module*m) {
struct userdata *u;
-
+
assert(c);
assert(m);
@@ -354,8 +354,8 @@ void pa__done(pa_core *c, pa_module*m) {
pa_xfree(p);
}
#endif
-
-
+
+
pa_xfree(u->socket_path);
#endif
diff --git a/src/modules/module-rescue-streams.c b/src/modules/module-rescue-streams.c
index 7aa205bd..2eea4f61 100644
--- a/src/modules/module-rescue-streams.c
+++ b/src/modules/module-rescue-streams.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -49,7 +49,7 @@ struct userdata {
static pa_hook_result_t sink_hook_callback(pa_core *c, pa_sink *sink, void* userdata) {
pa_sink_input *i;
pa_sink *target;
-
+
assert(c);
assert(sink);
@@ -57,7 +57,7 @@ static pa_hook_result_t sink_hook_callback(pa_core *c, pa_sink *sink, void* user
pa_log_debug("No sink inputs to move away.");
return PA_HOOK_OK;
}
-
+
if (!(target = pa_namereg_get(c, NULL, PA_NAMEREG_SINK, 0))) {
pa_log_info("No evacuation sink found.");
return PA_HOOK_OK;
@@ -74,14 +74,14 @@ static pa_hook_result_t sink_hook_callback(pa_core *c, pa_sink *sink, void* user
pa_log_info("Sucessfully moved sink input %u \"%s\" to %s.", i->index, i->name, target->name);
}
-
+
return PA_HOOK_OK;
}
static pa_hook_result_t source_hook_callback(pa_core *c, pa_source *source, void* userdata) {
pa_source_output *o;
pa_source *target;
-
+
assert(c);
assert(source);
@@ -89,7 +89,7 @@ static pa_hook_result_t source_hook_callback(pa_core *c, pa_source *source, void
pa_log_debug("No source outputs to move away.");
return PA_HOOK_OK;
}
-
+
if (!(target = pa_namereg_get(c, NULL, PA_NAMEREG_SOURCE, 0))) {
pa_log_info("No evacuation source found.");
return PA_HOOK_OK;
@@ -106,14 +106,14 @@ static pa_hook_result_t source_hook_callback(pa_core *c, pa_source *source, void
pa_log_info("Sucessfully moved source output %u \"%s\" to %s.", o->index, o->name, target->name);
}
-
+
return PA_HOOK_OK;
}
int pa__init(pa_core *c, pa_module*m) {
pa_modargs *ma = NULL;
struct userdata *u;
-
+
assert(c);
assert(m);
@@ -132,7 +132,7 @@ int pa__init(pa_core *c, pa_module*m) {
void pa__done(pa_core *c, pa_module*m) {
struct userdata *u;
-
+
assert(c);
assert(m);
diff --git a/src/modules/module-sine.c b/src/modules/module-sine.c
index fa29ba16..871b702d 100644
--- a/src/modules/module-sine.c
+++ b/src/modules/module-sine.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -96,7 +96,7 @@ static void calc_sine(float *f, size_t l, float freq) {
size_t i;
l /= sizeof(float);
-
+
for (i = 0; i < l; i++)
f[i] = (float) sin((double) i/l*M_PI*2*freq)/2;
}
@@ -115,7 +115,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("Failed to parse module arguments");
goto fail;
}
-
+
m->userdata = u = pa_xmalloc(sizeof(struct userdata));
u->core = c;
u->module = m;
@@ -138,7 +138,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("Invalid frequency specification");
goto fail;
}
-
+
u->memblock = pa_memblock_new(c->mempool, pa_bytes_per_second(&ss));
calc_sine(u->memblock->data, u->memblock->length, frequency);
@@ -160,10 +160,10 @@ int pa__init(pa_core *c, pa_module*m) {
u->sink_input->userdata = u;
u->peek_index = 0;
-
+
pa_modargs_free(ma);
return 0;
-
+
fail:
if (ma)
pa_modargs_free(ma);
@@ -183,7 +183,7 @@ void pa__done(pa_core *c, pa_module*m) {
pa_sink_input_disconnect(u->sink_input);
pa_sink_input_unref(u->sink_input);
}
-
+
if (u->memblock)
pa_memblock_unref(u->memblock);
pa_xfree(u);
diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c
index 66968cb1..1454d639 100644
--- a/src/modules/module-solaris.c
+++ b/src/modules/module-solaris.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -124,7 +124,7 @@ static void do_write(struct userdata *u) {
int err;
size_t len;
ssize_t r;
-
+
assert(u);
/* We cannot check pa_iochannel_is_writable() because of our buffer hack */
@@ -163,7 +163,7 @@ static void do_write(struct userdata *u) {
}
u->sink_underflow = 0;
-
+
assert(u->memchunk.memblock);
assert(u->memchunk.memblock->data);
assert(u->memchunk.length);
@@ -181,10 +181,10 @@ static void do_write(struct userdata *u) {
}
assert(r % u->frame_size == 0);
-
+
u->memchunk.index += r;
u->memchunk.length -= r;
-
+
if (u->memchunk.length <= 0) {
pa_memblock_unref(u->memchunk.memblock);
u->memchunk.memblock = NULL;
@@ -199,7 +199,7 @@ static void do_read(struct userdata *u) {
size_t l;
ssize_t r;
assert(u);
-
+
if (!u->source || !pa_iochannel_is_readable(u->io))
return;
@@ -221,11 +221,11 @@ static void do_read(struct userdata *u) {
pa_log("read() failed: %s", pa_cstrerror(errno));
return;
}
-
+
assert(r <= (ssize_t) memchunk.memblock->length);
memchunk.length = memchunk.memblock->length = r;
memchunk.index = 0;
-
+
pa_source_post(u->source, &memchunk);
pa_memblock_unref(memchunk.memblock);
@@ -256,7 +256,7 @@ static void timer_cb(pa_mainloop_api*a, pa_time_event *e, const struct timeval *
static void sig_callback(pa_mainloop_api *api, pa_signal_event*e, int sig, void *userdata) {
struct userdata *u = userdata;
pa_cvolume old_vol;
-
+
assert(u);
if (u->sink) {
@@ -518,7 +518,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("failed to parse module arguments.");
goto fail;
}
-
+
if (pa_modargs_get_value_boolean(ma, "record", &record) < 0 || pa_modargs_get_value_boolean(ma, "playback", &playback) < 0) {
pa_log("record= and playback= expect numeric argument.");
goto fail;
@@ -531,7 +531,7 @@ int pa__init(pa_core *c, pa_module*m) {
mode = (playback&&record) ? O_RDWR : (playback ? O_WRONLY : (record ? O_RDONLY : 0));
- buffer_size = 16384;
+ buffer_size = 16384;
if (pa_modargs_get_value_s32(ma, "buffer_size", &buffer_size) < 0) {
pa_log("failed to parse buffer size argument");
goto fail;
@@ -542,7 +542,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("failed to parse sample specification");
goto fail;
}
-
+
if ((fd = open(p = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), mode | O_NONBLOCK)) < 0)
goto fail;
@@ -642,7 +642,7 @@ fail:
if (ma)
pa_modargs_free(ma);
-
+
return -1;
}
@@ -657,7 +657,7 @@ void pa__done(pa_core *c, pa_module*m) {
c->mainloop->time_free(u->timer);
ioctl(u->fd, I_SETSIG, 0);
pa_signal_free(u->sig);
-
+
if (u->memchunk.memblock)
pa_memblock_unref(u->memchunk.memblock);
@@ -665,12 +665,12 @@ void pa__done(pa_core *c, pa_module*m) {
pa_sink_disconnect(u->sink);
pa_sink_unref(u->sink);
}
-
+
if (u->source) {
pa_source_disconnect(u->source);
pa_source_unref(u->source);
}
-
+
pa_iochannel_free(u->io);
pa_xfree(u);
}
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index a110c57e..f7420a67 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -116,10 +116,10 @@ static void command_request(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
static const pa_pdispatch_cb_t command_table[PA_COMMAND_MAX] = {
#ifdef TUNNEL_SINK
[PA_COMMAND_REQUEST] = command_request,
-#endif
+#endif
[PA_COMMAND_PLAYBACK_STREAM_KILLED] = command_stream_killed,
[PA_COMMAND_RECORD_STREAM_KILLED] = command_stream_killed,
- [PA_COMMAND_SUBSCRIBE_EVENT] = command_subscribe_event,
+ [PA_COMMAND_SUBSCRIBE_EVENT] = command_subscribe_event,
};
struct userdata {
@@ -136,7 +136,7 @@ struct userdata {
char *source_name;
pa_source *source;
#endif
-
+
pa_module *module;
pa_core *core;
@@ -146,7 +146,7 @@ struct userdata {
uint32_t ctag;
uint32_t device_index;
uint32_t channel;
-
+
pa_usec_t host_latency;
pa_time_event *time_event;
@@ -156,7 +156,7 @@ struct userdata {
static void close_stuff(struct userdata *u) {
assert(u);
-
+
if (u->pstream) {
pa_pstream_close(u->pstream);
pa_pstream_unref(u->pstream);
@@ -256,10 +256,10 @@ static void send_bytes(struct userdata *u) {
while (u->requested_bytes > 0) {
pa_memchunk chunk;
if (pa_sink_render(u->sink, u->requested_bytes, &chunk) < 0) {
-
- if (u->requested_bytes >= DEFAULT_TLENGTH-DEFAULT_PREBUF)
+
+ if (u->requested_bytes >= DEFAULT_TLENGTH-DEFAULT_PREBUF)
send_prebuf_request(u);
-
+
return;
}
@@ -293,7 +293,7 @@ static void command_request(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED ui
die(u);
return;
}
-
+
u->requested_bytes += bytes;
send_bytes(u);
}
@@ -316,7 +316,7 @@ static void stream_get_latency_callback(pa_pdispatch *pd, uint32_t command, PA_G
die(u);
return;
}
-
+
if (pa_tagstruct_get_usec(t, &sink_usec) < 0 ||
pa_tagstruct_get_usec(t, &source_usec) < 0 ||
pa_tagstruct_get_boolean(t, &playing) < 0 ||
@@ -333,14 +333,14 @@ static void stream_get_latency_callback(pa_pdispatch *pd, uint32_t command, PA_G
pa_gettimeofday(&now);
/* FIXME! This could use some serious love. */
-
+
if (pa_timeval_cmp(&local, &remote) < 0 && pa_timeval_cmp(&remote, &now)) {
/* local and remote seem to have synchronized clocks */
#ifdef TUNNEL_SINK
transport_usec = pa_timeval_diff(&remote, &local);
#else
transport_usec = pa_timeval_diff(&now, &remote);
-#endif
+#endif
} else
transport_usec = pa_timeval_diff(&now, &local)/2;
@@ -364,7 +364,7 @@ static void request_latency(struct userdata *u) {
assert(u);
t = pa_tagstruct_new(NULL, 0);
-#ifdef TUNNEL_SINK
+#ifdef TUNNEL_SINK
pa_tagstruct_putu32(t, PA_COMMAND_GET_PLAYBACK_LATENCY);
#else
pa_tagstruct_putu32(t, PA_COMMAND_GET_RECORD_LATENCY);
@@ -374,7 +374,7 @@ static void request_latency(struct userdata *u) {
pa_gettimeofday(&now);
pa_tagstruct_put_timeval(t, &now);
-
+
pa_pstream_send_tagstruct(u->pstream, t);
pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, stream_get_latency_callback, u, NULL);
}
@@ -496,7 +496,7 @@ static void timeout_callback(pa_mainloop_api *m, pa_time_event*e, PA_GCC_UNUSED
assert(m && e && u);
request_latency(u);
-
+
pa_gettimeofday(&ntv);
ntv.tv_sec += LATENCY_INTERVAL;
m->time_restart(e, &ntv);
@@ -518,16 +518,16 @@ static void create_stream_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UN
if (pa_tagstruct_getu32(t, &u->channel) < 0 ||
pa_tagstruct_getu32(t, &u->device_index) < 0
-#ifdef TUNNEL_SINK
+#ifdef TUNNEL_SINK
|| pa_tagstruct_getu32(t, &u->requested_bytes) < 0
-#endif
+#endif
)
goto parse_error;
if (u->version >= 9) {
#ifdef TUNNEL_SINK
uint32_t maxlength, tlength, prebuf, minreq;
-
+
if (pa_tagstruct_getu32(t, &maxlength) < 0 ||
pa_tagstruct_getu32(t, &tlength) < 0 ||
pa_tagstruct_getu32(t, &prebuf) < 0 ||
@@ -535,13 +535,13 @@ static void create_stream_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UN
goto parse_error;
#else
uint32_t maxlength, fragsize;
-
+
if (pa_tagstruct_getu32(t, &maxlength) < 0 ||
- pa_tagstruct_getu32(t, &fragsize) < 0)
+ pa_tagstruct_getu32(t, &fragsize) < 0)
goto parse_error;
#endif
}
-
+
if (!pa_tagstruct_eof(t))
goto parse_error;
@@ -559,7 +559,7 @@ static void create_stream_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UN
#endif
return;
-
+
parse_error:
pa_log("invalid reply. (create stream)");
die(u);
@@ -603,7 +603,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
pa_get_user_name(un, sizeof(un)),
u->source->name);
#endif
-
+
reply = pa_tagstruct_new(NULL, 0);
pa_tagstruct_putu32(reply, PA_COMMAND_SET_CLIENT_NAME);
pa_tagstruct_putu32(reply, tag = u->ctag++);
@@ -612,7 +612,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
/* We ignore the server's reply here */
reply = pa_tagstruct_new(NULL, 0);
-#ifdef TUNNEL_SINK
+#ifdef TUNNEL_SINK
pa_tagstruct_putu32(reply, PA_COMMAND_CREATE_PLAYBACK_STREAM);
pa_tagstruct_putu32(reply, tag = u->ctag++);
pa_tagstruct_puts(reply, name);
@@ -640,7 +640,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
pa_tagstruct_put_boolean(reply, 0);
pa_tagstruct_putu32(reply, DEFAULT_FRAGSIZE);
#endif
-
+
pa_pstream_send_tagstruct(u->pstream, reply);
pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, create_stream_callback, u, NULL);
}
@@ -673,7 +673,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, PA_GCC_UN
die(u);
return;
}
-
+
pa_source_post(u->source, chunk);
}
#endif
@@ -686,7 +686,7 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata
pa_socket_client_unref(u->client);
u->client = NULL;
-
+
if (!io) {
pa_log("connection failed.");
pa_module_unload_request(u->module);
@@ -701,7 +701,7 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata
#ifndef TUNNEL_SINK
pa_pstream_set_recieve_memblock_callback(u->pstream, pstream_memblock_callback, u);
#endif
-
+
t = pa_tagstruct_new(NULL, 0);
pa_tagstruct_putu32(t, PA_COMMAND_AUTH);
pa_tagstruct_putu32(t, tag = u->ctag++);
@@ -709,7 +709,7 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata
pa_tagstruct_put_arbitrary(t, u->auth_cookie, sizeof(u->auth_cookie));
pa_pstream_send_tagstruct(u->pstream, t);
pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, setup_complete_callback, u, NULL);
-
+
}
#ifdef TUNNEL_SINK
@@ -862,14 +862,14 @@ static int load_key(struct userdata *u, const char*fn) {
assert(u);
u->auth_cookie_in_property = 0;
-
+
if (!fn && pa_authkey_prop_get(u->core, PA_NATIVE_COOKIE_PROPERTY_NAME, u->auth_cookie, sizeof(u->auth_cookie)) >= 0) {
pa_log_debug("using already loaded auth cookie.");
pa_authkey_prop_ref(u->core, PA_NATIVE_COOKIE_PROPERTY_NAME);
u->auth_cookie_in_property = 1;
return 0;
}
-
+
if (!fn)
fn = PA_NATIVE_COOKIE_FILE;
@@ -877,7 +877,7 @@ static int load_key(struct userdata *u, const char*fn) {
return -1;
pa_log_debug("loading cookie from disk.");
-
+
if (pa_authkey_prop_put(u->core, PA_NATIVE_COOKIE_PROPERTY_NAME, u->auth_cookie, sizeof(u->auth_cookie)) >= 0)
u->auth_cookie_in_property = 1;
@@ -890,7 +890,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_sample_spec ss;
pa_channel_map map;
char *t, *dn = NULL;
-
+
assert(c && m);
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
@@ -919,10 +919,10 @@ int pa__init(pa_core *c, pa_module*m) {
u->host_latency = 0;
u->auth_cookie_in_property = 0;
u->time_event = NULL;
-
+
if (load_key(u, pa_modargs_get_value(ma, "cookie", NULL)) < 0)
goto fail;
-
+
if (!(u->server_name = pa_xstrdup(pa_modargs_get_value(ma, "server", NULL)))) {
pa_log("no server specified.");
goto fail;
@@ -938,7 +938,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("failed to connect to server '%s'", u->server_name);
goto fail;
}
-
+
if (!u->client)
goto fail;
@@ -987,7 +987,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_source_set_owner(u->source, m);
#endif
-
+
pa_xfree(dn);
u->time_event = NULL;
@@ -995,7 +995,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_modargs_free(ma);
return 0;
-
+
fail:
pa__done(c, m);
@@ -1003,7 +1003,7 @@ fail:
pa_modargs_free(ma);
pa_xfree(dn);
-
+
return -1;
}
@@ -1018,7 +1018,7 @@ void pa__done(pa_core *c, pa_module*m) {
if (u->auth_cookie_in_property)
pa_authkey_prop_unref(c, PA_NATIVE_COOKIE_PROPERTY_NAME);
-
+
#ifdef TUNNEL_SINK
pa_xfree(u->sink_name);
#else
diff --git a/src/modules/module-volume-restore.c b/src/modules/module-volume-restore.c
index efa59f40..877d17c7 100644
--- a/src/modules/module-volume-restore.c
+++ b/src/modules/module-volume-restore.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -82,7 +82,7 @@ static pa_cvolume* parse_volume(const char *s, pa_cvolume *v) {
char *p;
long k;
unsigned i;
-
+
assert(s);
assert(v);
@@ -92,7 +92,7 @@ static pa_cvolume* parse_volume(const char *s, pa_cvolume *v) {
k = strtol(s, &p, 0);
if (k <= 0 || k > PA_CHANNELS_MAX)
return NULL;
-
+
v->channels = (unsigned) k;
for (i = 0; i < v->channels; i++) {
@@ -105,7 +105,7 @@ static pa_cvolume* parse_volume(const char *s, pa_cvolume *v) {
if (k < PA_VOLUME_MUTED)
return NULL;
-
+
v->values[i] = (pa_volume_t) k;
}
@@ -132,22 +132,22 @@ static int load_rules(struct userdata *u) {
ret = 0;
} else
pa_log("failed to open file '%s': %s", u->table_file, pa_cstrerror(errno));
-
+
goto finish;
}
pa_lock_fd(fileno(f), 1);
-
+
while (!feof(f)) {
struct rule *rule;
pa_cvolume v;
int v_is_set;
-
+
if (!fgets(ln, sizeof(buf_name), f))
break;
n++;
-
+
pa_strip_nl(ln);
if (ln[0] == '#')
@@ -181,12 +181,12 @@ static int load_rules(struct userdata *u) {
v_is_set = 0;
ln = buf_name;
-
+
if (pa_hashmap_get(u->hashmap, buf_name)) {
pa_log("double entry in %s:%u, ignoring", u->table_file, n);
continue;
}
-
+
rule = pa_xnew(struct rule, 1);
rule->name = pa_xstrdup(buf_name);
if ((rule->volume_is_set = v_is_set))
@@ -203,7 +203,7 @@ static int load_rules(struct userdata *u) {
}
ret = 0;
-
+
finish:
if (f) {
pa_lock_fd(fileno(f), 0);
@@ -218,7 +218,7 @@ static int save_rules(struct userdata *u) {
int ret = -1;
void *state = NULL;
struct rule *rule;
-
+
f = u->table_file ?
fopen(u->table_file, "w") :
pa_open_config_file(NULL, DEFAULT_VOLUME_TABLE_FILE, NULL, &u->table_file, "w");
@@ -232,7 +232,7 @@ static int save_rules(struct userdata *u) {
while ((rule = pa_hashmap_iterate(u->hashmap, &state, NULL))) {
unsigned i;
-
+
fprintf(f, "%s\n", rule->name);
if (rule->volume_is_set) {
@@ -241,14 +241,14 @@ static int save_rules(struct userdata *u) {
for (i = 0; i < rule->volume.channels; i++)
fprintf(f, " %u", rule->volume.values[i]);
}
-
+
fprintf(f, "\n%s\n%s\n",
rule->sink ? rule->sink : "",
rule->source ? rule->source : "");
}
-
+
ret = 0;
-
+
finish:
if (f) {
pa_lock_fd(fileno(f), 0);
@@ -260,7 +260,7 @@ finish:
static char* client_name(pa_client *c) {
char *t, *e;
-
+
if (!c->name || !c->driver)
return NULL;
@@ -280,11 +280,11 @@ static char* client_name(pa_client *c) {
* sessions of the same application, which is something we
* explicitly don't want. Besides other stuff this makes xmms
* with esound work properly for us. */
-
+
if (*k == ')' && *(k+1) == 0)
*e = 0;
}
-
+
return t;
}
@@ -294,7 +294,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
pa_source_output *so = NULL;
struct rule *r;
char *name;
-
+
assert(c);
assert(u);
@@ -307,7 +307,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
if ((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SINK_INPUT) {
if (!(si = pa_idxset_get_by_index(c->sink_inputs, idx)))
return;
-
+
if (!si->client || !(name = client_name(si->client)))
return;
} else {
@@ -315,7 +315,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
if (!(so = pa_idxset_get_by_index(c->source_outputs, idx)))
return;
-
+
if (!so->client || !(name = client_name(so->client)))
return;
}
@@ -348,7 +348,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
u->modified = 1;
}
}
-
+
} else {
pa_log_info("Creating new entry for <%s>", name);
@@ -366,7 +366,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
r->sink = NULL;
r->source = pa_xstrdup(so->source->name);
}
-
+
pa_hashmap_put(u->hashmap, r->name, r);
u->modified = 1;
}
@@ -419,7 +419,7 @@ static pa_hook_result_t source_output_hook_callback(pa_core *c, pa_source_output
int pa__init(pa_core *c, pa_module*m) {
pa_modargs *ma = NULL;
struct userdata *u;
-
+
assert(c);
assert(m);
@@ -433,9 +433,9 @@ int pa__init(pa_core *c, pa_module*m) {
u->subscription = NULL;
u->table_file = pa_xstrdup(pa_modargs_get_value(ma, "table", NULL));
u->modified = 0;
-
+
m->userdata = u;
-
+
if (load_rules(u) < 0)
goto fail;
@@ -451,7 +451,7 @@ fail:
if (ma)
pa_modargs_free(ma);
-
+
return -1;
}
@@ -467,7 +467,7 @@ static void free_func(void *p, void *userdata) {
void pa__done(pa_core *c, pa_module*m) {
struct userdata* u;
-
+
assert(c);
assert(m);
@@ -486,7 +486,7 @@ void pa__done(pa_core *c, pa_module*m) {
if (u->modified)
save_rules(u);
-
+
pa_hashmap_free(u->hashmap, free_func, NULL);
}
diff --git a/src/modules/module-waveout.c b/src/modules/module-waveout.c
index 4043c136..e245e138 100644
--- a/src/modules/module-waveout.c
+++ b/src/modules/module-waveout.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -172,7 +172,7 @@ static void do_write(struct userdata *u)
pa_log_error(__FILE__ ": ERROR: Unable to write waveOut block: %d",
res);
}
-
+
u->written_bytes += hdr->dwBufferLength;
EnterCriticalSection(&u->crit);
@@ -233,7 +233,7 @@ static void do_read(struct userdata *u)
pa_log_error(__FILE__ ": ERROR: Unable to add waveIn block: %d",
res);
}
-
+
free_frags--;
u->cur_ihdr++;
u->cur_ihdr %= u->fragments;
@@ -561,7 +561,7 @@ int pa__init(pa_core *c, pa_module*m) {
u->ohdrs[i].lpData = pa_xmalloc(u->fragment_size);
assert(u->ohdrs);
}
-
+
u->module = m;
m->userdata = u;
@@ -585,7 +585,7 @@ fail:
if (ma)
pa_modargs_free(ma);
-
+
return -1;
}
@@ -597,7 +597,7 @@ void pa__done(pa_core *c, pa_module*m) {
if (!(u = m->userdata))
return;
-
+
if (u->event)
c->mainloop->time_free(u->event);
@@ -608,12 +608,12 @@ void pa__done(pa_core *c, pa_module*m) {
pa_sink_disconnect(u->sink);
pa_sink_unref(u->sink);
}
-
+
if (u->source) {
pa_source_disconnect(u->source);
pa_source_unref(u->source);
}
-
+
if (u->hwi != INVALID_HANDLE_VALUE) {
waveInReset(u->hwi);
waveInClose(u->hwi);
@@ -633,6 +633,6 @@ void pa__done(pa_core *c, pa_module*m) {
pa_xfree(u->ohdrs);
DeleteCriticalSection(&u->crit);
-
+
pa_xfree(u);
}
diff --git a/src/modules/module-x11-bell.c b/src/modules/module-x11-bell.c
index 48e95c8c..5322a71f 100644
--- a/src/modules/module-x11-bell.c
+++ b/src/modules/module-x11-bell.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -107,19 +107,19 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("failed to parse module arguments");
goto fail;
}
-
+
m->userdata = u = pa_xmalloc(sizeof(struct userdata));
u->core = c;
u->scache_item = pa_xstrdup(pa_modargs_get_value(ma, "sample", "x11-bell"));
u->sink_name = pa_xstrdup(pa_modargs_get_value(ma, "sink", NULL));
u->x11_client = NULL;
- if (!(u->x11_wrapper = pa_x11_wrapper_get(c, pa_modargs_get_value(ma, "display", NULL))))
+ if (!(u->x11_wrapper = pa_x11_wrapper_get(c, pa_modargs_get_value(ma, "display", NULL))))
goto fail;
major = XkbMajorVersion;
minor = XkbMinorVersion;
-
+
if (!XkbLibraryVersion(&major, &minor)) {
pa_log("XkbLibraryVersion() failed");
goto fail;
@@ -140,11 +140,11 @@ int pa__init(pa_core *c, pa_module*m) {
XkbChangeEnabledControls(pa_x11_wrapper_get_display(u->x11_wrapper), XkbUseCoreKbd, XkbAudibleBellMask, 0);
u->x11_client = pa_x11_client_new(u->x11_wrapper, x11_event_callback, u);
-
+
pa_modargs_free(ma);
-
+
return 0;
-
+
fail:
if (ma)
pa_modargs_free(ma);
diff --git a/src/modules/module-x11-publish.c b/src/modules/module-x11-publish.c
index f2cace14..b1c17a7c 100644
--- a/src/modules/module-x11-publish.c
+++ b/src/modules/module-x11-publish.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -77,14 +77,14 @@ static int load_key(struct userdata *u, const char*fn) {
assert(u);
u->auth_cookie_in_property = 0;
-
+
if (!fn && pa_authkey_prop_get(u->core, PA_NATIVE_COOKIE_PROPERTY_NAME, u->auth_cookie, sizeof(u->auth_cookie)) >= 0) {
pa_log_debug("using already loaded auth cookie.");
pa_authkey_prop_ref(u->core, PA_NATIVE_COOKIE_PROPERTY_NAME);
u->auth_cookie_in_property = 1;
return 0;
}
-
+
if (!fn)
fn = PA_NATIVE_COOKIE_FILE;
@@ -92,7 +92,7 @@ static int load_key(struct userdata *u, const char*fn) {
return -1;
pa_log_debug("loading cookie from disk.");
-
+
if (pa_authkey_prop_put(u->core, PA_NATIVE_COOKIE_PROPERTY_NAME, u->auth_cookie, sizeof(u->auth_cookie)) >= 0)
u->auth_cookie_in_property = 1;
@@ -121,7 +121,7 @@ int pa__init(pa_core *c, pa_module*m) {
if (load_key(u, pa_modargs_get_value(ma, "cookie", NULL)) < 0)
goto fail;
- if (!(u->x11_wrapper = pa_x11_wrapper_get(c, pa_modargs_get_value(ma, "display", NULL))))
+ if (!(u->x11_wrapper = pa_x11_wrapper_get(c, pa_modargs_get_value(ma, "display", NULL))))
goto fail;
if (!(l = pa_property_get(c, PA_NATIVE_SERVER_PROPERTY_NAME)))
@@ -130,10 +130,10 @@ int pa__init(pa_core *c, pa_module*m) {
s = pa_strlist_tostring(l);
pa_x11_set_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SERVER", s);
pa_xfree(s);
-
+
if (!pa_get_fqdn(hn, sizeof(hn)) || !pa_get_user_name(un, sizeof(un)))
goto fail;
-
+
u->id = pa_sprintf_malloc("%s@%s/%u", un, hn, (unsigned) getpid());
pa_x11_set_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_ID", u->id);
@@ -144,10 +144,10 @@ int pa__init(pa_core *c, pa_module*m) {
pa_x11_set_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SINK", t);
pa_x11_set_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_COOKIE", pa_hexstr(u->auth_cookie, sizeof(u->auth_cookie), hx, sizeof(hx)));
-
+
pa_modargs_free(ma);
return 0;
-
+
fail:
if (ma)
pa_modargs_free(ma);
@@ -162,7 +162,7 @@ void pa__done(pa_core *c, pa_module*m) {
if (!(u = m->userdata))
return;
-
+
if (u->x11_wrapper) {
char t[256];
@@ -178,7 +178,7 @@ void pa__done(pa_core *c, pa_module*m) {
XSync(pa_x11_wrapper_get_display(u->x11_wrapper), False);
}
}
-
+
if (u->x11_wrapper)
pa_x11_wrapper_unref(u->x11_wrapper);
diff --git a/src/modules/module-zeroconf-publish.c b/src/modules/module-zeroconf-publish.c
index 696d8afe..10643808 100644
--- a/src/modules/module-zeroconf-publish.c
+++ b/src/modules/module-zeroconf-publish.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -153,7 +153,7 @@ static int publish_service(struct userdata *u, struct service *s) {
if (!u->client || avahi_client_get_state(u->client) != AVAHI_CLIENT_S_RUNNING)
return 0;
-
+
if ((s->published == PUBLISHED_REAL && s->loaded.valid) ||
(s->published == PUBLISHED_AUTOLOAD && s->autoload.valid && !s->loaded.valid))
return 0;
@@ -161,8 +161,8 @@ static int publish_service(struct userdata *u, struct service *s) {
if (s->published != UNPUBLISHED) {
avahi_entry_group_reset(s->entry_group);
s->published = UNPUBLISHED;
- }
-
+ }
+
if (s->loaded.valid || s->autoload.valid) {
pa_namereg_type_t type;
@@ -172,26 +172,26 @@ static int publish_service(struct userdata *u, struct service *s) {
goto finish;
}
}
-
+
txt = avahi_string_list_add_pair(txt, "device", s->name);
txt = txt_record_server_data(u->core, txt);
-
+
if (s->loaded.valid) {
char *description;
pa_sample_spec ss;
-
+
get_service_data(u, s, &ss, &description);
-
+
txt = avahi_string_list_add_printf(txt, "rate=%u", ss.rate);
txt = avahi_string_list_add_printf(txt, "channels=%u", ss.channels);
txt = avahi_string_list_add_pair(txt, "format", pa_sample_format_to_string(ss.format));
if (description)
txt = avahi_string_list_add_pair(txt, "description", description);
-
+
type = s->loaded.type;
} else if (s->autoload.valid)
type = s->autoload.type;
-
+
if (avahi_entry_group_add_service_strlst(
s->entry_group,
AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
@@ -202,24 +202,24 @@ static int publish_service(struct userdata *u, struct service *s) {
NULL,
u->port,
txt) < 0) {
-
+
pa_log("avahi_entry_group_add_service_strlst(): %s", avahi_strerror(avahi_client_errno(u->client)));
goto finish;
}
-
+
if (avahi_entry_group_commit(s->entry_group) < 0) {
pa_log("avahi_entry_group_commit(): %s", avahi_strerror(avahi_client_errno(u->client)));
goto finish;
}
-
+
if (s->loaded.valid)
s->published = PUBLISHED_REAL;
else if (s->autoload.valid)
s->published = PUBLISHED_AUTOLOAD;
}
-
+
r = 0;
-
+
finish:
if (s->published == UNPUBLISHED) {
@@ -227,7 +227,7 @@ finish:
if (s->entry_group)
avahi_entry_group_free(s->entry_group);
-
+
pa_hashmap_remove(u->services, s->name);
pa_xfree(s->name);
pa_xfree(s->service_name);
@@ -236,17 +236,17 @@ finish:
if (txt)
avahi_string_list_free(txt);
-
+
return r;
}
static struct service *get_service(struct userdata *u, const char *name, const char *description) {
struct service *s;
char hn[64];
-
+
if ((s = pa_hashmap_get(u->services, name)))
return s;
-
+
s = pa_xnew(struct service, 1);
s->userdata = u;
s->entry_group = NULL;
@@ -283,7 +283,7 @@ static int publish_sink(struct userdata *u, pa_sink *s) {
static int publish_source(struct userdata *u, pa_source *s) {
struct service *svc;
int ret;
-
+
assert(u && s);
svc = get_service(u, s->name, s->description);
@@ -295,7 +295,7 @@ static int publish_source(struct userdata *u, pa_source *s) {
svc->loaded.index = s->index;
pa_dynarray_put(u->source_dynarray, s->index, svc);
-
+
if ((ret = publish_service(u, svc)) < 0)
return ret;
@@ -306,7 +306,7 @@ static int publish_source(struct userdata *u, pa_source *s) {
static int publish_autoload(struct userdata *u, pa_autoload_entry *s) {
struct service *svc;
int ret;
-
+
assert(u && s);
svc = get_service(u, s->name, NULL);
@@ -319,7 +319,7 @@ static int publish_autoload(struct userdata *u, pa_autoload_entry *s) {
if ((ret = publish_service(u, svc)) < 0)
return ret;
-
+
pa_dynarray_put(u->autoload_dynarray, s->index, svc);
return ret;
}
@@ -336,14 +336,14 @@ static int remove_sink(struct userdata *u, uint32_t idx) {
svc->loaded.valid = 0;
pa_dynarray_put(u->sink_dynarray, idx, NULL);
-
+
return publish_service(u, svc);
}
static int remove_source(struct userdata *u, uint32_t idx) {
struct service *svc;
assert(u && idx != PA_INVALID_INDEX);
-
+
if (!(svc = pa_dynarray_get(u->source_dynarray, idx)))
return 0;
@@ -359,7 +359,7 @@ static int remove_source(struct userdata *u, uint32_t idx) {
static int remove_autoload(struct userdata *u, uint32_t idx) {
struct service *svc;
assert(u && idx != PA_INVALID_INDEX);
-
+
if (!(svc = pa_dynarray_get(u->autoload_dynarray, idx)))
return 0;
@@ -389,14 +389,14 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
if (remove_sink(u, idx) < 0)
goto fail;
}
-
+
break;
case PA_SUBSCRIPTION_EVENT_SOURCE:
if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW) {
pa_source *source;
-
+
if ((source = pa_idxset_get_by_index(c->sources, idx))) {
if (publish_source(u, source) < 0)
goto fail;
@@ -405,13 +405,13 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
if (remove_source(u, idx) < 0)
goto fail;
}
-
+
break;
case PA_SUBSCRIPTION_EVENT_AUTOLOAD:
if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW) {
pa_autoload_entry *autoload;
-
+
if ((autoload = pa_idxset_get_by_index(c->autoload_idxset, idx))) {
if (publish_autoload(u, autoload) < 0)
goto fail;
@@ -420,7 +420,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
if (remove_autoload(u, idx) < 0)
goto fail;
}
-
+
break;
}
@@ -453,7 +453,7 @@ static void main_entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState s
static int publish_main_service(struct userdata *u) {
AvahiStringList *txt = NULL;
int r = -1;
-
+
if (!u->main_entry_group) {
if (!(u->main_entry_group = avahi_entry_group_new(u->client, main_entry_group_callback, u))) {
pa_log("avahi_entry_group_new() failed: %s", avahi_strerror(avahi_client_errno(u->client)));
@@ -461,7 +461,7 @@ static int publish_main_service(struct userdata *u) {
}
} else
avahi_entry_group_reset(u->main_entry_group);
-
+
txt = txt_record_server_data(u->core, NULL);
if (avahi_entry_group_add_service_strlst(
@@ -474,18 +474,18 @@ static int publish_main_service(struct userdata *u) {
NULL,
u->port,
txt) < 0) {
-
+
pa_log("avahi_entry_group_add_service_strlst() failed: %s", avahi_strerror(avahi_client_errno(u->client)));
goto fail;
}
-
+
if (avahi_entry_group_commit(u->main_entry_group) < 0) {
pa_log("avahi_entry_group_commit() failed: %s", avahi_strerror(avahi_client_errno(u->client)));
goto fail;
}
r = 0;
-
+
fail:
avahi_string_list_free(txt);
@@ -498,7 +498,7 @@ static int publish_all_services(struct userdata *u) {
pa_autoload_entry *autoload;
int r = -1;
uint32_t idx;
-
+
assert(u);
pa_log_debug("Publishing services in Zeroconf");
@@ -518,9 +518,9 @@ static int publish_all_services(struct userdata *u) {
if (publish_main_service(u) < 0)
goto fail;
-
+
r = 0;
-
+
fail:
return r;
}
@@ -528,7 +528,7 @@ fail:
static void unpublish_all_services(struct userdata *u, int rem) {
void *state = NULL;
struct service *s;
-
+
assert(u);
pa_log_debug("Unpublishing services in Zeroconf");
@@ -538,7 +538,7 @@ static void unpublish_all_services(struct userdata *u, int rem) {
if (rem) {
avahi_entry_group_free(s->entry_group);
s->entry_group = NULL;
- } else
+ } else
avahi_entry_group_reset(s->entry_group);
}
@@ -559,12 +559,12 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda
assert(c);
u->client = c;
-
+
switch (state) {
case AVAHI_CLIENT_S_RUNNING:
publish_all_services(u);
break;
-
+
case AVAHI_CLIENT_S_COLLISION:
unpublish_all_services(u, 0);
break;
@@ -578,7 +578,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda
if (!(u->client = avahi_client_new(u->avahi_poll, AVAHI_CLIENT_NO_FAIL, client_callback, u, &error)))
pa_log("pa_avahi_client_new() failed: %s", avahi_strerror(error));
}
-
+
break;
default: ;
@@ -607,7 +607,7 @@ int pa__init(pa_core *c, pa_module*m) {
u->port = (uint16_t) port;
u->avahi_poll = pa_avahi_poll_new(c->mainloop);
-
+
u->services = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
u->sink_dynarray = pa_dynarray_new();
u->source_dynarray = pa_dynarray_new();
@@ -628,15 +628,15 @@ int pa__init(pa_core *c, pa_module*m) {
}
pa_modargs_free(ma);
-
+
return 0;
-
+
fail:
pa__done(c, m);
if (ma)
pa_modargs_free(ma);
-
+
return -1;
}
@@ -649,7 +649,7 @@ static void service_free(void *p, void *userdata) {
if (s->entry_group)
avahi_entry_group_free(s->entry_group);
-
+
pa_xfree(s->service_name);
pa_xfree(s->name);
pa_xfree(s);
@@ -674,14 +674,14 @@ void pa__done(pa_core *c, pa_module*m) {
pa_dynarray_free(u->source_dynarray, NULL, NULL);
if (u->autoload_dynarray)
pa_dynarray_free(u->autoload_dynarray, NULL, NULL);
-
+
if (u->main_entry_group)
avahi_entry_group_free(u->main_entry_group);
-
+
if (u->client)
avahi_client_free(u->client);
-
+
if (u->avahi_poll)
pa_avahi_poll_free(u->avahi_poll);
diff --git a/src/modules/oss-util.c b/src/modules/oss-util.c
index 0aaf6971..d26a0e81 100644
--- a/src/modules/oss-util.c
+++ b/src/modules/oss-util.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -48,14 +48,14 @@ int pa_oss_open(const char *device, int *mode, int* pcaps) {
if(!pcaps)
pcaps = &caps;
-
+
if (*mode == O_RDWR) {
if ((fd = open(device, O_RDWR|O_NDELAY)) >= 0) {
int dcaps, *tcaps;
ioctl(fd, SNDCTL_DSP_SETDUPLEX, 0);
tcaps = pcaps ? pcaps : &dcaps;
-
+
if (ioctl(fd, SNDCTL_DSP_GETCAPS, tcaps) < 0) {
pa_log("SNDCTL_DSP_GETCAPS: %s", pa_cstrerror(errno));
goto fail;
@@ -68,7 +68,7 @@ int pa_oss_open(const char *device, int *mode, int* pcaps) {
close(fd);
}
-
+
if ((fd = open(device, (*mode = O_WRONLY)|O_NDELAY)) < 0) {
if ((fd = open(device, (*mode = O_RDONLY)|O_NDELAY)) < 0) {
pa_log("open('%s'): %s", device, pa_cstrerror(errno));
@@ -80,17 +80,17 @@ int pa_oss_open(const char *device, int *mode, int* pcaps) {
pa_log("open('%s'): %s", device, pa_cstrerror(errno));
goto fail;
}
- }
+ }
success:
*pcaps = 0;
-
+
if (ioctl(fd, SNDCTL_DSP_GETCAPS, pcaps) < 0) {
pa_log("SNDCTL_DSP_GETCAPS: %s", pa_cstrerror(errno));
goto fail;
}
-
+
pa_log_debug("capabilities:%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
*pcaps & DSP_CAP_BATCH ? " BATCH" : "",
#ifdef DSP_CAP_BIND
@@ -100,7 +100,7 @@ success:
#endif
*pcaps & DSP_CAP_COPROC ? " COPROC" : "",
*pcaps & DSP_CAP_DUPLEX ? " DUPLEX" : "",
-#ifdef DSP_CAP_FREERATE
+#ifdef DSP_CAP_FREERATE
*pcaps & DSP_CAP_FREERATE ? " FREERATE" : "",
#else
"",
@@ -140,7 +140,7 @@ success:
*pcaps & DSP_CAP_TRIGGER ? " TRIGGER" : "");
pa_fd_set_cloexec(fd, 1);
-
+
return fd;
fail:
@@ -152,7 +152,7 @@ fail:
int pa_oss_auto_format(int fd, pa_sample_spec *ss) {
int format, channels, speed, reqformat;
pa_sample_format_t orig_format;
-
+
static const int format_trans[PA_SAMPLE_MAX] = {
[PA_SAMPLE_U8] = AFMT_U8,
[PA_SAMPLE_ALAW] = AFMT_A_LAW,
@@ -166,7 +166,7 @@ int pa_oss_auto_format(int fd, pa_sample_spec *ss) {
assert(fd >= 0 && ss);
orig_format = ss->format;
-
+
reqformat = format = format_trans[ss->format];
if (reqformat == AFMT_QUERY || ioctl(fd, SNDCTL_DSP_SETFMT, &format) < 0 || format != reqformat) {
format = AFMT_S16_NE;
@@ -190,7 +190,7 @@ int pa_oss_auto_format(int fd, pa_sample_spec *ss) {
pa_log_warn("device doesn't support sample format %s, changed to %s.",
pa_sample_format_to_string(orig_format),
pa_sample_format_to_string(ss->format));
-
+
channels = ss->channels;
if (ioctl(fd, SNDCTL_DSP_CHANNELS, &channels) < 0) {
pa_log("SNDCTL_DSP_CHANNELS: %s", pa_cstrerror(errno));
@@ -229,14 +229,14 @@ static int simple_log2(int v) {
if (!v) break;
k++;
}
-
+
return k;
}
int pa_oss_set_fragments(int fd, int nfrags, int frag_size) {
int arg;
arg = ((int) nfrags << 16) | simple_log2(frag_size);
-
+
if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &arg) < 0) {
pa_log("SNDCTL_DSP_SETFRAGMENT: %s", pa_cstrerror(errno));
return -1;
@@ -252,7 +252,7 @@ static int pa_oss_get_volume(int fd, int mixer, const pa_sample_spec *ss, pa_cvo
assert(fd >= 0);
assert(ss);
assert(volume);
-
+
if (ioctl(fd, mixer, &vol) < 0)
return -1;
@@ -278,7 +278,7 @@ static int pa_oss_set_volume(int fd, int mixer, const pa_sample_spec *ss, const
r = volume->values[1] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[1];
vol |= ((r*100)/PA_VOLUME_NORM) << 8;
}
-
+
if (ioctl(fd, mixer, &vol) < 0)
return -1;
@@ -321,7 +321,7 @@ int pa_oss_get_hw_description(const char *dev, char *name, size_t l) {
n = *e - '0';
else
return -1;
-
+
if (!(f = fopen("/dev/sndstat", "r")) &&
!(f = fopen("/proc/sndstat", "r")) &&
!(f = fopen("/proc/asound/oss/sndstat", "r"))) {
@@ -335,7 +335,7 @@ int pa_oss_get_hw_description(const char *dev, char *name, size_t l) {
while (!feof(f)) {
char line[64];
int device;
-
+
if (!fgets(line, sizeof(line), f))
break;
@@ -348,7 +348,7 @@ int pa_oss_get_hw_description(const char *dev, char *name, size_t l) {
if (line[0] == 0)
break;
-
+
if (sscanf(line, "%i: ", &device) != 1)
continue;
@@ -360,7 +360,7 @@ int pa_oss_get_hw_description(const char *dev, char *name, size_t l) {
if (pa_endswith(k, " (DUPLEX)"))
k[strlen(k)-9] = 0;
-
+
pa_strlcpy(name, k, l);
r = 0;
break;
diff --git a/src/modules/oss-util.h b/src/modules/oss-util.h
index 12855f4e..6a8bf3d2 100644
--- a/src/modules/oss-util.h
+++ b/src/modules/oss-util.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/browser.c b/src/pulse/browser.c
index dae8e3d5..4b0de029 100644
--- a/src/pulse/browser.c
+++ b/src/pulse/browser.c
@@ -2,26 +2,26 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
***/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <assert.h>
#include <string.h>
@@ -53,10 +53,10 @@ struct pa_browser {
pa_browser_error_cb_t error_callback;
void *error_userdata;
-
+
AvahiClient *client;
AvahiServiceBrowser *server_browser, *sink_browser, *source_browser;
-
+
};
static int map_to_opcode(const char *type, int new) {
@@ -84,7 +84,7 @@ static void resolve_callback(
AvahiStringList *txt,
AvahiLookupResultFlags flags,
void *userdata) {
-
+
pa_browser *b = userdata;
pa_browse_info i;
char ip[256], a[256];
@@ -94,7 +94,7 @@ static void resolve_callback(
pa_sample_spec ss;
int ss_valid = 0;
char *key = NULL, *value = NULL;
-
+
assert(b);
memset(&i, 0, sizeof(i));
@@ -102,7 +102,7 @@ static void resolve_callback(
if (event != AVAHI_RESOLVER_FOUND)
goto fail;
-
+
if (!b->callback)
goto fail;
@@ -119,10 +119,10 @@ static void resolve_callback(
while (txt) {
-
+
if (avahi_string_list_get_pair(txt, &key, &value, NULL) < 0)
break;
-
+
if (!strcmp(key, "device")) {
device_found = 1;
pa_xfree((char*) i.device);
@@ -138,11 +138,11 @@ static void resolve_callback(
value = NULL;
} else if (!strcmp(key, "fqdn")) {
size_t l;
-
+
pa_xfree((char*) i.fqdn);
i.fqdn = value;
value = NULL;
-
+
l = strlen(a);
assert(l+1 <= sizeof(a));
strncat(a, " ", sizeof(a)-l-1);
@@ -151,7 +151,7 @@ static void resolve_callback(
if (pa_atou(value, &cookie) < 0)
goto fail;
-
+
i.cookie = &cookie;
} else if (!strcmp(key, "description")) {
pa_xfree((char*) i.description);
@@ -159,13 +159,13 @@ static void resolve_callback(
value = NULL;
} else if (!strcmp(key, "channels")) {
uint32_t ch;
-
+
if (pa_atou(value, &ch) < 0 || ch <= 0 || ch > 255)
goto fail;
-
+
ss.channels = (uint8_t) ch;
ss_valid |= 1;
-
+
} else if (!strcmp(key, "rate")) {
if (pa_atou(value, &ss.rate) < 0)
goto fail;
@@ -174,7 +174,7 @@ static void resolve_callback(
if ((ss.format = pa_parse_sample_format(value)) == PA_SAMPLE_INVALID)
goto fail;
-
+
ss_valid |= 4;
}
@@ -186,7 +186,7 @@ static void resolve_callback(
}
/* No device txt record was sent for a sink or source service */
- if (opcode != PA_BROWSE_NEW_SERVER && !device_found)
+ if (opcode != PA_BROWSE_NEW_SERVER && !device_found)
goto fail;
if (ss_valid == 7)
@@ -203,7 +203,7 @@ fail:
pa_xfree(key);
pa_xfree(value);
-
+
avahi_service_resolver_free(r);
}
@@ -263,19 +263,19 @@ static void browse_callback(
break;
}
-
+
case AVAHI_BROWSER_REMOVE: {
if (b->callback) {
pa_browse_info i;
int opcode;
-
+
memset(&i, 0, sizeof(i));
i.name = name;
opcode = map_to_opcode(type, 0);
assert(opcode >= 0);
-
+
b->callback(b, opcode, &i, b->userdata);
}
break;
@@ -285,7 +285,7 @@ static void browse_callback(
handle_failure(b);
break;
}
-
+
default:
;
}
@@ -313,7 +313,7 @@ pa_browser *pa_browser_new_full(pa_mainloop_api *mainloop, pa_browse_flags_t fla
if (flags & ~(PA_BROWSE_FOR_SERVERS|PA_BROWSE_FOR_SINKS|PA_BROWSE_FOR_SOURCES) || flags == 0)
return NULL;
-
+
b = pa_xnew(pa_browser, 1);
b->mainloop = mainloop;
b->ref = 1;
@@ -346,7 +346,7 @@ pa_browser *pa_browser_new_full(pa_mainloop_api *mainloop, pa_browse_flags_t fla
*error_string = avahi_strerror(avahi_client_errno(b->client));
goto fail;
}
-
+
if ((flags & PA_BROWSE_FOR_SINKS) &&
!(b->sink_browser = avahi_service_browser_new(
b->client,
@@ -378,13 +378,13 @@ pa_browser *pa_browser_new_full(pa_mainloop_api *mainloop, pa_browse_flags_t fla
*error_string = avahi_strerror(avahi_client_errno(b->client));
goto fail;
}
-
+
return b;
fail:
if (b)
browser_free(b);
-
+
return NULL;
}
@@ -403,7 +403,7 @@ static void browser_free(pa_browser *b) {
if (b->avahi_poll)
pa_avahi_poll_free(b->avahi_poll);
-
+
pa_xfree(b);
}
diff --git a/src/pulse/browser.h b/src/pulse/browser.h
index fc57a4d5..7b9aae8d 100644
--- a/src/pulse/browser.h
+++ b/src/pulse/browser.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -41,7 +41,7 @@ typedef enum pa_browse_opcode {
PA_BROWSE_NEW_SINK, /**< New sink found */
PA_BROWSE_NEW_SOURCE, /**< New source found */
PA_BROWSE_REMOVE_SERVER, /**< Server disappeared */
- PA_BROWSE_REMOVE_SINK, /**< Sink disappeared */
+ PA_BROWSE_REMOVE_SINK, /**< Sink disappeared */
PA_BROWSE_REMOVE_SOURCE /**< Source disappeared */
} pa_browse_opcode_t;
diff --git a/src/pulse/cdecl.h b/src/pulse/cdecl.h
index a3ec231c..09b9b84a 100644
--- a/src/pulse/cdecl.h
+++ b/src/pulse/cdecl.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c
index 69b09089..40655cf5 100644
--- a/src/pulse/channelmap.c
+++ b/src/pulse/channelmap.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -35,23 +35,23 @@
const char *const table[] = {
[PA_CHANNEL_POSITION_MONO] = "mono",
-
+
[PA_CHANNEL_POSITION_FRONT_CENTER] = "front-center",
[PA_CHANNEL_POSITION_FRONT_LEFT] = "front-left",
[PA_CHANNEL_POSITION_FRONT_RIGHT] = "front-right",
-
+
[PA_CHANNEL_POSITION_REAR_CENTER] = "rear-center",
[PA_CHANNEL_POSITION_REAR_LEFT] = "rear-left",
[PA_CHANNEL_POSITION_REAR_RIGHT] = "rear-right",
-
+
[PA_CHANNEL_POSITION_LFE] = "lfe",
-
+
[PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER] = "front-left-of-center",
[PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER] = "front-right-of-center",
-
+
[PA_CHANNEL_POSITION_SIDE_LEFT] = "side-left",
[PA_CHANNEL_POSITION_SIDE_RIGHT] = "side-right",
-
+
[PA_CHANNEL_POSITION_AUX0] = "aux0",
[PA_CHANNEL_POSITION_AUX1] = "aux1",
[PA_CHANNEL_POSITION_AUX2] = "aux2",
@@ -86,7 +86,7 @@ const char *const table[] = {
[PA_CHANNEL_POSITION_AUX31] = "aux31",
[PA_CHANNEL_POSITION_TOP_CENTER] = "top-center",
-
+
[PA_CHANNEL_POSITION_TOP_FRONT_LEFT] = "top-front-left",
[PA_CHANNEL_POSITION_TOP_FRONT_RIGHT] = "top-front-right",
[PA_CHANNEL_POSITION_TOP_FRONT_CENTER] = "top-front-center",
@@ -140,14 +140,14 @@ pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, p
switch (def) {
case PA_CHANNEL_MAP_AIFF:
-
+
/* This is somewhat compatible with RFC3551 */
-
+
switch (channels) {
case 1:
m->map[0] = PA_CHANNEL_POSITION_MONO;
return m;
-
+
case 6:
m->map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
m->map[1] = PA_CHANNEL_POSITION_SIDE_LEFT;
@@ -156,31 +156,31 @@ pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, p
m->map[4] = PA_CHANNEL_POSITION_SIDE_RIGHT;
m->map[5] = PA_CHANNEL_POSITION_LFE;
return m;
-
+
case 5:
m->map[2] = PA_CHANNEL_POSITION_FRONT_CENTER;
m->map[3] = PA_CHANNEL_POSITION_REAR_LEFT;
m->map[4] = PA_CHANNEL_POSITION_REAR_RIGHT;
/* Fall through */
-
+
case 2:
m->map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
m->map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT;
return m;
-
+
case 3:
m->map[0] = PA_CHANNEL_POSITION_LEFT;
m->map[1] = PA_CHANNEL_POSITION_RIGHT;
m->map[2] = PA_CHANNEL_POSITION_CENTER;
return m;
-
+
case 4:
m->map[0] = PA_CHANNEL_POSITION_LEFT;
m->map[1] = PA_CHANNEL_POSITION_CENTER;
m->map[2] = PA_CHANNEL_POSITION_RIGHT;
m->map[3] = PA_CHANNEL_POSITION_LFE;
return m;
-
+
default:
return NULL;
}
@@ -191,43 +191,43 @@ pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, p
case 1:
m->map[0] = PA_CHANNEL_POSITION_MONO;
return m;
-
+
case 8:
m->map[6] = PA_CHANNEL_POSITION_SIDE_LEFT;
m->map[7] = PA_CHANNEL_POSITION_SIDE_RIGHT;
/* Fall through */
-
+
case 6:
m->map[5] = PA_CHANNEL_POSITION_LFE;
/* Fall through */
-
+
case 5:
m->map[4] = PA_CHANNEL_POSITION_FRONT_CENTER;
/* Fall through */
-
+
case 4:
m->map[2] = PA_CHANNEL_POSITION_REAR_LEFT;
m->map[3] = PA_CHANNEL_POSITION_REAR_RIGHT;
/* Fall through */
-
+
case 2:
m->map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
m->map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT;
return m;
-
+
default:
return NULL;
}
case PA_CHANNEL_MAP_AUX: {
unsigned i;
-
+
if (channels >= PA_CHANNELS_MAX)
return NULL;
for (i = 0; i < channels; i++)
m->map[i] = PA_CHANNEL_POSITION_AUX0 + i;
-
+
return m;
}
@@ -237,55 +237,55 @@ pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, p
case 1:
m->map[0] = PA_CHANNEL_POSITION_MONO;
return m;
-
+
case 18:
m->map[15] = PA_CHANNEL_POSITION_TOP_REAR_LEFT;
m->map[16] = PA_CHANNEL_POSITION_TOP_REAR_CENTER;
m->map[17] = PA_CHANNEL_POSITION_TOP_REAR_RIGHT;
/* Fall through */
-
+
case 15:
m->map[12] = PA_CHANNEL_POSITION_TOP_FRONT_LEFT;
m->map[13] = PA_CHANNEL_POSITION_TOP_FRONT_CENTER;
m->map[14] = PA_CHANNEL_POSITION_TOP_FRONT_RIGHT;
/* Fall through */
-
+
case 12:
m->map[11] = PA_CHANNEL_POSITION_TOP_CENTER;
/* Fall through */
-
+
case 11:
m->map[9] = PA_CHANNEL_POSITION_SIDE_LEFT;
m->map[10] = PA_CHANNEL_POSITION_SIDE_RIGHT;
/* Fall through */
-
+
case 9:
m->map[8] = PA_CHANNEL_POSITION_REAR_CENTER;
/* Fall through */
-
+
case 8:
m->map[6] = PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER;
m->map[7] = PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER;
/* Fall through */
-
+
case 6:
m->map[4] = PA_CHANNEL_POSITION_REAR_LEFT;
m->map[5] = PA_CHANNEL_POSITION_REAR_RIGHT;
/* Fall through */
-
+
case 4:
m->map[3] = PA_CHANNEL_POSITION_LFE;
/* Fall through */
-
+
case 3:
m->map[2] = PA_CHANNEL_POSITION_FRONT_CENTER;
/* Fall through */
-
+
case 2:
m->map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
m->map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT;
return m;
-
+
default:
return NULL;
}
@@ -296,12 +296,12 @@ pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, p
case 1:
m->map[0] = PA_CHANNEL_POSITION_MONO;
return m;
-
+
case 8:
m->map[6] = PA_CHANNEL_POSITION_REAR_LEFT;
m->map[7] = PA_CHANNEL_POSITION_REAR_RIGHT;
/* Fall through */
-
+
case 6:
m->map[4] = PA_CHANNEL_POSITION_SIDE_LEFT;
m->map[5] = PA_CHANNEL_POSITION_SIDE_RIGHT;
@@ -310,20 +310,20 @@ pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, p
case 4:
m->map[3] = PA_CHANNEL_POSITION_LFE;
/* Fall through */
-
+
case 3:
m->map[2] = PA_CHANNEL_POSITION_FRONT_CENTER;
/* Fall through */
-
+
case 2:
m->map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
m->map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT;
return m;
-
+
default:
return NULL;
}
-
+
default:
return NULL;
@@ -341,13 +341,13 @@ const char* pa_channel_position_to_string(pa_channel_position_t pos) {
int pa_channel_map_equal(const pa_channel_map *a, const pa_channel_map *b) {
unsigned c;
-
+
assert(a);
assert(b);
if (a->channels != b->channels)
return 0;
-
+
for (c = 0; c < a->channels; c++)
if (a->map[c] != b->map[c])
return 0;
@@ -359,7 +359,7 @@ char* pa_channel_map_snprint(char *s, size_t l, const pa_channel_map *map) {
unsigned channel;
int first = 1;
char *e;
-
+
assert(s);
assert(l > 0);
assert(map);
@@ -382,7 +382,7 @@ pa_channel_map *pa_channel_map_parse(pa_channel_map *rmap, const char *s) {
const char *state;
pa_channel_map map;
char *p;
-
+
assert(rmap);
assert(s);
@@ -397,14 +397,14 @@ pa_channel_map *pa_channel_map_parse(pa_channel_map *rmap, const char *s) {
state = NULL;
map.channels = 0;
-
+
while ((p = pa_split(s, ",", &state))) {
if (map.channels >= PA_CHANNELS_MAX) {
pa_xfree(p);
return NULL;
}
-
+
/* Some special aliases */
if (strcmp(p, "left") == 0)
map.map[map.channels++] = PA_CHANNEL_POSITION_LEFT;
@@ -416,13 +416,13 @@ pa_channel_map *pa_channel_map_parse(pa_channel_map *rmap, const char *s) {
map.map[map.channels++] = PA_CHANNEL_POSITION_SUBWOOFER;
else {
pa_channel_position_t i;
-
+
for (i = 0; i < PA_CHANNEL_POSITION_MAX; i++)
if (strcmp(p, table[i]) == 0) {
map.map[map.channels++] = i;
break;
}
-
+
if (i >= PA_CHANNEL_POSITION_MAX) {
pa_xfree(p);
return NULL;
@@ -433,24 +433,24 @@ pa_channel_map *pa_channel_map_parse(pa_channel_map *rmap, const char *s) {
}
finish:
-
+
if (!pa_channel_map_valid(&map))
return NULL;
-
+
*rmap = map;
return rmap;
}
int pa_channel_map_valid(const pa_channel_map *map) {
unsigned c;
-
+
assert(map);
if (map->channels <= 0 || map->channels > PA_CHANNELS_MAX)
return 0;
for (c = 0; c < map->channels; c++) {
-
+
if (map->map[c] < 0 ||map->map[c] >= PA_CHANNEL_POSITION_MAX)
return 0;
diff --git a/src/pulse/channelmap.h b/src/pulse/channelmap.h
index 8a39ade8..20380251 100644
--- a/src/pulse/channelmap.h
+++ b/src/pulse/channelmap.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -72,7 +72,7 @@ typedef enum pa_channel_position {
PA_CHANNEL_POSITION_LEFT,
PA_CHANNEL_POSITION_RIGHT,
PA_CHANNEL_POSITION_CENTER,
-
+
PA_CHANNEL_POSITION_FRONT_LEFT = PA_CHANNEL_POSITION_LEFT,
PA_CHANNEL_POSITION_FRONT_RIGHT = PA_CHANNEL_POSITION_RIGHT,
PA_CHANNEL_POSITION_FRONT_CENTER = PA_CHANNEL_POSITION_CENTER,
@@ -80,13 +80,13 @@ typedef enum pa_channel_position {
PA_CHANNEL_POSITION_REAR_CENTER,
PA_CHANNEL_POSITION_REAR_LEFT,
PA_CHANNEL_POSITION_REAR_RIGHT,
-
+
PA_CHANNEL_POSITION_LFE,
PA_CHANNEL_POSITION_SUBWOOFER = PA_CHANNEL_POSITION_LFE,
-
+
PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
-
+
PA_CHANNEL_POSITION_SIDE_LEFT,
PA_CHANNEL_POSITION_SIDE_RIGHT,
@@ -124,7 +124,7 @@ typedef enum pa_channel_position {
PA_CHANNEL_POSITION_AUX31,
PA_CHANNEL_POSITION_TOP_CENTER,
-
+
PA_CHANNEL_POSITION_TOP_FRONT_LEFT,
PA_CHANNEL_POSITION_TOP_FRONT_RIGHT,
PA_CHANNEL_POSITION_TOP_FRONT_CENTER,
@@ -132,7 +132,7 @@ typedef enum pa_channel_position {
PA_CHANNEL_POSITION_TOP_REAR_LEFT,
PA_CHANNEL_POSITION_TOP_REAR_RIGHT,
PA_CHANNEL_POSITION_TOP_REAR_CENTER,
-
+
PA_CHANNEL_POSITION_MAX
} pa_channel_position_t;
@@ -143,7 +143,7 @@ typedef enum pa_channel_map_def {
PA_CHANNEL_MAP_AUX, /**< Only aux channels */
PA_CHANNEL_MAP_WAVEEX, /**< Microsoft's WAVEFORMATEXTENSIBLE mapping */
PA_CHANNEL_MAP_OSS, /**< The default channel mapping used by OSS as defined in the OSS 4.0 API specs */
-
+
PA_CHANNEL_MAP_DEFAULT = PA_CHANNEL_MAP_AIFF /**< The default channel map */
} pa_channel_map_def_t;
diff --git a/src/pulse/client-conf-x11.c b/src/pulse/client-conf-x11.c
index 8cedc48b..78e190e5 100644
--- a/src/pulse/client-conf-x11.c
+++ b/src/pulse/client-conf-x11.c
@@ -44,7 +44,7 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
if (!dname && !getenv("DISPLAY"))
goto finish;
-
+
if (!(d = XOpenDisplay(dname))) {
pa_log("XOpenDisplay() failed");
goto finish;
@@ -89,5 +89,5 @@ finish:
XCloseDisplay(d);
return ret;
-
+
}
diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c
index 5cd7e3ed..b652a25b 100644
--- a/src/pulse/client-conf.c
+++ b/src/pulse/client-conf.c
@@ -69,11 +69,11 @@ static const pa_client_conf default_conf = {
pa_client_conf *pa_client_conf_new(void) {
pa_client_conf *c = pa_xmemdup(&default_conf, sizeof(default_conf));
-
+
c->daemon_binary = pa_xstrdup(PA_BINARY);
c->extra_arguments = pa_xstrdup("--log-target=syslog --exit-idle-time=5");
c->cookie_file = pa_xstrdup(PA_NATIVE_COOKIE_FILE);
-
+
return c;
}
@@ -122,25 +122,25 @@ int pa_client_conf_load(pa_client_conf *c, const char *filename) {
pa_log("WARNING: failed to open configuration file '%s': %s", fn, pa_cstrerror(errno));
goto finish;
}
-
+
r = f ? pa_config_parse(fn, f, table, NULL) : 0;
if (!r)
r = pa_client_conf_load_cookie(c);
-
+
finish:
pa_xfree(fn);
if (f)
fclose(f);
-
+
return r;
}
int pa_client_conf_env(pa_client_conf *c) {
char *e;
-
+
if ((e = getenv(ENV_DEFAULT_SINK))) {
pa_xfree(c->default_sink);
c->default_sink = pa_xstrdup(e);
@@ -155,7 +155,7 @@ int pa_client_conf_env(pa_client_conf *c) {
pa_xfree(c->default_server);
c->default_server = pa_xstrdup(e);
}
-
+
if ((e = getenv(ENV_DAEMON_BINARY))) {
pa_xfree(c->daemon_binary);
c->daemon_binary = pa_xstrdup(e);
@@ -167,7 +167,7 @@ int pa_client_conf_env(pa_client_conf *c) {
return pa_client_conf_load_cookie(c);
}
-
+
return 0;
}
diff --git a/src/pulse/context.c b/src/pulse/context.c
index a458c6b1..7ef43b30 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -88,11 +88,11 @@ static const pa_pdispatch_cb_t command_table[PA_COMMAND_MAX] = {
static void unlock_autospawn_lock_file(pa_context *c) {
assert(c);
-
+
if (c->autospawn_lock_fd >= 0) {
char lf[PATH_MAX];
pa_runtime_path(AUTOSPAWN_LOCK, lf, sizeof(lf));
-
+
pa_unlock_lockfile(lf, c->autospawn_lock_fd);
c->autospawn_lock_fd = -1;
}
@@ -102,10 +102,10 @@ static void context_free(pa_context *c);
pa_context *pa_context_new(pa_mainloop_api *mainloop, const char *name) {
pa_context *c;
-
+
assert(mainloop);
assert(name);
-
+
c = pa_xnew(pa_context, 1);
c->ref = 1;
c->name = pa_xstrdup(name);
@@ -118,7 +118,7 @@ pa_context *pa_context_new(pa_mainloop_api *mainloop, const char *name) {
PA_LLIST_HEAD_INIT(pa_stream, c->streams);
PA_LLIST_HEAD_INIT(pa_operation, c->operations);
-
+
c->error = PA_OK;
c->state = PA_CONTEXT_UNCONNECTED;
c->ctag = 0;
@@ -138,7 +138,7 @@ pa_context *pa_context_new(pa_mainloop_api *mainloop, const char *name) {
c->do_autospawn = 0;
#ifndef MSG_NOSIGNAL
-#ifdef SIGPIPE
+#ifdef SIGPIPE
pa_check_signal_is_blocked(SIGPIPE);
#endif
#endif
@@ -183,7 +183,7 @@ static void context_free(pa_context *c) {
pa_pstream_close(c->pstream);
pa_pstream_unref(c->pstream);
}
-
+
if (c->record_streams)
pa_dynarray_free(c->record_streams, NULL, NULL);
if (c->playback_streams)
@@ -196,7 +196,7 @@ static void context_free(pa_context *c) {
pa_client_conf_free(c->conf);
pa_strlist_free(c->server_list);
-
+
pa_xfree(c->name);
pa_xfree(c->server);
pa_xfree(c);
@@ -205,7 +205,7 @@ static void context_free(pa_context *c) {
pa_context* pa_context_ref(pa_context *c) {
assert(c);
assert(c->ref >= 1);
-
+
c->ref++;
return c;
}
@@ -221,7 +221,7 @@ void pa_context_unref(pa_context *c) {
void pa_context_set_state(pa_context *c, pa_context_state_t st) {
assert(c);
assert(c->ref >= 1);
-
+
if (c->state == st)
return;
@@ -233,7 +233,7 @@ void pa_context_set_state(pa_context *c, pa_context_state_t st) {
if (st == PA_CONTEXT_FAILED || st == PA_CONTEXT_TERMINATED) {
pa_stream *s;
-
+
s = c->streams ? pa_stream_ref(c->streams) : NULL;
while (s) {
pa_stream *n = s->next ? pa_stream_ref(s->next) : NULL;
@@ -245,13 +245,13 @@ void pa_context_set_state(pa_context *c, pa_context_state_t st) {
if (c->pdispatch)
pa_pdispatch_unref(c->pdispatch);
c->pdispatch = NULL;
-
+
if (c->pstream) {
pa_pstream_close(c->pstream);
pa_pstream_unref(c->pstream);
}
c->pstream = NULL;
-
+
if (c->client)
pa_socket_client_unref(c->client);
c->client = NULL;
@@ -263,7 +263,7 @@ void pa_context_set_state(pa_context *c, pa_context_state_t st) {
void pa_context_fail(pa_context *c, int error) {
assert(c);
assert(c->ref >= 1);
-
+
pa_context_set_error(c, error);
pa_context_set_state(c, PA_CONTEXT_FAILED);
}
@@ -283,19 +283,19 @@ static void pstream_die_callback(pa_pstream *p, void *userdata) {
assert(p);
assert(c);
-
+
pa_context_fail(c, PA_ERR_CONNECTIONTERMINATED);
}
static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_creds *creds, void *userdata) {
pa_context *c = userdata;
-
+
assert(p);
assert(packet);
assert(c);
pa_context_ref(c);
-
+
if (pa_pdispatch_run(c->pdispatch, packet, creds, c) < 0)
pa_context_fail(c, PA_ERR_PROTOCOL);
@@ -305,7 +305,7 @@ static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_c
static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t offset, pa_seek_mode_t seek, const pa_memchunk *chunk, void *userdata) {
pa_context *c = userdata;
pa_stream *s;
-
+
assert(p);
assert(chunk);
assert(chunk->memblock);
@@ -321,7 +321,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
pa_memblockq_seek(s->record_memblockq, offset, seek);
pa_memblockq_push_align(s->record_memblockq, chunk);
-
+
if (s->read_callback) {
size_t l;
@@ -339,11 +339,11 @@ int pa_context_handle_error(pa_context *c, uint32_t command, pa_tagstruct *t) {
if (command == PA_COMMAND_ERROR) {
assert(t);
-
+
if (pa_tagstruct_getu32(t, &c->error) < 0) {
pa_context_fail(c, PA_ERR_PROTOCOL);
return -1;
-
+
}
} else if (command == PA_COMMAND_TIMEOUT)
c->error = PA_ERR_TIMEOUT;
@@ -357,15 +357,15 @@ int pa_context_handle_error(pa_context *c, uint32_t command, pa_tagstruct *t) {
static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
pa_context *c = userdata;
-
+
assert(pd);
assert(c);
assert(c->state == PA_CONTEXT_AUTHORIZING || c->state == PA_CONTEXT_SETTING_NAME);
pa_context_ref(c);
-
+
if (command != PA_COMMAND_REPLY) {
-
+
if (pa_context_handle_error(c, command, t) < 0)
pa_context_fail(c, PA_ERR_PROTOCOL);
@@ -398,7 +398,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
* user. This is a security measure because otherwise
* data private to the user might leak. */
-#ifdef HAVE_CREDS
+#ifdef HAVE_CREDS
const pa_creds *creds;
if ((creds = pa_pdispatch_creds(pd)))
if (getuid() == creds->uid)
@@ -418,7 +418,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
case PA_CONTEXT_SETTING_NAME :
pa_context_set_state(c, PA_CONTEXT_READY);
break;
-
+
default:
assert(0);
}
@@ -430,12 +430,12 @@ finish:
static void setup_context(pa_context *c, pa_iochannel *io) {
pa_tagstruct *t;
uint32_t tag;
-
+
assert(c);
assert(io);
pa_context_ref(c);
-
+
assert(!c->pstream);
c->pstream = pa_pstream_new(c->mainloop, io, c->mempool);
@@ -462,13 +462,13 @@ static void setup_context(pa_context *c, pa_iochannel *io) {
ucred.uid = getuid();
ucred.gid = getgid();
-
+
pa_pstream_send_tagstruct_with_creds(c->pstream, t, &ucred);
}
#else
pa_pstream_send_tagstruct(c->pstream, t);
#endif
-
+
pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, setup_complete_callback, c, NULL);
pa_context_set_state(c, PA_CONTEXT_AUTHORIZING);
@@ -487,7 +487,7 @@ static int context_connect_spawn(pa_context *c) {
pa_iochannel *io;
pa_context_ref(c);
-
+
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
pa_log("socketpair(): %s", pa_cstrerror(errno));
pa_context_fail(c, PA_ERR_INTERNAL);
@@ -495,7 +495,7 @@ static int context_connect_spawn(pa_context *c) {
}
pa_fd_set_cloexec(fds[0], 1);
-
+
pa_socket_low_delay(fds[0]);
pa_socket_low_delay(fds[1]);
@@ -508,7 +508,7 @@ static int context_connect_spawn(pa_context *c) {
if (c->spawn_api.postfork)
c->spawn_api.postfork();
-
+
goto fail;
} else if (!pid) {
/* Child */
@@ -521,17 +521,17 @@ static int context_connect_spawn(pa_context *c) {
/* Not required, since fds[0] has CLOEXEC enabled anyway */
close(fds[0]);
-
+
if (c->spawn_api.atfork)
c->spawn_api.atfork();
/* Setup argv */
n = 0;
-
+
argv[n++] = c->conf->daemon_binary;
argv[n++] = "--daemonize=yes";
-
+
snprintf(t, sizeof(t), "-Lmodule-native-protocol-fd fd=%i", fds[1]);
argv[n++] = strdup(t);
@@ -540,7 +540,7 @@ static int context_connect_spawn(pa_context *c) {
if (!(a = pa_split_spaces(c->conf->extra_arguments, &state)))
break;
-
+
argv[n++] = a;
}
@@ -549,7 +549,7 @@ static int context_connect_spawn(pa_context *c) {
execv(argv[0], (char * const *) argv);
_exit(1);
#undef MAX_ARGS
- }
+ }
/* Parent */
@@ -557,7 +557,7 @@ static int context_connect_spawn(pa_context *c) {
if (c->spawn_api.postfork)
c->spawn_api.postfork();
-
+
if (r < 0) {
pa_log("waitpid(): %s", pa_cstrerror(errno));
pa_context_fail(c, PA_ERR_INTERNAL);
@@ -570,7 +570,7 @@ static int context_connect_spawn(pa_context *c) {
close(fds[1]);
c->is_local = 1;
-
+
io = pa_iochannel_new(c->mainloop, fds[0], fds[0]);
setup_context(c, io);
@@ -598,16 +598,16 @@ fail:
static int try_next_connection(pa_context *c) {
char *u = NULL;
int r = -1;
-
+
assert(c);
assert(!c->client);
for (;;) {
pa_xfree(u);
u = NULL;
-
+
c->server_list = pa_strlist_pop(c->server_list, &u);
-
+
if (!u) {
#ifndef OS_IS_WIN32
@@ -616,19 +616,19 @@ static int try_next_connection(pa_context *c) {
goto finish;
}
#endif
-
+
pa_context_fail(c, PA_ERR_CONNECTIONREFUSED);
goto finish;
}
-
- pa_log_debug("Trying to connect to %s...", u);
+
+ pa_log_debug("Trying to connect to %s...", u);
pa_xfree(c->server);
c->server = pa_xstrdup(u);
if (!(c->client = pa_socket_client_new_string(c->mainloop, u, PA_NATIVE_DEFAULT_PORT)))
continue;
-
+
c->is_local = pa_socket_client_is_local(c->client);
pa_socket_client_set_callback(c->client, on_connection, c);
break;
@@ -638,13 +638,13 @@ static int try_next_connection(pa_context *c) {
finish:
pa_xfree(u);
-
+
return r;
}
static void on_connection(pa_socket_client *client, pa_iochannel*io, void *userdata) {
pa_context *c = userdata;
-
+
assert(client);
assert(c);
assert(c->state == PA_CONTEXT_CONNECTING);
@@ -677,9 +677,9 @@ int pa_context_connect(
const char *server,
pa_context_flags_t flags,
const pa_spawn_api *api) {
-
+
int r = -1;
-
+
assert(c);
assert(c->ref >= 1);
@@ -693,7 +693,7 @@ int pa_context_connect(
pa_context_ref(c);
assert(!c->server_list);
-
+
if (server) {
if (!(c->server_list = pa_strlist_parse(server))) {
pa_context_fail(c, PA_ERR_INVALIDSERVER);
@@ -704,7 +704,7 @@ int pa_context_connect(
char ufn[PATH_MAX];
/* Prepend in reverse order */
-
+
if ((d = getenv("DISPLAY"))) {
char *e;
d = pa_xstrdup(d);
@@ -716,7 +716,7 @@ int pa_context_connect(
pa_xfree(d);
}
-
+
c->server_list = pa_strlist_prepend(c->server_list, "tcp6:localhost");
c->server_list = pa_strlist_prepend(c->server_list, "tcp4:localhost");
@@ -744,38 +744,38 @@ int pa_context_connect(
pa_context_set_state(c, PA_CONTEXT_CONNECTING);
r = try_next_connection(c);
-
+
finish:
pa_context_unref(c);
-
+
return r;
}
void pa_context_disconnect(pa_context *c) {
assert(c);
assert(c->ref >= 1);
-
+
pa_context_set_state(c, PA_CONTEXT_TERMINATED);
}
pa_context_state_t pa_context_get_state(pa_context *c) {
assert(c);
assert(c->ref >= 1);
-
+
return c->state;
}
int pa_context_errno(pa_context *c) {
assert(c);
assert(c->ref >= 1);
-
+
return c->error;
}
void pa_context_set_state_callback(pa_context *c, pa_context_notify_cb_t cb, void *userdata) {
assert(c);
assert(c->ref >= 1);
-
+
c->state_callback = cb;
c->state_userdata = userdata;
}
@@ -807,7 +807,7 @@ static void pstream_drain_callback(PA_GCC_UNUSED pa_pstream *s, void *userdata)
static void set_dispatch_callbacks(pa_operation *o) {
int done = 1;
-
+
assert(o);
assert(o->ref >= 1);
assert(o->context);
@@ -816,7 +816,7 @@ static void set_dispatch_callbacks(pa_operation *o) {
pa_pstream_set_drain_callback(o->context->pstream, NULL, NULL);
pa_pdispatch_set_drain_callback(o->context->pdispatch, NULL, NULL);
-
+
if (pa_pdispatch_is_pending(o->context->pdispatch)) {
pa_pdispatch_set_drain_callback(o->context->pdispatch, pdispatch_drain_callback, o);
done = 0;
@@ -832,7 +832,7 @@ static void set_dispatch_callbacks(pa_operation *o) {
pa_context_notify_cb_t cb = (pa_context_notify_cb_t) o->callback;
cb(o->context, o->userdata);
}
-
+
pa_operation_done(o);
pa_operation_unref(o);
}
@@ -840,13 +840,13 @@ static void set_dispatch_callbacks(pa_operation *o) {
pa_operation* pa_context_drain(pa_context *c, pa_context_notify_cb_t cb, void *userdata) {
pa_operation *o;
-
+
assert(c);
assert(c->ref >= 1);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, pa_context_is_pending(c), PA_ERR_BADSTATE);
-
+
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
set_dispatch_callbacks(pa_operation_ref(o));
@@ -856,7 +856,7 @@ pa_operation* pa_context_drain(pa_context *c, pa_context_notify_cb_t cb, void *u
void pa_context_simple_ack_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) {
pa_operation *o = userdata;
int success = 1;
-
+
assert(pd);
assert(o);
assert(o->ref >= 1);
@@ -907,12 +907,12 @@ pa_operation* pa_context_send_simple_command(pa_context *c, uint32_t command, pa
pa_tagstruct *t;
pa_operation *o;
uint32_t tag;
-
+
assert(c);
assert(c->ref >= 1);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
-
+
o = pa_operation_new(c, NULL, cb, userdata);
t = pa_tagstruct_command(c, command, &tag);
@@ -926,7 +926,7 @@ pa_operation* pa_context_set_default_sink(pa_context *c, const char *name, pa_co
pa_tagstruct *t;
pa_operation *o;
uint32_t tag;
-
+
assert(c);
assert(c->ref >= 1);
@@ -951,7 +951,7 @@ pa_operation* pa_context_set_default_source(pa_context *c, const char *name, pa_
assert(c->ref >= 1);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
-
+
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
t = pa_tagstruct_command(c, PA_COMMAND_SET_DEFAULT_SOURCE, &tag);
@@ -964,7 +964,7 @@ pa_operation* pa_context_set_default_source(pa_context *c, const char *name, pa_
int pa_context_is_local(pa_context *c) {
assert(c);
-
+
return c->is_local;
}
@@ -978,7 +978,7 @@ pa_operation* pa_context_set_name(pa_context *c, const char *name, pa_context_su
assert(name);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
-
+
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
t = pa_tagstruct_command(c, PA_COMMAND_SET_CLIENT_NAME, &tag);
@@ -999,12 +999,12 @@ const char* pa_context_get_server(pa_context *c) {
if (!c->server)
return NULL;
-
+
if (*c->server == '{') {
char *e = strchr(c->server+1, '}');
return e ? e+1 : c->server;
}
-
+
return c->server;
}
@@ -1024,7 +1024,7 @@ pa_tagstruct *pa_tagstruct_command(pa_context *c, uint32_t command, uint32_t *ta
assert(c);
assert(tag);
-
+
t = pa_tagstruct_new(NULL, 0);
pa_tagstruct_putu32(t, command);
pa_tagstruct_putu32(t, *tag = c->ctag++);
diff --git a/src/pulse/context.h b/src/pulse/context.h
index 661ff617..048ed17f 100644
--- a/src/pulse/context.h
+++ b/src/pulse/context.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -50,7 +50,7 @@
* The abstraction is represented as a number of function pointers in the
* pa_mainloop_api structure.
*
- * To actually be able to use these functions, an implementation needs to
+ * To actually be able to use these functions, an implementation needs to
* be coupled to the abstraction. There are three of these shipped with
* PulseAudio, but any other can be used with a minimal ammount of work,
* provided it supports the three basic events listed above.
@@ -76,7 +76,7 @@
* and decrease their reference counts. Whenever an object's reference
* count reaches zero, that object gets destroy and any resources it uses
* get freed.
- *
+ *
* The benefit of this design is that an application need not worry about
* whether or not it needs to keep an object around in case the library is
* using it internally. If it is, then it has made sure it has its own
diff --git a/src/pulse/def.h b/src/pulse/def.h
index a22e3c19..fb04de50 100644
--- a/src/pulse/def.h
+++ b/src/pulse/def.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -69,7 +69,7 @@ typedef enum pa_context_flags {
PA_CONTEXT_NOAUTOSPAWN = 1 /**< Disabled autospawning of the PulseAudio daemon if required */
} pa_context_flags_t;
-/** The direction of a pa_stream object */
+/** The direction of a pa_stream object */
typedef enum pa_stream_direction {
PA_STREAM_NODIRECTION, /**< Invalid direction */
PA_STREAM_PLAYBACK, /**< Playback stream */
@@ -149,7 +149,7 @@ enum {
PA_ERR_EXIST, /**< Entity exists */
PA_ERR_NOENTITY, /**< No such entity */
PA_ERR_CONNECTIONREFUSED, /**< Connection refused */
- PA_ERR_PROTOCOL, /**< Protocol error */
+ PA_ERR_PROTOCOL, /**< Protocol error */
PA_ERR_TIMEOUT, /**< Timeout */
PA_ERR_AUTHKEY, /**< No authorization key */
PA_ERR_INTERNAL, /**< Internal error */
@@ -207,7 +207,7 @@ typedef enum pa_subscription_event_type {
* total output latency a sample that is written with
* pa_stream_write() takes to be played may be estimated by
* sink_usec+buffer_usec+transport_usec. (where buffer_usec is defined
- * as pa_bytes_to_usec(write_index-read_index)) The output buffer
+ * as pa_bytes_to_usec(write_index-read_index)) The output buffer
* which buffer_usec relates to may be manipulated freely (with
* pa_stream_write()'s seek argument, pa_stream_flush() and friends),
* the buffers sink_usec and source_usec relate to are first-in
@@ -256,7 +256,7 @@ typedef struct pa_timing_info {
* flush request that corrupted it has
* been issued in the time since this
* latency info was current. \since 0.8 */
-
+
int64_t read_index; /**< Current read index into the
* playback buffer in bytes. Think twice before
* using this for seeking purposes: it
@@ -288,7 +288,7 @@ typedef struct pa_spawn_api {
/** Seek type for pa_stream_write(). \since 0.8*/
typedef enum pa_seek_mode {
PA_SEEK_RELATIVE = 0, /**< Seek relatively to the write index */
- PA_SEEK_ABSOLUTE = 1, /**< Seek relatively to the start of the buffer queue */
+ PA_SEEK_ABSOLUTE = 1, /**< Seek relatively to the start of the buffer queue */
PA_SEEK_RELATIVE_ON_READ = 2, /**< Seek relatively to the read index. */
PA_SEEK_RELATIVE_END = 3 /**< Seek relatively to the current end of the buffer queue. */
} pa_seek_mode_t;
diff --git a/src/pulse/error.c b/src/pulse/error.c
index 7bd31ead..3b9a60a4 100644
--- a/src/pulse/error.c
+++ b/src/pulse/error.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/error.h b/src/pulse/error.h
index bfce023c..c96349a6 100644
--- a/src/pulse/error.h
+++ b/src/pulse/error.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/glib-mainloop.c b/src/pulse/glib-mainloop.c
index 201b6e23..1669acdd 100644
--- a/src/pulse/glib-mainloop.c
+++ b/src/pulse/glib-mainloop.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -69,7 +69,7 @@ struct pa_defer_event {
int dead;
int enabled;
-
+
pa_defer_event_cb_t callback;
void *userdata;
pa_defer_event_destroy_cb_t destroy_callback;
@@ -79,7 +79,7 @@ struct pa_defer_event {
struct pa_glib_mainloop {
GSource source;
-
+
pa_mainloop_api api;
GMainContext *context;
@@ -102,7 +102,7 @@ static void cleanup_io_events(pa_glib_mainloop *g, int force) {
if (!force && g->io_events_please_scan <= 0)
break;
-
+
if (force || e->dead) {
PA_LLIST_REMOVE(pa_io_event, g->io_events, e);
@@ -110,13 +110,13 @@ static void cleanup_io_events(pa_glib_mainloop *g, int force) {
g_assert(g->io_events_please_scan > 0);
g->io_events_please_scan--;
}
-
+
if (e->poll_fd_added)
g_source_remove_poll(&g->source, &e->poll_fd);
-
+
if (e->destroy_callback)
e->destroy_callback(&g->api, e, e->userdata);
-
+
pa_xfree(e);
}
@@ -135,7 +135,7 @@ static void cleanup_time_events(pa_glib_mainloop *g, int force) {
if (!force && g->time_events_please_scan <= 0)
break;
-
+
if (force || e->dead) {
PA_LLIST_REMOVE(pa_time_event, g->time_events, e);
@@ -148,10 +148,10 @@ static void cleanup_time_events(pa_glib_mainloop *g, int force) {
g_assert(g->n_enabled_time_events > 0);
g->n_enabled_time_events--;
}
-
+
if (e->destroy_callback)
e->destroy_callback(&g->api, e, e->userdata);
-
+
pa_xfree(e);
}
@@ -170,7 +170,7 @@ static void cleanup_defer_events(pa_glib_mainloop *g, int force) {
if (!force && g->defer_events_please_scan <= 0)
break;
-
+
if (force || e->dead) {
PA_LLIST_REMOVE(pa_defer_event, g->defer_events, e);
@@ -183,10 +183,10 @@ static void cleanup_defer_events(pa_glib_mainloop *g, int force) {
g_assert(g->n_enabled_defer_events > 0);
g->n_enabled_defer_events--;
}
-
+
if (e->destroy_callback)
e->destroy_callback(&g->api, e, e->userdata);
-
+
pa_xfree(e);
}
@@ -218,7 +218,7 @@ static pa_io_event* glib_io_new(
pa_io_event_flags_t f,
pa_io_event_cb_t cb,
void *userdata) {
-
+
pa_io_event *e;
pa_glib_mainloop *g;
@@ -226,7 +226,7 @@ static pa_io_event* glib_io_new(
g_assert(m->userdata);
g_assert(fd >= 0);
g_assert(cb);
-
+
g = m->userdata;
e = pa_xnew(pa_io_event, 1);
@@ -236,7 +236,7 @@ static pa_io_event* glib_io_new(
e->poll_fd.fd = fd;
e->poll_fd.events = map_flags_to_glib(f);
e->poll_fd.revents = 0;
-
+
e->callback = cb;
e->userdata = userdata;
e->destroy_callback = NULL;
@@ -245,7 +245,7 @@ static pa_io_event* glib_io_new(
g_source_add_poll(&g->source, &e->poll_fd);
e->poll_fd_added = 1;
-
+
return e;
}
@@ -272,7 +272,7 @@ static void glib_io_free(pa_io_event*e) {
static void glib_io_set_destroy(pa_io_event*e, pa_io_event_destroy_cb_t cb) {
g_assert(e);
g_assert(!e->dead);
-
+
e->destroy_callback = cb;
}
@@ -283,14 +283,14 @@ static pa_time_event* glib_time_new(
const struct timeval *tv,
pa_time_event_cb_t cb,
void *userdata) {
-
+
pa_glib_mainloop *g;
pa_time_event *e;
-
+
g_assert(m);
g_assert(m->userdata);
g_assert(cb);
-
+
g = m->userdata;
e = pa_xnew(pa_time_event, 1);
@@ -308,13 +308,13 @@ static pa_time_event* glib_time_new(
g->cached_next_time_event = e;
}
}
-
+
e->callback = cb;
e->userdata = userdata;
e->destroy_callback = NULL;
PA_LLIST_PREPEND(pa_time_event, g->time_events, e);
-
+
return e;
}
@@ -328,12 +328,12 @@ static void glib_time_restart(pa_time_event*e, const struct timeval *tv) {
} else if (!e->enabled && tv)
e->mainloop->n_enabled_time_events++;
- if ((e->enabled = !!tv))
+ if ((e->enabled = !!tv))
e->timeval = *tv;
if (e->mainloop->cached_next_time_event && e->enabled) {
g_assert(e->mainloop->cached_next_time_event->enabled);
-
+
if (pa_timeval_cmp(tv, &e->mainloop->cached_next_time_event->timeval) < 0)
e->mainloop->cached_next_time_event = e;
} else if (e->mainloop->cached_next_time_event == e)
@@ -357,7 +357,7 @@ static void glib_time_free(pa_time_event *e) {
static void glib_time_set_destroy(pa_time_event *e, pa_time_event_destroy_cb_t cb) {
g_assert(e);
g_assert(!e->dead);
-
+
e->destroy_callback = cb;
}
@@ -367,27 +367,27 @@ static pa_defer_event* glib_defer_new(
pa_mainloop_api*m,
pa_defer_event_cb_t cb,
void *userdata) {
-
+
pa_defer_event *e;
pa_glib_mainloop *g;
g_assert(m);
g_assert(m->userdata);
g_assert(cb);
-
+
g = m->userdata;
-
+
e = pa_xnew(pa_defer_event, 1);
e->mainloop = g;
e->dead = 0;
e->enabled = 1;
g->n_enabled_defer_events++;
-
+
e->callback = cb;
e->userdata = userdata;
e->destroy_callback = NULL;
-
+
PA_LLIST_PREPEND(pa_defer_event, g->defer_events, e);
return e;
}
@@ -430,7 +430,7 @@ static void glib_defer_set_destroy(pa_defer_event *e, pa_defer_event_destroy_cb_
static void glib_quit(pa_mainloop_api*a, PA_GCC_UNUSED int retval) {
g_warning("quit() ignored");
-
+
/* NOOP */
}
@@ -440,7 +440,7 @@ static pa_time_event* find_next_time_event(pa_glib_mainloop *g) {
if (g->cached_next_time_event)
return g->cached_next_time_event;
-
+
for (t = g->time_events; t; t = t->next) {
if (t->dead || !t->enabled)
@@ -461,7 +461,7 @@ static pa_time_event* find_next_time_event(pa_glib_mainloop *g) {
static void scan_dead(pa_glib_mainloop *g) {
g_assert(g);
-
+
if (g->io_events_please_scan)
cleanup_io_events(g, 0);
@@ -499,7 +499,7 @@ static gboolean prepare_func(GSource *source, gint *timeout) {
if (pa_timeval_cmp(&t->timeval, &tvnow) <= 0) {
*timeout = 0;
return TRUE;
- }
+ }
usec = pa_timeval_diff(&t->timeval, &tvnow);
*timeout = (gint) (usec / 1000);
} else
@@ -519,10 +519,10 @@ static gboolean check_func(GSource *source) {
pa_time_event *t;
GTimeVal now;
struct timeval tvnow;
-
+
t = find_next_time_event(g);
g_assert(t);
-
+
g_source_get_current_time(source, &now);
tvnow.tv_sec = now.tv_sec;
tvnow.tv_usec = now.tv_usec;
@@ -555,7 +555,7 @@ static gboolean dispatch_func(GSource *source, PA_GCC_UNUSED GSourceFunc callbac
}
g_assert(d);
-
+
d->callback(&g->api, d, d->userdata);
return TRUE;
}
@@ -567,7 +567,7 @@ static gboolean dispatch_func(GSource *source, PA_GCC_UNUSED GSourceFunc callbac
t = find_next_time_event(g);
g_assert(t);
-
+
g_source_get_current_time(source, &now);
tvnow.tv_sec = now.tv_sec;
tvnow.tv_usec = now.tv_usec;
@@ -576,7 +576,7 @@ static gboolean dispatch_func(GSource *source, PA_GCC_UNUSED GSourceFunc callbac
/* Disable time event */
glib_time_restart(t, NULL);
-
+
t->callback(&g->api, t, &t->timeval, t->userdata);
return TRUE;
}
@@ -604,12 +604,12 @@ static const pa_mainloop_api vtable = {
.time_restart = glib_time_restart,
.time_free = glib_time_free,
.time_set_destroy = glib_time_set_destroy,
-
+
.defer_new = glib_defer_new,
.defer_enable = glib_defer_enable,
.defer_free = glib_defer_free,
.defer_set_destroy = glib_defer_set_destroy,
-
+
.quit = glib_quit,
};
@@ -624,10 +624,10 @@ pa_glib_mainloop *pa_glib_mainloop_new(GMainContext *c) {
NULL,
NULL
};
-
+
g = (pa_glib_mainloop*) g_source_new(&source_funcs, sizeof(pa_glib_mainloop));
g_main_context_ref(g->context = c ? c : g_main_context_default());
-
+
g->api = vtable;
g->api.userdata = g;
@@ -639,10 +639,10 @@ pa_glib_mainloop *pa_glib_mainloop_new(GMainContext *c) {
g->io_events_please_scan = g->time_events_please_scan = g->defer_events_please_scan = 0;
g->cached_next_time_event = NULL;
-
+
g_source_attach(&g->source, g->context);
g_source_set_can_recurse(&g->source, FALSE);
-
+
return g;
}
@@ -660,6 +660,6 @@ void pa_glib_mainloop_free(pa_glib_mainloop* g) {
pa_mainloop_api* pa_glib_mainloop_get_api(pa_glib_mainloop *g) {
g_assert(g);
-
+
return &g->api;
}
diff --git a/src/pulse/glib-mainloop.h b/src/pulse/glib-mainloop.h
index af7cc0e9..5f8093a1 100644
--- a/src/pulse/glib-mainloop.h
+++ b/src/pulse/glib-mainloop.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/internal.h b/src/pulse/internal.h
index 4eef4b4a..8cdbf84a 100644
--- a/src/pulse/internal.h
+++ b/src/pulse/internal.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -45,7 +45,7 @@
struct pa_context {
int ref;
-
+
char *name;
pa_mainloop_api* mainloop;
@@ -75,7 +75,7 @@ struct pa_context {
int do_autospawn;
int autospawn_lock_fd;
pa_spawn_api spawn_api;
-
+
pa_strlist *server_list;
char *server;
@@ -109,7 +109,7 @@ struct pa_stream {
uint32_t device_index;
pa_stream_direction_t direction;
pa_stream_state_t state;
-
+
uint32_t requested_bytes;
pa_memchunk peek_memchunk;
@@ -120,10 +120,10 @@ struct pa_stream {
/* Store latest latency info */
pa_timing_info timing_info;
int timing_info_valid;
-
+
/* Use to make sure that time advances monotonically */
pa_usec_t previous_time;
-
+
/* time updates with tags older than these are invalid */
uint32_t write_index_not_before;
uint32_t read_index_not_before;
@@ -135,7 +135,7 @@ struct pa_stream {
/* Latency interpolation stuff */
pa_time_event *auto_timing_update_event;
int auto_timing_update_requested;
-
+
pa_usec_t cached_time;
int cached_time_valid;
@@ -160,7 +160,7 @@ struct pa_operation {
int ref;
pa_context *context;
pa_stream *stream;
-
+
PA_LLIST_FIELDS(pa_operation);
pa_operation_state_t state;
diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
index b926e4e4..5a2c8fb6 100644
--- a/src/pulse/introspect.c
+++ b/src/pulse/introspect.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -39,7 +39,7 @@
static void context_stat_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) {
pa_operation *o = userdata;
pa_stat_info i, *p = &i;
-
+
assert(pd);
assert(o);
assert(o->ref >= 1);
@@ -81,11 +81,11 @@ pa_operation* pa_context_stat(pa_context *c, pa_stat_info_cb_t cb, void *userdat
static void context_get_server_info_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) {
pa_operation *o = userdata;
pa_server_info i, *p = &i;
-
+
assert(pd);
assert(o);
assert(o->ref >= 1);
-
+
if (!o->context)
goto finish;
@@ -107,7 +107,7 @@ static void context_get_server_info_callback(pa_pdispatch *pd, uint32_t command,
pa_context_fail(o->context, PA_ERR_PROTOCOL);
goto finish;
}
-
+
if (o->callback) {
pa_server_info_cb_t cb = (pa_server_info_cb_t) o->callback;
cb(o->context, p, o->userdata);
@@ -127,14 +127,14 @@ pa_operation* pa_context_get_server_info(pa_context *c, pa_server_info_cb_t cb,
static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) {
pa_operation *o = userdata;
int eol = 1;
-
+
assert(pd);
assert(o);
assert(o->ref >= 1);
if (!o->context)
goto finish;
-
+
if (command != PA_COMMAND_REPLY) {
if (pa_context_handle_error(o->context, command, t) < 0)
goto finish;
@@ -142,10 +142,10 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, P
eol = -1;
} else {
uint32_t flags;
-
+
while (!pa_tagstruct_eof(t)) {
pa_sink_info i;
-
+
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
pa_tagstruct_gets(t, &i.name) < 0 ||
pa_tagstruct_gets(t, &i.description) < 0 ||
@@ -159,7 +159,7 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, P
pa_tagstruct_get_usec(t, &i.latency) < 0 ||
pa_tagstruct_gets(t, &i.driver) < 0 ||
pa_tagstruct_getu32(t, &flags) < 0) {
-
+
pa_context_fail(o->context, PA_ERR_PROTOCOL);
goto finish;
}
@@ -172,7 +172,7 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, P
}
}
}
-
+
if (o->callback) {
pa_sink_info_cb_t cb = (pa_sink_info_cb_t) o->callback;
cb(o->context, NULL, eol, o->userdata);
@@ -191,7 +191,7 @@ pa_operation* pa_context_get_sink_info_by_index(pa_context *c, uint32_t idx, pa_
pa_tagstruct *t;
pa_operation *o;
uint32_t tag;
-
+
assert(c);
assert(c->ref >= 1);
assert(cb);
@@ -213,7 +213,7 @@ pa_operation* pa_context_get_sink_info_by_name(pa_context *c, const char *name,
pa_tagstruct *t;
pa_operation *o;
uint32_t tag;
-
+
assert(c);
assert(c->ref >= 1);
assert(cb);
@@ -251,11 +251,11 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
eol = -1;
} else {
-
+
while (!pa_tagstruct_eof(t)) {
pa_source_info i;
uint32_t flags;
-
+
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
pa_tagstruct_gets(t, &i.name) < 0 ||
pa_tagstruct_gets(t, &i.description) < 0 ||
@@ -269,7 +269,7 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
pa_tagstruct_get_usec(t, &i.latency) < 0 ||
pa_tagstruct_gets(t, &i.driver) < 0 ||
pa_tagstruct_getu32(t, &flags) < 0) {
-
+
pa_context_fail(o->context, PA_ERR_PROTOCOL);
goto finish;
}
@@ -282,7 +282,7 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
}
}
}
-
+
if (o->callback) {
pa_source_info_cb_t cb = (pa_source_info_cb_t) o->callback;
cb(o->context, NULL, eol, o->userdata);
@@ -309,7 +309,7 @@ pa_operation* pa_context_get_source_info_by_index(pa_context *c, uint32_t idx, p
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
-
+
t = pa_tagstruct_command(c, PA_COMMAND_GET_SOURCE_INFO, &tag);
pa_tagstruct_putu32(t, idx);
pa_tagstruct_puts(t, NULL);
@@ -361,10 +361,10 @@ static void context_get_client_info_callback(pa_pdispatch *pd, uint32_t command,
eol = -1;
} else {
-
+
while (!pa_tagstruct_eof(t)) {
pa_client_info i;
-
+
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
pa_tagstruct_gets(t, &i.name) < 0 ||
pa_tagstruct_getu32(t, &i.owner_module) < 0 ||
@@ -379,7 +379,7 @@ static void context_get_client_info_callback(pa_pdispatch *pd, uint32_t command,
}
}
}
-
+
if (o->callback) {
pa_client_info_cb_t cb = (pa_client_info_cb_t) o->callback;
cb(o->context, NULL, eol, o->userdata);
@@ -428,17 +428,17 @@ static void context_get_module_info_callback(pa_pdispatch *pd, uint32_t command,
if (!o->context)
goto finish;
-
+
if (command != PA_COMMAND_REPLY) {
if (pa_context_handle_error(o->context, command, t) < 0)
goto finish;
eol = -1;
} else {
-
+
while (!pa_tagstruct_eof(t)) {
pa_module_info i;
-
+
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
pa_tagstruct_gets(t, &i.name) < 0 ||
pa_tagstruct_gets(t, &i.argument) < 0 ||
@@ -454,7 +454,7 @@ static void context_get_module_info_callback(pa_pdispatch *pd, uint32_t command,
}
}
}
-
+
if (o->callback) {
pa_module_info_cb_t cb = (pa_module_info_cb_t) o->callback;
cb(o->context, NULL, eol, o->userdata);
@@ -476,7 +476,7 @@ pa_operation* pa_context_get_module_info(pa_context *c, uint32_t idx, pa_module_
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
-
+
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
t = pa_tagstruct_command(c, PA_COMMAND_GET_MODULE_INFO, &tag);
@@ -503,17 +503,17 @@ static void context_get_sink_input_info_callback(pa_pdispatch *pd, uint32_t comm
if (!o->context)
goto finish;
-
+
if (command != PA_COMMAND_REPLY) {
if (pa_context_handle_error(o->context, command, t) < 0)
goto finish;
eol = -1;
} else {
-
+
while (!pa_tagstruct_eof(t)) {
pa_sink_input_info i;
-
+
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
pa_tagstruct_gets(t, &i.name) < 0 ||
pa_tagstruct_getu32(t, &i.owner_module) < 0 ||
@@ -526,7 +526,7 @@ static void context_get_sink_input_info_callback(pa_pdispatch *pd, uint32_t comm
pa_tagstruct_get_usec(t, &i.sink_usec) < 0 ||
pa_tagstruct_gets(t, &i.resample_method) < 0 ||
pa_tagstruct_gets(t, &i.driver) < 0) {
-
+
pa_context_fail(o->context, PA_ERR_PROTOCOL);
goto finish;
}
@@ -537,7 +537,7 @@ static void context_get_sink_input_info_callback(pa_pdispatch *pd, uint32_t comm
}
}
}
-
+
if (o->callback) {
pa_sink_input_info_cb_t cb = (pa_sink_input_info_cb_t) o->callback;
cb(o->context, NULL, eol, o->userdata);
@@ -559,7 +559,7 @@ pa_operation* pa_context_get_sink_input_info(pa_context *c, uint32_t idx, pa_sin
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
-
+
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
t = pa_tagstruct_command(c, PA_COMMAND_GET_SINK_INPUT_INFO, &tag);
@@ -593,10 +593,10 @@ static void context_get_source_output_info_callback(pa_pdispatch *pd, uint32_t c
eol = -1;
} else {
-
+
while (!pa_tagstruct_eof(t)) {
pa_source_output_info i;
-
+
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
pa_tagstruct_gets(t, &i.name) < 0 ||
pa_tagstruct_getu32(t, &i.owner_module) < 0 ||
@@ -608,7 +608,7 @@ static void context_get_source_output_info_callback(pa_pdispatch *pd, uint32_t c
pa_tagstruct_get_usec(t, &i.source_usec) < 0 ||
pa_tagstruct_gets(t, &i.resample_method) < 0 ||
pa_tagstruct_gets(t, &i.driver) < 0) {
-
+
pa_context_fail(o->context, PA_ERR_PROTOCOL);
goto finish;
}
@@ -619,7 +619,7 @@ static void context_get_source_output_info_callback(pa_pdispatch *pd, uint32_t c
}
}
}
-
+
if (o->callback) {
pa_source_output_info_cb_t cb = (pa_source_output_info_cb_t) o->callback;
cb(o->context, NULL, eol, o->userdata);
@@ -641,7 +641,7 @@ pa_operation* pa_context_get_source_output_info(pa_context *c, uint32_t idx, pa_
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
-
+
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
t = pa_tagstruct_command(c, PA_COMMAND_GET_SOURCE_OUTPUT_INFO, &tag);
@@ -695,7 +695,7 @@ pa_operation* pa_context_set_sink_volume_by_name(pa_context *c, const char *name
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, pa_cvolume_valid(volume), PA_ERR_INVALID);
PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
-
+
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
t = pa_tagstruct_command(c, PA_COMMAND_SET_SINK_VOLUME, &tag);
@@ -741,7 +741,7 @@ pa_operation* pa_context_set_sink_mute_by_name(pa_context *c, const char *name,
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
-
+
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
t = pa_tagstruct_command(c, PA_COMMAND_SET_SINK_MUTE, &tag);
@@ -766,7 +766,7 @@ pa_operation* pa_context_set_sink_input_volume(pa_context *c, uint32_t idx, cons
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
PA_CHECK_VALIDITY_RETURN_NULL(c, pa_cvolume_valid(volume), PA_ERR_INVALID);
-
+
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
t = pa_tagstruct_command(c, PA_COMMAND_SET_SINK_INPUT_VOLUME, &tag);
@@ -815,7 +815,7 @@ pa_operation* pa_context_set_source_volume_by_name(pa_context *c, const char *na
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, pa_cvolume_valid(volume), PA_ERR_INVALID);
PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
-
+
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
t = pa_tagstruct_command(c, PA_COMMAND_SET_SOURCE_VOLUME, &tag);
@@ -861,7 +861,7 @@ pa_operation* pa_context_set_source_mute_by_name(pa_context *c, const char *name
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
-
+
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
t = pa_tagstruct_command(c, PA_COMMAND_SET_SOURCE_MUTE, &tag);
@@ -886,17 +886,17 @@ static void context_get_sample_info_callback(pa_pdispatch *pd, uint32_t command,
if (!o->context)
goto finish;
-
+
if (command != PA_COMMAND_REPLY) {
if (pa_context_handle_error(o->context, command, t) < 0)
goto finish;
eol = -1;
} else {
-
+
while (!pa_tagstruct_eof(t)) {
pa_sample_info i;
-
+
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
pa_tagstruct_gets(t, &i.name) < 0 ||
pa_tagstruct_get_cvolume(t, &i.volume) < 0 ||
@@ -906,7 +906,7 @@ static void context_get_sample_info_callback(pa_pdispatch *pd, uint32_t command,
pa_tagstruct_getu32(t, &i.bytes) < 0 ||
pa_tagstruct_get_boolean(t, &i.lazy) < 0 ||
pa_tagstruct_gets(t, &i.filename) < 0) {
-
+
pa_context_fail(o->context, PA_ERR_PROTOCOL);
goto finish;
}
@@ -917,7 +917,7 @@ static void context_get_sample_info_callback(pa_pdispatch *pd, uint32_t command,
}
}
}
-
+
if (o->callback) {
pa_sample_info_cb_t cb = (pa_sample_info_cb_t) o->callback;
cb(o->context, NULL, eol, o->userdata);
@@ -932,7 +932,7 @@ pa_operation* pa_context_get_sample_info_by_name(pa_context *c, const char *name
pa_tagstruct *t;
pa_operation *o;
uint32_t tag;
-
+
assert(c);
assert(c->ref >= 1);
assert(cb);
@@ -1002,7 +1002,7 @@ static pa_operation* command_kill(pa_context *c, uint32_t command, uint32_t idx,
pa_operation* pa_context_kill_client(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata) {
return command_kill(c, PA_COMMAND_KILL_CLIENT, idx, cb, userdata);
}
-
+
pa_operation* pa_context_kill_sink_input(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata) {
return command_kill(c, PA_COMMAND_KILL_SINK_INPUT, idx, cb, userdata);
}
@@ -1021,7 +1021,7 @@ static void context_index_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UN
if (!o->context)
goto finish;
-
+
if (command != PA_COMMAND_REPLY) {
if (pa_context_handle_error(o->context, command, t) < 0)
goto finish;
@@ -1048,7 +1048,7 @@ pa_operation* pa_context_load_module(pa_context *c, const char*name, const char
pa_operation *o;
pa_tagstruct *t;
uint32_t tag;
-
+
assert(c);
assert(c->ref >= 1);
@@ -1089,10 +1089,10 @@ static void context_get_autoload_info_callback(pa_pdispatch *pd, uint32_t comman
eol = -1;
} else {
-
+
while (!pa_tagstruct_eof(t)) {
pa_autoload_info i;
-
+
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
pa_tagstruct_gets(t, &i.name) < 0 ||
pa_tagstruct_getu32(t, &i.type) < 0 ||
@@ -1108,7 +1108,7 @@ static void context_get_autoload_info_callback(pa_pdispatch *pd, uint32_t comman
}
}
}
-
+
if (o->callback) {
pa_autoload_info_cb_t cb = (pa_autoload_info_cb_t) o->callback;
cb(o->context, NULL, eol, o->userdata);
@@ -1147,7 +1147,7 @@ pa_operation* pa_context_get_autoload_info_by_index(pa_context *c, uint32_t idx,
pa_tagstruct *t;
pa_operation *o;
uint32_t tag;
-
+
assert(c);
assert(c->ref >= 1);
assert(cb);
@@ -1176,7 +1176,7 @@ pa_operation* pa_context_add_autoload(pa_context *c, const char *name, pa_autolo
assert(c);
assert(c->ref >= 1);
-
+
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID);
PA_CHECK_VALIDITY_RETURN_NULL(c, type == PA_AUTOLOAD_SINK || type == PA_AUTOLOAD_SOURCE, PA_ERR_INVALID);
@@ -1202,7 +1202,7 @@ pa_operation* pa_context_remove_autoload_by_name(pa_context *c, const char *name
assert(c);
assert(c->ref >= 1);
-
+
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID);
PA_CHECK_VALIDITY_RETURN_NULL(c, type == PA_AUTOLOAD_SINK || type == PA_AUTOLOAD_SOURCE, PA_ERR_INVALID);
diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h
index 28d22cd7..6de7bc71 100644
--- a/src/pulse/introspect.h
+++ b/src/pulse/introspect.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -206,7 +206,7 @@ PA_C_DECL_BEGIN
/** Stores information about sinks */
typedef struct pa_sink_info {
const char *name; /**< Name of the sink */
- uint32_t index; /**< Index of the sink */
+ uint32_t index; /**< Index of the sink */
const char *description; /**< Description of this sink */
pa_sample_spec sample_spec; /**< Sample spec of this sink */
pa_channel_map channel_map; /**< Channel map \since 0.8 */
@@ -233,7 +233,7 @@ pa_operation* pa_context_get_sink_info_by_index(pa_context *c, uint32_t id, pa_s
pa_operation* pa_context_get_sink_info_list(pa_context *c, pa_sink_info_cb_t cb, void *userdata);
/** Stores information about sources */
-typedef struct pa_source_info {
+typedef struct pa_source_info {
const char *name ; /**< Name of the source */
uint32_t index; /**< Index of the source */
const char *description; /**< Description of this source */
@@ -316,7 +316,7 @@ pa_operation* pa_context_get_client_info_list(pa_context *c, pa_client_info_cb_t
/** Stores information about sink inputs */
typedef struct pa_sink_input_info {
- uint32_t index; /**< Index of the sink input */
+ uint32_t index; /**< Index of the sink input */
const char *name; /**< Name of the sink input */
uint32_t owner_module; /**< Index of the module this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any module */
uint32_t client; /**< Index of the client this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any client */
@@ -341,11 +341,11 @@ pa_operation* pa_context_get_sink_input_info_list(pa_context *c, pa_sink_input_i
/** Stores information about source outputs */
typedef struct pa_source_output_info {
- uint32_t index; /**< Index of the sink input */
+ uint32_t index; /**< Index of the sink input */
const char *name; /**< Name of the sink input */
- uint32_t owner_module; /**< Index of the module this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any module */
- uint32_t client; /**< Index of the client this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any client */
- uint32_t source; /**< Index of the connected source */
+ uint32_t owner_module; /**< Index of the module this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any module */
+ uint32_t client; /**< Index of the client this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any client */
+ uint32_t source; /**< Index of the connected source */
pa_sample_spec sample_spec; /**< The sample specification of the source output */
pa_channel_map channel_map; /**< Channel map */
pa_usec_t buffer_usec; /**< Latency due to buffering in the source output, see pa_latency_info for details. \since 0.5 */
@@ -396,7 +396,7 @@ typedef struct pa_stat_info {
uint32_t memblock_total_size; /**< Currentl total size of allocated memory blocks */
uint32_t memblock_allocated; /**< Allocated memory blocks during the whole lifetime of the daemon */
uint32_t memblock_allocated_size; /**< Total size of all memory blocks allocated during the whole lifetime of the daemon */
- uint32_t scache_size; /**< Total size of all sample cache entries. \since 0.4 */
+ uint32_t scache_size; /**< Total size of all sample cache entries. \since 0.4 */
} pa_stat_info;
/** Callback prototype for pa_context_stat() */
@@ -432,7 +432,7 @@ pa_operation* pa_context_get_sample_info_list(pa_context *c, pa_sample_info_cb_t
/** Kill a client. \since 0.5 */
pa_operation* pa_context_kill_client(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
-
+
/** Kill a sink input. \since 0.5 */
pa_operation* pa_context_kill_sink_input(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
diff --git a/src/pulse/mainloop-api.c b/src/pulse/mainloop-api.c
index 2e20b446..bf3ef37e 100644
--- a/src/pulse/mainloop-api.c
+++ b/src/pulse/mainloop-api.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/mainloop-api.h b/src/pulse/mainloop-api.h
index 7b7075ae..b88bf125 100644
--- a/src/pulse/mainloop-api.h
+++ b/src/pulse/mainloop-api.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -28,7 +28,7 @@
#include <pulse/cdecl.h>
/** \file
- *
+ *
* Main loop abstraction layer. Both the PulseAudio core and the
* PulseAudio client library use a main loop abstraction layer. Due to
* this it is possible to embed PulseAudio into other
diff --git a/src/pulse/mainloop-signal.c b/src/pulse/mainloop-signal.c
index d651462b..4dd42796 100644
--- a/src/pulse/mainloop-signal.c
+++ b/src/pulse/mainloop-signal.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -73,7 +73,7 @@ static void signal_handler(int sig) {
static void dispatch(pa_mainloop_api*a, int sig) {
pa_signal_event*s;
- for (s = signals; s; s = s->next)
+ for (s = signals; s; s = s->next)
if (s->sig == sig) {
assert(s->callback);
s->callback(a, s, sig, s->userdata);
@@ -93,7 +93,7 @@ static void callback(pa_mainloop_api*a, pa_io_event*e, int fd, pa_io_event_flags
pa_log("read(): %s", pa_cstrerror(errno));
return;
}
-
+
if (r != sizeof(sig)) {
pa_log("short read()");
return;
@@ -129,7 +129,7 @@ void pa_signal_done(void) {
while (signals)
pa_signal_free(signals);
-
+
api->io_free(io_event);
io_event = NULL;
@@ -148,11 +148,11 @@ pa_signal_event* pa_signal_new(int sig, void (*_callback) (pa_mainloop_api *api,
#endif
assert(sig > 0 && _callback);
-
+
for (e = signals; e; e = e->next)
if (e->sig == sig)
goto fail;
-
+
e = pa_xmalloc(sizeof(pa_signal_event));
e->sig = sig;
e->callback = _callback;
@@ -164,7 +164,7 @@ pa_signal_event* pa_signal_new(int sig, void (*_callback) (pa_mainloop_api *api,
sa.sa_handler = signal_handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART;
-
+
if (sigaction(sig, &sa, &e->saved_sigaction) < 0)
#else
if ((e->saved_handler = signal(sig, signal_handler)) == SIG_ERR)
@@ -200,7 +200,7 @@ void pa_signal_free(pa_signal_event *e) {
if (e->destroy_callback)
e->destroy_callback(api, e, e->userdata);
-
+
pa_xfree(e);
}
diff --git a/src/pulse/mainloop-signal.h b/src/pulse/mainloop-signal.h
index 0721c1f5..e991cf1c 100644
--- a/src/pulse/mainloop-signal.h
+++ b/src/pulse/mainloop-signal.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c
index f7b15537..04461b30 100644
--- a/src/pulse/mainloop.c
+++ b/src/pulse/mainloop.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -57,11 +57,11 @@
struct pa_io_event {
pa_mainloop *mainloop;
int dead;
-
+
int fd;
pa_io_event_flags_t events;
struct pollfd *pollfd;
-
+
pa_io_event_cb_t callback;
void *userdata;
pa_io_event_destroy_cb_t destroy_callback;
@@ -154,7 +154,7 @@ static pa_io_event* mainloop_io_new(
pa_io_event_flags_t events,
pa_io_event_cb_t callback,
void *userdata) {
-
+
pa_mainloop *m;
pa_io_event *e;
@@ -162,7 +162,7 @@ static pa_io_event* mainloop_io_new(
assert(a->userdata);
assert(fd >= 0);
assert(callback);
-
+
m = a->userdata;
assert(a == &m->api);
@@ -173,7 +173,7 @@ static pa_io_event* mainloop_io_new(
e->fd = fd;
e->events = events;
e->pollfd = NULL;
-
+
e->callback = callback;
e->userdata = userdata;
e->destroy_callback = NULL;
@@ -213,7 +213,7 @@ static void mainloop_io_enable(pa_io_event *e, pa_io_event_flags_t events) {
if (e->events == events)
return;
-
+
e->events = events;
if (e->pollfd)
@@ -239,7 +239,7 @@ static void mainloop_io_free(pa_io_event *e) {
static void mainloop_io_set_destroy(pa_io_event *e, pa_io_event_destroy_cb_t callback) {
assert(e);
-
+
e->destroy_callback = callback;
}
@@ -255,7 +255,7 @@ static pa_defer_event* mainloop_defer_new(
assert(a);
assert(a->userdata);
assert(callback);
-
+
m = a->userdata;
assert(a == &m->api);
@@ -265,7 +265,7 @@ static pa_defer_event* mainloop_defer_new(
e->enabled = 1;
m->n_enabled_defer_events++;
-
+
e->callback = callback;
e->userdata = userdata;
e->destroy_callback = NULL;
@@ -288,7 +288,7 @@ static void mainloop_defer_enable(pa_defer_event *e, int b) {
e->mainloop->n_enabled_defer_events++;
pa_mainloop_wakeup(e->mainloop);
}
-
+
e->enabled = b;
}
@@ -318,14 +318,14 @@ static pa_time_event* mainloop_time_new(
const struct timeval *tv,
pa_time_event_cb_t callback,
void *userdata) {
-
+
pa_mainloop *m;
pa_time_event *e;
assert(a);
assert(a->userdata);
assert(callback);
-
+
m = a->userdata;
assert(a == &m->api);
@@ -354,7 +354,7 @@ static pa_time_event* mainloop_time_new(
if (e->enabled)
pa_mainloop_wakeup(m);
-
+
return e;
}
@@ -375,7 +375,7 @@ static void mainloop_time_restart(pa_time_event *e, const struct timeval *tv) {
if (e->mainloop->cached_next_time_event && e->enabled) {
assert(e->mainloop->cached_next_time_event->enabled);
-
+
if (pa_timeval_cmp(tv, &e->mainloop->cached_next_time_event->timeval) < 0)
e->mainloop->cached_next_time_event = e;
} else if (e->mainloop->cached_next_time_event == e)
@@ -396,7 +396,7 @@ static void mainloop_time_free(pa_time_event *e) {
if (e->mainloop->cached_next_time_event == e)
e->mainloop->cached_next_time_event = NULL;
-
+
/* no wakeup needed here. Think about it! */
}
@@ -411,7 +411,7 @@ static void mainloop_time_set_destroy(pa_time_event *e, pa_time_event_destroy_cb
static void mainloop_quit(pa_mainloop_api*a, int retval) {
pa_mainloop *m;
-
+
assert(a);
assert(a->userdata);
m = a->userdata;
@@ -419,7 +419,7 @@ static void mainloop_quit(pa_mainloop_api*a, int retval) {
pa_mainloop_quit(m, retval);
}
-
+
static const pa_mainloop_api vtable = {
.userdata = NULL,
@@ -432,12 +432,12 @@ static const pa_mainloop_api vtable = {
.time_restart = mainloop_time_restart,
.time_free = mainloop_time_free,
.time_set_destroy = mainloop_time_set_destroy,
-
+
.defer_new = mainloop_defer_new,
.defer_enable = mainloop_defer_enable,
.defer_free = mainloop_defer_free,
.defer_set_destroy = mainloop_defer_set_destroy,
-
+
.quit = mainloop_quit,
};
@@ -466,7 +466,7 @@ pa_mainloop *pa_mainloop_new(void) {
m->cached_next_time_event = NULL;
m->prepared_timeout = 0;
-
+
m->pollfds = NULL;
m->max_pollfds = m->n_pollfds = 0;
m->rebuild_pollfds = 1;
@@ -481,7 +481,7 @@ pa_mainloop *pa_mainloop_new(void) {
m->poll_func = NULL;
m->poll_func_userdata = NULL;
m->poll_func_ret = -1;
-
+
return m;
}
@@ -494,7 +494,7 @@ static void cleanup_io_events(pa_mainloop *m, int force) {
if (!force && m->io_events_please_scan <= 0)
break;
-
+
if (force || e->dead) {
PA_LLIST_REMOVE(pa_io_event, m->io_events, e);
@@ -502,10 +502,10 @@ static void cleanup_io_events(pa_mainloop *m, int force) {
assert(m->io_events_please_scan > 0);
m->io_events_please_scan--;
}
-
+
if (e->destroy_callback)
e->destroy_callback(&m->api, e, e->userdata);
-
+
pa_xfree(e);
m->rebuild_pollfds = 1;
@@ -526,7 +526,7 @@ static void cleanup_time_events(pa_mainloop *m, int force) {
if (!force && m->time_events_please_scan <= 0)
break;
-
+
if (force || e->dead) {
PA_LLIST_REMOVE(pa_time_event, m->time_events, e);
@@ -539,10 +539,10 @@ static void cleanup_time_events(pa_mainloop *m, int force) {
assert(m->n_enabled_time_events > 0);
m->n_enabled_time_events--;
}
-
+
if (e->destroy_callback)
e->destroy_callback(&m->api, e, e->userdata);
-
+
pa_xfree(e);
}
@@ -561,7 +561,7 @@ static void cleanup_defer_events(pa_mainloop *m, int force) {
if (!force && m->defer_events_please_scan <= 0)
break;
-
+
if (force || e->dead) {
PA_LLIST_REMOVE(pa_defer_event, m->defer_events, e);
@@ -574,10 +574,10 @@ static void cleanup_defer_events(pa_mainloop *m, int force) {
assert(m->n_enabled_defer_events > 0);
m->n_enabled_defer_events--;
}
-
+
if (e->destroy_callback)
e->destroy_callback(&m->api, e, e->userdata);
-
+
pa_xfree(e);
}
@@ -664,11 +664,11 @@ static int dispatch_pollfds(pa_mainloop *m) {
int r = 0, k;
assert(m->poll_func_ret > 0);
-
+
for (e = m->io_events, k = m->poll_func_ret; e && !m->quit && k > 0; e = e->next) {
if (e->dead || !e->pollfd || !e->pollfd->revents)
continue;
-
+
assert(e->pollfd->fd == e->fd && e->callback);
e->callback(&m->api, e, e->fd, map_flags_from_libc(e->pollfd->revents), e->userdata);
e->pollfd->revents = 0;
@@ -690,7 +690,7 @@ static int dispatch_defer(pa_mainloop *m) {
for (e = m->defer_events; e && !m->quit; e = e->next) {
if (e->dead || !e->enabled)
continue;
-
+
assert(e->callback);
e->callback(&m->api, e, e->userdata);
r++;
@@ -705,7 +705,7 @@ static pa_time_event* find_next_time_event(pa_mainloop *m) {
if (m->cached_next_time_event)
return m->cached_next_time_event;
-
+
for (t = m->time_events; t; t = t->next) {
if (t->dead || !t->enabled)
@@ -737,7 +737,7 @@ static int calc_next_timeout(pa_mainloop *m) {
if (t->timeval.tv_sec <= 0)
return 0;
-
+
pa_gettimeofday(&now);
if (pa_timeval_cmp(&t->timeval, &now) <= 0)
@@ -759,7 +759,7 @@ static int dispatch_timeout(pa_mainloop *m) {
pa_gettimeofday(&now);
for (e = m->time_events; e && !m->quit; e = e->next) {
-
+
if (e->dead || !e->enabled)
continue;
@@ -815,7 +815,7 @@ int pa_mainloop_prepare(pa_mainloop *m, int timeout) {
if (m->n_enabled_defer_events <= 0) {
if (m->rebuild_pollfds)
rebuild_pollfds(m);
-
+
m->prepared_timeout = calc_next_timeout(m);
if (timeout >= 0 && (timeout < m->prepared_timeout || m->prepared_timeout < 0))
m->prepared_timeout = timeout;
@@ -842,7 +842,7 @@ int pa_mainloop_poll(pa_mainloop *m) {
m->poll_func_ret = 0;
else {
assert(!m->rebuild_pollfds);
-
+
if (m->poll_func)
m->poll_func_ret = m->poll_func(m->pollfds, m->n_pollfds, m->prepared_timeout, m->poll_func_userdata);
else
@@ -872,23 +872,23 @@ int pa_mainloop_dispatch(pa_mainloop *m) {
if (m->quit)
goto quit;
-
+
if (m->n_enabled_defer_events)
dispatched += dispatch_defer(m);
else {
- if (m->n_enabled_time_events)
+ if (m->n_enabled_time_events)
dispatched += dispatch_timeout(m);
-
+
if (m->quit)
goto quit;
if (m->poll_func_ret > 0)
dispatched += dispatch_pollfds(m);
}
-
+
if (m->quit)
goto quit;
-
+
m->state = STATE_PASSIVE;
return dispatched;
@@ -919,7 +919,7 @@ int pa_mainloop_iterate(pa_mainloop *m, int block, int *retval) {
return r;
quit:
-
+
if ((r == -2) && retval)
*retval = pa_mainloop_get_retval(m);
return r;
@@ -927,7 +927,7 @@ quit:
int pa_mainloop_run(pa_mainloop *m, int *retval) {
int r;
-
+
while ((r = pa_mainloop_iterate(m, 1, retval)) >= 0);
if (r == -2)
diff --git a/src/pulse/mainloop.h b/src/pulse/mainloop.h
index 8abd8fe4..18be1f2b 100644
--- a/src/pulse/mainloop.h
+++ b/src/pulse/mainloop.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -65,7 +65,7 @@ struct pollfd;
*/
/** \file
- *
+ *
* A minimal main loop implementation based on the C library's poll()
* function. Using the routines defined herein you may create a simple
* main loop supporting the generic main loop abstraction layer as
diff --git a/src/pulse/operation.c b/src/pulse/operation.c
index 8d896d7d..e039e8c9 100644
--- a/src/pulse/operation.c
+++ b/src/pulse/operation.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -46,14 +46,14 @@ pa_operation *pa_operation_new(pa_context *c, pa_stream *s, pa_operation_cb_t cb
/* Refcounting is strictly one-way: from the "bigger" to the "smaller" object. */
PA_LLIST_PREPEND(pa_operation, c->operations, o);
pa_operation_ref(o);
-
+
return o;
}
pa_operation *pa_operation_ref(pa_operation *o) {
assert(o);
assert(o->ref >= 1);
-
+
o->ref++;
return o;
}
@@ -81,14 +81,14 @@ static void operation_set_state(pa_operation *o, pa_operation_state_t st) {
o->state = st;
if ((o->state == PA_OPERATION_DONE) || (o->state == PA_OPERATION_CANCELED)) {
-
+
if (o->context) {
assert(o->ref >= 2);
-
+
PA_LLIST_REMOVE(pa_operation, o->context->operations, o);
pa_operation_unref(o);
}
-
+
o->context = NULL;
o->stream = NULL;
o->callback = NULL;
@@ -101,14 +101,14 @@ static void operation_set_state(pa_operation *o, pa_operation_state_t st) {
void pa_operation_cancel(pa_operation *o) {
assert(o);
assert(o->ref >= 1);
-
+
operation_set_state(o, PA_OPERATION_CANCELED);
}
void pa_operation_done(pa_operation *o) {
assert(o);
assert(o->ref >= 1);
-
+
operation_set_state(o, PA_OPERATION_DONE);
}
diff --git a/src/pulse/operation.h b/src/pulse/operation.h
index b544e08e..adfd5f2d 100644
--- a/src/pulse/operation.h
+++ b/src/pulse/operation.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/pulseaudio.h b/src/pulse/pulseaudio.h
index 88cc326b..5543d7cd 100644
--- a/src/pulse/pulseaudio.h
+++ b/src/pulse/pulseaudio.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -55,11 +55,11 @@
/** \mainpage
*
* \section intro_sec Introduction
- *
+ *
* This document describes the client API for the PulseAudio sound
* server. The API comes in two flavours to accomodate different styles
* of applications and different needs in complexity:
- *
+ *
* \li The complete but somewhat complicated to use asynchronous API
* \li The simplified, easy to use, but limited synchronous API
*
@@ -67,7 +67,7 @@
* locale. Some functions will filter invalid sequences from the string, some
* will simply fail. To ensure reliable behaviour, make sure everything you
* pass to the API is already in UTF-8.
-
+
* \section simple_sec Simple API
*
* Use this if you develop your program in synchronous style and just
diff --git a/src/pulse/sample.c b/src/pulse/sample.c
index 7ca418e1..dd68ac17 100644
--- a/src/pulse/sample.c
+++ b/src/pulse/sample.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -70,7 +70,7 @@ pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec) {
size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec) {
assert(spec);
- return (size_t) (((double) t * spec->rate / 1000000))*pa_frame_size(spec);
+ return (size_t) (((double) t * spec->rate / 1000000))*pa_frame_size(spec);
}
int pa_sample_spec_valid(const pa_sample_spec *spec) {
@@ -111,7 +111,7 @@ const char *pa_sample_format_to_string(pa_sample_format_t f) {
char *pa_sample_spec_snprint(char *s, size_t l, const pa_sample_spec *spec) {
assert(s && l && spec);
-
+
if (!pa_sample_spec_valid(spec))
snprintf(s, l, "Invalid");
else
@@ -134,7 +134,7 @@ char* pa_bytes_snprint(char *s, size_t l, unsigned v) {
}
pa_sample_format_t pa_parse_sample_format(const char *format) {
-
+
if (strcasecmp(format, "s16le") == 0)
return PA_SAMPLE_S16LE;
else if (strcasecmp(format, "s16be") == 0)
diff --git a/src/pulse/sample.h b/src/pulse/sample.h
index da32fdf0..b7c537e4 100644
--- a/src/pulse/sample.h
+++ b/src/pulse/sample.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/scache.c b/src/pulse/scache.c
index 5d29c5b3..5abaf845 100644
--- a/src/pulse/scache.c
+++ b/src/pulse/scache.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -37,14 +37,14 @@
int pa_stream_connect_upload(pa_stream *s, size_t length) {
pa_tagstruct *t;
uint32_t tag;
-
+
assert(s);
PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_UNCONNECTED, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY(s->context, length > 0, PA_ERR_INVALID);
-
+
pa_stream_ref(s);
-
+
s->direction = PA_STREAM_UPLOAD;
t = pa_tagstruct_command(s->context, PA_COMMAND_CREATE_UPLOAD_STREAM, &tag);
@@ -56,7 +56,7 @@ int pa_stream_connect_upload(pa_stream *s, size_t length) {
pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_create_stream_callback, s, NULL);
pa_stream_set_state(s, PA_STREAM_CREATING);
-
+
pa_stream_unref(s);
return 0;
}
@@ -87,16 +87,16 @@ pa_operation *pa_context_play_sample(pa_context *c, const char *name, const char
assert(c);
assert(c->ref >= 1);
-
+
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID);
PA_CHECK_VALIDITY_RETURN_NULL(c, !dev || *dev, PA_ERR_INVALID);
-
+
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
if (!dev)
dev = c->conf->default_sink;
-
+
t = pa_tagstruct_command(c, PA_COMMAND_PLAY_SAMPLE, &tag);
pa_tagstruct_putu32(t, PA_INVALID_INDEX);
pa_tagstruct_puts(t, dev);
@@ -118,9 +118,9 @@ pa_operation* pa_context_remove_sample(pa_context *c, const char *name, pa_conte
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID);
-
+
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
-
+
t = pa_tagstruct_command(c, PA_COMMAND_REMOVE_SAMPLE, &tag);
pa_tagstruct_puts(t, name);
pa_pstream_send_tagstruct(c->pstream, t);
diff --git a/src/pulse/scache.h b/src/pulse/scache.h
index e32703d4..2293dec4 100644
--- a/src/pulse/scache.h
+++ b/src/pulse/scache.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/simple.c b/src/pulse/simple.c
index a41881bb..1c632fa7 100644
--- a/src/pulse/simple.c
+++ b/src/pulse/simple.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -64,7 +64,7 @@ if (!(expression)) { \
goto label; \
} \
} while(0);
-
+
#define CHECK_DEAD_GOTO(p, rerror, label) do { \
if (!(p)->context || pa_context_get_state((p)->context) != PA_CONTEXT_READY || \
!(p)->stream || pa_stream_get_state((p)->stream) != PA_STREAM_READY) { \
@@ -143,7 +143,7 @@ pa_simple* pa_simple_new(
const pa_channel_map *map,
const pa_buffer_attr *attr,
int *rerror) {
-
+
pa_simple *p;
int error = PA_ERR_INTERNAL, r;
@@ -162,12 +162,12 @@ pa_simple* pa_simple_new(
if (!(p->mainloop = pa_threaded_mainloop_new()))
goto fail;
-
+
if (!(p->context = pa_context_new(pa_threaded_mainloop_get_api(p->mainloop), name)))
goto fail;
pa_context_set_state_callback(p->context, context_state_cb, p);
-
+
if (pa_context_connect(p->context, server, 0, NULL) < 0) {
error = pa_context_errno(p->context);
goto fail;
@@ -180,7 +180,7 @@ pa_simple* pa_simple_new(
/* Wait until the context is ready */
pa_threaded_mainloop_wait(p->mainloop);
-
+
if (pa_context_get_state(p->context) != PA_CONTEXT_READY) {
error = pa_context_errno(p->context);
goto unlock_and_fail;
@@ -216,12 +216,12 @@ pa_simple* pa_simple_new(
}
pa_threaded_mainloop_unlock(p->mainloop);
-
+
return p;
unlock_and_fail:
pa_threaded_mainloop_unlock(p->mainloop);
-
+
fail:
if (rerror)
*rerror = error;
@@ -234,10 +234,10 @@ void pa_simple_free(pa_simple *s) {
if (s->mainloop)
pa_threaded_mainloop_stop(s->mainloop);
-
+
if (s->stream)
pa_stream_unref(s->stream);
-
+
if (s->context)
pa_context_unref(s->context);
@@ -249,38 +249,38 @@ void pa_simple_free(pa_simple *s) {
int pa_simple_write(pa_simple *p, const void*data, size_t length, int *rerror) {
assert(p);
-
+
CHECK_VALIDITY_RETURN_ANY(rerror, p->direction == PA_STREAM_PLAYBACK, PA_ERR_BADSTATE, -1);
CHECK_VALIDITY_RETURN_ANY(rerror, data && length, PA_ERR_INVALID, -1);
pa_threaded_mainloop_lock(p->mainloop);
-
+
CHECK_DEAD_GOTO(p, rerror, unlock_and_fail);
while (length > 0) {
size_t l;
int r;
-
+
while (!(l = pa_stream_writable_size(p->stream))) {
pa_threaded_mainloop_wait(p->mainloop);
CHECK_DEAD_GOTO(p, rerror, unlock_and_fail);
}
CHECK_SUCCESS_GOTO(p, rerror, l != (size_t) -1, unlock_and_fail);
-
+
if (l > length)
l = length;
r = pa_stream_write(p->stream, data, l, NULL, 0, PA_SEEK_RELATIVE);
CHECK_SUCCESS_GOTO(p, rerror, r >= 0, unlock_and_fail);
-
+
data = (const uint8_t*) data + l;
length -= l;
}
pa_threaded_mainloop_unlock(p->mainloop);
return 0;
-
+
unlock_and_fail:
pa_threaded_mainloop_unlock(p->mainloop);
return -1;
@@ -293,15 +293,15 @@ int pa_simple_read(pa_simple *p, void*data, size_t length, int *rerror) {
CHECK_VALIDITY_RETURN_ANY(rerror, data && length, PA_ERR_INVALID, -1);
pa_threaded_mainloop_lock(p->mainloop);
-
+
CHECK_DEAD_GOTO(p, rerror, unlock_and_fail);
while (length > 0) {
size_t l;
-
+
while (!p->read_data) {
int r;
-
+
r = pa_stream_peek(p->stream, &p->read_data, &p->read_length);
CHECK_SUCCESS_GOTO(p, rerror, r == 0, unlock_and_fail);
@@ -311,31 +311,31 @@ int pa_simple_read(pa_simple *p, void*data, size_t length, int *rerror) {
} else
p->read_index = 0;
}
-
+
l = p->read_length < length ? p->read_length : length;
memcpy(data, (const uint8_t*) p->read_data+p->read_index, l);
data = (uint8_t*) data + l;
length -= l;
-
+
p->read_index += l;
p->read_length -= l;
if (!p->read_length) {
int r;
-
+
r = pa_stream_drop(p->stream);
p->read_data = NULL;
p->read_length = 0;
p->read_index = 0;
-
+
CHECK_SUCCESS_GOTO(p, rerror, r == 0, unlock_and_fail);
}
}
pa_threaded_mainloop_unlock(p->mainloop);
return 0;
-
+
unlock_and_fail:
pa_threaded_mainloop_unlock(p->mainloop);
return -1;
@@ -353,7 +353,7 @@ static void success_cb(pa_stream *s, int success, void *userdata) {
int pa_simple_drain(pa_simple *p, int *rerror) {
pa_operation *o = NULL;
-
+
assert(p);
CHECK_VALIDITY_RETURN_ANY(rerror, p->direction == PA_STREAM_PLAYBACK, PA_ERR_BADSTATE, -1);
@@ -370,7 +370,7 @@ int pa_simple_drain(pa_simple *p, int *rerror) {
CHECK_DEAD_GOTO(p, rerror, unlock_and_fail);
}
CHECK_SUCCESS_GOTO(p, rerror, p->operation_success, unlock_and_fail);
-
+
pa_operation_unref(o);
pa_threaded_mainloop_unlock(p->mainloop);
@@ -389,7 +389,7 @@ unlock_and_fail:
int pa_simple_flush(pa_simple *p, int *rerror) {
pa_operation *o = NULL;
-
+
assert(p);
CHECK_VALIDITY_RETURN_ANY(rerror, p->direction == PA_STREAM_PLAYBACK, PA_ERR_BADSTATE, -1);
@@ -399,7 +399,7 @@ int pa_simple_flush(pa_simple *p, int *rerror) {
o = pa_stream_flush(p->stream, success_cb, p);
CHECK_SUCCESS_GOTO(p, rerror, o, unlock_and_fail);
-
+
p->operation_success = 0;
while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
pa_threaded_mainloop_wait(p->mainloop);
@@ -426,14 +426,14 @@ unlock_and_fail:
pa_usec_t pa_simple_get_latency(pa_simple *p, int *rerror) {
pa_usec_t t;
int negative;
-
+
assert(p);
-
+
pa_threaded_mainloop_lock(p->mainloop);
for (;;) {
CHECK_DEAD_GOTO(p, rerror, unlock_and_fail);
-
+
if (pa_stream_get_latency(p->stream, &t, &negative) >= 0)
break;
@@ -442,7 +442,7 @@ pa_usec_t pa_simple_get_latency(pa_simple *p, int *rerror) {
/* Wait until latency data is available again */
pa_threaded_mainloop_wait(p->mainloop);
}
-
+
pa_threaded_mainloop_unlock(p->mainloop);
return negative ? 0 : t;
diff --git a/src/pulse/simple.h b/src/pulse/simple.h
index 0438d319..a97875f9 100644
--- a/src/pulse/simple.h
+++ b/src/pulse/simple.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index 180cd096..009eb3cf 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -43,7 +43,7 @@
pa_stream *pa_stream_new(pa_context *c, const char *name, const pa_sample_spec *ss, const pa_channel_map *map) {
pa_stream *s;
int i;
-
+
assert(c);
PA_CHECK_VALIDITY_RETURN_NULL(c, ss && pa_sample_spec_valid(ss), PA_ERR_INVALID);
@@ -76,7 +76,7 @@ pa_stream *pa_stream_new(pa_context *c, const char *name, const pa_sample_spec *
s->channel_map = *map;
else
pa_channel_map_init_auto(&s->channel_map, ss->channels, PA_CHANNEL_MAP_DEFAULT);
-
+
s->channel = 0;
s->channel_valid = 0;
s->syncid = c->csyncid++;
@@ -99,11 +99,11 @@ pa_stream *pa_stream_new(pa_context *c, const char *name, const pa_sample_spec *
for (i = 0; i < PA_MAX_WRITE_INDEX_CORRECTIONS; i++)
s->write_index_corrections[i].valid = 0;
s->current_write_index_correction = 0;
-
+
s->corked = 0;
s->cached_time_valid = 0;
-
+
s->auto_timing_update_event = NULL;
s->auto_timing_update_requested = 0;
@@ -143,7 +143,7 @@ void pa_stream_unref(pa_stream *s) {
pa_stream* pa_stream_ref(pa_stream *s) {
assert(s);
assert(s->ref >= 1);
-
+
s->ref++;
return s;
}
@@ -151,14 +151,14 @@ pa_stream* pa_stream_ref(pa_stream *s) {
pa_stream_state_t pa_stream_get_state(pa_stream *s) {
assert(s);
assert(s->ref >= 1);
-
+
return s->state;
}
pa_context* pa_stream_get_context(pa_stream *s) {
assert(s);
assert(s->ref >= 1);
-
+
return s->context;
}
@@ -167,17 +167,17 @@ uint32_t pa_stream_get_index(pa_stream *s) {
assert(s->ref >= 1);
PA_CHECK_VALIDITY_RETURN_ANY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE, PA_INVALID_INDEX);
-
+
return s->device_index;
}
-
+
void pa_stream_set_state(pa_stream *s, pa_stream_state_t st) {
assert(s);
assert(s->ref >= 1);
if (s->state == st)
return;
-
+
pa_stream_ref(s);
s->state = st;
@@ -192,24 +192,24 @@ void pa_stream_set_state(pa_stream *s, pa_stream_state_t st) {
/* Unref all operatio object that point to us */
for (o = s->context->operations; o; o = n) {
n = o->next;
-
+
if (o->stream == s)
pa_operation_cancel(o);
}
-
+
/* Drop all outstanding replies for this stream */
if (s->context->pdispatch)
pa_pdispatch_unregister_reply(s->context->pdispatch, s);
if (s->channel_valid)
pa_dynarray_put((s->direction == PA_STREAM_PLAYBACK) ? s->context->playback_streams : s->context->record_streams, s->channel, NULL);
-
+
PA_LLIST_REMOVE(pa_stream, s->context->streams, s);
pa_stream_unref(s);
s->channel = 0;
s->channel_valid = 0;
-
+
s->context = NULL;
}
@@ -220,20 +220,20 @@ void pa_command_stream_killed(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED
pa_context *c = userdata;
pa_stream *s;
uint32_t channel;
-
+
assert(pd);
assert(command == PA_COMMAND_PLAYBACK_STREAM_KILLED || command == PA_COMMAND_RECORD_STREAM_KILLED);
assert(t);
assert(c);
pa_context_ref(c);
-
+
if (pa_tagstruct_getu32(t, &channel) < 0 ||
!pa_tagstruct_eof(t)) {
pa_context_fail(c, PA_ERR_PROTOCOL);
goto finish;
}
-
+
if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_STREAM_KILLED ? c->playback_streams : c->record_streams, channel)))
goto finish;
@@ -248,27 +248,27 @@ void pa_command_request(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32
pa_stream *s;
pa_context *c = userdata;
uint32_t bytes, channel;
-
+
assert(pd);
assert(command == PA_COMMAND_REQUEST);
assert(t);
assert(c);
pa_context_ref(c);
-
+
if (pa_tagstruct_getu32(t, &channel) < 0 ||
pa_tagstruct_getu32(t, &bytes) < 0 ||
!pa_tagstruct_eof(t)) {
pa_context_fail(c, PA_ERR_PROTOCOL);
goto finish;
}
-
+
if (!(s = pa_dynarray_get(c->playback_streams, channel)))
goto finish;
if (s->state == PA_STREAM_READY) {
s->requested_bytes += bytes;
-
+
if (s->requested_bytes > 0 && s->write_callback)
s->write_callback(s, s->requested_bytes, s->write_userdata);
}
@@ -288,13 +288,13 @@ void pa_command_overflow_or_underflow(pa_pdispatch *pd, uint32_t command, PA_GCC
assert(c);
pa_context_ref(c);
-
+
if (pa_tagstruct_getu32(t, &channel) < 0 ||
!pa_tagstruct_eof(t)) {
pa_context_fail(c, PA_ERR_PROTOCOL);
goto finish;
}
-
+
if (!(s = pa_dynarray_get(c->playback_streams, channel)))
goto finish;
@@ -319,11 +319,11 @@ static void request_auto_timing_update(pa_stream *s, int force) {
if (!(s->flags & PA_STREAM_AUTO_TIMING_UPDATE))
return;
-
+
if (s->state == PA_STREAM_READY &&
(force || !s->auto_timing_update_requested)) {
pa_operation *o;
-
+
/* pa_log("automatically requesting new timing data"); */
if ((o = pa_stream_update_timing_info(s, NULL, NULL))) {
@@ -341,32 +341,32 @@ static void invalidate_indexes(pa_stream *s, int r, int w) {
assert(s);
/* pa_log("invalidate r:%u w:%u tag:%u", r, w, s->context->ctag); */
-
+
if (s->state != PA_STREAM_READY)
return;
if (w) {
s->write_index_not_before = s->context->ctag;
-
+
if (s->timing_info_valid)
s->timing_info.write_index_corrupt = 1;
-
+
/* pa_log("write_index invalidated"); */
}
-
+
if (r) {
s->read_index_not_before = s->context->ctag;
-
+
if (s->timing_info_valid)
s->timing_info.read_index_corrupt = 1;
-
+
/* pa_log("read_index invalidated"); */
}
-
+
if ((s->direction == PA_STREAM_PLAYBACK && r) ||
(s->direction == PA_STREAM_RECORD && w))
s->cached_time_valid = 0;
-
+
request_auto_timing_update(s, 1);
}
@@ -382,17 +382,17 @@ static void auto_timing_update_callback(PA_GCC_UNUSED pa_mainloop_api *m, PA_GCC
void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) {
pa_stream *s = userdata;
-
+
assert(pd);
assert(s);
assert(s->state == PA_STREAM_CREATING);
-
+
pa_stream_ref(s);
-
+
if (command != PA_COMMAND_REPLY) {
if (pa_context_handle_error(s->context, command, t) < 0)
goto finish;
-
+
pa_stream_set_state(s, PA_STREAM_FAILED);
goto finish;
}
@@ -429,9 +429,9 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED
if (s->direction == PA_STREAM_RECORD) {
assert(!s->record_memblockq);
-
+
s->record_memblockq = pa_memblockq_new(
- 0,
+ 0,
s->buffer_attr.maxlength,
0,
pa_frame_size(&s->sample_spec),
@@ -444,7 +444,7 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED
pa_dynarray_put((s->direction == PA_STREAM_RECORD) ? s->context->record_streams : s->context->playback_streams, s->channel, s);
pa_stream_set_state(s, PA_STREAM_READY);
-
+
if (s->direction != PA_STREAM_UPLOAD &&
s->flags & PA_STREAM_AUTO_TIMING_UPDATE) {
struct timeval tv;
@@ -473,13 +473,13 @@ static int create_stream(
pa_stream_flags_t flags,
const pa_cvolume *volume,
pa_stream *sync_stream) {
-
+
pa_tagstruct *t;
uint32_t tag;
-
+
assert(s);
assert(s->ref >= 1);
-
+
PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_UNCONNECTED, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY(s->context, !(flags & ~((direction != PA_STREAM_UPLOAD ?
PA_STREAM_START_CORKED|
@@ -493,10 +493,10 @@ static int create_stream(
s->direction = direction;
s->flags = flags;
-
+
if (sync_stream)
s->syncid = sync_stream->syncid;
-
+
if (attr)
s->buffer_attr = *attr;
else {
@@ -515,7 +515,7 @@ static int create_stream(
s->context,
s->direction == PA_STREAM_PLAYBACK ? PA_COMMAND_CREATE_PLAYBACK_STREAM : PA_COMMAND_CREATE_RECORD_STREAM,
&tag);
-
+
pa_tagstruct_put(
t,
PA_TAG_STRING, s->name,
@@ -526,7 +526,7 @@ static int create_stream(
PA_TAG_U32, s->buffer_attr.maxlength,
PA_TAG_BOOLEAN, !!(flags & PA_STREAM_START_CORKED),
PA_TAG_INVALID);
-
+
if (s->direction == PA_STREAM_PLAYBACK) {
pa_cvolume cv;
@@ -540,7 +540,7 @@ static int create_stream(
if (!volume)
volume = pa_cvolume_reset(&cv, s->sample_spec.channels);
-
+
pa_tagstruct_put_cvolume(t, volume);
} else
pa_tagstruct_putu32(t, s->buffer_attr.fragsize);
@@ -549,7 +549,7 @@ static int create_stream(
pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_create_stream_callback, s, NULL);
pa_stream_set_state(s, PA_STREAM_CREATING);
-
+
pa_stream_unref(s);
return 0;
}
@@ -561,10 +561,10 @@ int pa_stream_connect_playback(
pa_stream_flags_t flags,
pa_cvolume *volume,
pa_stream *sync_stream) {
-
+
assert(s);
assert(s->ref >= 1);
-
+
return create_stream(PA_STREAM_PLAYBACK, s, dev, attr, flags, volume, sync_stream);
}
@@ -573,7 +573,7 @@ int pa_stream_connect_record(
const char *dev,
const pa_buffer_attr *attr,
pa_stream_flags_t flags) {
-
+
assert(s);
assert(s->ref >= 1);
@@ -587,9 +587,9 @@ int pa_stream_write(
void (*free_cb)(void *p),
int64_t offset,
pa_seek_mode_t seek) {
-
+
pa_memchunk chunk;
-
+
assert(s);
assert(s->ref >= 1);
assert(data);
@@ -602,29 +602,29 @@ int pa_stream_write(
if (length <= 0)
return 0;
- if (free_cb)
+ if (free_cb)
chunk.memblock = pa_memblock_new_user(s->context->mempool, (void*) data, length, free_cb, 1);
else {
chunk.memblock = pa_memblock_new(s->context->mempool, length);
memcpy(chunk.memblock->data, data, length);
}
-
+
chunk.index = 0;
chunk.length = length;
pa_pstream_send_memblock(s->context->pstream, s->channel, offset, seek, &chunk);
pa_memblock_unref(chunk.memblock);
-
+
if (length < s->requested_bytes)
s->requested_bytes -= length;
else
s->requested_bytes = 0;
if (s->direction == PA_STREAM_PLAYBACK) {
-
+
/* Update latency request correction */
if (s->write_index_corrections[s->current_write_index_correction].valid) {
-
+
if (seek == PA_SEEK_ABSOLUTE) {
s->write_index_corrections[s->current_write_index_correction].corrupt = 0;
s->write_index_corrections[s->current_write_index_correction].absolute = 1;
@@ -635,10 +635,10 @@ int pa_stream_write(
} else
s->write_index_corrections[s->current_write_index_correction].corrupt = 1;
}
-
+
/* Update the write index in the already available latency data */
if (s->timing_info_valid) {
-
+
if (seek == PA_SEEK_ABSOLUTE) {
s->timing_info.write_index_corrupt = 0;
s->timing_info.write_index = offset + length;
@@ -652,7 +652,7 @@ int pa_stream_write(
if (!s->timing_info_valid || s->timing_info.write_index_corrupt)
request_auto_timing_update(s, 1);
}
-
+
return 0;
}
@@ -664,7 +664,7 @@ int pa_stream_peek(pa_stream *s, const void **data, size_t *length) {
PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY(s->context, s->direction == PA_STREAM_RECORD, PA_ERR_BADSTATE);
-
+
if (!s->peek_memchunk.memblock) {
if (pa_memblockq_peek(s->record_memblockq, &s->peek_memchunk) < 0) {
@@ -686,13 +686,13 @@ int pa_stream_drop(pa_stream *s) {
PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY(s->context, s->direction == PA_STREAM_RECORD, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY(s->context, s->peek_memchunk.memblock, PA_ERR_BADSTATE);
-
+
pa_memblockq_drop(s->record_memblockq, &s->peek_memchunk, s->peek_memchunk.length);
/* Fix the simulated local read index */
if (s->timing_info_valid && !s->timing_info.read_index_corrupt)
s->timing_info.read_index += s->peek_memchunk.length;
-
+
pa_memblock_unref(s->peek_memchunk.memblock);
s->peek_memchunk.length = 0;
s->peek_memchunk.index = 0;
@@ -707,7 +707,7 @@ size_t pa_stream_writable_size(pa_stream *s) {
PA_CHECK_VALIDITY_RETURN_ANY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE, (size_t) -1);
PA_CHECK_VALIDITY_RETURN_ANY(s->context, s->direction != PA_STREAM_RECORD, PA_ERR_BADSTATE, (size_t) -1);
-
+
return s->requested_bytes;
}
@@ -725,7 +725,7 @@ pa_operation * pa_stream_drain(pa_stream *s, pa_stream_success_cb_t cb, void *us
pa_operation *o;
pa_tagstruct *t;
uint32_t tag;
-
+
assert(s);
assert(s->ref >= 1);
@@ -746,7 +746,7 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command,
pa_operation *o = userdata;
struct timeval local, remote, now;
pa_timing_info *i;
-
+
assert(pd);
assert(o);
@@ -756,7 +756,7 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command,
i = &o->stream->timing_info;
/* pa_log("pre corrupt w:%u r:%u\n", !o->stream->timing_info_valid || i->write_index_corrupt,!o->stream->timing_info_valid || i->read_index_corrupt); */
-
+
o->stream->timing_info_valid = 0;
i->write_index_corrupt = 0;
i->read_index_corrupt = 0;
@@ -777,21 +777,21 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command,
!pa_tagstruct_eof(t)) {
pa_context_fail(o->context, PA_ERR_PROTOCOL);
goto finish;
-
+
} else {
o->stream->timing_info_valid = 1;
pa_gettimeofday(&now);
-
+
/* Calculcate timestamps */
if (pa_timeval_cmp(&local, &remote) <= 0 && pa_timeval_cmp(&remote, &now) <= 0) {
/* local and remote seem to have synchronized clocks */
-
+
if (o->stream->direction == PA_STREAM_PLAYBACK)
i->transport_usec = pa_timeval_diff(&remote, &local);
else
i->transport_usec = pa_timeval_diff(&now, &remote);
-
+
i->synchronized_clocks = 1;
i->timestamp = remote;
} else {
@@ -816,7 +816,7 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command,
uint32_t ctag = tag;
/* Go through the saved correction values and add up the total correction.*/
-
+
for (n = 0, j = o->stream->current_write_index_correction+1;
n < PA_MAX_WRITE_INDEX_CORRECTIONS;
n++, j = (j + 1) % PA_MAX_WRITE_INDEX_CORRECTIONS) {
@@ -851,21 +851,21 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command,
if (!i->read_index_corrupt)
i->read_index -= pa_memblockq_get_length(o->stream->record_memblockq);
}
-
+
o->stream->cached_time_valid = 0;
}
o->stream->auto_timing_update_requested = 0;
/* pa_log("post corrupt w:%u r:%u\n", i->write_index_corrupt || !o->stream->timing_info_valid, i->read_index_corrupt || !o->stream->timing_info_valid); */
-
+
/* Clear old correction entries */
if (o->stream->direction == PA_STREAM_PLAYBACK) {
int n;
-
+
for (n = 0; n < PA_MAX_WRITE_INDEX_CORRECTIONS; n++) {
if (!o->stream->write_index_corrections[n].valid)
continue;
-
+
if (o->stream->write_index_corrections[n].tag <= tag)
o->stream->write_index_corrections[n].valid = 0;
}
@@ -873,12 +873,12 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command,
if (o->stream->latency_update_callback)
o->stream->latency_update_callback(o->stream, o->stream->latency_update_userdata);
-
+
if (o->callback && o->stream && o->stream->state == PA_STREAM_READY) {
pa_stream_success_cb_t cb = (pa_stream_success_cb_t) o->callback;
cb(o->stream, o->stream->timing_info_valid, o->userdata);
}
-
+
finish:
pa_operation_done(o);
@@ -891,29 +891,29 @@ pa_operation* pa_stream_update_timing_info(pa_stream *s, pa_stream_success_cb_t
pa_tagstruct *t;
struct timeval now;
int cidx = 0;
-
+
assert(s);
assert(s->ref >= 1);
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
-
+
if (s->direction == PA_STREAM_PLAYBACK) {
/* Find a place to store the write_index correction data for this entry */
cidx = (s->current_write_index_correction + 1) % PA_MAX_WRITE_INDEX_CORRECTIONS;
-
+
/* Check if we could allocate a correction slot. If not, there are too many outstanding queries */
PA_CHECK_VALIDITY_RETURN_NULL(s->context, !s->write_index_corrections[cidx].valid, PA_ERR_INTERNAL);
}
o = pa_operation_new(s->context, s, (pa_operation_cb_t) cb, userdata);
-
+
t = pa_tagstruct_command(
s->context,
s->direction == PA_STREAM_PLAYBACK ? PA_COMMAND_GET_PLAYBACK_LATENCY : PA_COMMAND_GET_RECORD_LATENCY,
&tag);
pa_tagstruct_putu32(t, s->channel);
pa_tagstruct_put_timeval(t, pa_gettimeofday(&now));
-
+
pa_pstream_send_tagstruct(s->context->pstream, t);
pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, stream_get_timing_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
@@ -926,15 +926,15 @@ pa_operation* pa_stream_update_timing_info(pa_stream *s, pa_stream_success_cb_t
o->stream->write_index_corrections[cidx].value = 0;
o->stream->write_index_corrections[cidx].corrupt = 0;
}
-
+
/* pa_log("requesting update %u\n", tag); */
-
+
return o;
}
void pa_stream_disconnect_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) {
pa_stream *s = userdata;
-
+
assert(pd);
assert(s);
assert(s->ref >= 1);
@@ -961,7 +961,7 @@ finish:
int pa_stream_disconnect(pa_stream *s) {
pa_tagstruct *t;
uint32_t tag;
-
+
assert(s);
assert(s->ref >= 1);
@@ -1010,7 +1010,7 @@ void pa_stream_set_state_callback(pa_stream *s, pa_stream_notify_cb_t cb, void *
void pa_stream_set_overflow_callback(pa_stream *s, pa_stream_notify_cb_t cb, void *userdata) {
assert(s);
assert(s->ref >= 1);
-
+
s->overflow_callback = cb;
s->overflow_userdata = userdata;
}
@@ -1018,7 +1018,7 @@ void pa_stream_set_overflow_callback(pa_stream *s, pa_stream_notify_cb_t cb, voi
void pa_stream_set_underflow_callback(pa_stream *s, pa_stream_notify_cb_t cb, void *userdata) {
assert(s);
assert(s->ref >= 1);
-
+
s->underflow_callback = cb;
s->underflow_userdata = userdata;
}
@@ -1026,7 +1026,7 @@ void pa_stream_set_underflow_callback(pa_stream *s, pa_stream_notify_cb_t cb, vo
void pa_stream_set_latency_update_callback(pa_stream *s, pa_stream_notify_cb_t cb, void *userdata) {
assert(s);
assert(s->ref >= 1);
-
+
s->latency_update_callback = cb;
s->latency_update_userdata = userdata;
}
@@ -1034,14 +1034,14 @@ void pa_stream_set_latency_update_callback(pa_stream *s, pa_stream_notify_cb_t c
void pa_stream_simple_ack_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) {
pa_operation *o = userdata;
int success = 1;
-
+
assert(pd);
assert(o);
assert(o->ref >= 1);
if (!o->context)
goto finish;
-
+
if (command != PA_COMMAND_REPLY) {
if (pa_context_handle_error(o->context, command, t) < 0)
goto finish;
@@ -1066,15 +1066,15 @@ pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, voi
pa_operation *o;
pa_tagstruct *t;
uint32_t tag;
-
+
assert(s);
assert(s->ref >= 1);
-
+
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
s->corked = b;
-
+
o = pa_operation_new(s->context, s, (pa_operation_cb_t) cb, userdata);
t = pa_tagstruct_command(
@@ -1096,12 +1096,12 @@ static pa_operation* stream_send_simple_command(pa_stream *s, uint32_t command,
pa_tagstruct *t;
pa_operation *o;
uint32_t tag;
-
+
assert(s);
assert(s->ref >= 1);
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
-
+
o = pa_operation_new(s->context, s, (pa_operation_cb_t) cb, userdata);
t = pa_tagstruct_command(s->context, command, &tag);
@@ -1114,26 +1114,26 @@ static pa_operation* stream_send_simple_command(pa_stream *s, uint32_t command,
pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *userdata) {
pa_operation *o;
-
+
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
-
+
if ((o = stream_send_simple_command(s, s->direction == PA_STREAM_PLAYBACK ? PA_COMMAND_FLUSH_PLAYBACK_STREAM : PA_COMMAND_FLUSH_RECORD_STREAM, cb, userdata))) {
if (s->direction == PA_STREAM_PLAYBACK) {
if (s->write_index_corrections[s->current_write_index_correction].valid)
s->write_index_corrections[s->current_write_index_correction].corrupt = 1;
-
+
if (s->timing_info_valid)
s->timing_info.write_index_corrupt = 1;
- if (s->buffer_attr.prebuf > 0)
+ if (s->buffer_attr.prebuf > 0)
invalidate_indexes(s, 1, 0);
else
request_auto_timing_update(s, 1);
} else
invalidate_indexes(s, 0, 1);
}
-
+
return o;
}
@@ -1151,13 +1151,13 @@ pa_operation* pa_stream_prebuf(pa_stream *s, pa_stream_success_cb_t cb, void *us
pa_operation* pa_stream_trigger(pa_stream *s, pa_stream_success_cb_t cb, void *userdata) {
pa_operation *o;
-
+
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction == PA_STREAM_PLAYBACK, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->buffer_attr.prebuf > 0, PA_ERR_BADSTATE);
if ((o = stream_send_simple_command(s, PA_COMMAND_TRIGGER_PLAYBACK_STREAM, cb, userdata)))
invalidate_indexes(s, 1, 0);
-
+
return o;
}
@@ -1165,7 +1165,7 @@ pa_operation* pa_stream_set_name(pa_stream *s, const char *name, pa_stream_succe
pa_operation *o;
pa_tagstruct *t;
uint32_t tag;
-
+
assert(s);
assert(s->ref >= 1);
assert(name);
@@ -1213,7 +1213,7 @@ int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec) {
* to us, we assume that the real output time is actually
* a little ahead */
usec += s->timing_info.transport_usec;
-
+
/* However, the output device usually maintains a buffer
too, hence the real sample currently played is a little
back */
@@ -1222,7 +1222,7 @@ int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec) {
else
usec -= s->timing_info.sink_usec;
}
-
+
} else if (s->direction == PA_STREAM_RECORD) {
/* The last byte written into the server side queue had
* this time value associated */
@@ -1231,10 +1231,10 @@ int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec) {
if (!s->corked) {
/* Add transport latency */
usec += s->timing_info.transport_usec;
-
+
/* Add latency of data in device buffer */
usec += s->timing_info.source_usec;
-
+
/* If this is a monitor source, we need to correct the
* time by the playback device buffer */
if (s->timing_info.sink_usec >= usec)
@@ -1269,18 +1269,18 @@ int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec) {
if (r_usec)
*r_usec = usec;
-
+
return 0;
}
static pa_usec_t time_counter_diff(pa_stream *s, pa_usec_t a, pa_usec_t b, int *negative) {
assert(s);
assert(s->ref >= 1);
-
+
if (negative)
*negative = 0;
- if (a >= b)
+ if (a >= b)
return a-b;
else {
if (negative && s->direction == PA_STREAM_RECORD) {
@@ -1305,7 +1305,7 @@ int pa_stream_get_latency(pa_stream *s, pa_usec_t *r_usec, int *negative) {
PA_CHECK_VALIDITY(s->context, s->timing_info_valid, PA_ERR_NODATA);
PA_CHECK_VALIDITY(s->context, s->direction != PA_STREAM_PLAYBACK || !s->timing_info.write_index_corrupt, PA_ERR_NODATA);
PA_CHECK_VALIDITY(s->context, s->direction != PA_STREAM_RECORD || !s->timing_info.read_index_corrupt, PA_ERR_NODATA);
-
+
if ((r = pa_stream_get_time(s, &t)) < 0)
return r;
@@ -1316,7 +1316,7 @@ int pa_stream_get_latency(pa_stream *s, pa_usec_t *r_usec, int *negative) {
if (cindex < 0)
cindex = 0;
-
+
c = pa_bytes_to_usec(cindex, &s->sample_spec);
if (s->direction == PA_STREAM_PLAYBACK)
diff --git a/src/pulse/stream.h b/src/pulse/stream.h
index ad15125a..2ce53458 100644
--- a/src/pulse/stream.h
+++ b/src/pulse/stream.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -113,7 +113,7 @@
* read index may be larger than the write index, in which case
* silence is played. If the application writes data to indexes lower
* than the read index, the data is immediately lost.
- *
+ *
* \section transfer_sec Transferring Data
*
* Once the stream is up, data can start flowing between the client and the
@@ -159,13 +159,13 @@
* \li PA_SEEK_ABSOLUTE - seek relative to the beginning of the playback buffer, (i.e. the first that was ever played in the stream)
* \li PA_SEEK_RELATIVE_ON_READ - seek relative to the current read index. Use this to write data to the output buffer that should be played as soon as possible
* \li PA_SEEK_RELATIVE_END - seek relative to the last byte ever written.
- *
+ *
* If an application just wants to append some data to the output
* buffer, PA_SEEK_RELATIVE and an offset of 0 should be used.
*
* After a call to pa_stream_write() the write index will be left at
* the position right after the last byte of the written data.
- *
+ *
* \section latency_sec Latency
*
* A major problem with networked audio is the increased latency caused by
@@ -217,7 +217,7 @@
* this option with PA_STREAM_AUTO_TIMING_UPDATE, which will enable
* you to monitor the current playback time/latency very precisely and
* very frequently without requiring a network round trip every time.
- *
+ *
* \section flow_sec Overflow and underflow
*
* Even with the best precautions, buffers will sometime over - or
@@ -275,7 +275,7 @@ typedef void (*pa_stream_notify_cb_t)(pa_stream *p, void *userdata);
/** Create a new, unconnected stream with the specified name and sample type */
pa_stream* pa_stream_new(
- pa_context *c /**< The context to create this stream in */,
+ pa_context *c /**< The context to create this stream in */,
const char *name /**< A name for this stream */,
const pa_sample_spec *ss /**< The desired sample format */,
const pa_channel_map *map /**< The desired channel map, or NULL for default */);
@@ -320,7 +320,7 @@ int pa_stream_disconnect(pa_stream *s);
* is not copied. If NULL, the data is copied into an internal
* buffer. The client my freely seek around in the output buffer. For
* most applications passing 0 and PA_SEEK_RELATIVE as arguments for
- * offset and seek should be useful.*/
+ * offset and seek should be useful.*/
int pa_stream_write(
pa_stream *p /**< The stream to use */,
const void *data /**< The data to write */,
@@ -333,7 +333,7 @@ int pa_stream_write(
* data will point to the actual data and length will contain the size
* of the data in bytes (which can be less than a complete framgnet).
* Use pa_stream_drop() to actually remove the data from the
- * buffer. If no data is available will return a NULL pointer \since 0.8 */
+ * buffer. If no data is available will return a NULL pointer \since 0.8 */
int pa_stream_peek(
pa_stream *p /**< The stream to use */,
const void **data /**< Pointer to pointer that will point to data */,
diff --git a/src/pulse/subscribe.c b/src/pulse/subscribe.c
index c1d88912..d9abf6f8 100644
--- a/src/pulse/subscribe.c
+++ b/src/pulse/subscribe.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -69,7 +69,7 @@ pa_operation* pa_context_subscribe(pa_context *c, pa_subscription_mask_t m, pa_c
assert(c->ref >= 1);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
-
+
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
t = pa_tagstruct_command(c, PA_COMMAND_SUBSCRIBE, &tag);
@@ -83,7 +83,7 @@ pa_operation* pa_context_subscribe(pa_context *c, pa_subscription_mask_t m, pa_c
void pa_context_set_subscribe_callback(pa_context *c, pa_context_subscribe_cb_t cb, void *userdata) {
assert(c);
assert(c->ref >= 1);
-
+
c->subscribe_callback = cb;
c->subscribe_userdata = userdata;
}
diff --git a/src/pulse/subscribe.h b/src/pulse/subscribe.h
index adbea680..35d5a31c 100644
--- a/src/pulse/subscribe.h
+++ b/src/pulse/subscribe.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/thread-mainloop.c b/src/pulse/thread-mainloop.c
index 7e1ccfaa..ad29f5ba 100644
--- a/src/pulse/thread-mainloop.c
+++ b/src/pulse/thread-mainloop.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -128,7 +128,7 @@ void pa_threaded_mainloop_free(pa_threaded_mainloop* m) {
pa_mutex_free(m->mutex);
pa_cond_free(m->cond);
pa_cond_free(m->accept_cond);
-
+
pa_xfree(m);
}
@@ -161,7 +161,7 @@ void pa_threaded_mainloop_stop(pa_threaded_mainloop *m) {
void pa_threaded_mainloop_lock(pa_threaded_mainloop *m) {
assert(m);
-
+
/* Make sure that this function is not called from the helper thread */
assert(!m->thread || !pa_thread_is_running(m->thread) || !in_worker(m));
@@ -170,7 +170,7 @@ void pa_threaded_mainloop_lock(pa_threaded_mainloop *m) {
void pa_threaded_mainloop_unlock(pa_threaded_mainloop *m) {
assert(m);
-
+
/* Make sure that this function is not called from the helper thread */
assert(!m->thread || !pa_thread_is_running(m->thread) || !in_worker(m));
@@ -188,7 +188,7 @@ void pa_threaded_mainloop_signal(pa_threaded_mainloop *m, int wait_for_accept) {
void pa_threaded_mainloop_wait(pa_threaded_mainloop *m) {
assert(m);
-
+
/* Make sure that this function is not called from the helper thread */
assert(!m->thread || !pa_thread_is_running(m->thread) || !in_worker(m));
@@ -202,7 +202,7 @@ void pa_threaded_mainloop_wait(pa_threaded_mainloop *m) {
void pa_threaded_mainloop_accept(pa_threaded_mainloop *m) {
assert(m);
-
+
/* Make sure that this function is not called from the helper thread */
assert(!m->thread || !pa_thread_is_running(m->thread) || !in_worker(m));
diff --git a/src/pulse/thread-mainloop.h b/src/pulse/thread-mainloop.h
index 44eff5a3..48048b35 100644
--- a/src/pulse/thread-mainloop.h
+++ b/src/pulse/thread-mainloop.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -149,7 +149,7 @@ PA_C_DECL_BEGIN
* deal with that.
*
* The functions will not dead lock because the wait function will release
- * the lock before waiting and then regrab it once it has been signaled.
+ * the lock before waiting and then regrab it once it has been signaled.
* For those of you familiar with threads, the behaviour is that of a
* condition variable.
*
@@ -229,7 +229,7 @@ PA_C_DECL_BEGIN
*/
/** \file
- *
+ *
* A thread based event loop implementation based on pa_mainloop. The
* event loop is run in a helper thread in the background. A few
* synchronization primitives are available to access the objects
diff --git a/src/pulse/timeval.c b/src/pulse/timeval.c
index 11285230..e5a86a63 100644
--- a/src/pulse/timeval.c
+++ b/src/pulse/timeval.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -38,7 +38,7 @@
struct timeval *pa_gettimeofday(struct timeval *tv) {
#ifdef HAVE_GETTIMEOFDAY
assert(tv);
-
+
return gettimeofday(tv, NULL) < 0 ? NULL : tv;
#elif defined(OS_IS_WIN32)
/*
@@ -118,14 +118,14 @@ int pa_timeval_cmp(const struct timeval *a, const struct timeval *b) {
pa_usec_t pa_timeval_age(const struct timeval *tv) {
struct timeval now;
assert(tv);
-
+
return pa_timeval_diff(pa_gettimeofday(&now), tv);
}
struct timeval* pa_timeval_add(struct timeval *tv, pa_usec_t v) {
unsigned long secs;
assert(tv);
-
+
secs = (v/1000000);
tv->tv_sec += (unsigned long) secs;
v -= secs*1000000;
diff --git a/src/pulse/timeval.h b/src/pulse/timeval.h
index e2dbbadb..c10ec9f6 100644
--- a/src/pulse/timeval.h
+++ b/src/pulse/timeval.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/utf8.c b/src/pulse/utf8.c
index 33fa7214..2708c518 100644
--- a/src/pulse/utf8.c
+++ b/src/pulse/utf8.c
@@ -130,7 +130,7 @@ ONE_REMAINING:
if (o)
o++;
-
+
continue;
error:
diff --git a/src/pulse/utf8.h b/src/pulse/utf8.h
index 2eac724d..7225471f 100644
--- a/src/pulse/utf8.h
+++ b/src/pulse/utf8.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/util.c b/src/pulse/util.c
index c13951da..63f54e3b 100644
--- a/src/pulse/util.c
+++ b/src/pulse/util.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -79,7 +79,7 @@ char *pa_get_user_name(char *s, size_t l) {
if (!(p = getenv("USER")) && !(p = getenv("LOGNAME")) && !(p = getenv("USERNAME"))) {
#ifdef HAVE_PWD_H
-
+
#ifdef HAVE_GETPWUID_R
if (getpwuid_r(getuid(), &pw, buf, sizeof(buf), &r) != 0 || !r) {
#else
@@ -90,7 +90,7 @@ char *pa_get_user_name(char *s, size_t l) {
snprintf(s, l, "%lu", (unsigned long) getuid());
return s;
}
-
+
p = r->pw_name;
#elif defined(OS_IS_WIN32) /* HAVE_PWD_H */
@@ -162,26 +162,26 @@ char *pa_get_binary_name(char *s, size_t l) {
#if defined(OS_IS_WIN32)
{
char path[PATH_MAX];
-
+
if (GetModuleFileName(NULL, path, PATH_MAX))
return pa_strlcpy(s, pa_path_get_filename(path), l);
}
#endif
-
+
#ifdef HAVE_READLINK
{
int i;
char path[PATH_MAX];
/* This works on Linux only */
-
+
if ((i = readlink("/proc/self/exe", path, sizeof(path)-1)) >= 0) {
path[i] = 0;
return pa_strlcpy(s, pa_path_get_filename(path), l);
}
}
-
+
#endif
-
+
#if defined(HAVE_SYS_PRCTL_H) && defined(PR_GET_NAME)
{
@@ -192,14 +192,14 @@ char *pa_get_binary_name(char *s, size_t l) {
char tcomm[TASK_COMM_LEN+1];
memset(tcomm, 0, sizeof(tcomm));
-
+
/* This works on Linux only */
if (prctl(PR_GET_NAME, (unsigned long) tcomm, 0, 0, 0) == 0)
return pa_strlcpy(s, tcomm, l);
-
+
}
#endif
-
+
return NULL;
}
@@ -214,7 +214,7 @@ const char *pa_path_get_filename(const char *p) {
char *pa_get_fqdn(char *s, size_t l) {
char hn[256];
-#ifdef HAVE_GETADDRINFO
+#ifdef HAVE_GETADDRINFO
struct addrinfo *a, hints;
#endif
@@ -225,7 +225,7 @@ char *pa_get_fqdn(char *s, size_t l) {
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_flags = AI_CANONNAME;
-
+
if (getaddrinfo(hn, NULL, &hints, &a) < 0 || !a || !a->ai_canonname || !*a->ai_canonname)
return pa_strlcpy(s, hn, l);
diff --git a/src/pulse/util.h b/src/pulse/util.h
index 5c03b0a9..0be169fb 100644
--- a/src/pulse/util.h
+++ b/src/pulse/util.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index 530814e0..aa7ddba2 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -36,7 +36,7 @@ int pa_cvolume_equal(const pa_cvolume *a, const pa_cvolume *b) {
if (a->channels != b->channels)
return 0;
-
+
for (i = 0; i < a->channels; i++)
if (a->values[i] != b->values[i])
return 0;
@@ -46,7 +46,7 @@ int pa_cvolume_equal(const pa_cvolume *a, const pa_cvolume *b) {
pa_cvolume* pa_cvolume_set(pa_cvolume *a, unsigned channels, pa_volume_t v) {
int i;
-
+
assert(a);
assert(channels > 0);
assert(channels <= PA_CHANNELS_MAX);
@@ -115,7 +115,7 @@ char *pa_cvolume_snprint(char *s, size_t l, const pa_cvolume *c) {
unsigned channel;
int first = 1;
char *e;
-
+
assert(s);
assert(l > 0);
assert(c);
@@ -149,7 +149,7 @@ int pa_cvolume_channels_equal_to(const pa_cvolume *a, pa_volume_t v) {
pa_cvolume *pa_sw_cvolume_multiply(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b) {
unsigned i;
-
+
assert(dest);
assert(a);
assert(b);
diff --git a/src/pulse/volume.h b/src/pulse/volume.h
index 6c60223a..62d2867a 100644
--- a/src/pulse/volume.h
+++ b/src/pulse/volume.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulse/xmalloc.c b/src/pulse/xmalloc.c
index 36755166..dda42bdc 100644
--- a/src/pulse/xmalloc.c
+++ b/src/pulse/xmalloc.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -60,10 +60,10 @@ void* pa_xmalloc(size_t size) {
void *p;
assert(size > 0);
assert(size < MAX_ALLOC_SIZE);
-
+
if (!(p = malloc(size)))
oom();
-
+
return p;
}
@@ -71,18 +71,18 @@ void* pa_xmalloc0(size_t size) {
void *p;
assert(size > 0);
assert(size < MAX_ALLOC_SIZE);
-
+
if (!(p = calloc(1, size)))
oom();
-
+
return p;
}
-
+
void *pa_xrealloc(void *ptr, size_t size) {
void *p;
assert(size > 0);
assert(size < MAX_ALLOC_SIZE);
-
+
if (!(p = realloc(ptr, size)))
oom();
return p;
@@ -107,7 +107,7 @@ char *pa_xstrdup(const char *s) {
char *pa_xstrndup(const char *s, size_t l) {
char *e, *r;
-
+
if (!s)
return NULL;
diff --git a/src/pulse/xmalloc.h b/src/pulse/xmalloc.h
index 126c495c..2fb1c5f0 100644
--- a/src/pulse/xmalloc.h
+++ b/src/pulse/xmalloc.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/anotify.c b/src/pulsecore/anotify.c
index a61f8442..c89d4a15 100644
--- a/src/pulsecore/anotify.c
+++ b/src/pulsecore/anotify.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -48,7 +48,7 @@ struct pa_anotify {
static void dispatch_event(pa_anotify *a) {
assert(a);
assert(a->queue_index < a->n_queued_events);
-
+
a->callback(a->queued_events[a->queue_index++], a->userdata);
if (a->queue_index >= a->n_queued_events) {
@@ -69,14 +69,14 @@ static void io_callback(
int fd,
pa_io_event_flags_t events,
void *userdata) {
-
+
pa_anotify *a = userdata;
ssize_t r;
assert(a);
assert(events == PA_IO_EVENT_INPUT);
assert(a->n_queued_events == 0);
-
+
r = read(fd, a->queued_events, sizeof(a->queued_events));
assert(r > 0);
@@ -96,7 +96,7 @@ static void defer_callback(pa_mainloop_api *api, pa_defer_event *e, void *userda
pa_anotify *pa_anotify_new(pa_mainloop_api*api, pa_anotify_cb_t cb, void *userdata) {
pa_anotify *a;
-
+
assert(api);
assert(cb);
@@ -106,7 +106,7 @@ pa_anotify *pa_anotify_new(pa_mainloop_api*api, pa_anotify_cb_t cb, void *userda
pa_xfree(a);
return NULL;
}
-
+
a->api = api;
a->callback = cb;
a->userdata = userdata;
@@ -130,7 +130,7 @@ void pa_anotify_free(pa_anotify *a) {
close(a->fds[0]);
if (a->fds[1] >= 0)
close(a->fds[1]);
-
+
pa_xfree(a);
}
diff --git a/src/pulsecore/anotify.h b/src/pulsecore/anotify.h
index 44e942f7..b91e6875 100644
--- a/src/pulsecore/anotify.h
+++ b/src/pulsecore/anotify.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/atomic.h b/src/pulsecore/atomic.h
index 8d608b5b..e713e7a8 100644
--- a/src/pulsecore/atomic.h
+++ b/src/pulsecore/atomic.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/authkey-prop.c b/src/pulsecore/authkey-prop.c
index 7eda1e49..f3a81179 100644
--- a/src/pulsecore/authkey-prop.c
+++ b/src/pulsecore/authkey-prop.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -37,7 +37,7 @@ struct authkey_data {
int pa_authkey_prop_get(pa_core *c, const char *name, void *data, size_t len) {
struct authkey_data *a;
assert(c && name && data && len > 0);
-
+
if (!(a = pa_property_get(c, name)))
return -1;
@@ -59,7 +59,7 @@ int pa_authkey_prop_put(pa_core *c, const char *name, const void *data, size_t l
memcpy(a+1, data, len);
pa_property_set(c, name, a);
-
+
return 0;
}
diff --git a/src/pulsecore/authkey-prop.h b/src/pulsecore/authkey-prop.h
index b1da28be..fb777f85 100644
--- a/src/pulsecore/authkey-prop.h
+++ b/src/pulsecore/authkey-prop.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/authkey.c b/src/pulsecore/authkey.c
index 87631ca5..8ef53bd8 100644
--- a/src/pulsecore/authkey.c
+++ b/src/pulsecore/authkey.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -91,25 +91,25 @@ static int load(const char *fn, void *data, size_t length) {
if ((size_t) r != length) {
pa_log_debug("got %d bytes from cookie file '%s', expected %d", (int)r, fn, (int)length);
-
+
if (!writable) {
pa_log("unable to write cookie to read only file");
goto finish;
}
-
+
if (generate(fd, data, length) < 0)
goto finish;
}
ret = 0;
-
+
finish:
if (fd >= 0) {
-
+
if (unlock)
pa_lock_fd(fd, 0);
-
+
close(fd);
}
@@ -144,7 +144,7 @@ static const char *normalize_path(const char *fn, char *s, size_t l) {
char homedir[PATH_MAX];
if (!pa_get_home_dir(homedir, sizeof(homedir)))
return NULL;
-
+
#ifndef OS_IS_WIN32
snprintf(s, l, "%s/%s", homedir, fn);
#else
@@ -165,7 +165,7 @@ int pa_authkey_load_auto(const char *fn, void *data, size_t length) {
if (!(p = normalize_path(fn, path, sizeof(path))))
return -2;
-
+
return pa_authkey_load(p, data, length);
}
@@ -194,14 +194,14 @@ int pa_authkey_save(const char *fn, const void *data, size_t length) {
}
ret = 0;
-
+
finish:
if (fd >= 0) {
-
+
if (unlock)
pa_lock_fd(fd, 0);
-
+
close(fd);
}
diff --git a/src/pulsecore/authkey.h b/src/pulsecore/authkey.h
index cc8a565c..bba0bc73 100644
--- a/src/pulsecore/authkey.h
+++ b/src/pulsecore/authkey.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/autoload.c b/src/pulsecore/autoload.c
index 60304201..b68eaac7 100644
--- a/src/pulsecore/autoload.c
+++ b/src/pulsecore/autoload.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -58,20 +58,20 @@ static void entry_remove_and_free(pa_autoload_entry *e) {
static pa_autoload_entry* entry_new(pa_core *c, const char *name) {
pa_autoload_entry *e = NULL;
assert(c && name);
-
+
if (c->autoload_hashmap && (e = pa_hashmap_get(c->autoload_hashmap, name)))
return NULL;
-
+
e = pa_xmalloc(sizeof(pa_autoload_entry));
e->core = c;
e->name = pa_xstrdup(name);
e->module = e->argument = NULL;
e->in_action = 0;
-
+
if (!c->autoload_hashmap)
c->autoload_hashmap = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
assert(c->autoload_hashmap);
-
+
pa_hashmap_put(c->autoload_hashmap, e->name, e);
if (!c->autoload_idxset)
@@ -79,24 +79,24 @@ static pa_autoload_entry* entry_new(pa_core *c, const char *name) {
pa_idxset_put(c->autoload_idxset, e, &e->index);
pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_AUTOLOAD|PA_SUBSCRIPTION_EVENT_NEW, e->index);
-
+
return e;
}
int pa_autoload_add(pa_core *c, const char*name, pa_namereg_type_t type, const char*module, const char *argument, uint32_t *idx) {
pa_autoload_entry *e = NULL;
assert(c && name && module && (type == PA_NAMEREG_SINK || type == PA_NAMEREG_SOURCE));
-
+
if (!(e = entry_new(c, name)))
return -1;
-
+
e->module = pa_xstrdup(module);
e->argument = pa_xstrdup(argument);
e->type = type;
if (idx)
*idx = e->index;
-
+
return 0;
}
@@ -139,7 +139,7 @@ void pa_autoload_request(pa_core *c, const char *name, pa_namereg_type_t type) {
if ((m = pa_module_load(c, e->module, e->argument)))
m->auto_unload = 1;
}
-
+
e->in_action = 0;
}
@@ -154,7 +154,7 @@ void pa_autoload_free(pa_core *c) {
pa_hashmap_free(c->autoload_hashmap, free_func, NULL);
c->autoload_hashmap = NULL;
}
-
+
if (c->autoload_idxset) {
pa_idxset_free(c->autoload_idxset, NULL, NULL);
c->autoload_idxset = NULL;
@@ -164,7 +164,7 @@ void pa_autoload_free(pa_core *c) {
const pa_autoload_entry* pa_autoload_get_by_name(pa_core *c, const char*name, pa_namereg_type_t type) {
pa_autoload_entry *e;
assert(c && name);
-
+
if (!c->autoload_hashmap || !(e = pa_hashmap_get(c->autoload_hashmap, name)) || e->type != type)
return NULL;
@@ -174,7 +174,7 @@ const pa_autoload_entry* pa_autoload_get_by_name(pa_core *c, const char*name, pa
const pa_autoload_entry* pa_autoload_get_by_index(pa_core *c, uint32_t idx) {
pa_autoload_entry *e;
assert(c && idx != PA_IDXSET_INVALID);
-
+
if (!c->autoload_idxset || !(e = pa_idxset_get_by_index(c->autoload_idxset, idx)))
return NULL;
diff --git a/src/pulsecore/autoload.h b/src/pulsecore/autoload.h
index 65bdd6da..f410e49c 100644
--- a/src/pulsecore/autoload.h
+++ b/src/pulsecore/autoload.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -36,7 +36,7 @@ typedef struct pa_autoload_entry {
char *name;
pa_namereg_type_t type; /* Type of the autoload entry */
int in_action; /* Currently loaded */
- char *module, *argument;
+ char *module, *argument;
} pa_autoload_entry;
/* Add a new autoload entry of the given time, with the speicified
diff --git a/src/pulsecore/avahi-wrap.c b/src/pulsecore/avahi-wrap.c
index 80256a12..bcda9954 100644
--- a/src/pulsecore/avahi-wrap.c
+++ b/src/pulsecore/avahi-wrap.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -58,7 +58,7 @@ static pa_io_event_flags_t translate_io_flags(AvahiWatchEvent e) {
static void watch_callback(pa_mainloop_api*a, pa_io_event* e, int fd, pa_io_event_flags_t events, void *userdata) {
AvahiWatch *w = userdata;
-
+
assert(a);
assert(e);
assert(w);
@@ -75,7 +75,7 @@ static AvahiWatch* watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent event
assert(api);
assert(fd >= 0);
assert(callback);
-
+
p = api->userdata;
assert(p);
@@ -88,19 +88,19 @@ static AvahiWatch* watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent event
return w;
}
-
+
static void watch_update(AvahiWatch *w, AvahiWatchEvent event) {
assert(w);
w->avahi_poll->mainloop->io_enable(w->io_event, translate_io_flags(event));
}
-
+
static AvahiWatchEvent watch_get_events(AvahiWatch *w) {
assert(w);
return w->current_event;
}
-
+
static void watch_free(AvahiWatch *w) {
assert(w);
@@ -117,7 +117,7 @@ struct AvahiTimeout {
static void timeout_callback(pa_mainloop_api*a, pa_time_event* e, const struct timeval *tv, void *userdata) {
AvahiTimeout *t = userdata;
-
+
assert(a);
assert(e);
assert(t);
@@ -131,7 +131,7 @@ static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv,
assert(api);
assert(callback);
-
+
p = api->userdata;
assert(p);
@@ -139,12 +139,12 @@ static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv,
t->avahi_poll = p;
t->callback = callback;
t->userdata = userdata;
-
+
t->time_event = tv ? p->mainloop->time_new(p->mainloop, tv, timeout_callback, t) : NULL;
return t;
}
-
+
static void timeout_update(AvahiTimeout *t, const struct timeval *tv) {
assert(t);
@@ -157,7 +157,7 @@ static void timeout_update(AvahiTimeout *t, const struct timeval *tv) {
t->time_event = NULL;
}
}
-
+
static void timeout_free(AvahiTimeout *t) {
assert(t);
@@ -170,9 +170,9 @@ AvahiPoll* pa_avahi_poll_new(pa_mainloop_api *m) {
pa_avahi_poll *p;
assert(m);
-
+
p = pa_xnew(pa_avahi_poll, 1);
-
+
p->api.userdata = p;
p->api.watch_new = watch_new;
p->api.watch_update = watch_update;
@@ -182,7 +182,7 @@ AvahiPoll* pa_avahi_poll_new(pa_mainloop_api *m) {
p->api.timeout_update = timeout_update;
p->api.timeout_free = timeout_free;
p->mainloop = m;
-
+
return &p->api;
}
@@ -191,7 +191,7 @@ void pa_avahi_poll_free(AvahiPoll *api) {
assert(api);
p = api->userdata;
assert(p);
-
+
pa_xfree(p);
}
diff --git a/src/pulsecore/avahi-wrap.h b/src/pulsecore/avahi-wrap.h
index d868fed4..bb8f5716 100644
--- a/src/pulsecore/avahi-wrap.h
+++ b/src/pulsecore/avahi-wrap.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index ae475c3a..cb438a22 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -172,7 +172,7 @@ static int pa_cli_command_help(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
assert(c && t && buf);
pa_strbuf_puts(buf, "Available commands:\n");
-
+
for (command = commands; command->name; command++)
if (command->help)
pa_strbuf_printf(buf, " %-25s %s\n", command->name, command->help);
@@ -252,12 +252,12 @@ static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
[PA_MEMBLOCK_FIXED] = "FIXED",
[PA_MEMBLOCK_IMPORTED] = "IMPORTED",
};
-
+
assert(c);
assert(t);
stat = pa_mempool_get_stat(c->mempool);
-
+
pa_strbuf_printf(buf, "Memory blocks currently allocated: %u, size: %s.\n",
(unsigned) AO_load_acquire_read((AO_t*) &stat->n_allocated),
pa_bytes_snprint(s, sizeof(s), (size_t) AO_load_acquire_read((AO_t*) &stat->allocated_size)));
@@ -291,7 +291,7 @@ static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
type_table[k],
(unsigned) AO_load_acquire_read(&stat->n_allocated_by_type[k]),
(unsigned) AO_load_acquire_read(&stat->n_accumulated_by_type[k]));
-
+
return 0;
}
@@ -318,7 +318,7 @@ static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
pa_strbuf_puts(buf, "You need to specify the module name and optionally arguments.\n");
return -1;
}
-
+
if (!(m = pa_module_load(c, name, pa_tokenizer_get(t, 2)))) {
pa_strbuf_puts(buf, "Module load failed.\n");
return -1;
@@ -724,14 +724,14 @@ static int pa_cli_command_autoload_add(pa_core *c, pa_tokenizer *t, pa_strbuf *b
}
pa_autoload_add(c, a, strstr(pa_tokenizer_get(t, 0), "sink") ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE, b, pa_tokenizer_get(t, 3), NULL);
-
+
return 0;
}
static int pa_cli_command_autoload_remove(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
const char *name;
assert(c && t && buf && fail);
-
+
if (!(name = pa_tokenizer_get(t, 1))) {
pa_strbuf_puts(buf, "You need to specify a device name\n");
return -1;
@@ -742,7 +742,7 @@ static int pa_cli_command_autoload_remove(pa_core *c, pa_tokenizer *t, pa_strbuf
return -1;
}
- return 0;
+ return 0;
}
static int pa_cli_command_autoload_list(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
@@ -766,7 +766,7 @@ static int pa_cli_command_vacuum(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, in
assert(t);
pa_mempool_vacuum(c->mempool);
-
+
return 0;
}
@@ -857,7 +857,7 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
time_t now;
void *i;
pa_autoload_entry *a;
-
+
assert(c && t);
time(&now);
@@ -868,7 +868,7 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
pa_strbuf_printf(buf, "### Configuration dump generated at %s\n", ctime(&now));
#endif
-
+
for (m = pa_idxset_first(c->modules, &idx); m; m = pa_idxset_next(c->modules, &idx)) {
if (m->auto_unload)
continue;
@@ -912,7 +912,7 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
if (c->autoload_hashmap) {
nl = 0;
-
+
i = NULL;
while ((a = pa_hashmap_iterate(c->autoload_hashmap, &i, NULL))) {
@@ -920,18 +920,18 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
pa_strbuf_puts(buf, "\n");
nl = 1;
}
-
+
pa_strbuf_printf(buf, "add-autoload-%s %s %s", a->type == PA_NAMEREG_SINK ? "sink" : "source", a->name, a->module);
-
+
if (a->argument)
pa_strbuf_printf(buf, " %s", a->argument);
-
+
pa_strbuf_puts(buf, "\n");
}
}
nl = 0;
-
+
if ((p = pa_namereg_get_default_sink_name(c))) {
if (!nl) {
pa_strbuf_puts(buf, "\n");
@@ -955,7 +955,7 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
int pa_cli_command_execute_line(pa_core *c, const char *s, pa_strbuf *buf, int *fail) {
const char *cs;
-
+
cs = s+strspn(s, whitespace);
if (*cs == '#' || !*cs)
@@ -983,10 +983,10 @@ int pa_cli_command_execute_line(pa_core *c, const char *s, pa_strbuf *buf, int *
const struct command*command;
int unknown = 1;
size_t l;
-
+
l = strcspn(cs, whitespace);
- for (command = commands; command->name; command++)
+ for (command = commands; command->name; command++)
if (strlen(command->name) == l && !strncmp(cs, command->name, l)) {
int ret;
pa_tokenizer *t = pa_tokenizer_new(cs, command->args);
@@ -997,7 +997,7 @@ int pa_cli_command_execute_line(pa_core *c, const char *s, pa_strbuf *buf, int *
if (ret < 0 && *fail)
return -1;
-
+
break;
}
@@ -1049,7 +1049,7 @@ int pa_cli_command_execute(pa_core *c, const char *s, pa_strbuf *buf, int *fail)
while (*p) {
size_t l = strcspn(p, linebreak);
char *line = pa_xstrndup(p, l);
-
+
if (pa_cli_command_execute_line(c, line, buf, fail) < 0&& *fail) {
pa_xfree(line);
return -1;
diff --git a/src/pulsecore/cli-command.h b/src/pulsecore/cli-command.h
index c56c3ca0..1594f4db 100644
--- a/src/pulsecore/cli-command.h
+++ b/src/pulsecore/cli-command.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c
index 49934c07..ac74a287 100644
--- a/src/pulsecore/cli-text.c
+++ b/src/pulsecore/cli-text.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -52,10 +52,10 @@ char *pa_module_list_to_string(pa_core *c) {
assert(s);
pa_strbuf_printf(s, "%u module(s) loaded.\n", pa_idxset_size(c->modules));
-
+
for (m = pa_idxset_first(c->modules, &idx); m; m = pa_idxset_next(c->modules, &idx))
pa_strbuf_printf(s, " index: %u\n\tname: <%s>\n\targument: <%s>\n\tused: %i\n\tauto unload: %s\n", m->index, m->name, m->argument, m->n_used, m->auto_unload ? "yes" : "no");
-
+
return pa_strbuf_tostring_free(s);
}
@@ -69,14 +69,14 @@ char *pa_client_list_to_string(pa_core *c) {
assert(s);
pa_strbuf_printf(s, "%u client(s) logged in.\n", pa_idxset_size(c->clients));
-
+
for (client = pa_idxset_first(c->clients, &idx); client; client = pa_idxset_next(c->clients, &idx)) {
pa_strbuf_printf(s, " index: %u\n\tname: <%s>\n\tdriver: <%s>\n", client->index, client->name, client->driver);
if (client->owner)
pa_strbuf_printf(s, "\towner module: <%u>\n", client->owner->index);
}
-
+
return pa_strbuf_tostring_free(s);
}
@@ -93,7 +93,7 @@ char *pa_sink_list_to_string(pa_core *c) {
for (sink = pa_idxset_first(c->sinks, &idx); sink; sink = pa_idxset_next(c->sinks, &idx)) {
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
-
+
pa_strbuf_printf(
s,
" %c index: %u\n"
@@ -118,7 +118,7 @@ char *pa_sink_list_to_string(pa_core *c) {
if (sink->description)
pa_strbuf_printf(s, "\tdescription: <%s>\n", sink->description);
}
-
+
return pa_strbuf_tostring_free(s);
}
@@ -135,8 +135,8 @@ char *pa_source_list_to_string(pa_core *c) {
for (source = pa_idxset_first(c->sources, &idx); source; source = pa_idxset_next(c->sources, &idx)) {
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
-
-
+
+
pa_strbuf_printf(
s,
" %c index: %u\n"
@@ -153,14 +153,14 @@ char *pa_source_list_to_string(pa_core *c) {
pa_sample_spec_snprint(ss, sizeof(ss), &source->sample_spec),
pa_channel_map_snprint(cm, sizeof(cm), &source->channel_map));
- if (source->monitor_of)
+ if (source->monitor_of)
pa_strbuf_printf(s, "\tmonitor_of: <%u>\n", source->monitor_of->index);
if (source->owner)
pa_strbuf_printf(s, "\towner module: <%u>\n", source->owner->index);
if (source->description)
pa_strbuf_printf(s, "\tdescription: <%s>\n", source->description);
}
-
+
return pa_strbuf_tostring_free(s);
}
@@ -183,9 +183,9 @@ char *pa_source_output_list_to_string(pa_core *c) {
for (o = pa_idxset_first(c->source_outputs, &idx); o; o = pa_idxset_next(c->source_outputs, &idx)) {
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
-
+
assert(o->source);
-
+
pa_strbuf_printf(
s,
" index: %u\n"
@@ -209,7 +209,7 @@ char *pa_source_output_list_to_string(pa_core *c) {
if (o->client)
pa_strbuf_printf(s, "\tclient: <%u> '%s'\n", o->client->index, o->client->name);
}
-
+
return pa_strbuf_tostring_free(s);
}
@@ -233,7 +233,7 @@ char *pa_sink_input_list_to_string(pa_core *c) {
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
assert(i->sink);
-
+
pa_strbuf_printf(
s,
" index: %u\n"
@@ -262,7 +262,7 @@ char *pa_sink_input_list_to_string(pa_core *c) {
if (i->client)
pa_strbuf_printf(s, "\tclient: <%u> '%s'\n", i->client->index, i->client->name);
}
-
+
return pa_strbuf_tostring_free(s);
}
@@ -282,13 +282,13 @@ char *pa_scache_list_to_string(pa_core *c) {
for (e = pa_idxset_first(c->scache, &idx); e; e = pa_idxset_next(c->scache, &idx)) {
double l = 0;
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX] = "n/a", cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX] = "n/a";
-
+
if (e->memchunk.memblock) {
pa_sample_spec_snprint(ss, sizeof(ss), &e->sample_spec);
pa_channel_map_snprint(cm, sizeof(cm), &e->channel_map);
l = (double) e->memchunk.length / pa_bytes_per_second(&e->sample_spec);
}
-
+
pa_strbuf_printf(
s,
" name: <%s>\n"
@@ -351,9 +351,9 @@ char *pa_full_status_string(pa_core *c) {
for (i = 0; i < 8; i++) {
char *t = NULL;
-
+
switch (i) {
- case 0:
+ case 0:
t = pa_sink_list_to_string(c);
break;
case 1:
@@ -365,7 +365,7 @@ char *pa_full_status_string(pa_core *c) {
case 3:
t = pa_source_output_list_to_string(c);
break;
- case 4:
+ case 4:
t = pa_client_list_to_string(c);
break;
case 5:
diff --git a/src/pulsecore/cli-text.h b/src/pulsecore/cli-text.h
index cd3acdee..b092fc8b 100644
--- a/src/pulsecore/cli-text.h
+++ b/src/pulsecore/cli-text.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/cli.c b/src/pulsecore/cli.c
index e3fc2e4c..0820fc8e 100644
--- a/src/pulsecore/cli.c
+++ b/src/pulsecore/cli.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -82,12 +82,12 @@ pa_cli* pa_cli_new(pa_core *core, pa_iochannel *io, pa_module *m) {
c->client->kill = client_kill;
c->client->userdata = c;
c->client->owner = m;
-
+
pa_ioline_set_callback(c->line, line_callback, c);
pa_ioline_puts(c->line, "Welcome to PulseAudio! Use \"help\" for usage information.\n"PROMPT);
c->fail = c->kill_requested = c->defer_kill = 0;
-
+
return c;
}
@@ -103,7 +103,7 @@ static void client_kill(pa_client *client) {
pa_cli *c;
assert(client && client->userdata);
c = client->userdata;
-
+
pa_log_debug("CLI client killed.");
if (c->defer_kill)
c->kill_requested = 1;
@@ -138,7 +138,7 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
if (c->kill_requested) {
if (c->eof_callback)
c->eof_callback(c, c->userdata);
- } else
+ } else
pa_ioline_puts(line, PROMPT);
}
diff --git a/src/pulsecore/cli.h b/src/pulsecore/cli.h
index 639fa952..5cf0ebd2 100644
--- a/src/pulsecore/cli.h
+++ b/src/pulsecore/cli.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/client.c b/src/pulsecore/client.c
index c34bf149..55697d2e 100644
--- a/src/pulsecore/client.c
+++ b/src/pulsecore/client.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -56,7 +56,7 @@ pa_client *pa_client_new(pa_core *core, const char *driver, const char *name) {
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CLIENT|PA_SUBSCRIPTION_EVENT_NEW, c->index);
pa_core_check_quit(core);
-
+
return c;
}
diff --git a/src/pulsecore/client.h b/src/pulsecore/client.h
index b28065e5..e632da12 100644
--- a/src/pulsecore/client.h
+++ b/src/pulsecore/client.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/conf-parser.c b/src/pulsecore/conf-parser.c
index db1e3719..6f55e2de 100644
--- a/src/pulsecore/conf-parser.c
+++ b/src/pulsecore/conf-parser.c
@@ -42,24 +42,24 @@
/* Run the user supplied parser for an assignment */
static int next_assignment(const char *filename, unsigned line, const pa_config_item *t, const char *lvalue, const char *rvalue, void *userdata) {
assert(filename && t && lvalue && rvalue);
-
+
for (; t->parse; t++)
if (!strcmp(lvalue, t->lvalue))
return t->parse(filename, line, lvalue, rvalue, t->data, userdata);
pa_log("[%s:%u] Unknown lvalue '%s'.", filename, line, lvalue);
-
+
return -1;
}
/* Returns non-zero when c is contained in s */
static int in_string(char c, const char *s) {
assert(s);
-
+
for (; *s; s++)
if (*s == c)
return 1;
-
+
return 0;
}
@@ -85,7 +85,7 @@ static int parse_line(const char *filename, unsigned line, const pa_config_item
if ((c = strpbrk(b, COMMENTS)))
*c = 0;
-
+
if (!*b)
return 0;
@@ -106,13 +106,13 @@ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, void
unsigned line = 0;
int do_close = !f;
assert(filename && t);
-
+
if (!f && !(f = fopen(filename, "r"))) {
if (errno == ENOENT) {
r = 0;
goto finish;
}
-
+
pa_log_warn("WARNING: failed to open configuration file '%s': %s",
filename, pa_cstrerror(errno));
goto finish;
@@ -123,23 +123,23 @@ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, void
if (!fgets(l, sizeof(l), f)) {
if (feof(f))
break;
-
+
pa_log_warn("WARNING: failed to read configuration file '%s': %s",
filename, pa_cstrerror(errno));
goto finish;
}
-
+
if (parse_line(filename, ++line, t, l, userdata) < 0)
goto finish;
}
-
+
r = 0;
-
+
finish:
if (do_close && f)
fclose(f);
-
+
return r;
}
@@ -152,22 +152,22 @@ int pa_config_parse_int(const char *filename, unsigned line, const char *lvalue,
pa_log("[%s:%u] Failed to parse numeric value: %s", filename, line, rvalue);
return -1;
}
-
+
*i = (int) k;
- return 0;
+ return 0;
}
int pa_config_parse_bool(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
int *b = data, k;
assert(filename && lvalue && rvalue && data);
-
+
if ((k = pa_parse_boolean(rvalue)) < 0) {
pa_log("[%s:%u] Failed to parse boolean value: %s", filename, line, rvalue);
return -1;
}
-
+
*b = k;
-
+
return 0;
}
diff --git a/src/pulsecore/core-def.h b/src/pulsecore/core-def.h
index 718499d1..f849a6f6 100644
--- a/src/pulsecore/core-def.h
+++ b/src/pulsecore/core-def.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/core-error.c b/src/pulsecore/core-error.c
index 61878c9e..2362068f 100644
--- a/src/pulsecore/core-error.c
+++ b/src/pulsecore/core-error.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/core-error.h b/src/pulsecore/core-error.h
index 32da8bf2..e4390833 100644
--- a/src/pulsecore/core-error.h
+++ b/src/pulsecore/core-error.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/core-scache.c b/src/pulsecore/core-scache.c
index e3bf3ca2..26c493ca 100644
--- a/src/pulsecore/core-scache.c
+++ b/src/pulsecore/core-scache.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -94,7 +94,7 @@ static pa_scache_entry* scache_add_item(pa_core *c, const char *name) {
pa_memblock_unref(e->memchunk.memblock);
pa_xfree(e->filename);
-
+
assert(e->core == c);
pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE|PA_SUBSCRIPTION_EVENT_CHANGE, e->index);
@@ -178,7 +178,7 @@ int pa_scache_add_file(pa_core *c, const char *name, const char *filename, uint3
if (pa_sound_file_load(c->mempool, filename, &ss, &map, &chunk) < 0)
return -1;
-
+
r = pa_scache_add_item(c, name, &ss, &map, &chunk, idx);
pa_memblock_unref(chunk.memblock);
@@ -202,7 +202,7 @@ int pa_scache_add_file_lazy(pa_core *c, const char *name, const char *filename,
e->lazy = 1;
e->filename = pa_xstrdup(filename);
-
+
if (!c->scache_auto_unload_event) {
struct timeval ntv;
pa_gettimeofday(&ntv);
@@ -252,7 +252,7 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t
pa_scache_entry *e;
char *t;
pa_cvolume r;
-
+
assert(c);
assert(name);
assert(sink);
@@ -269,7 +269,7 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t
if (e->volume.channels > e->sample_spec.channels)
e->volume.channels = e->sample_spec.channels;
}
-
+
if (!e->memchunk.memblock)
return -1;
@@ -287,7 +287,7 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t
if (e->lazy)
time(&e->last_used_time);
-
+
return 0;
}
@@ -318,7 +318,7 @@ uint32_t pa_scache_total_size(pa_core *c) {
if (!c->scache || !pa_idxset_size(c->scache))
return 0;
-
+
for (e = pa_idxset_first(c->scache, &idx); e; e = pa_idxset_next(c->scache, &idx))
if (e->memchunk.memblock)
sum += e->memchunk.length;
@@ -334,7 +334,7 @@ void pa_scache_unload_unused(pa_core *c) {
if (!c->scache || !pa_idxset_size(c->scache))
return;
-
+
time(&now);
for (e = pa_idxset_first(c->scache, &idx); e; e = pa_idxset_next(c->scache, &idx)) {
@@ -344,7 +344,7 @@ void pa_scache_unload_unused(pa_core *c) {
if (e->last_used_time + c->scache_idle_time > now)
continue;
-
+
pa_memblock_unref(e->memchunk.memblock);
e->memchunk.memblock = NULL;
e->memchunk.index = e->memchunk.length = 0;
@@ -358,7 +358,7 @@ static void add_file(pa_core *c, const char *pathname) {
const char *e;
e = pa_path_get_filename(pathname);
-
+
if (stat(pathname, &st) < 0) {
pa_log("stat('%s'): %s", pathname, pa_cstrerror(errno));
return;
@@ -388,7 +388,7 @@ int pa_scache_add_directory_lazy(pa_core *c, const char *pathname) {
for (i = 0; i < p.gl_pathc; i++)
add_file(c, p.gl_pathv[i]);
-
+
globfree(&p);
#else
return -1;
diff --git a/src/pulsecore/core-scache.h b/src/pulsecore/core-scache.h
index d01aae9b..69baabbc 100644
--- a/src/pulsecore/core-scache.h
+++ b/src/pulsecore/core-scache.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -32,14 +32,14 @@ typedef struct pa_scache_entry {
pa_core *core;
uint32_t index;
char *name;
-
+
pa_cvolume volume;
pa_sample_spec sample_spec;
pa_channel_map channel_map;
pa_memchunk memchunk;
char *filename;
-
+
int lazy;
time_t last_used_time;
} pa_scache_entry;
diff --git a/src/pulsecore/core-subscribe.c b/src/pulsecore/core-subscribe.c
index 4df1d511..5a958b83 100644
--- a/src/pulsecore/core-subscribe.c
+++ b/src/pulsecore/core-subscribe.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -65,7 +65,7 @@ static void sched_event(pa_core *c);
/* Allocate a new subscription object for the given subscription mask. Use the specified callback function and user data */
pa_subscription* pa_subscription_new(pa_core *c, pa_subscription_mask_t m, pa_subscription_cb_t callback, void *userdata) {
pa_subscription *s;
-
+
assert(c);
assert(m);
assert(callback);
@@ -85,7 +85,7 @@ pa_subscription* pa_subscription_new(pa_core *c, pa_subscription_mask_t m, pa_su
void pa_subscription_free(pa_subscription*s) {
assert(s);
assert(!s->dead);
-
+
s->dead = 1;
sched_event(s->core);
}
@@ -104,7 +104,7 @@ static void free_event(pa_subscription_event *s) {
if (!s->next)
s->core->subscription_event_last = s->prev;
-
+
PA_LLIST_REMOVE(pa_subscription_event, s->core->subscription_event_queue, s);
pa_xfree(s);
}
@@ -112,7 +112,7 @@ static void free_event(pa_subscription_event *s) {
/* Free all subscription objects */
void pa_subscription_free_all(pa_core *c) {
assert(c);
-
+
while (c->subscriptions)
free_subscription(c->subscriptions);
@@ -157,7 +157,7 @@ static void dump_event(const char * prefix, pa_subscription_event*e) {
static void defer_cb(pa_mainloop_api *m, pa_defer_event *de, void *userdata) {
pa_core *c = userdata;
pa_subscription *s;
-
+
assert(c->mainloop == m);
assert(c);
assert(c->subscription_defer_event == de);
@@ -170,7 +170,7 @@ static void defer_cb(pa_mainloop_api *m, pa_defer_event *de, void *userdata) {
pa_subscription_event *e = c->subscription_event_queue;
for (s = c->subscriptions; s; s = s->next) {
-
+
if (!s->dead && pa_subscription_match_flags(s->mask, e->type))
s->callback(c, e->type, e->index, s->userdata);
}
@@ -182,7 +182,7 @@ static void defer_cb(pa_mainloop_api *m, pa_defer_event *de, void *userdata) {
}
/* Remove dead subscriptions */
-
+
s = c->subscriptions;
while (s) {
pa_subscription *n = s->next;
@@ -200,7 +200,7 @@ static void sched_event(pa_core *c) {
c->subscription_defer_event = c->mainloop->defer_new(c->mainloop, defer_cb, c);
assert(c->subscription_defer_event);
}
-
+
c->mainloop->defer_enable(c->subscription_defer_event, 1);
}
@@ -212,18 +212,18 @@ void pa_subscription_post(pa_core *c, pa_subscription_event_type_t t, uint32_t i
/* No need for queuing subscriptions of noone is listening */
if (!c->subscriptions)
return;
-
+
if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) != PA_SUBSCRIPTION_EVENT_NEW) {
pa_subscription_event *i, *n;
-
+
/* Check for duplicates */
for (i = c->subscription_event_last; i; i = n) {
n = i->prev;
-
+
/* not the same object type */
if (((t ^ i->type) & PA_SUBSCRIPTION_EVENT_FACILITY_MASK))
continue;
-
+
/* not the same object */
if (i->index != index)
continue;
@@ -253,7 +253,7 @@ void pa_subscription_post(pa_core *c, pa_subscription_event_type_t t, uint32_t i
e->type = t;
e->index = index;
- PA_LLIST_INSERT_AFTER(pa_subscription_event, c->subscription_event_queue, c->subscription_event_last, e);
+ PA_LLIST_INSERT_AFTER(pa_subscription_event, c->subscription_event_queue, c->subscription_event_last, e);
c->subscription_event_last = e;
#ifdef DEBUG
diff --git a/src/pulsecore/core-subscribe.h b/src/pulsecore/core-subscribe.h
index 6e3b646e..875cf331 100644
--- a/src/pulsecore/core-subscribe.h
+++ b/src/pulsecore/core-subscribe.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 5f72b342..b42dc0ca 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -139,7 +139,7 @@ void pa_make_nonblock_fd(int fd) {
int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
struct stat st;
int r;
-
+
assert(dir);
#ifdef OS_IS_WIN32
@@ -152,7 +152,7 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
umask(u);
}
#endif
-
+
if (r < 0 && errno != EEXIST)
return -1;
@@ -163,18 +163,18 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
gid = getgid();
chown(dir, uid, gid);
#endif
-
+
#ifdef HAVE_CHMOD
chmod(dir, m);
#endif
-
+
#ifdef HAVE_LSTAT
if (lstat(dir, &st) < 0)
#else
if (stat(dir, &st) < 0)
#endif
goto fail;
-
+
#ifndef OS_IS_WIN32
if (!S_ISDIR(st.st_mode) ||
(st.st_uid != uid) ||
@@ -186,9 +186,9 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
#else
pa_log_warn("secure directory creation not supported on Win32.");
#endif
-
+
return 0;
-
+
fail:
rmdir(dir);
return -1;
@@ -214,12 +214,12 @@ int pa_make_secure_parent_dir(const char *fn, mode_t m, uid_t uid, gid_t gid) {
if (!(dir = pa_parent_dir(fn)))
goto finish;
-
+
if (pa_make_secure_dir(dir, m, uid, gid) < 0)
goto finish;
ret = 0;
-
+
finish:
pa_xfree(dir);
return ret;
@@ -237,7 +237,7 @@ ssize_t pa_read(int fd, void *buf, size_t count, int *type) {
if (!type || *type == 0) {
ssize_t r;
-
+
if ((r = recv(fd, buf, count, 0)) >= 0)
return r;
@@ -251,7 +251,7 @@ ssize_t pa_read(int fd, void *buf, size_t count, int *type) {
}
#endif
-
+
return read(fd, buf, count);
}
@@ -263,7 +263,7 @@ ssize_t pa_write(int fd, const void *buf, size_t count, int *type) {
if ((r = send(fd, buf, count, MSG_NOSIGNAL)) >= 0)
return r;
-
+
#ifdef OS_IS_WIN32
if (WSAGetLastError() != WSAENOTSOCK) {
errno = WSAGetLastError();
@@ -286,7 +286,7 @@ ssize_t pa_write(int fd, const void *buf, size_t count, int *type) {
ssize_t pa_loop_read(int fd, void*data, size_t size, int *type) {
ssize_t ret = 0;
int _type;
-
+
assert(fd >= 0);
assert(data);
assert(size);
@@ -304,7 +304,7 @@ ssize_t pa_loop_read(int fd, void*data, size_t size, int *type) {
if (r == 0)
break;
-
+
ret += r;
data = (uint8_t*) data + r;
size -= r;
@@ -335,7 +335,7 @@ ssize_t pa_loop_write(int fd, const void*data, size_t size, int *type) {
if (r == 0)
break;
-
+
ret += r;
data = (const uint8_t*) data + r;
size -= r;
@@ -354,8 +354,8 @@ void pa_check_signal_is_blocked(int sig) {
/* If POSIX threads are supported use thread-aware
* pthread_sigmask() function, to check if the signal is
* blocked. Otherwise fall back to sigprocmask() */
-
-#ifdef HAVE_PTHREAD
+
+#ifdef HAVE_PTHREAD
if (pthread_sigmask(SIG_SETMASK, NULL, &set) < 0) {
#endif
if (sigprocmask(SIG_SETMASK, NULL, &set) < 0) {
@@ -370,15 +370,15 @@ void pa_check_signal_is_blocked(int sig) {
return;
/* Check whether the signal is trapped */
-
+
if (sigaction(sig, NULL, &sa) < 0) {
pa_log("sigaction(): %s", pa_cstrerror(errno));
return;
}
-
+
if (sa.sa_handler != SIG_DFL)
return;
-
+
pa_log("WARNING: %s is not trapped. This might cause malfunction!", pa_strsignal(sig));
#else /* HAVE_SIGACTION */
pa_log("WARNING: %s might not be trapped. This might cause malfunction!", pa_strsignal(sig));
@@ -390,9 +390,9 @@ void pa_check_signal_is_blocked(int sig) {
char *pa_sprintf_malloc(const char *format, ...) {
int size = 100;
char *c = NULL;
-
+
assert(format);
-
+
for(;;) {
int r;
va_list ap;
@@ -402,12 +402,12 @@ char *pa_sprintf_malloc(const char *format, ...) {
va_start(ap, format);
r = vsnprintf(c, size, format, ap);
va_end(ap);
-
+
if (r > -1 && r < size)
return c;
if (r > -1) /* glibc 2.1 */
- size = r+1;
+ size = r+1;
else /* glibc 2.0 */
size *= 2;
}
@@ -418,9 +418,9 @@ char *pa_sprintf_malloc(const char *format, ...) {
char *pa_vsprintf_malloc(const char *format, va_list ap) {
int size = 100;
char *c = NULL;
-
+
assert(format);
-
+
for(;;) {
int r;
va_list aq;
@@ -431,12 +431,12 @@ char *pa_vsprintf_malloc(const char *format, va_list ap) {
r = vsnprintf(c, size, format, aq);
va_end(aq);
-
+
if (r > -1 && r < size)
return c;
if (r > -1) /* glibc 2.1 */
- size = r+1;
+ size = r+1;
else /* glibc 2.0 */
size *= 2;
}
@@ -461,10 +461,10 @@ void pa_raise_priority(void) {
#ifdef HAVE_SYS_RESOURCE_H
if (setpriority(PRIO_PROCESS, 0, NICE_LEVEL) < 0)
pa_log_warn("setpriority(): %s", pa_cstrerror(errno));
- else
- pa_log_info("Successfully gained nice level %i.", NICE_LEVEL);
+ else
+ pa_log_info("Successfully gained nice level %i.", NICE_LEVEL);
#endif
-
+
#ifdef _POSIX_PRIORITY_SCHEDULING
{
struct sched_param sp;
@@ -473,14 +473,14 @@ void pa_raise_priority(void) {
pa_log("sched_getparam(): %s", pa_cstrerror(errno));
return;
}
-
+
sp.sched_priority = 1;
if (sched_setscheduler(0, SCHED_FIFO, &sp) < 0) {
pa_log_warn("sched_setscheduler(): %s", pa_cstrerror(errno));
return;
}
- pa_log_info("Successfully enabled SCHED_FIFO scheduling.");
+ pa_log_info("Successfully enabled SCHED_FIFO scheduling.");
}
#endif
@@ -488,7 +488,7 @@ void pa_raise_priority(void) {
if (!SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS))
pa_log_warn("SetPriorityClass() failed: 0x%08X", GetLastError());
else
- pa_log_info("Successfully gained high priority class.");
+ pa_log_info("Successfully gained high priority class.");
#endif
}
@@ -521,19 +521,19 @@ int pa_fd_set_cloexec(int fd, int b) {
if ((v = fcntl(fd, F_GETFD, 0)) < 0)
return -1;
-
+
v = (v & ~FD_CLOEXEC) | (b ? FD_CLOEXEC : 0);
-
+
if (fcntl(fd, F_SETFD, v) < 0)
return -1;
-#endif
+#endif
return 0;
}
/* Try to parse a boolean string value.*/
int pa_parse_boolean(const char *v) {
-
+
if (!strcmp(v, "1") || v[0] == 'y' || v[0] == 'Y' || v[0] == 't' || v[0] == 'T' || !strcasecmp(v, "on"))
return 1;
else if (!strcmp(v, "0") || v[0] == 'n' || v[0] == 'N' || v[0] == 'f' || v[0] == 'F' || !strcasecmp(v, "off"))
@@ -552,7 +552,7 @@ char *pa_split(const char *c, const char *delimiter, const char**state) {
if (!*current)
return NULL;
-
+
l = strcspn(current, delimiter);
*state = current+l;
@@ -632,7 +632,7 @@ static int is_group(gid_t gid, const char *name) {
}
r = strcmp(name, result->gr_name) == 0;
-
+
finish:
pa_xfree(data);
#else
@@ -647,7 +647,7 @@ finish:
finish:
#endif
-
+
return r;
}
@@ -658,9 +658,9 @@ int pa_own_uid_in_group(const char *name, gid_t *gid) {
int r = -1, i;
assert(n > 0);
-
+
gids = pa_xmalloc(sizeof(GETGROUPS_T)*n);
-
+
if ((n = getgroups(n, gids)) < 0) {
pa_log("getgroups(): %s", pa_cstrerror(errno));
goto finish;
@@ -681,7 +681,7 @@ int pa_own_uid_in_group(const char *name, gid_t *gid) {
}
r = 0;
-
+
finish:
pa_xfree(gids);
@@ -695,20 +695,20 @@ int pa_uid_in_group(uid_t uid, const char *name) {
struct group grbuf, *gr;
char **i;
int r = -1;
-
+
g_n = sysconf(_SC_GETGR_R_SIZE_MAX);
g_buf = pa_xmalloc(g_n);
p_n = sysconf(_SC_GETPW_R_SIZE_MAX);
p_buf = pa_xmalloc(p_n);
-
+
if (getgrnam_r(name, &grbuf, g_buf, (size_t) g_n, &gr) != 0 || !gr)
goto finish;
r = 0;
for (i = gr->gr_mem; *i; i++) {
struct passwd pwbuf, *pw;
-
+
if (getpwnam_r(*i, &pwbuf, p_buf, (size_t) p_n, &pw) != 0 || !pw)
continue;
@@ -763,7 +763,7 @@ int pa_check_in_group(gid_t g) {
int pa_own_uid_in_group(const char *name, gid_t *gid) {
return -1;
-
+
}
int pa_uid_in_group(uid_t uid, const char *name) {
@@ -787,7 +787,7 @@ int pa_lock_fd(int fd, int b) {
struct flock flock;
/* Try a R/W lock first */
-
+
flock.l_type = b ? F_WRLCK : F_UNLCK;
flock.l_whence = SEEK_SET;
flock.l_start = 0;
@@ -802,7 +802,7 @@ int pa_lock_fd(int fd, int b) {
if (fcntl(fd, F_SETLKW, &flock) >= 0)
return 0;
}
-
+
pa_log("%slock: %s", !b? "un" : "",
pa_cstrerror(errno));
#endif
@@ -836,18 +836,18 @@ int pa_lock_lockfile(const char *fn) {
for (;;) {
struct stat st;
-
+
if ((fd = open(fn, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR)) < 0) {
pa_log("failed to create lock file '%s': %s", fn,
pa_cstrerror(errno));
goto fail;
}
-
+
if (pa_lock_fd(fd, 1) < 0) {
pa_log("failed to lock file '%s'.", fn);
goto fail;
}
-
+
if (fstat(fd, &st) < 0) {
pa_log("failed to fstat() file '%s'.", fn);
goto fail;
@@ -856,12 +856,12 @@ int pa_lock_lockfile(const char *fn) {
/* Check wheter the file has been removed meanwhile. When yes, restart this loop, otherwise, we're done */
if (st.st_nlink >= 1)
break;
-
+
if (pa_lock_fd(fd, 0) < 0) {
pa_log("failed to unlock file '%s'.", fn);
goto fail;
}
-
+
if (close(fd) < 0) {
pa_log("failed to close file '%s'.", fn);
goto fail;
@@ -869,7 +869,7 @@ int pa_lock_lockfile(const char *fn) {
fd = -1;
}
-
+
return fd;
fail:
@@ -890,7 +890,7 @@ int pa_unlock_lockfile(const char *fn, int fd) {
fn, pa_cstrerror(errno));
r = -1;
}
-
+
if (pa_lock_fd(fd, 0) < 0) {
pa_log_warn("WARNING: failed to unlock file '%s'.", fn);
r = -1;
@@ -946,20 +946,20 @@ FILE *pa_open_config_file(const char *global, const char *local, const char *env
if (lfn) {
FILE *f;
-
+
#ifdef OS_IS_WIN32
if (!ExpandEnvironmentStrings(lfn, buf, PATH_MAX))
return NULL;
fn = buf;
#endif
-
+
if ((f = fopen(fn, mode)) || errno != ENOENT) {
if (result)
*result = pa_xstrdup(fn);
pa_xfree(lfn);
return f;
}
-
+
pa_xfree(lfn);
}
}
@@ -979,10 +979,10 @@ FILE *pa_open_config_file(const char *global, const char *local, const char *env
if (result)
*result = pa_xstrdup(global);
-
+
return fopen(global, mode);
}
-
+
/* Format the specified data as a hexademical string */
char *pa_hexstr(const uint8_t* d, size_t dlength, char *s, size_t slength) {
size_t i = 0, j = 0;
@@ -1025,7 +1025,7 @@ size_t pa_parsehex(const char *p, uint8_t *d, size_t dlength) {
if ((b = hexc(*(p++))) < 0)
return (size_t) -1;
-
+
d[j] = (uint8_t) (b << 4);
if (!*p)
@@ -1044,10 +1044,10 @@ size_t pa_parsehex(const char *p, uint8_t *d, size_t dlength) {
/* Returns nonzero when *s starts with *pfx */
int pa_startswith(const char *s, const char *pfx) {
size_t l;
-
+
assert(s);
assert(pfx);
-
+
l = strlen(pfx);
return strlen(s) >= l && strncmp(s, pfx, l) == 0;
@@ -1056,10 +1056,10 @@ int pa_startswith(const char *s, const char *pfx) {
/* Returns nonzero when *s ends with *sfx */
int pa_endswith(const char *s, const char *sfx) {
size_t l1, l2;
-
+
assert(s);
assert(sfx);
-
+
l1 = strlen(s);
l2 = strlen(sfx);
@@ -1081,20 +1081,20 @@ char *pa_runtime_path(const char *fn, char *s, size_t l) {
if ((e = getenv("PULSE_RUNTIME_PATH"))) {
- if (fn)
+ if (fn)
snprintf(s, l, "%s%c%s", e, PATH_SEP, fn);
else
snprintf(s, l, "%s", e);
-
+
} else {
char u[256];
-
- if (fn)
+
+ if (fn)
snprintf(s, l, "%s%s%c%s", PA_USER_RUNTIME_PATH_PREFIX, pa_get_user_name(u, sizeof(u)), PATH_SEP, fn);
else
snprintf(s, l, "%s%s", PA_USER_RUNTIME_PATH_PREFIX, pa_get_user_name(u, sizeof(u)));
}
-
+
#ifdef OS_IS_WIN32
{
@@ -1119,7 +1119,7 @@ int pa_atoi(const char *s, int32_t *ret_i) {
return -1;
*ret_i = (int32_t) l;
-
+
return 0;
}
@@ -1135,6 +1135,6 @@ int pa_atou(const char *s, uint32_t *ret_u) {
return -1;
*ret_u = (uint32_t) l;
-
+
return 0;
}
diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h
index ba325968..b2608edd 100644
--- a/src/pulsecore/core-util.h
+++ b/src/pulsecore/core-util.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
index 63ee60ca..b19b1974 100644
--- a/src/pulsecore/core.c
+++ b/src/pulsecore/core.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -116,7 +116,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, int shared) {
pa_property_init(c);
pa_random(&c->cookie, sizeof(c->cookie));
-
+
#ifdef SIGPIPE
pa_check_signal_is_blocked(SIGPIPE);
#endif
@@ -131,16 +131,16 @@ void pa_core_free(pa_core *c) {
assert(pa_idxset_isempty(c->clients));
pa_idxset_free(c->clients, NULL, NULL);
-
+
assert(pa_idxset_isempty(c->sinks));
pa_idxset_free(c->sinks, NULL, NULL);
assert(pa_idxset_isempty(c->sources));
pa_idxset_free(c->sources, NULL, NULL);
-
+
assert(pa_idxset_isempty(c->source_outputs));
pa_idxset_free(c->source_outputs, NULL, NULL);
-
+
assert(pa_idxset_isempty(c->sink_inputs));
pa_idxset_free(c->sink_inputs, NULL, NULL);
@@ -163,8 +163,8 @@ void pa_core_free(pa_core *c) {
pa_hook_free(&c->hook_sink_disconnect);
pa_hook_free(&c->hook_source_output_new);
pa_hook_free(&c->hook_source_disconnect);
-
- pa_xfree(c);
+
+ pa_xfree(c);
}
static void quit_callback(pa_mainloop_api*m, pa_time_event *e, PA_GCC_UNUSED const struct timeval *tv, void *userdata) {
diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index 3a34d297..c1c6a19c 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -46,7 +46,7 @@ struct pa_core {
/* A random value which may be used to identify this instance of
* PulseAudio. Not cryptographically secure in any way. */
uint32_t cookie;
-
+
pa_mainloop_api *mainloop;
/* idxset of all kinds of entities */
diff --git a/src/pulsecore/creds.h b/src/pulsecore/creds.h
index d92ce598..5ad880a0 100644
--- a/src/pulsecore/creds.h
+++ b/src/pulsecore/creds.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/dynarray.c b/src/pulsecore/dynarray.c
index cd1fcb0f..91a9d5e1 100644
--- a/src/pulsecore/dynarray.c
+++ b/src/pulsecore/dynarray.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/dynarray.h b/src/pulsecore/dynarray.h
index 4ddb526c..216d8766 100644
--- a/src/pulsecore/dynarray.h
+++ b/src/pulsecore/dynarray.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/endianmacros.h b/src/pulsecore/endianmacros.h
index 65db3feb..c0193014 100644
--- a/src/pulsecore/endianmacros.h
+++ b/src/pulsecore/endianmacros.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/esound.h b/src/pulsecore/esound.h
index 9d44f65c..0ea201b6 100644
--- a/src/pulsecore/esound.h
+++ b/src/pulsecore/esound.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/flist.c b/src/pulsecore/flist.c
index cfeeac22..5091bfd1 100644
--- a/src/pulsecore/flist.c
+++ b/src/pulsecore/flist.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -111,12 +111,12 @@ pa_flist *pa_flist_new(unsigned size) {
size = FLIST_SIZE;
assert(is_power_of_two(size));
-
+
l = pa_xnew(pa_flist, 1);
l->size = size;
l->cells = pa_xnew0(struct cell, size);
-
+
pa_atomic_store(&l->read_idx, 0);
pa_atomic_store(&l->write_idx, 0);
pa_atomic_store(&l->length, 0);
@@ -133,10 +133,10 @@ void pa_flist_free(pa_flist *l, pa_free_cb_t free_cb) {
if (free_cb) {
int len, idx;
-
+
idx = reduce(l, pa_atomic_load(&l->read_idx));
len = pa_atomic_load(&l->length);
-
+
for (; len > 0; len--) {
if (pa_atomic_load(&l->cells[idx].state) == STATE_USED)
@@ -152,7 +152,7 @@ void pa_flist_free(pa_flist *l, pa_free_cb_t free_cb) {
int pa_flist_push(pa_flist*l, void *p) {
int idx, len, n;
-
+
assert(l);
assert(p);
@@ -183,13 +183,13 @@ int pa_flist_push(pa_flist*l, void *p) {
if (len > N_EXTRA_SCAN)
pa_log("WARNING: Didn't find free cell after %u iterations.", len);
#endif
-
+
return -1;
}
void* pa_flist_pop(pa_flist*l) {
int idx, len, n;
-
+
assert(l);
n = len = pa_atomic_load(&l->length) + N_EXTRA_SCAN;
@@ -221,6 +221,6 @@ void* pa_flist_pop(pa_flist*l) {
if (len > N_EXTRA_SCAN)
pa_log("WARNING: Didn't find used cell after %u iterations.", len);
#endif
-
+
return NULL;
}
diff --git a/src/pulsecore/flist.h b/src/pulsecore/flist.h
index 57c9598b..9871f32d 100644
--- a/src/pulsecore/flist.h
+++ b/src/pulsecore/flist.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/g711.h b/src/pulsecore/g711.h
index 97cedf81..b5c9e6a2 100644
--- a/src/pulsecore/g711.h
+++ b/src/pulsecore/g711.h
@@ -33,7 +33,7 @@ extern int16_t _st_ulaw2linear16[256];
#define st_14linear2ulaw(sw) (_st_14linear2ulaw[(sw + 0x2000)])
#define st_ulaw2linear16(uc) (_st_ulaw2linear16[uc])
#else
-unsigned char st_14linear2ulaw(int16_t pcm_val);
+unsigned char st_14linear2ulaw(int16_t pcm_val);
int16_t st_ulaw2linear16(unsigned char);
#endif
diff --git a/src/pulsecore/gccmacro.h b/src/pulsecore/gccmacro.h
index 8825700a..87f7eece 100644
--- a/src/pulsecore/gccmacro.h
+++ b/src/pulsecore/gccmacro.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/hashmap.c b/src/pulsecore/hashmap.c
index 81a160a6..809eaeec 100644
--- a/src/pulsecore/hashmap.c
+++ b/src/pulsecore/hashmap.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -47,7 +47,7 @@ struct pa_hashmap {
unsigned size;
struct hashmap_entry **data;
struct hashmap_entry *first_entry;
-
+
unsigned n_entries;
pa_hash_func_t hash_func;
pa_compare_func_t compare_func;
@@ -55,14 +55,14 @@ struct pa_hashmap {
pa_hashmap *pa_hashmap_new(pa_hash_func_t hash_func, pa_compare_func_t compare_func) {
pa_hashmap *h;
-
+
h = pa_xnew(pa_hashmap, 1);
h->data = pa_xnew0(struct hashmap_entry*, h->size = BUCKETS);
h->first_entry = NULL;
h->n_entries = 0;
h->hash_func = hash_func ? hash_func : pa_idxset_trivial_hash_func;
h->compare_func = compare_func ? compare_func : pa_idxset_trivial_compare_func;
-
+
return h;
}
@@ -98,7 +98,7 @@ void pa_hashmap_free(pa_hashmap*h, void (*free_func)(void *p, void *userdata), v
free_func(h->first_entry->value, userdata);
remove(h, h->first_entry);
}
-
+
pa_xfree(h->data);
pa_xfree(h);
}
@@ -124,24 +124,24 @@ int pa_hashmap_put(pa_hashmap *h, const void *key, void *value) {
if ((e = get(h, hash, key)))
return -1;
-
+
e = pa_xnew(struct hashmap_entry, 1);
e->hash = hash;
e->key = key;
e->value = value;
-
+
e->previous = NULL;
e->next = h->first_entry;
if (h->first_entry)
h->first_entry->previous = e;
h->first_entry = e;
-
+
e->bucket_previous = NULL;
e->bucket_next = h->data[hash];
if (h->data[hash])
h->data[hash]->bucket_previous = e;
h->data[hash] = e;
-
+
h->n_entries ++;
return 0;
}
@@ -164,7 +164,7 @@ void* pa_hashmap_remove(pa_hashmap *h, const void *key) {
struct hashmap_entry *e;
unsigned hash;
void *data;
-
+
assert(h);
hash = h->hash_func(key) % h->size;
@@ -185,7 +185,7 @@ void *pa_hashmap_iterate(pa_hashmap *h, void **state, const void **key) {
assert(h);
assert(state);
- if (!*state)
+ if (!*state)
*state = h->first_entry;
else
*state = ((struct hashmap_entry*) *state)->next;
@@ -198,13 +198,13 @@ void *pa_hashmap_iterate(pa_hashmap *h, void **state, const void **key) {
if (key)
*key = ((struct hashmap_entry*) *state)->key;
-
+
return ((struct hashmap_entry*) *state)->value;
}
void* pa_hashmap_steal_first(pa_hashmap *h) {
void *data;
-
+
assert(h);
if (!h->first_entry)
diff --git a/src/pulsecore/hashmap.h b/src/pulsecore/hashmap.h
index b8a358ec..18e41cf3 100644
--- a/src/pulsecore/hashmap.h
+++ b/src/pulsecore/hashmap.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/hook-list.c b/src/pulsecore/hook-list.c
index 91c2598b..40f6b435 100644
--- a/src/pulsecore/hook-list.c
+++ b/src/pulsecore/hook-list.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -36,9 +36,9 @@ static void slot_free(pa_hook *hook, pa_hook_slot *slot) {
if (hook->last == slot)
hook->last = slot->prev;
-
+
PA_LLIST_REMOVE(pa_hook_slot, hook->slots, slot);
-
+
pa_xfree(slot);
}
@@ -48,13 +48,13 @@ void pa_hook_free(pa_hook *hook) {
while (hook->slots)
slot_free(hook, hook->slots);
-
+
pa_hook_init(hook, NULL);
}
pa_hook_slot* pa_hook_connect(pa_hook *hook, pa_hook_cb_t cb, void *data) {
pa_hook_slot *slot;
-
+
assert(cb);
slot = pa_xnew(pa_hook_slot, 1);
@@ -62,17 +62,17 @@ pa_hook_slot* pa_hook_connect(pa_hook *hook, pa_hook_cb_t cb, void *data) {
slot->dead = 0;
slot->callback = cb;
slot->data = data;
-
+
PA_LLIST_INSERT_AFTER(pa_hook_slot, hook->slots, hook->last, slot);
hook->last = slot;
-
+
return slot;
}
void pa_hook_slot_free(pa_hook_slot *slot) {
assert(slot);
assert(!slot->dead);
-
+
if (slot->hook->firing > 0) {
slot->dead = 1;
slot->hook->n_dead++;
@@ -83,7 +83,7 @@ void pa_hook_slot_free(pa_hook_slot *slot) {
pa_hook_result_t pa_hook_fire(pa_hook *hook, void *data) {
pa_hook_slot *slot, *next;
pa_hook_result_t result = PA_HOOK_OK;
-
+
assert(hook);
hook->firing ++;
@@ -91,16 +91,16 @@ pa_hook_result_t pa_hook_fire(pa_hook *hook, void *data) {
for (slot = hook->slots; slot; slot = slot->next) {
if (slot->dead)
continue;
-
+
if ((result = slot->callback(hook->data, data, slot->data)) != PA_HOOK_OK)
break;
}
-
+
hook->firing --;
-
+
for (slot = hook->slots; hook->n_dead > 0 && slot; slot = next) {
next = slot->next;
-
+
if (slot->dead) {
slot_free(hook, slot);
hook->n_dead--;
diff --git a/src/pulsecore/hook-list.h b/src/pulsecore/hook-list.h
index 67e5d1ae..9a219a90 100644
--- a/src/pulsecore/hook-list.h
+++ b/src/pulsecore/hook-list.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/idxset.c b/src/pulsecore/idxset.c
index ee0137a3..dce51e21 100644
--- a/src/pulsecore/idxset.c
+++ b/src/pulsecore/idxset.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -44,7 +44,7 @@ typedef struct idxset_entry {
struct pa_idxset {
pa_hash_func_t hash_func;
pa_compare_func_t compare_func;
-
+
unsigned hash_table_size, n_entries;
idxset_entry **hash_table, **array, *iterate_list_head, *iterate_list_tail;
uint32_t index, start_index, array_size;
@@ -53,7 +53,7 @@ struct pa_idxset {
unsigned pa_idxset_string_hash_func(const void *p) {
unsigned hash = 0;
const char *c;
-
+
for (c = p; *c; c++)
hash = 31 * hash + *c;
@@ -97,7 +97,7 @@ void pa_idxset_free(pa_idxset *s, void (*free_func) (void *p, void *userdata), v
while (s->iterate_list_head) {
idxset_entry *e = s->iterate_list_head;
s->iterate_list_head = s->iterate_list_head->iterate_next;
-
+
if (free_func)
free_func(e->data, userdata);
pa_xfree(e);
@@ -133,12 +133,12 @@ static void extend_array(pa_idxset *s, uint32_t idx) {
l = idx - s->start_index - i + 100;
n = pa_xnew0(idxset_entry*, l);
-
+
for (j = 0; j < s->array_size-i; j++)
n[j] = s->array[i+j];
pa_xfree(s->array);
-
+
s->array = n;
s->array_size = l;
s->start_index += i;
@@ -147,17 +147,17 @@ static void extend_array(pa_idxset *s, uint32_t idx) {
static idxset_entry** array_index(pa_idxset*s, uint32_t idx) {
if (idx >= s->start_index + s->array_size)
return NULL;
-
+
if (idx < s->start_index)
return NULL;
-
+
return s->array + idx - s->start_index;
}
int pa_idxset_put(pa_idxset*s, void *p, uint32_t *idx) {
unsigned h;
idxset_entry *e, **a;
-
+
assert(s);
assert(p);
@@ -168,7 +168,7 @@ int pa_idxset_put(pa_idxset*s, void *p, uint32_t *idx) {
if ((e = hash_scan(s, s->hash_table[h], p))) {
if (idx)
*idx = e->index;
-
+
return -1;
}
@@ -201,10 +201,10 @@ int pa_idxset_put(pa_idxset*s, void *p, uint32_t *idx) {
s->iterate_list_head = e;
}
s->iterate_list_tail = e;
-
+
s->n_entries++;
assert(s->n_entries >= 1);
-
+
if (idx)
*idx = e->index;
@@ -214,7 +214,7 @@ int pa_idxset_put(pa_idxset*s, void *p, uint32_t *idx) {
void* pa_idxset_get_by_index(pa_idxset*s, uint32_t idx) {
idxset_entry **a;
assert(s);
-
+
if (!(a = array_index(s, idx)))
return NULL;
@@ -228,7 +228,7 @@ void* pa_idxset_get_by_data(pa_idxset*s, const void *p, uint32_t *idx) {
unsigned h;
idxset_entry *e;
assert(s && p);
-
+
assert(s->hash_func);
h = s->hash_func(p) % s->hash_table_size;
@@ -250,13 +250,13 @@ static void remove_entry(pa_idxset *s, idxset_entry *e) {
a = array_index(s, e->index);
assert(a && *a && *a == e);
*a = NULL;
-
+
/* Remove from linked list */
if (e->iterate_next)
e->iterate_next->iterate_prev = e->iterate_prev;
else
s->iterate_list_tail = e->iterate_prev;
-
+
if (e->iterate_prev)
e->iterate_prev->iterate_next = e->iterate_next;
else
@@ -280,7 +280,7 @@ static void remove_entry(pa_idxset *s, idxset_entry *e) {
void* pa_idxset_remove_by_index(pa_idxset*s, uint32_t idx) {
idxset_entry **a;
void *data;
-
+
assert(s);
if (!(a = array_index(s, idx)))
@@ -291,15 +291,15 @@ void* pa_idxset_remove_by_index(pa_idxset*s, uint32_t idx) {
data = (*a)->data;
remove_entry(s, *a);
-
- return data;
+
+ return data;
}
void* pa_idxset_remove_by_data(pa_idxset*s, const void *data, uint32_t *idx) {
idxset_entry *e;
unsigned h;
void *r;
-
+
assert(s->hash_func);
h = s->hash_func(data) % s->hash_table_size;
@@ -328,7 +328,7 @@ void* pa_idxset_rrobin(pa_idxset *s, uint32_t *idx) {
if (!e)
return NULL;
-
+
*idx = e->index;
return e->data;
}
@@ -351,7 +351,7 @@ void *pa_idxset_next(pa_idxset *s, uint32_t *idx) {
if ((a = array_index(s, *idx)) && *a)
e = (*a)->iterate_next;
-
+
if (e) {
*idx = e->index;
return e->data;
@@ -380,7 +380,7 @@ int pa_idxset_foreach(pa_idxset*s, int (*func)(void *p, uint32_t idx, int *del,
e = n;
}
-
+
return 0;
}
diff --git a/src/pulsecore/idxset.h b/src/pulsecore/idxset.h
index 1765e843..0d751e07 100644
--- a/src/pulsecore/idxset.h
+++ b/src/pulsecore/idxset.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/inet_ntop.c b/src/pulsecore/inet_ntop.c
index 483c3e26..5d7a543e 100644
--- a/src/pulsecore/inet_ntop.c
+++ b/src/pulsecore/inet_ntop.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/inet_pton.c b/src/pulsecore/inet_pton.c
index 7b6bbc31..42bb5387 100644
--- a/src/pulsecore/inet_pton.c
+++ b/src/pulsecore/inet_pton.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/iochannel.c b/src/pulsecore/iochannel.c
index af732c26..b40f0aa1 100644
--- a/src/pulsecore/iochannel.c
+++ b/src/pulsecore/iochannel.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -54,11 +54,11 @@ struct pa_iochannel {
pa_iochannel_cb_t callback;
void*userdata;
-
+
int readable;
int writable;
int hungup;
-
+
int no_close;
pa_io_event* input_event, *output_event;
@@ -70,7 +70,7 @@ static void enable_mainloop_sources(pa_iochannel *io) {
if (io->input_event == io->output_event && io->input_event) {
pa_io_event_flags_t f = PA_IO_EVENT_NULL;
assert(io->input_event);
-
+
if (!io->readable)
f |= PA_IO_EVENT_INPUT;
if (!io->writable)
@@ -88,7 +88,7 @@ static void enable_mainloop_sources(pa_iochannel *io) {
static void callback(pa_mainloop_api* m, pa_io_event *e, int fd, pa_io_event_flags_t f, void *userdata) {
pa_iochannel *io = userdata;
int changed = 0;
-
+
assert(m);
assert(e);
assert(fd >= 0);
@@ -104,7 +104,7 @@ static void callback(pa_mainloop_api* m, pa_io_event *e, int fd, pa_io_event_fla
changed = 1;
assert(e == io->input_event);
}
-
+
if ((f & PA_IO_EVENT_OUTPUT) && !io->writable) {
io->writable = 1;
changed = 1;
@@ -113,7 +113,7 @@ static void callback(pa_mainloop_api* m, pa_io_event *e, int fd, pa_io_event_fla
if (changed) {
enable_mainloop_sources(io);
-
+
if (io->callback)
io->callback(io, io->userdata);
}
@@ -121,7 +121,7 @@ static void callback(pa_mainloop_api* m, pa_io_event *e, int fd, pa_io_event_fla
pa_iochannel* pa_iochannel_new(pa_mainloop_api*m, int ifd, int ofd) {
pa_iochannel *io;
-
+
assert(m);
assert(ifd >= 0 || ofd >= 0);
@@ -165,42 +165,42 @@ void pa_iochannel_free(pa_iochannel*io) {
if (io->input_event)
io->mainloop->io_free(io->input_event);
-
+
if (io->output_event && (io->output_event != io->input_event))
io->mainloop->io_free(io->output_event);
if (!io->no_close) {
if (io->ifd >= 0)
-
+
close(io->ifd);
if (io->ofd >= 0 && io->ofd != io->ifd)
close(io->ofd);
}
-
+
pa_xfree(io);
}
int pa_iochannel_is_readable(pa_iochannel*io) {
assert(io);
-
+
return io->readable || io->hungup;
}
int pa_iochannel_is_writable(pa_iochannel*io) {
assert(io);
-
+
return io->writable && !io->hungup;
}
int pa_iochannel_is_hungup(pa_iochannel*io) {
assert(io);
-
+
return io->hungup;
}
ssize_t pa_iochannel_write(pa_iochannel*io, const void*data, size_t l) {
ssize_t r;
-
+
assert(io);
assert(data);
assert(l);
@@ -217,7 +217,7 @@ ssize_t pa_iochannel_write(pa_iochannel*io, const void*data, size_t l) {
ssize_t pa_iochannel_read(pa_iochannel*io, void*data, size_t l) {
ssize_t r;
-
+
assert(io);
assert(data);
assert(io->ifd >= 0);
@@ -236,13 +236,13 @@ ssize_t pa_iochannel_read(pa_iochannel*io, void*data, size_t l) {
int pa_iochannel_creds_supported(pa_iochannel *io) {
struct sockaddr_un sa;
socklen_t l;
-
+
assert(io);
assert(io->ifd >= 0);
assert(io->ofd == io->ifd);
l = sizeof(sa);
-
+
if (getsockname(io->ifd, (struct sockaddr*) &sa, &l) < 0)
return 0;
@@ -254,7 +254,7 @@ int pa_iochannel_creds_enable(pa_iochannel *io) {
assert(io);
assert(io->ifd >= 0);
-
+
if (setsockopt(io->ifd, SOL_SOCKET, SO_PASSCRED, &t, sizeof(t)) < 0) {
pa_log_error("setsockopt(SOL_SOCKET, SO_PASSCRED): %s", pa_cstrerror(errno));
return -1;
@@ -270,7 +270,7 @@ ssize_t pa_iochannel_write_with_creds(pa_iochannel*io, const void*data, size_t l
uint8_t cmsg_data[CMSG_SPACE(sizeof(struct ucred))];
struct ucred *u;
struct cmsghdr *cmsg;
-
+
assert(io);
assert(data);
assert(l);
@@ -296,7 +296,7 @@ ssize_t pa_iochannel_write_with_creds(pa_iochannel*io, const void*data, size_t l
u->uid = getuid();
u->gid = getgid();
}
-
+
memset(&mh, 0, sizeof(mh));
mh.msg_name = NULL;
mh.msg_namelen = 0;
@@ -319,7 +319,7 @@ ssize_t pa_iochannel_read_with_creds(pa_iochannel*io, void*data, size_t l, pa_cr
struct msghdr mh;
struct iovec iov;
uint8_t cmsg_data[CMSG_SPACE(sizeof(struct ucred))];
-
+
assert(io);
assert(data);
assert(l);
@@ -346,9 +346,9 @@ ssize_t pa_iochannel_read_with_creds(pa_iochannel*io, void*data, size_t l, pa_cr
struct cmsghdr *cmsg;
*creds_valid = 0;
-
+
for (cmsg = CMSG_FIRSTHDR(&mh); cmsg; cmsg = CMSG_NXTHDR(&mh, cmsg)) {
-
+
if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_CREDENTIALS) {
struct ucred u;
assert(cmsg->cmsg_len == CMSG_LEN(sizeof(struct ucred)));
@@ -364,7 +364,7 @@ ssize_t pa_iochannel_read_with_creds(pa_iochannel*io, void*data, size_t l, pa_cr
io->readable = 0;
enable_mainloop_sources(io);
}
-
+
return r;
}
@@ -372,14 +372,14 @@ ssize_t pa_iochannel_read_with_creds(pa_iochannel*io, void*data, size_t l, pa_cr
void pa_iochannel_set_callback(pa_iochannel*io, pa_iochannel_cb_t _callback, void *userdata) {
assert(io);
-
+
io->callback = _callback;
io->userdata = userdata;
}
void pa_iochannel_set_noclose(pa_iochannel*io, int b) {
assert(io);
-
+
io->no_close = b;
}
@@ -387,25 +387,25 @@ void pa_iochannel_socket_peer_to_string(pa_iochannel*io, char*s, size_t l) {
assert(io);
assert(s);
assert(l);
-
+
pa_socket_peer_to_string(io->ifd, s, l);
}
int pa_iochannel_socket_set_rcvbuf(pa_iochannel *io, size_t l) {
assert(io);
-
+
return pa_socket_set_rcvbuf(io->ifd, l);
}
int pa_iochannel_socket_set_sndbuf(pa_iochannel *io, size_t l) {
assert(io);
-
+
return pa_socket_set_sndbuf(io->ofd, l);
}
pa_mainloop_api* pa_iochannel_get_mainloop_api(pa_iochannel *io) {
assert(io);
-
+
return io->mainloop;
}
diff --git a/src/pulsecore/iochannel.h b/src/pulsecore/iochannel.h
index 0e6d6d3a..147e7276 100644
--- a/src/pulsecore/iochannel.h
+++ b/src/pulsecore/iochannel.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/ioline.c b/src/pulsecore/ioline.c
index a3bca22f..2fe5c88d 100644
--- a/src/pulsecore/ioline.c
+++ b/src/pulsecore/ioline.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -64,7 +64,7 @@ static void defer_callback(pa_mainloop_api*m, pa_defer_event*e, void *userdata);
pa_ioline* pa_ioline_new(pa_iochannel *io) {
pa_ioline *l;
assert(io);
-
+
l = pa_xnew(pa_ioline, 1);
l->io = io;
l->dead = 0;
@@ -85,9 +85,9 @@ pa_ioline* pa_ioline_new(pa_iochannel *io) {
l->mainloop->defer_enable(l->defer_event, 0);
l->defer_close = 0;
-
+
pa_iochannel_set_callback(io, io_callback, l);
-
+
return l;
}
@@ -126,7 +126,7 @@ void pa_ioline_close(pa_ioline *l) {
assert(l->ref >= 1);
l->dead = 1;
-
+
if (l->io) {
pa_iochannel_free(l->io);
l->io = NULL;
@@ -143,21 +143,21 @@ void pa_ioline_close(pa_ioline *l) {
void pa_ioline_puts(pa_ioline *l, const char *c) {
size_t len;
-
+
assert(l);
assert(l->ref >= 1);
assert(c);
if (l->dead)
return;
-
+
len = strlen(c);
if (len > BUFFER_LIMIT - l->wbuf_valid_length)
len = BUFFER_LIMIT - l->wbuf_valid_length;
if (len) {
assert(l->wbuf_length >= l->wbuf_valid_length);
-
+
/* In case the allocated buffer is too small, enlarge it. */
if (l->wbuf_valid_length + len > l->wbuf_length) {
size_t n = l->wbuf_valid_length+len;
@@ -170,14 +170,14 @@ void pa_ioline_puts(pa_ioline *l, const char *c) {
l->wbuf_length = n;
l->wbuf_index = 0;
} else if (l->wbuf_index + l->wbuf_valid_length + len > l->wbuf_length) {
-
+
/* In case the allocated buffer fits, but the current index is too far from the start, move it to the front. */
memmove(l->wbuf, l->wbuf+l->wbuf_index, l->wbuf_valid_length);
l->wbuf_index = 0;
}
-
+
assert(l->wbuf_index + l->wbuf_valid_length + len <= l->wbuf_length);
-
+
/* Append the new string */
memcpy(l->wbuf + l->wbuf_index + l->wbuf_valid_length, c, len);
l->wbuf_valid_length += len;
@@ -189,7 +189,7 @@ void pa_ioline_puts(pa_ioline *l, const char *c) {
void pa_ioline_set_callback(pa_ioline*l, void (*callback)(pa_ioline*io, const char *s, void *userdata), void *userdata) {
assert(l);
assert(l->ref >= 1);
-
+
l->callback = callback;
l->userdata = userdata;
}
@@ -213,7 +213,7 @@ static void failure(pa_ioline *l, int process_leftover) {
l->callback(l, NULL, l->userdata);
l->callback = NULL;
}
-
+
pa_ioline_close(l);
}
@@ -223,12 +223,12 @@ static void scan_for_lines(pa_ioline *l, size_t skip) {
while (!l->dead && l->rbuf_valid_length > skip) {
char *e, *p;
size_t m;
-
+
if (!(e = memchr(l->rbuf + l->rbuf_index + skip, '\n', l->rbuf_valid_length - skip)))
break;
*e = 0;
-
+
p = l->rbuf + l->rbuf_index;
m = strlen(p);
@@ -260,14 +260,14 @@ static int do_read(pa_ioline *l) {
size_t len;
len = l->rbuf_length - l->rbuf_index - l->rbuf_valid_length;
-
+
/* Check if we have to enlarge the read buffer */
if (len < READ_SIZE) {
size_t n = l->rbuf_valid_length+READ_SIZE;
-
+
if (n >= BUFFER_LIMIT)
n = BUFFER_LIMIT;
-
+
if (l->rbuf_length >= n) {
/* The current buffer is large enough, let's just move the data to the front */
if (l->rbuf_valid_length)
@@ -281,14 +281,14 @@ static int do_read(pa_ioline *l) {
l->rbuf = new;
l->rbuf_length = n;
}
-
+
l->rbuf_index = 0;
}
-
+
len = l->rbuf_length - l->rbuf_index - l->rbuf_valid_length;
-
+
assert(len >= READ_SIZE);
-
+
/* Read some data */
if ((r = pa_iochannel_read(l->io, l->rbuf+l->rbuf_index+l->rbuf_valid_length, len)) <= 0) {
if (r < 0) {
@@ -296,16 +296,16 @@ static int do_read(pa_ioline *l) {
failure(l, 0);
} else
failure(l, 1);
-
+
return -1;
}
-
+
l->rbuf_valid_length += r;
-
+
/* Look if a line has been terminated in the newly read data */
scan_for_lines(l, l->rbuf_valid_length - r);
}
-
+
return 0;
}
@@ -315,21 +315,21 @@ static int do_write(pa_ioline *l) {
assert(l && l->ref >= 1);
while (!l->dead && pa_iochannel_is_writable(l->io) && l->wbuf_valid_length) {
-
+
if ((r = pa_iochannel_write(l->io, l->wbuf+l->wbuf_index, l->wbuf_valid_length)) < 0) {
pa_log("write(): %s", r < 0 ? pa_cstrerror(errno) : "EOF");
failure(l, 0);
return -1;
}
-
+
l->wbuf_index += r;
l->wbuf_valid_length -= r;
-
+
/* A shortcut for the next time */
if (l->wbuf_valid_length == 0)
l->wbuf_index = 0;
}
-
+
return 0;
}
@@ -341,7 +341,7 @@ static void do_work(pa_ioline *l) {
pa_ioline_ref(l);
l->mainloop->defer_enable(l->defer_event, 0);
-
+
if (!l->dead)
do_read(l);
@@ -371,7 +371,7 @@ static void defer_callback(pa_mainloop_api*m, pa_defer_event*e, void *userdata)
void pa_ioline_defer_close(pa_ioline *l) {
assert(l);
assert(l->ref >= 1);
-
+
l->defer_close = 1;
if (!l->wbuf_valid_length)
@@ -381,7 +381,7 @@ void pa_ioline_defer_close(pa_ioline *l) {
void pa_ioline_printf(pa_ioline *l, const char *format, ...) {
char *t;
va_list ap;
-
+
assert(l);
assert(l->ref >= 1);
diff --git a/src/pulsecore/ioline.h b/src/pulsecore/ioline.h
index e736e2b3..8d3fb5f8 100644
--- a/src/pulsecore/ioline.h
+++ b/src/pulsecore/ioline.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/ipacl.c b/src/pulsecore/ipacl.c
index 36159fab..2848b169 100644
--- a/src/pulsecore/ipacl.c
+++ b/src/pulsecore/ipacl.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -59,7 +59,7 @@
struct acl_entry {
PA_LLIST_FIELDS(struct acl_entry);
- int family;
+ int family;
struct in_addr address_ipv4;
struct in6_addr address_ipv6;
int bits;
@@ -75,10 +75,10 @@ pa_ip_acl* pa_ip_acl_new(const char *s) {
pa_ip_acl *acl;
assert(s);
-
+
acl = pa_xnew(pa_ip_acl, 1);
PA_LLIST_HEAD_INIT(struct acl_entry, acl->entries);
-
+
while ((a = pa_split(s, ";", &state))) {
char *slash;
struct acl_entry e, *n;
@@ -97,7 +97,7 @@ pa_ip_acl* pa_ip_acl_new(const char *s) {
if (inet_pton(AF_INET, a, &e.address_ipv4) > 0) {
e.bits = bits == (uint32_t) -1 ? 32 : (int) bits;
-
+
if (e.bits > 32) {
pa_log("number of bits out of range: %i", e.bits);
goto fail;
@@ -107,7 +107,7 @@ pa_ip_acl* pa_ip_acl_new(const char *s) {
if (e.bits < 32 && (uint32_t) (ntohl(e.address_ipv4.s_addr) << e.bits) != 0)
pa_log_warn("WARNING: Host part of ACL entry '%s/%u' is not zero!", a, e.bits);
-
+
} else if (inet_pton(AF_INET6, a, &e.address_ipv6) > 0) {
e.bits = bits == (uint32_t) -1 ? 128 : (int) bits;
@@ -123,7 +123,7 @@ pa_ip_acl* pa_ip_acl_new(const char *s) {
for (i = 0, bits = e.bits; i < 16; i++) {
- if (bits >= 8)
+ if (bits >= 8)
bits -= 8;
else {
if ((uint8_t) ((e.address_ipv6.s6_addr[i]) << bits) != 0) {
@@ -137,7 +137,7 @@ pa_ip_acl* pa_ip_acl_new(const char *s) {
if (t)
pa_log_warn("WARNING: Host part of ACL entry '%s/%u' is not zero!", a, e.bits);
}
-
+
} else {
pa_log("failed to parse address: %s", a);
goto fail;
@@ -145,16 +145,16 @@ pa_ip_acl* pa_ip_acl_new(const char *s) {
n = pa_xmemdup(&e, sizeof(struct acl_entry));
PA_LLIST_PREPEND(struct acl_entry, acl->entries, n);
-
+
pa_xfree(a);
}
return acl;
-
+
fail:
pa_xfree(a);
pa_ip_acl_free(acl);
-
+
return NULL;
}
@@ -166,7 +166,7 @@ void pa_ip_acl_free(pa_ip_acl *acl) {
PA_LLIST_REMOVE(struct acl_entry, acl->entries, e);
pa_xfree(e);
}
-
+
pa_xfree(acl);
}
@@ -174,7 +174,7 @@ int pa_ip_acl_check(pa_ip_acl *acl, int fd) {
struct sockaddr_storage sa;
struct acl_entry *e;
socklen_t salen;
-
+
assert(acl);
assert(fd >= 0);
@@ -190,7 +190,7 @@ int pa_ip_acl_check(pa_ip_acl *acl, int fd) {
if (sa.ss_family == AF_INET6 && salen != sizeof(struct sockaddr_in6))
return -1;
-
+
for (e = acl->entries; e; e = e->next) {
if (e->family != sa.ss_family)
@@ -198,7 +198,7 @@ int pa_ip_acl_check(pa_ip_acl *acl, int fd) {
if (e->family == AF_INET) {
struct sockaddr_in *sai = (struct sockaddr_in*) &sa;
-
+
if (e->bits == 0 || /* this needs special handling because >> takes the right-hand side modulo 32 */
(ntohl(sai->sin_addr.s_addr ^ e->address_ipv4.s_addr) >> (32 - e->bits)) == 0)
return 1;
@@ -211,7 +211,7 @@ int pa_ip_acl_check(pa_ip_acl *acl, int fd) {
if (e->bits == 0)
return 1;
-
+
for (i = 0, bits = e->bits; i < 16; i++) {
if (bits >= 8) {
diff --git a/src/pulsecore/ipacl.h b/src/pulsecore/ipacl.h
index 7a4540ce..61bf99b0 100644
--- a/src/pulsecore/ipacl.h
+++ b/src/pulsecore/ipacl.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/llist.h b/src/pulsecore/llist.h
index 31279431..49d26166 100644
--- a/src/pulsecore/llist.h
+++ b/src/pulsecore/llist.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -75,7 +75,7 @@ do { \
assert(_head); \
while ((*_head)->prev) \
*_head = (*_head)->prev; \
-} while (0)
+} while (0)
#define PA_LLIST_INSERT_AFTER(t,head,a,b) \
do { \
@@ -92,7 +92,7 @@ do { \
_b->prev = _a; \
_a->next = _b; \
} \
-} while (0)
-
+} while (0)
+
#endif
diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c
index ce093221..7ad90383 100644
--- a/src/pulsecore/log.c
+++ b/src/pulsecore/log.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -89,16 +89,16 @@ void pa_log_levelv_meta(
const char *func,
const char *format,
va_list ap) {
-
+
const char *e;
char *text, *t, *n, *location;
-
+
assert(level < PA_LOG_LEVEL_MAX);
assert(format);
if ((e = getenv(ENV_LOGLEVEL)))
maximal_level = atoi(e);
-
+
if (level > maximal_level)
return;
@@ -122,13 +122,13 @@ void pa_log_levelv_meta(
if (!*t)
continue;
-
+
switch (log_target) {
case PA_LOG_STDERR: {
const char *prefix = "", *suffix = "";
char *local_t;
-#ifndef OS_IS_WIN32
+#ifndef OS_IS_WIN32
/* Yes indeed. Useless, but fun! */
if (isatty(STDERR_FILENO)) {
if (level <= PA_LOG_ERROR) {
@@ -151,8 +151,8 @@ void pa_log_levelv_meta(
break;
}
-
-#ifdef HAVE_SYSLOG_H
+
+#ifdef HAVE_SYSLOG_H
case PA_LOG_SYSLOG: {
char *local_t;
@@ -167,20 +167,20 @@ void pa_log_levelv_meta(
}
closelog();
- break;
+ break;
}
#endif
-
+
case PA_LOG_USER: {
char *x;
x = pa_sprintf_malloc("%s%s", location, t);
user_log_func(level, x);
pa_xfree(x);
-
+
break;
}
-
+
case PA_LOG_NULL:
default:
break;
@@ -197,7 +197,7 @@ void pa_log_level_meta(
int line,
const char *func,
const char *format, ...) {
-
+
va_list ap;
va_start(ap, format);
pa_log_levelv_meta(level, file, line, func, format, ap);
diff --git a/src/pulsecore/log.h b/src/pulsecore/log.h
index bf0e75f5..728c2501 100644
--- a/src/pulsecore/log.h
+++ b/src/pulsecore/log.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/mcalign.c b/src/pulsecore/mcalign.c
index 9ede610d..baf36784 100644
--- a/src/pulsecore/mcalign.c
+++ b/src/pulsecore/mcalign.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -42,11 +42,11 @@ pa_mcalign *pa_mcalign_new(size_t base) {
assert(base);
m = pa_xnew(pa_mcalign, 1);
-
+
m->base = base;
pa_memchunk_reset(&m->leftover);
pa_memchunk_reset(&m->current);
-
+
return m;
}
@@ -58,22 +58,22 @@ void pa_mcalign_free(pa_mcalign *m) {
if (m->current.memblock)
pa_memblock_unref(m->current.memblock);
-
+
pa_xfree(m);
}
void pa_mcalign_push(pa_mcalign *m, const pa_memchunk *c) {
assert(m);
assert(c);
-
+
assert(c->memblock);
assert(c->length > 0);
assert(!m->current.memblock);
-
+
/* Append to the leftover memory block */
if (m->leftover.memblock) {
-
+
/* Try to merge */
if (m->leftover.memblock == c->memblock &&
m->leftover.index + m->leftover.length == c->index) {
@@ -85,7 +85,7 @@ void pa_mcalign_push(pa_mcalign *m, const pa_memchunk *c) {
if (m->leftover.length >= m->base) {
m->current = m->leftover;
pa_memchunk_reset(&m->leftover);
- }
+ }
} else {
size_t l;
@@ -93,7 +93,7 @@ void pa_mcalign_push(pa_mcalign *m, const pa_memchunk *c) {
/* We have to copy */
assert(m->leftover.length < m->base);
l = m->base - m->leftover.length;
-
+
if (l > c->length)
l = c->length;
@@ -115,7 +115,7 @@ void pa_mcalign_push(pa_mcalign *m, const pa_memchunk *c) {
}
} else {
/* Nothing to merge or copy, just store it */
-
+
if (c->length >= m->base)
m->current = *c;
else
@@ -146,7 +146,7 @@ int pa_mcalign_pop(pa_mcalign *m, pa_memchunk *c) {
m->leftover = m->current;
pa_memchunk_reset(&m->current);
}
-
+
return 0;
}
@@ -182,13 +182,13 @@ int pa_mcalign_pop(pa_mcalign *m, pa_memchunk *c) {
}
pa_memchunk_reset(&m->current);
-
+
return 0;
}
/* There's simply nothing */
return -1;
-
+
}
size_t pa_mcalign_csize(pa_mcalign *m, size_t l) {
@@ -196,9 +196,9 @@ size_t pa_mcalign_csize(pa_mcalign *m, size_t l) {
assert(l > 0);
assert(!m->current.memblock);
-
+
if (m->leftover.memblock)
l += m->leftover.length;
-
+
return (l/m->base)*m->base;
}
diff --git a/src/pulsecore/mcalign.h b/src/pulsecore/mcalign.h
index 94e99e21..751eacd3 100644
--- a/src/pulsecore/mcalign.h
+++ b/src/pulsecore/mcalign.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -41,11 +41,11 @@
* for (;;) {
* pa_memchunk input;
*
- * ... fill input ...
+ * ... fill input ...
*
* pa_mcalign_push(m, &input);
* pa_memblock_unref(input.memblock);
- *
+ *
* for (;;) {
* pa_memchunk output;
*
diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index 9cfd79b5..73874cf1 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -71,7 +71,7 @@ struct memexport_slot {
struct pa_memexport {
pa_mempool *pool;
-
+
struct memexport_slot slots[PA_MEMEXPORT_SLOTS_MAX];
PA_LLIST_HEAD(struct memexport_slot, free_slots);
PA_LLIST_HEAD(struct memexport_slot, used_slots);
@@ -101,7 +101,7 @@ struct pa_mempool {
/* A list of free slots that may be reused */
PA_LLIST_HEAD(struct mempool_slot, free_slots);
-
+
pa_mempool_stat stat;
};
@@ -132,14 +132,14 @@ static void stat_remove(pa_memblock *b) {
assert(AO_load_acquire_read(&b->pool->stat.n_allocated) > 0);
assert(AO_load_acquire_read(&b->pool->stat.allocated_size) >= (AO_t) b->length);
-
+
AO_fetch_and_sub1_release_write(&b->pool->stat.n_allocated);
AO_fetch_and_add_release_write(&b->pool->stat.allocated_size, (AO_t) (-b->length));
if (b->type == PA_MEMBLOCK_IMPORTED) {
assert(AO_load_acquire_read(&b->pool->stat.n_imported) > 0);
assert(AO_load_acquire_read(&b->pool->stat.imported_size) >= (AO_t) b->length);
-
+
AO_fetch_and_sub1_release_write(&b->pool->stat.n_imported);
AO_fetch_and_add_release_write(&b->pool->stat.imported_size, (AO_t) (-b->length));
}
@@ -151,10 +151,10 @@ static pa_memblock *memblock_new_appended(pa_mempool *p, size_t length);
pa_memblock *pa_memblock_new(pa_mempool *p, size_t length) {
pa_memblock *b;
-
+
assert(p);
assert(length > 0);
-
+
if (!(b = pa_memblock_new_pool(p, length)))
b = memblock_new_appended(p, length);
@@ -231,16 +231,16 @@ pa_memblock *pa_memblock_new_pool(pa_mempool *p, size_t length) {
if (!(slot = mempool_allocate_slot(p)))
return NULL;
-
+
b = mempool_slot_data(slot);
b->type = PA_MEMBLOCK_POOL;
b->data = (uint8_t*) b + sizeof(pa_memblock);
-
+
} else if (p->block_size - sizeof(struct mempool_slot) >= length) {
if (!(slot = mempool_allocate_slot(p)))
return NULL;
-
+
b = pa_xnew(pa_memblock, 1);
b->type = PA_MEMBLOCK_POOL_EXTERNAL;
b->data = mempool_slot_data(slot);
@@ -285,7 +285,7 @@ pa_memblock *pa_memblock_new_user(pa_mempool *p, void *d, size_t length, void (*
assert(d);
assert(length > 0);
assert(free_cb);
-
+
b = pa_xnew(pa_memblock, 1);
b->type = PA_MEMBLOCK_USER;
b->read_only = read_only;
@@ -313,7 +313,7 @@ void pa_memblock_unref(pa_memblock*b) {
if (PA_REFCNT_DEC(b) > 0)
return;
-
+
stat_remove(b);
switch (b->type) {
@@ -334,13 +334,13 @@ void pa_memblock_unref(pa_memblock*b) {
segment = b->per_type.imported.segment;
assert(segment);
assert(segment->import);
-
+
pa_hashmap_remove(segment->import->blocks, PA_UINT32_TO_PTR(b->per_type.imported.id));
segment->import->release_cb(segment->import, b->per_type.imported.id, segment->import->userdata);
if (-- segment->n_blocks <= 0)
segment_detach(segment);
-
+
pa_xfree(b);
break;
}
@@ -351,9 +351,9 @@ void pa_memblock_unref(pa_memblock*b) {
slot = mempool_slot_by_ptr(b->pool, b->data);
assert(slot);
-
+
PA_LLIST_PREPEND(struct mempool_slot, b->pool->free_slots, slot);
-
+
if (b->type == PA_MEMBLOCK_POOL_EXTERNAL)
pa_xfree(b);
@@ -377,7 +377,7 @@ static void memblock_make_local(pa_memblock *b) {
if ((slot = mempool_allocate_slot(b->pool))) {
void *new_data;
/* We can move it into a local pool, perfect! */
-
+
b->type = PA_MEMBLOCK_POOL_EXTERNAL;
b->read_only = 0;
@@ -412,7 +412,7 @@ void pa_memblock_unref_fixed(pa_memblock *b) {
static void memblock_replace_import(pa_memblock *b) {
pa_memimport_segment *seg;
-
+
assert(b);
assert(b->type == PA_MEMBLOCK_IMPORTED);
@@ -453,7 +453,7 @@ pa_mempool* pa_mempool_new(int shared) {
if (p->block_size < ps)
p->block_size = ps;
-
+
p->n_blocks = PA_MEMPOOL_SLOTS_MAX;
assert(p->block_size > sizeof(struct mempool_slot));
@@ -464,7 +464,7 @@ pa_mempool* pa_mempool_new(int shared) {
}
p->n_init = 0;
-
+
PA_LLIST_HEAD_INIT(pa_memimport, p->imports);
PA_LLIST_HEAD_INIT(pa_memexport, p->exports);
PA_LLIST_HEAD_INIT(struct mempool_slot, p->free_slots);
@@ -485,7 +485,7 @@ void pa_mempool_free(pa_mempool *p) {
if (AO_load_acquire_read(&p->stat.n_allocated) > 0)
pa_log_warn("WARNING! Memory pool destroyed but not all memory blocks freed!");
-
+
pa_shm_free(&p->memory);
pa_xfree(p);
}
@@ -498,7 +498,7 @@ const pa_mempool_stat* pa_mempool_get_stat(pa_mempool *p) {
void pa_mempool_vacuum(pa_mempool *p) {
struct mempool_slot *slot;
-
+
assert(p);
for (slot = p->free_slots; slot; slot = slot->next)
@@ -512,7 +512,7 @@ int pa_mempool_get_shm_id(pa_mempool *p, uint32_t *id) {
return -1;
*id = p->memory.id;
-
+
return 0;
}
@@ -528,14 +528,14 @@ pa_memimport* pa_memimport_new(pa_mempool *p, pa_memimport_release_cb_t cb, void
assert(p);
assert(cb);
-
+
i = pa_xnew(pa_memimport, 1);
i->pool = p;
i->segments = pa_hashmap_new(NULL, NULL);
i->blocks = pa_hashmap_new(NULL, NULL);
i->release_cb = cb;
i->userdata = userdata;
-
+
PA_LLIST_PREPEND(pa_memimport, p->imports, i);
return i;
}
@@ -549,7 +549,7 @@ static pa_memimport_segment* segment_attach(pa_memimport *i, uint32_t shm_id) {
return NULL;
seg = pa_xnew(pa_memimport_segment, 1);
-
+
if (pa_shm_attach_ro(&seg->memory, shm_id) < 0) {
pa_xfree(seg);
return NULL;
@@ -557,7 +557,7 @@ static pa_memimport_segment* segment_attach(pa_memimport *i, uint32_t shm_id) {
seg->import = i;
seg->n_blocks = 0;
-
+
pa_hashmap_put(i->segments, PA_UINT32_TO_PTR(shm_id), seg);
return seg;
}
@@ -573,7 +573,7 @@ static void segment_detach(pa_memimport_segment *seg) {
void pa_memimport_free(pa_memimport *i) {
pa_memexport *e;
pa_memblock *b;
-
+
assert(i);
/* If we've exported this block further we need to revoke that export */
@@ -587,7 +587,7 @@ void pa_memimport_free(pa_memimport *i) {
pa_hashmap_free(i->blocks, NULL, NULL);
pa_hashmap_free(i->segments, NULL, NULL);
-
+
PA_LLIST_REMOVE(pa_memimport, i->pool->imports, i);
pa_xfree(i);
}
@@ -595,19 +595,19 @@ void pa_memimport_free(pa_memimport *i) {
pa_memblock* pa_memimport_get(pa_memimport *i, uint32_t block_id, uint32_t shm_id, size_t offset, size_t size) {
pa_memblock *b;
pa_memimport_segment *seg;
-
+
assert(i);
if (pa_hashmap_size(i->blocks) >= PA_MEMIMPORT_SLOTS_MAX)
return NULL;
- if (!(seg = pa_hashmap_get(i->segments, PA_UINT32_TO_PTR(shm_id))))
+ if (!(seg = pa_hashmap_get(i->segments, PA_UINT32_TO_PTR(shm_id))))
if (!(seg = segment_attach(i, shm_id)))
return NULL;
if (offset+size > seg->memory.size)
return NULL;
-
+
b = pa_xnew(pa_memblock, 1);
b->type = PA_MEMBLOCK_IMPORTED;
b->read_only = 1;
@@ -621,9 +621,9 @@ pa_memblock* pa_memimport_get(pa_memimport *i, uint32_t block_id, uint32_t shm_i
pa_hashmap_put(i->blocks, PA_UINT32_TO_PTR(block_id), b);
seg->n_blocks++;
-
+
stat_add(b);
-
+
return b;
}
@@ -633,7 +633,7 @@ int pa_memimport_process_revoke(pa_memimport *i, uint32_t id) {
if (!(b = pa_hashmap_get(i->blocks, PA_UINT32_TO_PTR(id))))
return -1;
-
+
memblock_replace_import(b);
return 0;
}
@@ -641,13 +641,13 @@ int pa_memimport_process_revoke(pa_memimport *i, uint32_t id) {
/* For sending blocks to other nodes */
pa_memexport* pa_memexport_new(pa_mempool *p, pa_memexport_revoke_cb_t cb, void *userdata) {
pa_memexport *e;
-
+
assert(p);
assert(cb);
if (!p->memory.shared)
return NULL;
-
+
e = pa_xnew(pa_memexport, 1);
e->pool = p;
PA_LLIST_HEAD_INIT(struct memexport_slot, e->free_slots);
@@ -655,7 +655,7 @@ pa_memexport* pa_memexport_new(pa_mempool *p, pa_memexport_revoke_cb_t cb, void
e->n_init = 0;
e->revoke_cb = cb;
e->userdata = userdata;
-
+
PA_LLIST_PREPEND(pa_memexport, p->exports, e);
return e;
}
@@ -683,10 +683,10 @@ int pa_memexport_process_release(pa_memexport *e, uint32_t id) {
assert(AO_load_acquire_read(&e->pool->stat.n_exported) > 0);
assert(AO_load_acquire_read(&e->pool->stat.exported_size) >= (AO_t) e->slots[id].block->length);
-
+
AO_fetch_and_sub1_release_write(&e->pool->stat.n_exported);
AO_fetch_and_add_release_write(&e->pool->stat.exported_size, (AO_t) -e->slots[id].block->length);
-
+
pa_memblock_unref(e->slots[id].block);
e->slots[id].block = NULL;
@@ -704,7 +704,7 @@ static void memexport_revoke_blocks(pa_memexport *e, pa_memimport *i) {
for (slot = e->used_slots; slot; slot = next) {
uint32_t idx;
next = slot->next;
-
+
if (slot->block->type != PA_MEMBLOCK_IMPORTED ||
slot->block->per_type.imported.segment->import != i)
continue;
@@ -720,7 +720,7 @@ static pa_memblock *memblock_shared_copy(pa_mempool *p, pa_memblock *b) {
assert(p);
assert(b);
-
+
if (b->type == PA_MEMBLOCK_IMPORTED ||
b->type == PA_MEMBLOCK_POOL ||
b->type == PA_MEMBLOCK_POOL_EXTERNAL) {
@@ -738,7 +738,7 @@ static pa_memblock *memblock_shared_copy(pa_mempool *p, pa_memblock *b) {
int pa_memexport_put(pa_memexport *e, pa_memblock *b, uint32_t *block_id, uint32_t *shm_id, size_t *offset, size_t * size) {
pa_shm *memory;
struct memexport_slot *slot;
-
+
assert(e);
assert(b);
assert(block_id);
@@ -774,10 +774,10 @@ int pa_memexport_put(pa_memexport *e, pa_memblock *b, uint32_t *block_id, uint32
assert(b->pool);
memory = &b->pool->memory;
}
-
+
assert(b->data >= memory->ptr);
assert((uint8_t*) b->data + b->length <= (uint8_t*) memory->ptr + memory->size);
-
+
*shm_id = memory->id;
*offset = (uint8_t*) b->data - (uint8_t*) memory->ptr;
*size = b->length;
diff --git a/src/pulsecore/memblock.h b/src/pulsecore/memblock.h
index d4f2b7aa..eeecf756 100644
--- a/src/pulsecore/memblock.h
+++ b/src/pulsecore/memblock.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -37,7 +37,7 @@
typedef enum pa_memblock_type {
PA_MEMBLOCK_POOL, /* Memory is part of the memory pool */
PA_MEMBLOCK_POOL_EXTERNAL, /* Data memory is part of the memory pool but the pa_memblock structure itself not */
- PA_MEMBLOCK_APPENDED, /* the data is appended to the memory block */
+ PA_MEMBLOCK_APPENDED, /* the data is appended to the memory block */
PA_MEMBLOCK_USER, /* User supplied memory, to be freed with free_cb */
PA_MEMBLOCK_FIXED, /* data is a pointer to fixed memory that needs not to be freed */
PA_MEMBLOCK_IMPORTED, /* Memory is imported from another process via shm */
@@ -66,7 +66,7 @@ struct pa_memblock {
struct {
void (*free_cb)(void *p); /* If type == PA_MEMBLOCK_USER this points to a function for freeing this memory block */
} user;
-
+
struct {
uint32_t id;
pa_memimport_segment *segment;
diff --git a/src/pulsecore/memblockq.c b/src/pulsecore/memblockq.c
index e6b73fc5..4a845a53 100644
--- a/src/pulsecore/memblockq.c
+++ b/src/pulsecore/memblockq.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -61,12 +61,12 @@ pa_memblockq* pa_memblockq_new(
size_t prebuf,
size_t minreq,
pa_memblock *silence) {
-
+
pa_memblockq* bq;
-
+
assert(base > 0);
assert(maxlength >= base);
-
+
bq = pa_xnew(pa_memblockq, 1);
bq->blocks = bq->blocks_tail = NULL;
bq->n_blocks = 0;
@@ -90,20 +90,20 @@ pa_memblockq* pa_memblockq_new(
bq->prebuf = bq->maxlength;
bq->minreq = (minreq/base)*base;
-
+
if (bq->minreq > bq->tlength - bq->prebuf)
bq->minreq = bq->tlength - bq->prebuf;
if (!bq->minreq)
bq->minreq = 1;
-
+
pa_log_debug("memblockq sanitized: maxlength=%lu, tlength=%lu, base=%lu, prebuf=%lu, minreq=%lu",
(unsigned long)bq->maxlength, (unsigned long)bq->tlength, (unsigned long)bq->base, (unsigned long)bq->prebuf, (unsigned long)bq->minreq);
bq->state = bq->prebuf ? PREBUF : RUNNING;
bq->silence = silence ? pa_memblock_ref(silence) : NULL;
bq->mcalign = NULL;
-
+
return bq;
}
@@ -117,7 +117,7 @@ void pa_memblockq_free(pa_memblockq* bq) {
if (bq->mcalign)
pa_mcalign_free(bq->mcalign);
-
+
pa_xfree(bq);
}
@@ -126,12 +126,12 @@ static void drop_block(pa_memblockq *bq, struct memblock_list *q) {
assert(q);
assert(bq->n_blocks >= 1);
-
+
if (q->prev)
q->prev->next = q->next;
else
bq->blocks = q->next;
-
+
if (q->next)
q->next->prev = q->prev;
else
@@ -168,10 +168,10 @@ static int can_push(pa_memblockq *bq, size_t l) {
}
int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) {
-
+
struct memblock_list *q, *n;
pa_memchunk chunk;
-
+
assert(bq);
assert(uchunk);
assert(uchunk->memblock);
@@ -185,7 +185,7 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) {
return -1;
chunk = *uchunk;
-
+
if (bq->read_index > bq->write_index) {
/* We currently have a buffer underflow, we need to drop some
@@ -203,7 +203,7 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) {
return 0;
}
}
-
+
/* We go from back to front to look for the right place to add
* this new entry. Drop data we will overwrite on the way */
@@ -275,29 +275,29 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) {
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);
-
+
/* The job overwrites the current entry at the end, so let's drop the beginning of this entry */
d = bq->write_index + chunk.length - q->index;
q->index += d;
q->chunk.index += d;
q->chunk.length -= d;
-
+
q = q->prev;
}
-
+
}
if (q) {
assert(bq->write_index >= q->index + (int64_t)q->chunk.length);
assert(!q->next || (bq->write_index + (int64_t)chunk.length <= q->next->index));
-
+
/* Try to merge memory blocks */
-
+
if (q->chunk.memblock == chunk.memblock &&
q->chunk.index + (int64_t)q->chunk.length == chunk.index &&
bq->write_index == q->index + (int64_t)q->chunk.length) {
-
+
q->chunk.length += chunk.length;
bq->write_index += chunk.length;
return 0;
@@ -324,7 +324,7 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) {
n->prev->next = n;
else
bq->blocks = n;
-
+
bq->n_blocks++;
return 0;
}
@@ -347,7 +347,7 @@ int pa_memblockq_peek(pa_memblockq* bq, pa_memchunk *chunk) {
bq->state = PREBUF;
return -1;
}
-
+
/* Do we need to spit out silence? */
if (!bq->blocks || bq->blocks->index > bq->read_index) {
@@ -362,7 +362,7 @@ int pa_memblockq_peek(pa_memblockq* bq, pa_memchunk *chunk) {
if (!length || length > chunk->memblock->length)
length = chunk->memblock->length;
-
+
chunk->length = length;
} else {
@@ -370,7 +370,7 @@ int pa_memblockq_peek(pa_memblockq* bq, pa_memchunk *chunk) {
* the time to sleep */
if (!bq->blocks)
return -1;
-
+
chunk->memblock = NULL;
chunk->length = length;
}
@@ -381,7 +381,7 @@ int pa_memblockq_peek(pa_memblockq* bq, pa_memchunk *chunk) {
/* Ok, let's pass real data to the caller */
assert(bq->blocks->index == bq->read_index);
-
+
*chunk = bq->blocks->chunk;
pa_memblock_ref(chunk->memblock);
@@ -432,14 +432,14 @@ void pa_memblockq_drop(pa_memblockq *bq, const pa_memchunk *chunk, size_t length
assert(bq->blocks->index >= bq->read_index);
d = (size_t) (bq->blocks->index - bq->read_index);
-
+
if (d >= length) {
/* The first block is too far in the future */
-
+
bq->read_index += length;
break;
} else {
-
+
length -= d;
bq->read_index += d;
}
@@ -462,7 +462,7 @@ void pa_memblockq_drop(pa_memblockq *bq, const pa_memchunk *chunk, size_t length
bq->read_index += length;
break;
}
-
+
} else {
/* The list is empty, there's nothing we could drop */
@@ -477,7 +477,7 @@ int pa_memblockq_is_readable(pa_memblockq *bq) {
if (bq->prebuf > 0) {
size_t l = pa_memblockq_get_length(bq);
-
+
if (bq->state == PREBUF && l < bq->prebuf)
return 0;
@@ -493,7 +493,7 @@ int pa_memblockq_is_writable(pa_memblockq *bq, size_t length) {
if (length % bq->base)
return 0;
-
+
return pa_memblockq_get_length(bq) + length <= bq->tlength;
}
@@ -502,7 +502,7 @@ size_t pa_memblockq_get_length(pa_memblockq *bq) {
if (bq->write_index <= bq->read_index)
return 0;
-
+
return (size_t) (bq->write_index - bq->read_index);
}
@@ -546,7 +546,7 @@ void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek) {
void pa_memblockq_flush(pa_memblockq *bq) {
assert(bq);
-
+
while (bq->blocks)
drop_block(bq, bq->blocks);
@@ -559,7 +559,7 @@ void pa_memblockq_flush(pa_memblockq *bq) {
size_t pa_memblockq_get_tlength(pa_memblockq *bq) {
assert(bq);
-
+
return bq->tlength;
}
@@ -578,18 +578,18 @@ int pa_memblockq_push_align(pa_memblockq* bq, const pa_memchunk *chunk) {
assert(bq);
assert(chunk && bq->base);
-
+
if (bq->base == 1)
return pa_memblockq_push(bq, chunk);
-
+
if (!bq->mcalign)
bq->mcalign = pa_mcalign_new(bq->base);
if (!can_push(bq, pa_mcalign_csize(bq->mcalign, chunk->length)))
return -1;
-
+
pa_mcalign_push(bq->mcalign, chunk);
-
+
while (pa_mcalign_pop(bq->mcalign, &rchunk) >= 0) {
int r;
r = pa_memblockq_push(bq, &rchunk);
diff --git a/src/pulsecore/memblockq.h b/src/pulsecore/memblockq.h
index 4d701a80..3485a669 100644
--- a/src/pulsecore/memblockq.h
+++ b/src/pulsecore/memblockq.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -39,27 +39,27 @@ typedef struct pa_memblockq pa_memblockq;
/* Parameters:
-
+
- idx: start value for both read and write index
- maxlength: maximum length of queue. If more data is pushed into
the queue, the operation will fail. Must not be 0.
-
+
- tlength: the target length of the queue. Pass 0 for the default.
-
+
- base: a base value for all metrics. Only multiples of this value
are popped from the queue or should be pushed into
it. Must not be 0.
-
+
- prebuf: If the queue runs empty wait until this many bytes are in
queue again before passing the first byte out. If set
to 0 pa_memblockq_pop() will return a silence memblock
if no data is in the queue and will never fail. Pass
(size_t) -1 for the default.
-
+
- minreq: pa_memblockq_missing() will only return values greater
than this value. Pass 0 for the default.
-
+
- silence: return this memblock whzen reading unitialized data
*/
pa_memblockq* pa_memblockq_new(
@@ -67,7 +67,7 @@ pa_memblockq* pa_memblockq_new(
size_t maxlength,
size_t tlength,
size_t base,
- size_t prebuf,
+ size_t prebuf,
size_t minreq,
pa_memblock *silence);
diff --git a/src/pulsecore/memchunk.c b/src/pulsecore/memchunk.c
index 1dbad2b9..2ab6d358 100644
--- a/src/pulsecore/memchunk.c
+++ b/src/pulsecore/memchunk.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -35,7 +35,7 @@
void pa_memchunk_make_writable(pa_memchunk *c, size_t min) {
pa_memblock *n;
size_t l;
-
+
assert(c);
assert(c->memblock);
assert(PA_REFCNT_VALUE(c->memblock) > 0);
@@ -48,7 +48,7 @@ void pa_memchunk_make_writable(pa_memchunk *c, size_t min) {
l = c->length;
if (l < min)
l = min;
-
+
n = pa_memblock_new(c->memblock->pool, l);
memcpy(n->data, (uint8_t*) c->memblock->data + c->index, c->length);
pa_memblock_unref(c->memblock);
diff --git a/src/pulsecore/memchunk.h b/src/pulsecore/memchunk.h
index b8ce6249..2e2f936b 100644
--- a/src/pulsecore/memchunk.h
+++ b/src/pulsecore/memchunk.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/modargs.c b/src/pulsecore/modargs.c
index 13a48785..243ea019 100644
--- a/src/pulsecore/modargs.c
+++ b/src/pulsecore/modargs.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -60,7 +60,7 @@ static int add_key_value(pa_hashmap *map, char *key, char *value, const char* co
return -1;
}
}
-
+
e = pa_xmalloc(sizeof(struct entry));
e->key = key;
e->value = value;
@@ -78,7 +78,7 @@ pa_modargs *pa_modargs_new(const char *args, const char* const* valid_keys) {
enum { WHITESPACE, KEY, VALUE_START, VALUE_SIMPLE, VALUE_DOUBLE_QUOTES, VALUE_TICKS } state;
const char *p, *key, *value;
size_t key_len = 0, value_len = 0;
-
+
key = value = NULL;
state = WHITESPACE;
for (p = args; *p; p++) {
@@ -160,7 +160,7 @@ fail:
if (map)
pa_modargs_free((pa_modargs*) map);
-
+
return NULL;
}
@@ -210,7 +210,7 @@ int pa_modargs_get_value_s32(pa_modargs *ma, const char *key, int32_t *value) {
if (pa_atoi(v, value) < 0)
return -1;
-
+
return 0;
}
@@ -239,7 +239,7 @@ int pa_modargs_get_sample_spec(pa_modargs *ma, pa_sample_spec *rss) {
assert(ma && rss);
/* DEBUG_TRAP;*/
-
+
ss = *rss;
if ((pa_modargs_get_value_u32(ma, "rate", &ss.rate)) < 0)
return -1;
@@ -257,14 +257,14 @@ int pa_modargs_get_sample_spec(pa_modargs *ma, pa_sample_spec *rss) {
return -1;
*rss = ss;
-
+
return 0;
}
int pa_modargs_get_channel_map(pa_modargs *ma, pa_channel_map *rmap) {
pa_channel_map map;
const char *cm;
-
+
assert(ma);
assert(rmap);
@@ -284,7 +284,7 @@ int pa_modargs_get_channel_map(pa_modargs *ma, pa_channel_map *rmap) {
int pa_modargs_get_sample_spec_and_channel_map(pa_modargs *ma, pa_sample_spec *rss, pa_channel_map *rmap, pa_channel_map_def_t def) {
pa_sample_spec ss;
pa_channel_map map;
-
+
assert(ma);
assert(rss);
assert(rmap);
diff --git a/src/pulsecore/modargs.h b/src/pulsecore/modargs.h
index 730cf396..5cccee90 100644
--- a/src/pulsecore/modargs.h
+++ b/src/pulsecore/modargs.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/modinfo.c b/src/pulsecore/modinfo.c
index 00720113..46e66c50 100644
--- a/src/pulsecore/modinfo.c
+++ b/src/pulsecore/modinfo.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/modinfo.h b/src/pulsecore/modinfo.h
index 90404504..e8d3103f 100644
--- a/src/pulsecore/modinfo.h
+++ b/src/pulsecore/modinfo.h
@@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/pulsecore/module.c b/src/pulsecore/module.c
index ea3d726e..94410b39 100644
--- a/src/pulsecore/module.c
+++ b/src/pulsecore/module.c
@@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -100,17 +100,17 @@ static inline fnptr load_sym(lt_dlhandle handle, const char *module, const char
pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
pa_module *m = NULL;
int r;
-
+
assert(c && name);
if (c->disallow_module_loading)
goto fail;
-
+
m = pa_xmalloc(sizeof(pa_module));
m->name = pa_xstrdup(name);
m->argument = pa_xstrdup(argument);
-
+
if (!(m->dl = lt_dlopenext(name))) {
pa_log("Failed to open module \"%s\": %s", name, lt_dlerror());
goto fail;
@@ -125,7 +125,7 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
pa_log("Failed to load module \"%s\": symbol \""PA_SYMBOL_DONE"\" not found.", name);
goto fail;
}
-
+
m->userdata = NULL;
m->core = c;
m->n_used = -1;
@@ -148,23 +148,23 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
c->module_auto_unload_event = c->mainloop->time_new(c->mainloop, &ntv, timeout_callback, c);
}
assert(c->module_auto_unload_event);
-
+
assert(c->modules);
r = pa_idxset_put(c->modules, m, &m->index);
assert(r >= 0 && m->index != PA_IDXSET_INVALID);
- pa_log_info("Loaded \"%s\" (index: #%u; argument: \"%s\").", m->name, m->index, m->argument ? m->argument : "");
+ pa_log_info("Loaded \"%s\" (index: #%u; argument: \"%s\").", m->name, m->index, m->argument ? m->argument : "");
pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_NEW, m->index);
-
+
return m;
-
+
fail:
if (m) {
pa_xfree(m->argument);
pa_xfree(m->name);
-
+
if (m->dl)
lt_dlclose(m->dl);
@@ -180,16 +180,16 @@ static void pa_module_free(pa_module *m) {
if (m->core->disallow_module_loading)
return;
- pa_log_info("Unloading \"%s\" (index: #%u).", m->name, m->index);
+ pa_log_info("Unloading \"%s\" (index: #%u).", m->name, m->index);
m->done(m->core, m);
lt_dlclose(m->dl);
-
- pa_log_info("Unloaded \"%s\" (index: #%u).", m->name, m->index);
+
+ pa_log_info("Unloaded \"%s\" (index: #%u).", m->name, m->index);
pa_subscription_post(m->core, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_REMOVE, m->index);
-
+
pa_xfree(m->name);
pa_xfree(m->argument);
pa_xfree(m);
@@ -250,7 +250,7 @@ static int unused_callback(void *p, PA_GCC_UNUSED uint32_t idx, int *del, void *
pa_module *m = p;
time_t *now = userdata;
assert(p && del && now);
-