summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2007-01-04 13:43:45 +0000
committerPierre Ossman <ossman@cendio.se>2007-01-04 13:43:45 +0000
commit521daf6f0ac4fa6a2fbfb5d523c0c743342dca2b (patch)
treeb4ae535c62dd1fd31c23eb2734aeaab8686a0fa4
parent1a460ee40ab19e354402f6c9346591b554471f03 (diff)
Huge trailing whitespace cleanup. Let's keep the tree pure from here on,
mmmkay? git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1418 fefdeb5f-60dc-0310-8127-8f9354f1896f
-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 cebdaebcc..db4bd9194 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 8a618286f..34da1af68 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 d368b644f..c3cb9209e 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 25453e558..fdfbc0b69 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 d7466b06e..808cb4d4a 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 21bdd17ba..bb11f794e 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 dd478126c..319cf0c7d 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 b4b833ad4..b7fcf23b7 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 06734ea63..8509924aa 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 5d77282c7..b7266b7ea 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 d8b6c5ccc..8023d3add 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 215844b40..675856c6b 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 165ccff6a..ee9062d19 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 7a9871a47..73501c29c 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 6ff9a6e49..2fea58917 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 aa0666f10..596998d12 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 d5374838b..b5c27299d 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 f3bb3fd3a..6bc958aa9 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 84ccd14cb..3057f70db 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 263e81f93..fbb6bd6db 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 7a662c2df..a7196313e 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 6d4a84891..626006826 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 8232cd383..eb275ff02 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 47f77bab3..6175536c8 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 62a991087..8d891ce64 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 18b2ddf1f..f32667ee6 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 eb5de64eb..d0e82ba32 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 37234d925..baf688f19 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 dd3b4abe8..907aab273 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 50e58853a..fc9107a37 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 5ab082878..7bf6cbbdf 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 b71581d9a..b8ced86fb 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 4aee849bb..724003130 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 c251f7ac3..f53f6a63b 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 df58958a9..93fb2a366 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 7aa205bd4..2eea4f61d 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 fa29ba160..871b702d3 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 66968cb1a..1454d6398 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 a110c57e2..f7420a67b 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 efa59f406..877d17c78 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 4043c1364..e245e1380 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 48e95c8ce..5322a71f9 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 f2cace149..b1c17a7c1 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 696d8afeb..10643808b 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 0aaf6971d..d26a0e813 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 12855f4e2..6a8bf3d28 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 dae8e3d51..4b0de0294 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 fc57a4d50..7b9aae8d5 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 a3ec231cc..09b9b84a5 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 69b09089c..40655cf50 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 8a39ade85..203802510 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 8cedc48b9..78e190e51 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 5cd7e3ed5..b652a25ba 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 a458c6b10..7ef43b306 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 661ff6170..048ed17f4 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 a22e3c190..fb04de506 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 7bd31ead9..3b9a60a4c 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 bfce023ca..c96349a61 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 201b6e236..1669acddb 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 af7cc0e90..5f8093a1a 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 4eef4b4ad..8cdbf84a1 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 b926e4e4d..5a2c8fb67 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 28d22cd7e..6de7bc714 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 2e20b446a..bf3ef37ed 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 7b7075ae2..b88bf125e 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 d651462b0..4dd427966 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 0721c1f5d..e991cf1cf 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 f7b155373..04461b307 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 8abd8fe47..18be1f2ba 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 8d896d7d9..e039e8c9a 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 b544e08ec..adfd5f2d0 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 88cc326b8..5543d7cd6 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 7ca418e10..dd68ac17b 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 da32fdf0f..b7c537e4c 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 5d29c5b32..5abaf845f 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 e32703d44..2293dec4e 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 a41881bb6..1c632fa7f 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 0438d3199..a97875f91 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 180cd096d..009eb3cf6 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 ad15125ab..2ce534586 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 c1d889122..d9abf6f80 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 adbea6809..35d5a31ce 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 7e1ccfaa6..ad29f5ba8 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 44eff5a34..48048b35c 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 112852302..e5a86a632 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 e2dbbadb2..c10ec9f60 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 33fa7214e..2708c5181 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 2eac724db..7225471f1 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 c13951da4..63f54e3bb 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 5c03b0a94..0be169fb4 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 530814e0f..aa7ddba29 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 6c60223ac..62d2867aa 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 367551665..dda42bdc3 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 126c495ca..2fb1c5f0f 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 a61f84426..c89d4a15f 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 44e942f75..b91e6875b 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 8d608b5b6..e713e7a83 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 7eda1e496..f3a811798 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 b1da28bea..fb777f85f 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 87631ca53..8ef53bd8e 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 cc8a565cf..bba0bc73c 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 60304201f..b68eaac75 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 65bdd6da6..f410e49cb 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 80256a124..bcda99546 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 d868fed49..bb8f5716b 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 ae475c3a0..cb438a224 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 c56c3ca00..1594f4db4 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 49934c07d..ac74a287c 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 cd3acdee7..b092fc8b7 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 e3fc2e4cd..0820fc8e7 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 639fa9525..5cf0ebd21 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 c34bf1490..55697d2e3 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 b28065e5d..e632da129 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 db1e37192..6f55e2de4 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 718499d12..f849a6f64 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 61878c9ed..2362068f1 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 32da8bf2b..e43908339 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 e3bf3ca21..26c493ca5 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 d01aae9b1..69baabbc6 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 4df1d5112..5a958b839 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 6e3b646eb..875cf331b 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 5f72b3428..b42dc0caa 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 ba3259686..b2608edd0 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 63ee60ca8..b19b1974b 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 3a34d297a..c1c6a19c2 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 d92ce5989..5ad880a01 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 cd1fcb0fd..91a9d5e10 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 4ddb526ca..216d87662 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 65db3feb3..c01930140 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 9d44f65c7..0ea201b62 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 cfeeac22f..5091bfd1e 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 57c9598b2..9871f32d6 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 97cedf814..b5c9e6a2c 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 8825700ad..87f7eece5 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 81a160a69..809eaeec3 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 b8a358ec6..18e41cf3f 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 91c2598b7..40f6b4355 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 67e5d1ae2..9a219a90b 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 ee0137a3d..dce51e210 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 1765e843c..0d751e079 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 483c3e262..5d7a543ef 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 7b6bbc31d..42bb53879 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 af732c26c..b40f0aa10 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 0e6d6d3af..147e7276f 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 a3bca22f9..2fe5c88d4 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 e736e2b3b..8d3fb5f80 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 36159fabf..2848b1698 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 7a4540ce9..61bf99b01 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 312794312..49d261664 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 ce0932211..7ad90383c 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 bf0e75f51..728c25013 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 9ede610d7..baf367843 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 94e99e212..751eacd3e 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 9cfd79b5e..73874cf1a 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 d4f2b7aaf..eeecf7562 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 e6b73fc55..4a845a53b 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 4d701a80e..3485a6693 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 1dbad2b90..2ab6d3581 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 b8ce62495..2e2f936bb 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 13a48785b..243ea0196 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 730cf3968..5cccee903 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 00720113a..46e66c50f 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 90404504f..e8d3103fa 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 ea3d726ed..94410b396 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);
-
+
if (m->n_used == 0 && m->auto_unload && m->last_used_time+m->core->module_idle_time <= *now) {
pa_module_free(m);
*del = 1;
@@ -265,7 +265,7 @@ void pa_module_unload_unused(pa_core *c) {
if (!c->modules)
return;
-
+
time(&now);
pa_idxset_foreach(c->modules, unused_callback, &now);
}
@@ -309,7 +309,7 @@ void pa_module_set_used(pa_module*m, int used) {
if (m->n_used != used)
pa_subscription_post(m->core, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_CHANGE, m->index);
-
+
if (m->n_used != used && used == 0)
time(&m->last_used_time);
diff --git a/src/pulsecore/module.h b/src/pulsecore/module.h
index 8c320be88..5f1075076 100644
--- a/src/pulsecore/module.h
+++ b/src/pulsecore/module.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 @@ struct pa_module {
uint32_t index;
lt_dlhandle dl;
-
+
int (*init)(pa_core *c, pa_module*m);
void (*done)(pa_core *c, pa_module*m);
diff --git a/src/pulsecore/mutex-posix.c b/src/pulsecore/mutex-posix.c
index 094d637d9..896913ce1 100644
--- a/src/pulsecore/mutex-posix.c
+++ b/src/pulsecore/mutex-posix.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/mutex-win32.c b/src/pulsecore/mutex-win32.c
index 3710d914d..124b17c61 100644
--- a/src/pulsecore/mutex-win32.c
+++ b/src/pulsecore/mutex-win32.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/mutex.h b/src/pulsecore/mutex.h
index b3b9c5c6a..11a20733b 100644
--- a/src/pulsecore/mutex.h
+++ b/src/pulsecore/mutex.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/namereg.c b/src/pulsecore/namereg.c
index fcd271bf6..faf7f1444 100644
--- a/src/pulsecore/namereg.c
+++ b/src/pulsecore/namereg.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
@@ -59,14 +59,14 @@ static int is_valid_name(const char *name) {
if (*name == 0)
return 0;
-
+
for (c = name; *c && (c-name < PA_NAME_MAX); c++)
if (!is_valid_char(*c))
return 0;
if (*c)
return 0;
-
+
return 1;
}
@@ -78,7 +78,7 @@ static char* cleanup_name(const char *name) {
return NULL;
n = pa_xnew(char, strlen(name)+1);
-
+
for (a = name, b = n; *a && (a-name < PA_NAME_MAX); a++, b++)
*b = is_valid_char(*a) ? *a : '_';
@@ -89,10 +89,10 @@ static char* cleanup_name(const char *name) {
void pa_namereg_free(pa_core *c) {
assert(c);
-
+
if (!c->namereg)
return;
-
+
assert(pa_hashmap_size(c->namereg) == 0);
pa_hashmap_free(c->namereg, NULL, NULL);
}
@@ -101,17 +101,17 @@ const char *pa_namereg_register(pa_core *c, const char *name, pa_namereg_type_t
struct namereg_entry *e;
char *n = NULL;
int r;
-
+
assert(c);
assert(name);
assert(data);
if (!*name)
return NULL;
-
+
if ((type == PA_NAMEREG_SINK || type == PA_NAMEREG_SOURCE) &&
!is_valid_name(name) ) {
-
+
if (fail)
return NULL;
@@ -136,9 +136,9 @@ const char *pa_namereg_register(pa_core *c, const char *name, pa_namereg_type_t
pa_xfree(n);
return NULL;
}
-
+
k = pa_xnew(char, l+4);
-
+
for (i = 2; i <= 99; i++) {
snprintf(k, l+4, "%s.%u", name, i);
@@ -151,11 +151,11 @@ const char *pa_namereg_register(pa_core *c, const char *name, pa_namereg_type_t
pa_xfree(k);
return NULL;
}
-
+
pa_xfree(n);
n = k;
}
-
+
e = pa_xnew(struct namereg_entry, 1);
e->type = type;
e->name = n ? n : pa_xstrdup(name);
@@ -169,7 +169,7 @@ const char *pa_namereg_register(pa_core *c, const char *name, pa_namereg_type_t
void pa_namereg_unregister(pa_core *c, const char *name) {
struct namereg_entry *e;
-
+
assert(c);
assert(name);
@@ -184,26 +184,26 @@ void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type, int a
struct namereg_entry *e;
uint32_t idx;
assert(c);
-
+
if (!name) {
-
+
if (type == PA_NAMEREG_SOURCE)
name = pa_namereg_get_default_source_name(c);
else if (type == PA_NAMEREG_SINK)
name = pa_namereg_get_default_sink_name(c);
-
+
} else if (strcmp(name, "@DEFAULT_SINK@") == 0) {
if (type == PA_NAMEREG_SINK)
name = pa_namereg_get_default_sink_name(c);
-
+
} else if (strcmp(name, "@DEFAULT_SOURCE@") == 0) {
if (type == PA_NAMEREG_SOURCE)
name = pa_namereg_get_default_source_name(c);
-
+
} else if (strcmp(name, "@DEFAULT_MONITOR@") == 0) {
if (type == PA_NAMEREG_SOURCE) {
pa_sink *k;
-
+
if ((k = pa_namereg_get(c, NULL, PA_NAMEREG_SINK, autoload)))
return k->monitor_source;
}
@@ -212,7 +212,7 @@ void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type, int a
if (!name)
return NULL;
-
+
if (c->namereg && (e = pa_hashmap_get(c->namereg, name)))
if (e->type == type)
return e->data;
@@ -221,12 +221,12 @@ void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type, int a
if (autoload) {
pa_autoload_request(c, name, type);
-
+
if (c->namereg && (e = pa_hashmap_get(c->namereg, name)))
if (e->type == type)
return e->data;
}
-
+
return NULL;
}
@@ -242,7 +242,7 @@ void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type, int a
int pa_namereg_set_default(pa_core*c, const char *name, pa_namereg_type_t type) {
char **s;
-
+
assert(c);
assert(type == PA_NAMEREG_SINK || type == PA_NAMEREG_SOURCE);
@@ -256,7 +256,7 @@ int pa_namereg_set_default(pa_core*c, const char *name, pa_namereg_type_t type)
if (!is_valid_name(name))
return -1;
-
+
pa_xfree(*s);
*s = pa_xstrdup(name);
pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_SERVER|PA_SUBSCRIPTION_EVENT_CHANGE, PA_INVALID_INDEX);
@@ -266,12 +266,12 @@ int pa_namereg_set_default(pa_core*c, const char *name, pa_namereg_type_t type)
const char *pa_namereg_get_default_sink_name(pa_core *c) {
pa_sink *s;
-
+
assert(c);
if (c->default_sink_name)
return c->default_sink_name;
-
+
if ((s = pa_idxset_first(c->sinks, NULL)))
pa_namereg_set_default(c, s->name, PA_NAMEREG_SINK);
@@ -281,7 +281,7 @@ const char *pa_namereg_get_default_sink_name(pa_core *c) {
const char *pa_namereg_get_default_source_name(pa_core *c) {
pa_source *s;
uint32_t idx;
-
+
assert(c);
if (c->default_source_name)
diff --git a/src/pulsecore/namereg.h b/src/pulsecore/namereg.h
index 53fb66184..efadb06eb 100644
--- a/src/pulsecore/namereg.h
+++ b/src/pulsecore/namereg.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/native-common.h b/src/pulsecore/native-common.h
index 785289eb1..df7654ffa 100644
--- a/src/pulsecore/native-common.h
+++ b/src/pulsecore/native-common.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
@@ -51,7 +51,7 @@ enum {
PA_COMMAND_FINISH_UPLOAD_STREAM,
PA_COMMAND_PLAY_SAMPLE,
PA_COMMAND_REMOVE_SAMPLE,
-
+
PA_COMMAND_GET_SERVER_INFO,
PA_COMMAND_GET_SINK_INFO,
PA_COMMAND_GET_SINK_INFO_LIST,
@@ -68,24 +68,24 @@ enum {
PA_COMMAND_GET_SAMPLE_INFO,
PA_COMMAND_GET_SAMPLE_INFO_LIST,
PA_COMMAND_SUBSCRIBE,
-
+
PA_COMMAND_SET_SINK_VOLUME,
PA_COMMAND_SET_SINK_INPUT_VOLUME,
PA_COMMAND_SET_SOURCE_VOLUME,
PA_COMMAND_SET_SINK_MUTE,
PA_COMMAND_SET_SOURCE_MUTE,
-
+
PA_COMMAND_CORK_PLAYBACK_STREAM,
PA_COMMAND_FLUSH_PLAYBACK_STREAM,
PA_COMMAND_TRIGGER_PLAYBACK_STREAM,
-
+
PA_COMMAND_SET_DEFAULT_SINK,
PA_COMMAND_SET_DEFAULT_SOURCE,
-
+
PA_COMMAND_SET_PLAYBACK_STREAM_NAME,
PA_COMMAND_SET_RECORD_STREAM_NAME,
-
+
PA_COMMAND_KILL_CLIENT,
PA_COMMAND_KILL_SINK_INPUT,
PA_COMMAND_KILL_SOURCE_OUTPUT,
diff --git a/src/pulsecore/once-posix.c b/src/pulsecore/once-posix.c
index 865997df3..bb2ca7930 100644
--- a/src/pulsecore/once-posix.c
+++ b/src/pulsecore/once-posix.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,22 +35,22 @@
assert(_r == 0); \
} while(0)
-static pa_mutex *global_mutex;
+static pa_mutex *global_mutex;
static pthread_once_t global_mutex_once = PTHREAD_ONCE_INIT;
-static void global_mutex_once_func(void) {
- global_mutex = pa_mutex_new(0);
-}
+static void global_mutex_once_func(void) {
+ global_mutex = pa_mutex_new(0);
+}
+
+void pa_once(pa_once_t *control, pa_once_func_t func) {
+ assert(control);
+ assert(func);
-void pa_once(pa_once_t *control, pa_once_func_t func) {
- assert(control);
- assert(func);
-
/* Create the global mutex */
- ASSERT_SUCCESS(pthread_once(&global_mutex_once, global_mutex_once_func));
+ ASSERT_SUCCESS(pthread_once(&global_mutex_once, global_mutex_once_func));
/* Create the local mutex */
- pa_mutex_lock(global_mutex);
+ pa_mutex_lock(global_mutex);
if (!control->mutex)
control->mutex = pa_mutex_new(1);
pa_mutex_unlock(global_mutex);
@@ -61,9 +61,9 @@ void pa_once(pa_once_t *control, pa_once_func_t func) {
control->once_value = 1;
func();
}
- pa_mutex_unlock(control->mutex);
+ pa_mutex_unlock(control->mutex);
/* Caveat: We have to make sure that the once func has completed
* before returning, even if the once func is not actually
* executed by us. Hence the awkward locking. */
-}
+}
diff --git a/src/pulsecore/once-win32.c b/src/pulsecore/once-win32.c
index 8b9282f42..07f68f383 100644
--- a/src/pulsecore/once-win32.c
+++ b/src/pulsecore/once-win32.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
@@ -59,7 +59,7 @@ void pa_once(pa_once_t *control, pa_once_func_t func) {
control->once_value = 1;
func();
}
- pa_mutex_unlock(control->mutex);
+ pa_mutex_unlock(control->mutex);
/* Caveat: We have to make sure that the once func has completed
* before returning, even if the once func is not actually
diff --git a/src/pulsecore/once.h b/src/pulsecore/once.h
index 0aabb3f29..3c475a1d0 100644
--- a/src/pulsecore/once.h
+++ b/src/pulsecore/once.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/packet.c b/src/pulsecore/packet.c
index 8b010f012..b3a4b6f4c 100644
--- a/src/pulsecore/packet.c
+++ b/src/pulsecore/packet.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
@@ -40,7 +40,7 @@ pa_packet* pa_packet_new(size_t length) {
p->length = length;
p->data = (uint8_t*) (p+1);
p->type = PA_PACKET_APPENDED;
-
+
return p;
}
@@ -55,14 +55,14 @@ pa_packet* pa_packet_new_dynamic(void* data, size_t length) {
p->length = length;
p->data = data;
p->type = PA_PACKET_DYNAMIC;
-
+
return p;
}
pa_packet* pa_packet_ref(pa_packet *p) {
assert(p);
assert(p->ref >= 1);
-
+
p->ref++;
return p;
}
@@ -70,7 +70,7 @@ pa_packet* pa_packet_ref(pa_packet *p) {
void pa_packet_unref(pa_packet *p) {
assert(p);
assert(p->ref >= 1);
-
+
if (--p->ref == 0) {
if (p->type == PA_PACKET_DYNAMIC)
pa_xfree(p->data);
diff --git a/src/pulsecore/packet.h b/src/pulsecore/packet.h
index 7842857a6..89759c5ab 100644
--- a/src/pulsecore/packet.h
+++ b/src/pulsecore/packet.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/parseaddr.c b/src/pulsecore/parseaddr.c
index da1647af7..3a5bc2e80 100644
--- a/src/pulsecore/parseaddr.c
+++ b/src/pulsecore/parseaddr.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
@@ -53,11 +53,11 @@ static char *parse_host(const char *s, uint16_t *ret_port) {
*ret_port = atoi(e+2);
else if (e[1] != 0)
return NULL;
-
+
return pa_xstrndup(s+1, e-s-1);
} else {
char *e;
-
+
if (!(e = strrchr(s, ':')))
return pa_xstrdup(s);
@@ -75,22 +75,22 @@ int pa_parse_address(const char *name, pa_parsed_address *ret_p) {
if (*name == '{') {
char hn[256], *pfx;
/* The URL starts with a host specification for detecting local connections */
-
+
if (!pa_get_host_name(hn, sizeof(hn)))
return -1;
-
+
pfx = pa_sprintf_malloc("{%s}", hn);
if (!pa_startswith(name, pfx)) {
pa_xfree(pfx);
/* Not local */
return -1;
}
-
+
p = name + strlen(pfx);
pa_xfree(pfx);
} else
p = name;
-
+
if (*p == '/')
ret_p->type = PA_PARSED_ADDRESS_UNIX;
else if (pa_startswith(p, "unix:")) {
@@ -109,7 +109,7 @@ int pa_parse_address(const char *name, pa_parsed_address *ret_p) {
else
if (!(ret_p->path_or_host = parse_host(p, &ret_p->port)))
return -1;
-
-
+
+
return 0;
}
diff --git a/src/pulsecore/parseaddr.h b/src/pulsecore/parseaddr.h
index 0393f6657..bbbb8989b 100644
--- a/src/pulsecore/parseaddr.h
+++ b/src/pulsecore/parseaddr.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/pdispatch.c b/src/pulsecore/pdispatch.c
index 6ecf710a7..c474ccd1c 100644
--- a/src/pulsecore/pdispatch.c
+++ b/src/pulsecore/pdispatch.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
@@ -120,9 +120,9 @@ static void reply_info_free(struct reply_info *r) {
if (r->time_event)
r->pdispatch->mainloop->time_free(r->time_event);
-
+
PA_LLIST_REMOVE(struct reply_info, r->pdispatch->replies, r);
-
+
pa_xfree(r);
}
@@ -131,7 +131,7 @@ pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *mainloop, const pa_pdispatch_cb_
assert(mainloop);
assert((entries && table) || (!entries && !table));
-
+
pd = pa_xmalloc(sizeof(pa_pdispatch));
pd->ref = 1;
pd->mainloop = mainloop;
@@ -141,7 +141,7 @@ pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *mainloop, const pa_pdispatch_cb_
pd->drain_callback = NULL;
pd->drain_userdata = NULL;
pd->creds = NULL;
-
+
return pd;
}
@@ -154,7 +154,7 @@ static void pdispatch_free(pa_pdispatch *pd) {
reply_info_free(pd->replies);
}
-
+
pa_xfree(pd);
}
@@ -165,13 +165,13 @@ static void run_action(pa_pdispatch *pd, struct reply_info *r, uint32_t command,
assert(r);
pa_pdispatch_ref(pd);
-
+
callback = r->callback;
userdata = r->userdata;
tag = r->tag;
-
+
reply_info_free(r);
-
+
callback(pd, command, tag, ts, userdata);
if (pd->drain_callback && !pa_pdispatch_is_pending(pd))
@@ -187,24 +187,24 @@ int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*packet, const pa_creds *creds,
assert(pd && packet && packet->data);
pa_pdispatch_ref(pd);
-
+
if (packet->length <= 8)
goto finish;
ts = pa_tagstruct_new(packet->data, packet->length);
assert(ts);
-
+
if (pa_tagstruct_getu32(ts, &command) < 0 ||
pa_tagstruct_getu32(ts, &tag) < 0)
goto finish;
-
+
#ifdef DEBUG_OPCODES
{
char t[256];
char const *p;
if (!(p = command_names[command]))
snprintf((char*) (p = t), sizeof(t), "%u", command);
-
+
pa_log("Recieved opcode <%s>", p);
}
#endif
@@ -231,10 +231,10 @@ int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*packet, const pa_creds *creds,
}
ret = 0;
-
+
finish:
pd->creds = NULL;
-
+
if (ts)
pa_tagstruct_free(ts);
@@ -261,7 +261,7 @@ void pa_pdispatch_register_reply(pa_pdispatch *pd, uint32_t tag, int timeout, pa
r->userdata = userdata;
r->free_cb = free_cb;
r->tag = tag;
-
+
pa_gettimeofday(&tv);
tv.tv_sec += timeout;
@@ -292,7 +292,7 @@ void pa_pdispatch_unregister_reply(pa_pdispatch *pd, void *userdata) {
for (r = pd->replies; r; r = n) {
n = r->next;
- if (r->userdata == userdata)
+ if (r->userdata == userdata)
reply_info_free(r);
}
}
@@ -313,6 +313,6 @@ pa_pdispatch* pa_pdispatch_ref(pa_pdispatch *pd) {
const pa_creds * pa_pdispatch_creds(pa_pdispatch *pd) {
assert(pd);
assert(pd->ref >= 1);
-
+
return pd->creds;
}
diff --git a/src/pulsecore/pdispatch.h b/src/pulsecore/pdispatch.h
index 479eb6b44..28bc29d94 100644
--- a/src/pulsecore/pdispatch.h
+++ b/src/pulsecore/pdispatch.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/pid.c b/src/pulsecore/pid.c
index 6e0c085ee..40cc82489 100644
--- a/src/pulsecore/pid.c
+++ b/src/pulsecore/pid.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 pid_t read_pid(const char *fn, int fd) {
if (r == 0)
return (pid_t) 0;
-
+
t[r] = 0;
if ((e = strchr(t, '\n')))
*e = 0;
@@ -79,10 +79,10 @@ static pid_t read_pid(const char *fn, int fd) {
static int open_pid_file(const char *fn, int mode) {
int fd = -1;
-
+
for (;;) {
struct stat st;
-
+
if ((fd = open(fn, mode, S_IRUSR|S_IWUSR)) < 0) {
if (mode != O_RDONLY || errno != ENOENT)
pa_log_warn("WARNING: failed to open PID file '%s': %s",
@@ -93,7 +93,7 @@ static int open_pid_file(const char *fn, int mode) {
/* Try to lock the file. If that fails, go without */
if (pa_lock_fd(fd, 1) < 0)
goto fail;
-
+
if (fstat(fd, &st) < 0) {
pa_log_warn("WARNING: failed to fstat() PID file '%s': %s",
fn, pa_cstrerror(errno));
@@ -168,23 +168,23 @@ int pa_pid_file_create(void) {
fn, pa_cstrerror(errno));
goto fail;
}
-
+
snprintf(t, sizeof(t), "%lu\n", (unsigned long) getpid());
l = strlen(t);
-
+
if (pa_loop_write(fd, t, l, NULL) != (ssize_t) l) {
pa_log("failed to write PID file.");
goto fail;
}
ret = 0;
-
+
fail:
if (fd >= 0) {
pa_lock_fd(fd, 0);
close(fd);
}
-
+
return ret;
}
@@ -230,7 +230,7 @@ int pa_pid_file_remove(void) {
}
ret = 0;
-
+
fail:
if (fd >= 0) {
@@ -262,26 +262,26 @@ int pa_pid_file_kill(int sig, pid_t *pid) {
if (!pid)
pid = &_pid;
-
+
pa_runtime_path("pid", fn, sizeof(fn));
-
+
if ((fd = open_pid_file(fn, O_RDONLY)) < 0)
goto fail;
-
+
if ((*pid = read_pid(fn, fd)) == (pid_t) -1)
goto fail;
ret = kill(*pid, sig);
-
+
fail:
-
+
if (fd >= 0) {
pa_lock_fd(fd, 0);
close(fd);
}
return ret;
-
+
}
#else /* OS_IS_WIN32 */
diff --git a/src/pulsecore/pid.h b/src/pulsecore/pid.h
index bd476b292..31d6f0bb4 100644
--- a/src/pulsecore/pid.h
+++ b/src/pulsecore/pid.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/pipe.c b/src/pulsecore/pipe.c
index 41ffb693b..a0c46fa3a 100644
--- a/src/pulsecore/pipe.c
+++ b/src/pulsecore/pipe.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/pipe.h b/src/pulsecore/pipe.h
index 21049e17f..86a198d36 100644
--- a/src/pulsecore/pipe.h
+++ b/src/pulsecore/pipe.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/play-memblockq.c b/src/pulsecore/play-memblockq.c
index f459142ae..ae7cd616e 100644
--- a/src/pulsecore/play-memblockq.c
+++ b/src/pulsecore/play-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
@@ -65,11 +65,11 @@ static void si_kill(PA_GCC_UNUSED pa_mainloop_api *m, void *i) {
static void sink_input_drop(pa_sink_input *i, const pa_memchunk*chunk, size_t length) {
pa_memblockq *q;
-
+
assert(i);
assert(length > 0);
assert( i->userdata);
-
+
q = i->userdata;
pa_memblockq_drop(q, chunk, length);
@@ -85,7 +85,7 @@ int pa_play_memblockq(
const pa_channel_map *map,
pa_memblockq *q,
pa_cvolume *volume) {
-
+
pa_sink_input *si;
pa_sink_input_new_data data;
@@ -110,17 +110,17 @@ int pa_play_memblockq(
pa_sink_input_new_data_set_channel_map(&data, map);
pa_sink_input_new_data_set_sample_spec(&data, ss);
pa_sink_input_new_data_set_volume(&data, volume);
-
+
if (!(si = pa_sink_input_new(sink->core, &data, 0)))
return -1;
si->peek = sink_input_peek;
si->drop = sink_input_drop;
si->kill = sink_input_kill;
-
+
si->userdata = q;
pa_sink_notify(si->sink);
-
+
return 0;
}
diff --git a/src/pulsecore/play-memblockq.h b/src/pulsecore/play-memblockq.h
index 9b96efe36..68d0f8e3c 100644
--- a/src/pulsecore/play-memblockq.h
+++ b/src/pulsecore/play-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
diff --git a/src/pulsecore/play-memchunk.c b/src/pulsecore/play-memchunk.c
index cde6a9ee4..c5dcc8cec 100644
--- a/src/pulsecore/play-memchunk.c
+++ b/src/pulsecore/play-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 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
@@ -54,7 +54,7 @@ static int sink_input_peek(pa_sink_input *i, pa_memchunk *chunk) {
if (c->length <= 0)
return -1;
-
+
assert(c->memblock && c->memblock->length);
*chunk = *c;
pa_memblock_ref(c->memblock);
@@ -88,7 +88,7 @@ int pa_play_memchunk(
const pa_channel_map *map,
const pa_memchunk *chunk,
pa_cvolume *volume) {
-
+
pa_sink_input *si;
pa_memchunk *nchunk;
pa_sink_input_new_data data;
@@ -107,20 +107,20 @@ int pa_play_memchunk(
pa_sink_input_new_data_set_sample_spec(&data, ss);
pa_sink_input_new_data_set_channel_map(&data, map);
pa_sink_input_new_data_set_volume(&data, volume);
-
+
if (!(si = pa_sink_input_new(sink->core, &data, 0)))
return -1;
si->peek = sink_input_peek;
si->drop = sink_input_drop;
si->kill = sink_input_kill;
-
+
si->userdata = nchunk = pa_xnew(pa_memchunk, 1);
*nchunk = *chunk;
-
+
pa_memblock_ref(chunk->memblock);
pa_sink_notify(si->sink);
-
+
return 0;
}
diff --git a/src/pulsecore/play-memchunk.h b/src/pulsecore/play-memchunk.h
index 3d5b8cc69..3e087baa2 100644
--- a/src/pulsecore/play-memchunk.h
+++ b/src/pulsecore/play-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 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/poll.c b/src/pulsecore/poll.c
index 289e0cdf2..82af4c057 100644
--- a/src/pulsecore/poll.c
+++ b/src/pulsecore/poll.c
@@ -9,17 +9,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/poll.h b/src/pulsecore/poll.h
index c3d486e14..9c29789d5 100644
--- a/src/pulsecore/poll.h
+++ b/src/pulsecore/poll.h
@@ -10,17 +10,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/props.c b/src/pulsecore/props.c
index 8879b7aa0..b8f920905 100644
--- a/src/pulsecore/props.c
+++ b/src/pulsecore/props.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 @@ typedef struct pa_property {
static pa_property* property_new(const char *name, void *data) {
pa_property* p;
assert(name && data);
-
+
p = pa_xmalloc(sizeof(pa_property));
p->name = pa_xstrdup(name);
p->data = data;
@@ -80,7 +80,7 @@ int pa_property_remove(pa_core *c, const char *name) {
if (!(p = pa_hashmap_remove(c->properties, name)))
return -1;
-
+
property_free(p);
return 0;
}
@@ -101,7 +101,7 @@ void pa_property_cleanup(pa_core *c) {
pa_hashmap_free(c->properties, NULL, NULL);
c->properties = NULL;
-
+
}
void pa_property_dump(pa_core *c, pa_strbuf *s) {
diff --git a/src/pulsecore/props.h b/src/pulsecore/props.h
index 39b7ca683..2b881b67e 100644
--- a/src/pulsecore/props.h
+++ b/src/pulsecore/props.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/protocol-cli.c b/src/pulsecore/protocol-cli.c
index 81ce5e8fb..9cca39eb1 100644
--- a/src/pulsecore/protocol-cli.c
+++ b/src/pulsecore/protocol-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
@@ -60,7 +60,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
pa_iochannel_free(io);
return;
}
-
+
c = pa_cli_new(p->core, io, p->module);
assert(c);
pa_cli_set_eof_callback(c, cli_eof_cb, p);
@@ -79,7 +79,7 @@ pa_protocol_cli* pa_protocol_cli_new(pa_core *core, pa_socket_server *server, pa
p->connections = pa_idxset_new(NULL, NULL);
pa_socket_server_set_callback(p->server, on_connection, p);
-
+
return p;
}
diff --git a/src/pulsecore/protocol-cli.h b/src/pulsecore/protocol-cli.h
index 84101e14d..6acd62cfe 100644
--- a/src/pulsecore/protocol-cli.h
+++ b/src/pulsecore/protocol-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/protocol-esound.c b/src/pulsecore/protocol-esound.c
index c36f82017..2984676d8 100644
--- a/src/pulsecore/protocol-esound.c
+++ b/src/pulsecore/protocol-esound.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
@@ -93,7 +93,7 @@ struct connection {
pa_defer_event *defer_event;
char *original_name;
-
+
struct {
pa_memblock *current_memblock;
size_t memblock_index, fragment_size;
@@ -177,7 +177,7 @@ static struct proto_handler proto_map[ESD_PROTO_MAX] = {
{ 3 * sizeof(int), esd_proto_stream_pan, "stream pan"},
{ 3 * sizeof(int), NULL, "sample pan" },
-
+
{ sizeof(int), NULL, "standby mode" },
{ 0, esd_proto_get_latency, "get latency" }
};
@@ -188,19 +188,19 @@ static void connection_free(struct connection *c) {
if (c->state == ESD_STREAMING_DATA)
c->protocol->n_player--;
-
+
pa_client_free(c->client);
if (c->sink_input) {
pa_sink_input_disconnect(c->sink_input);
pa_sink_input_unref(c->sink_input);
}
-
+
if (c->source_output) {
pa_source_output_disconnect(c->source_output);
pa_source_output_unref(c->source_output);
}
-
+
if (c->input_memblockq)
pa_memblockq_free(c->input_memblockq);
if (c->output_memblockq)
@@ -208,13 +208,13 @@ static void connection_free(struct connection *c) {
if (c->playback.current_memblock)
pa_memblock_unref(c->playback.current_memblock);
-
+
pa_xfree(c->read_data);
pa_xfree(c->write_data);
if (c->io)
pa_iochannel_free(c->io);
-
+
if (c->defer_event)
c->protocol->core->mainloop->defer_free(c->defer_event);
@@ -254,7 +254,7 @@ static void connection_write(struct connection *c, const void *data, size_t leng
i = c->write_data_length;
c->write_data_length += length;
-
+
memcpy((char*)c->write_data + i, data, length);
}
@@ -270,7 +270,7 @@ static void format_esd2native(int format, int swap_bytes, pa_sample_spec *ss) {
static int format_native2esd(pa_sample_spec *ss) {
int format = 0;
-
+
format = (ss->format == PA_SAMPLE_U8) ? ESD_BITS8 : ESD_BITS16;
format |= (ss->channels >= 2) ? ESD_STEREO : ESD_MONO;
@@ -331,7 +331,7 @@ static int esd_proto_stream_play(struct connection *c, PA_GCC_UNUSED esd_proto_t
pa_sink_input_new_data sdata;
assert(c && length == (sizeof(int32_t)*2+ESD_NAME_MAX));
-
+
memcpy(&format, data, sizeof(int32_t));
format = MAYBE_INT32_SWAP(c->swap_byte_order, format);
data = (const char*)data + sizeof(int32_t);
@@ -356,7 +356,7 @@ static int esd_proto_stream_play(struct connection *c, PA_GCC_UNUSED esd_proto_t
utf8_name = pa_utf8_filter(name);
pa_client_set_name(c->client, utf8_name);
pa_xfree(utf8_name);
-
+
c->original_name = pa_xstrdup(name);
assert(!c->sink_input && !c->input_memblockq);
@@ -368,11 +368,11 @@ static int esd_proto_stream_play(struct connection *c, PA_GCC_UNUSED esd_proto_t
pa_sink_input_new_data_set_sample_spec(&sdata, &ss);
sdata.module = c->protocol->module;
sdata.client = c->client;
-
+
c->sink_input = pa_sink_input_new(c->protocol->core, &sdata, 0);
CHECK_VALIDITY(c->sink_input, "Failed to create sink input.");
- l = (size_t) (pa_bytes_per_second(&ss)*PLAYBACK_BUFFER_SECONDS);
+ l = (size_t) (pa_bytes_per_second(&ss)*PLAYBACK_BUFFER_SECONDS);
c->input_memblockq = pa_memblockq_new(
0,
l,
@@ -393,7 +393,7 @@ static int esd_proto_stream_play(struct connection *c, PA_GCC_UNUSED esd_proto_t
c->state = ESD_STREAMING_DATA;
c->protocol->n_player++;
-
+
return 0;
}
@@ -406,7 +406,7 @@ static int esd_proto_stream_record(struct connection *c, esd_proto_t request, co
pa_source_output_new_data sdata;
assert(c && length == (sizeof(int32_t)*2+ESD_NAME_MAX));
-
+
memcpy(&format, data, sizeof(int32_t));
format = MAYBE_INT32_SWAP(c->swap_byte_order, format);
data = (const char*)data + sizeof(int32_t);
@@ -442,14 +442,14 @@ static int esd_proto_stream_record(struct connection *c, esd_proto_t request, co
}
}
}
-
+
strncpy(name, data, sizeof(name));
name[sizeof(name)-1] = 0;
utf8_name = pa_utf8_filter(name);
pa_client_set_name(c->client, utf8_name);
pa_xfree(utf8_name);
-
+
c->original_name = pa_xstrdup(name);
assert(!c->output_memblockq && !c->source_output);
@@ -461,11 +461,11 @@ static int esd_proto_stream_record(struct connection *c, esd_proto_t request, co
pa_source_output_new_data_set_sample_spec(&sdata, &ss);
sdata.module = c->protocol->module;
sdata.client = c->client;
-
+
c->source_output = pa_source_output_new(c->protocol->core, &sdata, 9);
CHECK_VALIDITY(c->source_output, "Failed to create source_output.");
- l = (size_t) (pa_bytes_per_second(&ss)*RECORD_BUFFER_SECONDS);
+ l = (size_t) (pa_bytes_per_second(&ss)*RECORD_BUFFER_SECONDS);
c->output_memblockq = pa_memblockq_new(
0,
l,
@@ -475,7 +475,7 @@ static int esd_proto_stream_record(struct connection *c, esd_proto_t request, co
0,
NULL);
pa_iochannel_socket_set_sndbuf(c->io, l/RECORD_BUFFER_FRAGMENTS*2);
-
+
c->source_output->push = source_output_push_cb;
c->source_output->kill = source_output_kill_cb;
c->source_output->get_latency = source_output_get_latency_cb;
@@ -484,7 +484,7 @@ static int esd_proto_stream_record(struct connection *c, esd_proto_t request, co
c->state = ESD_STREAMING_DATA;
c->protocol->n_player++;
-
+
return 0;
}
@@ -500,7 +500,7 @@ static int esd_proto_get_latency(struct connection *c, PA_GCC_UNUSED esd_proto_t
double usec = pa_sink_get_latency(sink);
latency = (int) ((usec*44100)/1000000);
}
-
+
latency = MAYBE_INT32_SWAP(c->swap_byte_order, latency);
connection_write(c, &latency, sizeof(int32_t));
return 0;
@@ -538,7 +538,7 @@ static int esd_proto_all_info(struct connection *c, esd_proto_t request, const v
char terminator[sizeof(int32_t)*6+ESD_NAME_MAX];
assert(c && data && length == sizeof(int32_t));
-
+
if (esd_proto_server_info(c, request, data, length) < 0)
return -1;
@@ -559,7 +559,7 @@ static int esd_proto_all_info(struct connection *c, esd_proto_t request, const v
continue;
assert(t >= k*2+s);
-
+
if (conn->sink_input) {
pa_cvolume volume = *pa_sink_input_get_volume(conn->sink_input);
rate = conn->sink_input->sample_spec.rate;
@@ -567,7 +567,7 @@ static int esd_proto_all_info(struct connection *c, esd_proto_t request, const v
rvolume = (volume.values[1]*ESD_VOLUME_BASE)/PA_VOLUME_NORM;
format = format_native2esd(&conn->sink_input->sample_spec);
}
-
+
/* id */
id = MAYBE_INT32_SWAP(c->swap_byte_order, (int32_t) (conn->index+1));
connection_write(c, &id, sizeof(int32_t));
@@ -606,7 +606,7 @@ static int esd_proto_all_info(struct connection *c, esd_proto_t request, const v
if (nsamples) {
pa_scache_entry *ce;
-
+
idx = PA_IDXSET_INVALID;
for (ce = pa_idxset_first(c->protocol->core->scache, &idx); ce; ce = pa_idxset_next(c->protocol->core->scache, &idx)) {
int32_t id, rate, lvolume, rvolume, format, len;
@@ -617,7 +617,7 @@ static int esd_proto_all_info(struct connection *c, esd_proto_t request, const v
/* id */
id = MAYBE_INT32_SWAP(c->swap_byte_order, (int) (ce->index+1));
connection_write(c, &id, sizeof(int32_t));
-
+
/* name */
memset(name, 0, ESD_NAME_MAX); /* don't leak old data */
if (strncmp(ce->name, SCACHE_PREFIX, sizeof(SCACHE_PREFIX)-1) == 0)
@@ -625,19 +625,19 @@ static int esd_proto_all_info(struct connection *c, esd_proto_t request, const v
else
snprintf(name, ESD_NAME_MAX, "native.%s", ce->name);
connection_write(c, name, ESD_NAME_MAX);
-
+
/* rate */
rate = MAYBE_UINT32_SWAP(c->swap_byte_order, ce->sample_spec.rate);
connection_write(c, &rate, sizeof(int32_t));
-
+
/* left */
lvolume = MAYBE_UINT32_SWAP(c->swap_byte_order, (ce->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM);
connection_write(c, &lvolume, sizeof(int32_t));
-
+
/*right*/
rvolume = MAYBE_UINT32_SWAP(c->swap_byte_order, (ce->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM);
connection_write(c, &rvolume, sizeof(int32_t));
-
+
/*format*/
format = MAYBE_INT32_SWAP(c->swap_byte_order, format_native2esd(&ce->sample_spec));
connection_write(c, &format, sizeof(int32_t));
@@ -663,7 +663,7 @@ static int esd_proto_stream_pan(struct connection *c, PA_GCC_UNUSED esd_proto_t
struct connection *conn;
assert(c && data && length == sizeof(int32_t)*3);
-
+
memcpy(&idx, data, sizeof(uint32_t));
idx = MAYBE_UINT32_SWAP(c->swap_byte_order, idx) - 1;
data = (const char*)data + sizeof(uint32_t);
@@ -687,7 +687,7 @@ static int esd_proto_stream_pan(struct connection *c, PA_GCC_UNUSED esd_proto_t
ok = 0;
connection_write(c, &ok, sizeof(int32_t));
-
+
return 0;
}
@@ -706,7 +706,7 @@ static int esd_proto_sample_cache(struct connection *c, PA_GCC_UNUSED esd_proto_
memcpy(&rate, data, sizeof(int32_t));
rate = MAYBE_INT32_SWAP(c->swap_byte_order, rate);
data = (const char*)data + sizeof(int32_t);
-
+
ss.rate = rate;
format_esd2native(format, c->swap_byte_order, &ss);
@@ -723,7 +723,7 @@ static int esd_proto_sample_cache(struct connection *c, PA_GCC_UNUSED esd_proto_
name[sizeof(name)-1] = 0;
CHECK_VALIDITY(pa_utf8_valid(name), "Invalid UTF8 in sample name.");
-
+
assert(!c->scache.memchunk.memblock);
c->scache.memchunk.memblock = pa_memblock_new(c->protocol->core->mempool, sc_length);
c->scache.memchunk.index = 0;
@@ -731,14 +731,14 @@ static int esd_proto_sample_cache(struct connection *c, PA_GCC_UNUSED esd_proto_
c->scache.sample_spec = ss;
assert(!c->scache.name);
c->scache.name = pa_xstrdup(name);
-
+
c->state = ESD_CACHING_SAMPLE;
pa_scache_add_item(c->protocol->core, c->scache.name, NULL, NULL, NULL, &idx);
idx += 1;
connection_write(c, &idx, sizeof(uint32_t));
-
+
return 0;
}
@@ -775,11 +775,11 @@ static int esd_proto_sample_free_or_play(struct connection *c, esd_proto_t reque
idx = MAYBE_UINT32_SWAP(c->swap_byte_order, idx) - 1;
ok = 0;
-
+
if ((name = pa_scache_get_name_by_id(c->protocol->core, idx))) {
if (request == ESD_PROTO_SAMPLE_PLAY) {
pa_sink *sink;
-
+
if ((sink = pa_namereg_get(c->protocol->core, c->protocol->sink_name, PA_NAMEREG_SINK, 1)))
if (pa_scache_play_item(c->protocol->core, name, sink, PA_VOLUME_NORM) >= 0)
ok = idx + 1;
@@ -790,7 +790,7 @@ static int esd_proto_sample_free_or_play(struct connection *c, esd_proto_t reque
ok = idx + 1;
}
}
-
+
connection_write(c, &ok, sizeof(int32_t));
return 0;
@@ -821,7 +821,7 @@ static int do_read(struct connection *c) {
assert(c && c->io);
/* pa_log("READ"); */
-
+
if (c->state == ESD_NEXT_REQUEST) {
ssize_t r;
assert(c->read_data_length < sizeof(c->request));
@@ -833,7 +833,7 @@ static int do_read(struct connection *c) {
if ((c->read_data_length+= r) >= sizeof(c->request)) {
struct proto_handler *handler;
-
+
c->request = MAYBE_INT32_SWAP(c->swap_byte_order, c->request);
if (c->request < ESD_PROTO_CONNECT || c->request > ESD_PROTO_MAX) {
@@ -849,18 +849,18 @@ static int do_read(struct connection *c) {
pa_log("recieved unimplemented request #%u.", c->request);
return -1;
}
-
+
if (handler->data_length == 0) {
c->read_data_length = 0;
if (handler->proc(c, c->request, NULL, 0) < 0)
return -1;
-
+
} else {
if (c->read_data_alloc < handler->data_length)
c->read_data = pa_xrealloc(c->read_data, c->read_data_alloc = handler->data_length);
assert(c->read_data);
-
+
c->state = ESD_NEEDS_REQDATA;
c->read_data_length = 0;
}
@@ -871,7 +871,7 @@ static int do_read(struct connection *c) {
struct proto_handler *handler = proto_map+c->request;
assert(handler->proc);
-
+
assert(c->read_data && c->read_data_length < handler->data_length);
if ((r = pa_iochannel_read(c->io, (uint8_t*) c->read_data + c->read_data_length, handler->data_length - c->read_data_length)) <= 0) {
@@ -885,7 +885,7 @@ static int do_read(struct connection *c) {
c->state = ESD_NEXT_REQUEST;
c->read_data_length = 0;
-
+
if (handler->proc(c, c->request, c->read_data, l) < 0)
return -1;
}
@@ -893,7 +893,7 @@ static int do_read(struct connection *c) {
ssize_t r;
assert(c->scache.memchunk.memblock && c->scache.name && c->scache.memchunk.index < c->scache.memchunk.length);
-
+
if ((r = pa_iochannel_read(c->io, (uint8_t*) c->scache.memchunk.memblock->data+c->scache.memchunk.index, c->scache.memchunk.length-c->scache.memchunk.index)) <= 0) {
pa_log_debug("read(): %s", r < 0 ? pa_cstrerror(errno) : "EOF");
return -1;
@@ -901,10 +901,10 @@ static int do_read(struct connection *c) {
c->scache.memchunk.index += r;
assert(c->scache.memchunk.index <= c->scache.memchunk.length);
-
+
if (c->scache.memchunk.index == c->scache.memchunk.length) {
uint32_t idx;
-
+
c->scache.memchunk.index = 0;
pa_scache_add_item(c->protocol->core, c->scache.name, &c->scache.sample_spec, NULL, &c->scache.memchunk, &idx);
@@ -920,7 +920,7 @@ static int do_read(struct connection *c) {
idx += 1;
connection_write(c, &idx, sizeof(uint32_t));
}
-
+
} else if (c->state == ESD_STREAMING_DATA && c->sink_input) {
pa_memchunk chunk;
ssize_t r;
@@ -936,13 +936,13 @@ static int do_read(struct connection *c) {
if (l > c->playback.fragment_size)
l = c->playback.fragment_size;
- if (c->playback.current_memblock)
+ if (c->playback.current_memblock)
if (c->playback.current_memblock->length - c->playback.memblock_index < l) {
pa_memblock_unref(c->playback.current_memblock);
c->playback.current_memblock = NULL;
c->playback.memblock_index = 0;
}
-
+
if (!c->playback.current_memblock) {
c->playback.current_memblock = pa_memblock_new(c->protocol->core->mempool, c->playback.fragment_size*2);
assert(c->playback.current_memblock && c->playback.current_memblock->length >= l);
@@ -953,20 +953,20 @@ static int do_read(struct connection *c) {
pa_log_debug("read(): %s", r < 0 ? pa_cstrerror(errno) : "EOF");
return -1;
}
-
+
chunk.memblock = c->playback.current_memblock;
chunk.index = c->playback.memblock_index;
chunk.length = r;
assert(chunk.memblock);
c->playback.memblock_index += r;
-
+
assert(c->input_memblockq);
pa_memblockq_push_align(c->input_memblockq, &chunk);
assert(c->sink_input);
pa_sink_notify(c->sink_input->sink);
}
-
+
return 0;
}
@@ -974,19 +974,19 @@ static int do_write(struct connection *c) {
assert(c && c->io);
/* pa_log("WRITE"); */
-
+
if (c->write_data_length) {
ssize_t r;
-
+
assert(c->write_data_index < c->write_data_length);
if ((r = pa_iochannel_write(c->io, (uint8_t*) c->write_data+c->write_data_index, c->write_data_length-c->write_data_index)) < 0) {
pa_log("write(): %s", pa_cstrerror(errno));
return -1;
}
-
+
if ((c->write_data_index +=r) >= c->write_data_length)
c->write_data_length = c->write_data_index = 0;
-
+
} else if (c->state == ESD_STREAMING_DATA && c->source_output) {
pa_memchunk chunk;
ssize_t r;
@@ -994,9 +994,9 @@ static int do_write(struct connection *c) {
assert(c->output_memblockq);
if (pa_memblockq_peek(c->output_memblockq, &chunk) < 0)
return 0;
-
+
assert(chunk.memblock && chunk.length);
-
+
if ((r = pa_iochannel_write(c->io, (uint8_t*) chunk.memblock->data+chunk.index, chunk.length)) < 0) {
pa_memblock_unref(chunk.memblock);
pa_log("write(): %s", pa_cstrerror(errno));
@@ -1008,7 +1008,7 @@ static int do_write(struct connection *c) {
pa_source_notify(c->source_output->source);
}
-
+
return 0;
}
@@ -1035,7 +1035,7 @@ static void do_work(struct connection *c) {
if (pa_iochannel_is_writable(c->io))
if (do_write(c) < 0)
goto fail;
-
+
return;
fail:
@@ -1066,7 +1066,7 @@ static void defer_callback(pa_mainloop_api*a, pa_defer_event *e, void *userdata)
assert(a && c && c->defer_event == e);
/* pa_log("DEFER"); */
-
+
do_work(c);
}
@@ -1076,12 +1076,12 @@ static int sink_input_peek_cb(pa_sink_input *i, pa_memchunk *chunk) {
struct connection*c;
assert(i && i->userdata && chunk);
c = i->userdata;
-
+
if (pa_memblockq_peek(c->input_memblockq, chunk) < 0) {
if (c->dead)
connection_free(c);
-
+
return -1;
}
@@ -1093,7 +1093,7 @@ static void sink_input_drop_cb(pa_sink_input *i, const pa_memchunk *chunk, size_
assert(i && c && length);
/* pa_log("DROP"); */
-
+
pa_memblockq_drop(c->input_memblockq, chunk, length);
/* do something */
@@ -1163,7 +1163,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
pa_iochannel_free(io);
return;
}
-
+
c = pa_xnew(struct connection, 1);
c->protocol = p;
c->io = io;
@@ -1177,7 +1177,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
c->client->owner = p->module;
c->client->kill = client_kill_cb;
c->client->userdata = c;
-
+
c->authorized = !!p->public;
c->swap_byte_order = 0;
c->dead = 0;
@@ -1219,7 +1219,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
c->auth_timeout_event = p->core->mainloop->time_new(p->core->mainloop, &tv, auth_timeout, c);
} else
c->auth_timeout_event = NULL;
-
+
c->defer_event = p->core->mainloop->defer_new(p->core->mainloop, defer_callback, c);
assert(c->defer_event);
p->core->mainloop->defer_enable(c->defer_event, 0);
@@ -1233,7 +1233,7 @@ pa_protocol_esound* pa_protocol_esound_new(pa_core*core, pa_socket_server *serve
pa_protocol_esound *p;
int public = 0;
const char *acl;
-
+
assert(core);
assert(server);
assert(m);
@@ -1257,7 +1257,7 @@ pa_protocol_esound* pa_protocol_esound_new(pa_core*core, pa_socket_server *serve
}
} else
p->auth_ip_acl = NULL;
-
+
p->module = m;
p->public = public;
p->server = server;
diff --git a/src/pulsecore/protocol-esound.h b/src/pulsecore/protocol-esound.h
index 79b5acf0b..265f9e2cd 100644
--- a/src/pulsecore/protocol-esound.h
+++ b/src/pulsecore/protocol-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/protocol-http.c b/src/pulsecore/protocol-http.c
index 3b1207f62..22ecba824 100644
--- a/src/pulsecore/protocol-http.c
+++ b/src/pulsecore/protocol-http.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
@@ -67,7 +67,7 @@ static void http_response(struct connection *c, int code, const char *msg, const
assert(msg);
assert(mime);
- snprintf(s, sizeof(s),
+ snprintf(s, sizeof(s),
"HTTP/1.0 %i %s\n"
"Connection: close\n"
"Content-Type: %s\n"
@@ -137,16 +137,16 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
}
case MIME_HEADER: {
-
+
/* Ignore MIME headers */
if (strcspn(s, " \r\n") != 0)
break;
-
+
/* We're done */
c->state = DATA;
pa_log_info("request for %s", c->url);
-
+
if (!strcmp(c->url, URL_ROOT)) {
char txt[256];
http_response(c, 200, "OK", "text/html");
@@ -168,18 +168,18 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
PRINTF_FIELD("Default Sample Specification:", pa_sample_spec_snprint(txt, sizeof(txt), &c->protocol->core->default_sample_spec));
PRINTF_FIELD("Default Sink:", pa_namereg_get_default_sink_name(c->protocol->core));
PRINTF_FIELD("Default Source:", pa_namereg_get_default_source_name(c->protocol->core));
-
+
pa_ioline_puts(c->line, "</table>");
pa_ioline_puts(c->line, "<p><a href=\"/status\">Click here</a> for an extensive server status report.</p>");
-
+
pa_ioline_puts(c->line, "</body></html>\n");
-
- pa_ioline_defer_close(c->line);
+
+ pa_ioline_defer_close(c->line);
} else if (!strcmp(c->url, URL_CSS)) {
http_response(c, 200, "OK", "text/css");
- pa_ioline_puts(c->line,
+ pa_ioline_puts(c->line,
"body { color: black; background-color: white; margin: 0.5cm; }\n"
"a:link, a:visited { color: #900000; }\n"
"p { margin-left: 0.5cm; margin-right: 0.5cm; }\n"
@@ -207,13 +207,13 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
break;
}
-
+
default:
;
}
return;
-
+
fail:
internal_server_error(c);
}
diff --git a/src/pulsecore/protocol-http.h b/src/pulsecore/protocol-http.h
index 5d5dba313..bf1562e69 100644
--- a/src/pulsecore/protocol-http.h
+++ b/src/pulsecore/protocol-http.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/protocol-native.c b/src/pulsecore/protocol-native.c
index 38c024b7b..a882d701c 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.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
@@ -234,7 +234,7 @@ static const pa_pdispatch_cb_t command_table[PA_COMMAND_MAX] = {
[PA_COMMAND_SET_SINK_VOLUME] = command_set_volume,
[PA_COMMAND_SET_SINK_INPUT_VOLUME] = command_set_volume,
[PA_COMMAND_SET_SOURCE_VOLUME] = command_set_volume,
-
+
[PA_COMMAND_SET_SINK_MUTE] = command_set_mute,
[PA_COMMAND_SET_SOURCE_MUTE] = command_set_mute,
@@ -242,13 +242,13 @@ static const pa_pdispatch_cb_t command_table[PA_COMMAND_MAX] = {
[PA_COMMAND_FLUSH_PLAYBACK_STREAM] = command_flush_playback_stream,
[PA_COMMAND_TRIGGER_PLAYBACK_STREAM] = command_trigger_or_prebuf_playback_stream,
[PA_COMMAND_PREBUF_PLAYBACK_STREAM] = command_trigger_or_prebuf_playback_stream,
-
+
[PA_COMMAND_CORK_RECORD_STREAM] = command_cork_record_stream,
[PA_COMMAND_FLUSH_RECORD_STREAM] = command_flush_record_stream,
-
+
[PA_COMMAND_SET_DEFAULT_SINK] = command_set_default_sink_or_source,
[PA_COMMAND_SET_DEFAULT_SOURCE] = command_set_default_sink_or_source,
- [PA_COMMAND_SET_PLAYBACK_STREAM_NAME] = command_set_stream_name,
+ [PA_COMMAND_SET_PLAYBACK_STREAM_NAME] = command_set_stream_name,
[PA_COMMAND_SET_RECORD_STREAM_NAME] = command_set_stream_name,
[PA_COMMAND_KILL_CLIENT] = command_kill,
[PA_COMMAND_KILL_SINK_INPUT] = command_kill,
@@ -271,10 +271,10 @@ static struct upload_stream* upload_stream_new(
const pa_sample_spec *ss,
const pa_channel_map *map,
const char *name, size_t length) {
-
+
struct upload_stream *s;
assert(c && ss && name && length);
-
+
s = pa_xnew(struct upload_stream, 1);
s->type = UPLOAD_STREAM;
s->connection = c;
@@ -287,7 +287,7 @@ static struct upload_stream* upload_stream_new(
s->memchunk.length = 0;
s->length = length;
-
+
pa_idxset_put(c->output_streams, s, &s->index);
return s;
}
@@ -298,10 +298,10 @@ static void upload_stream_free(struct upload_stream *o) {
pa_idxset_remove_by_data(o->connection->output_streams, o, NULL);
pa_xfree(o->name);
-
+
if (o->memchunk.memblock)
pa_memblock_unref(o->memchunk.memblock);
-
+
pa_xfree(o);
}
@@ -313,12 +313,12 @@ static struct record_stream* record_stream_new(
const char *name,
size_t maxlength,
size_t fragment_size) {
-
+
struct record_stream *s;
pa_source_output *source_output;
size_t base;
pa_source_output_new_data data;
-
+
assert(c && ss && name && maxlength);
pa_source_output_new_data_init(&data);
@@ -329,7 +329,7 @@ static struct record_stream* record_stream_new(
pa_source_output_new_data_set_channel_map(&data, map);
data.module = c->protocol->module;
data.client = c->client;
-
+
if (!(source_output = pa_source_output_new(c->protocol->core, &data, 0)))
return NULL;
@@ -381,19 +381,19 @@ static struct playback_stream* playback_stream_new(
size_t minreq,
pa_cvolume *volume,
uint32_t syncid) {
-
+
struct playback_stream *s, *ssync;
pa_sink_input *sink_input;
pa_memblock *silence;
uint32_t idx;
int64_t start_index;
pa_sink_input_new_data data;
-
+
assert(c && ss && name && maxlength);
/* Find syncid group */
for (ssync = pa_idxset_first(c->output_streams, &idx); ssync; ssync = pa_idxset_next(c->output_streams, &idx)) {
-
+
if (ssync->type != PLAYBACK_STREAM)
continue;
@@ -417,14 +417,14 @@ static struct playback_stream* playback_stream_new(
if (!(sink_input = pa_sink_input_new(c->protocol->core, &data, 0)))
return NULL;
-
+
s = pa_xnew(struct playback_stream, 1);
s->type = PLAYBACK_STREAM;
s->connection = c;
s->syncid = syncid;
s->sink_input = sink_input;
s->underrun = 1;
-
+
s->sink_input->peek = sink_input_peek_cb;
s->sink_input->drop = sink_input_drop_cb;
s->sink_input->kill = sink_input_kill_cb;
@@ -446,9 +446,9 @@ static struct playback_stream* playback_stream_new(
PA_LLIST_INIT(struct playback_stream, s);
start_index = 0;
}
-
+
silence = pa_silence_memblock_new(c->protocol->core->mempool, ss, 0);
-
+
s->memblockq = pa_memblockq_new(
start_index,
maxlength,
@@ -459,10 +459,10 @@ static struct playback_stream* playback_stream_new(
silence);
pa_memblock_unref(silence);
-
+
s->requested_bytes = 0;
s->drain_request = 0;
-
+
pa_idxset_put(c->output_streams, s, &s->index);
return s;
@@ -512,7 +512,7 @@ static void connection_free(struct connection *c) {
if (c->auth_timeout_event)
c->protocol->core->mainloop->time_free(c->auth_timeout_event);
-
+
pa_xfree(c);
}
@@ -523,7 +523,7 @@ static void request_bytes(struct playback_stream *s) {
if (!(l = pa_memblockq_missing(s->memblockq)))
return;
-
+
if (l <= s->requested_bytes)
return;
@@ -531,7 +531,7 @@ static void request_bytes(struct playback_stream *s) {
if (l < pa_memblockq_get_minreq(s->memblockq))
return;
-
+
s->requested_bytes += l;
t = pa_tagstruct_new(NULL, 0);
@@ -552,7 +552,7 @@ static void send_memblock(struct connection *c) {
start = PA_IDXSET_INVALID;
for (;;) {
pa_memchunk chunk;
-
+
if (!(r = pa_idxset_rrobin(c->record_streams, &c->rrobin_index)))
return;
@@ -563,14 +563,14 @@ static void send_memblock(struct connection *c) {
if (pa_memblockq_peek(r->memblockq, &chunk) >= 0) {
pa_memchunk schunk = chunk;
-
+
if (schunk.length > r->fragment_size)
schunk.length = r->fragment_size;
pa_pstream_send_memblock(c->pstream, r->index, 0, PA_SEEK_RELATIVE, &schunk);
pa_memblockq_drop(r->memblockq, &chunk, schunk.length);
pa_memblock_unref(schunk.memblock);
-
+
return;
}
}
@@ -618,14 +618,14 @@ static int sink_input_peek_cb(pa_sink_input *i, pa_memchunk *chunk) {
s->underrun = 1;
}
-
+
if (pa_memblockq_peek(s->memblockq, chunk) < 0) {
/* pa_log("peek: failure"); */
return -1;
}
/* pa_log("peek: %u", chunk->length); */
-
+
return 0;
}
@@ -658,7 +658,7 @@ static pa_usec_t sink_input_get_latency_cb(pa_sink_input *i) {
s = i->userdata;
/*pa_log("get_latency: %u", pa_memblockq_get_length(s->memblockq));*/
-
+
return pa_bytes_to_usec(pa_memblockq_get_length(s->memblockq), &s->sink_input->sample_spec);
}
@@ -668,12 +668,12 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk)
struct record_stream *s;
assert(o && o->userdata && chunk);
s = o->userdata;
-
+
if (pa_memblockq_push_align(s->memblockq, chunk) < 0) {
pa_log_warn("Failed to push data into output queue.");
return;
- }
-
+ }
+
if (!pa_pstream_is_pending(s->connection->pstream))
send_memblock(s->connection);
}
@@ -690,7 +690,7 @@ static pa_usec_t source_output_get_latency_cb(pa_source_output *o) {
s = o->userdata;
/*pa_log("get_latency: %u", pa_memblockq_get_length(s->memblockq));*/
-
+
return pa_bytes_to_usec(pa_memblockq_get_length(s->memblockq), &o->sample_spec);
}
@@ -710,7 +710,7 @@ if (!(expression)) { \
static pa_tagstruct *reply_new(uint32_t tag) {
pa_tagstruct *reply;
-
+
reply = pa_tagstruct_new(NULL, 0);
pa_tagstruct_putu32(reply, PA_COMMAND_REPLY);
pa_tagstruct_putu32(reply, tag);
@@ -728,9 +728,9 @@ static void command_create_playback_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GC
pa_sink *sink = NULL;
pa_cvolume volume;
int corked;
-
+
assert(c && t && c->protocol && c->protocol->core);
-
+
if (pa_tagstruct_get(
t,
PA_TAG_STRING, &name,
@@ -773,7 +773,7 @@ static void command_create_playback_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GC
CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_INVALID);
pa_sink_input_cork(s->sink_input, corked);
-
+
reply = reply_new(tag);
pa_tagstruct_putu32(reply, s->index);
assert(s->sink_input);
@@ -788,7 +788,7 @@ static void command_create_playback_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GC
pa_tagstruct_putu32(reply, (uint32_t) pa_memblockq_get_prebuf(s->memblockq));
pa_tagstruct_putu32(reply, (uint32_t) pa_memblockq_get_minreq(s->memblockq));
}
-
+
pa_pstream_send_tagstruct(c->pstream, reply);
request_bytes(s);
}
@@ -797,7 +797,7 @@ static void command_delete_stream(PA_GCC_UNUSED pa_pdispatch *pd, uint32_t comma
struct connection *c = userdata;
uint32_t channel;
assert(c && t);
-
+
if (pa_tagstruct_getu32(t, &channel) < 0 ||
!pa_tagstruct_eof(t)) {
protocol_error(c);
@@ -832,7 +832,7 @@ static void command_delete_stream(PA_GCC_UNUSED pa_pdispatch *pd, uint32_t comma
upload_stream_free(s);
}
-
+
pa_pstream_send_simple_ack(c->pstream, tag);
}
@@ -848,7 +848,7 @@ static void command_create_record_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_
pa_source *source = NULL;
int corked;
assert(c && t && c->protocol && c->protocol->core);
-
+
if (pa_tagstruct_gets(t, &name) < 0 ||
pa_tagstruct_get_sample_spec(t, &ss) < 0 ||
pa_tagstruct_get_channel_map(t, &map) < 0 ||
@@ -876,13 +876,13 @@ static void command_create_record_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_
} else if (source_name) {
source = pa_namereg_get(c->protocol->core, source_name, PA_NAMEREG_SOURCE, 1);
CHECK_VALIDITY(c->pstream, source, tag, PA_ERR_NOENTITY);
- }
-
+ }
+
s = record_stream_new(c, source, &ss, &map, name, maxlength, fragment_size);
CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_INVALID);
-
+
pa_source_output_cork(s->source_output, corked);
-
+
reply = reply_new(tag);
pa_tagstruct_putu32(reply, s->index);
assert(s->source_output);
@@ -894,21 +894,21 @@ static void command_create_record_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_
pa_tagstruct_putu32(reply, (uint32_t) pa_memblockq_get_maxlength(s->memblockq));
pa_tagstruct_putu32(reply, (uint32_t) s->fragment_size);
}
-
+
pa_pstream_send_tagstruct(c->pstream, reply);
}
static void command_exit(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
struct connection *c = userdata;
assert(c && t);
-
+
if (!pa_tagstruct_eof(t)) {
protocol_error(c);
return;
}
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
-
+
assert(c->protocol && c->protocol->core && c->protocol->core->mainloop);
c->protocol->core->mainloop->quit(c->protocol->core->mainloop, 0);
pa_pstream_send_simple_ack(c->pstream, tag); /* nonsense */
@@ -935,7 +935,7 @@ static void command_auth(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED uint32_t
if (!c->authorized) {
int success = 0;
-
+
#ifdef HAVE_CREDS
const pa_creds *creds;
@@ -950,7 +950,7 @@ static void command_auth(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED uint32_t
pa_log_warn("failed to get GID of group '%s'", c->protocol->auth_group);
else if (gid == creds->gid)
success = 1;
-
+
if (!success) {
if ((r = pa_uid_in_group(creds->uid, c->protocol->auth_group)) < 0)
pa_log_warn("failed to check group membership.");
@@ -958,7 +958,7 @@ static void command_auth(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED uint32_t
success = 1;
}
}
-
+
pa_log_info("Got credentials: uid=%lu gid=%lu success=%i",
(unsigned long) creds->uid,
(unsigned long) creds->gid,
@@ -971,7 +971,7 @@ static void command_auth(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED uint32_t
pa_pstream_use_shm(c->pstream, 1);
pa_log_info("Enabled SHM for new connection");
}
-
+
}
#endif
@@ -983,7 +983,7 @@ static void command_auth(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED uint32_t
pa_pstream_send_error(c->pstream, tag, PA_ERR_ACCESS);
return;
}
-
+
c->authorized = 1;
if (c->auth_timeout_event) {
c->protocol->core->mainloop->time_free(c->auth_timeout_event);
@@ -997,12 +997,12 @@ static void command_auth(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED uint32_t
#ifdef HAVE_CREDS
{
/* SHM support is only enabled after both sides made sure they are the same user. */
-
+
pa_creds ucred;
ucred.uid = getuid();
ucred.gid = getgid();
-
+
pa_pstream_send_tagstruct_with_creds(c->pstream, reply, &ucred);
}
#else
@@ -1022,7 +1022,7 @@ static void command_set_client_name(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSE
}
CHECK_VALIDITY(c->pstream, name && pa_utf8_valid(name), tag, PA_ERR_INVALID);
-
+
pa_client_set_name(c->client, name);
pa_pstream_send_simple_ack(c->pstream, tag);
}
@@ -1079,11 +1079,11 @@ static void command_drain_playback_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC
s = pa_idxset_get_by_index(c->output_streams, idx);
CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_NOENTITY);
CHECK_VALIDITY(c->pstream, s->type == PLAYBACK_STREAM, tag, PA_ERR_NOENTITY);
-
+
s->drain_request = 0;
pa_memblockq_prebuf_disable(s->memblockq);
-
+
if (!pa_memblockq_is_readable(s->memblockq)) {
/* pa_log("immediate drain: %u", pa_memblockq_get_length(s->memblockq)); */
pa_pstream_send_simple_ack(c->pstream, tag);
@@ -1094,7 +1094,7 @@ static void command_drain_playback_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC
pa_sink_notify(s->sink_input->sink);
}
-}
+}
static void command_stat(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
struct connection *c = userdata;
@@ -1110,7 +1110,7 @@ static void command_stat(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED uint32_t
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
stat = pa_mempool_get_stat(c->protocol->core->mempool);
-
+
reply = reply_new(tag);
pa_tagstruct_putu32(reply, (uint32_t) AO_load_acquire_read((AO_t*) &stat->n_allocated));
pa_tagstruct_putu32(reply, (uint32_t) AO_load_acquire_read((AO_t*) &stat->allocated_size));
@@ -1128,7 +1128,7 @@ static void command_get_playback_latency(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_
uint32_t idx;
pa_usec_t latency;
assert(c && t);
-
+
if (pa_tagstruct_getu32(t, &idx) < 0 ||
pa_tagstruct_get_timeval(t, &tv) < 0 ||
!pa_tagstruct_eof(t)) {
@@ -1147,7 +1147,7 @@ static void command_get_playback_latency(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_
if (s->sink_input->resampled_chunk.memblock)
latency += pa_bytes_to_usec(s->sink_input->resampled_chunk.length, &s->sink_input->sample_spec);
pa_tagstruct_put_usec(reply, latency);
-
+
pa_tagstruct_put_usec(reply, 0);
pa_tagstruct_put_boolean(reply, s->sink_input->state == PA_SINK_INPUT_RUNNING);
pa_tagstruct_put_timeval(reply, &tv);
@@ -1196,8 +1196,8 @@ static void command_create_upload_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_
pa_channel_map map;
pa_tagstruct *reply;
assert(c && t && c->protocol && c->protocol->core);
-
- if (pa_tagstruct_gets(t, &name) < 0 ||
+
+ if (pa_tagstruct_gets(t, &name) < 0 ||
pa_tagstruct_get_sample_spec(t, &ss) < 0 ||
pa_tagstruct_get_channel_map(t, &map) < 0 ||
pa_tagstruct_getu32(t, &length) < 0 ||
@@ -1213,10 +1213,10 @@ static void command_create_upload_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_
CHECK_VALIDITY(c->pstream, (length % pa_frame_size(&ss)) == 0 && length > 0, tag, PA_ERR_INVALID);
CHECK_VALIDITY(c->pstream, length <= PA_SCACHE_ENTRY_SIZE_MAX, tag, PA_ERR_TOOLARGE);
CHECK_VALIDITY(c->pstream, name && *name && pa_utf8_valid(name), tag, PA_ERR_INVALID);
-
+
s = upload_stream_new(c, &ss, &map, name, length);
CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_INVALID);
-
+
reply = reply_new(tag);
pa_tagstruct_putu32(reply, s->index);
pa_tagstruct_putu32(reply, length);
@@ -1229,7 +1229,7 @@ static void command_finish_upload_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_
struct upload_stream *s;
uint32_t idx;
assert(c && t);
-
+
if (pa_tagstruct_getu32(t, &channel) < 0 ||
!pa_tagstruct_eof(t)) {
protocol_error(c);
@@ -1246,7 +1246,7 @@ static void command_finish_upload_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_
pa_pstream_send_error(c->pstream, tag, PA_ERR_INTERNAL);
else
pa_pstream_send_simple_ack(c->pstream, tag);
-
+
upload_stream_free(s);
}
@@ -1266,7 +1266,7 @@ static void command_play_sample(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED ui
protocol_error(c);
return;
}
-
+
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
CHECK_VALIDITY(c->pstream, sink_index != PA_INVALID_INDEX || !sink_name || (*sink_name && pa_utf8_valid(name)), tag, PA_ERR_INVALID);
CHECK_VALIDITY(c->pstream, name && *name && pa_utf8_valid(name), tag, PA_ERR_INVALID);
@@ -1455,7 +1455,7 @@ static void command_get_info(PA_GCC_UNUSED pa_pdispatch *pd, uint32_t command, u
source = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SOURCE, 1);
} else if (command == PA_COMMAND_GET_CLIENT_INFO)
client = pa_idxset_get_by_index(c->protocol->core->clients, idx);
- else if (command == PA_COMMAND_GET_MODULE_INFO)
+ else if (command == PA_COMMAND_GET_MODULE_INFO)
module = pa_idxset_get_by_index(c->protocol->core->modules, idx);
else if (command == PA_COMMAND_GET_SINK_INPUT_INFO)
si = pa_idxset_get_by_index(c->protocol->core->sink_inputs, idx);
@@ -1468,7 +1468,7 @@ static void command_get_info(PA_GCC_UNUSED pa_pdispatch *pd, uint32_t command, u
else
sce = pa_namereg_get(c->protocol->core, name, PA_NAMEREG_SAMPLE, 0);
}
-
+
if (!sink && !source && !client && !module && !si && !so && !sce) {
pa_pstream_send_error(c->pstream, tag, PA_ERR_NOENTITY);
return;
@@ -1538,7 +1538,7 @@ static void command_get_info_list(PA_GCC_UNUSED pa_pdispatch *pd, uint32_t comma
module_fill_tagstruct(reply, p);
else if (command == PA_COMMAND_GET_SINK_INPUT_INFO_LIST)
sink_input_fill_tagstruct(reply, p);
- else if (command == PA_COMMAND_GET_SOURCE_OUTPUT_INFO_LIST)
+ else if (command == PA_COMMAND_GET_SOURCE_OUTPUT_INFO_LIST)
source_output_fill_tagstruct(reply, p);
else {
assert(command == PA_COMMAND_GET_SAMPLE_INFO_LIST);
@@ -1546,7 +1546,7 @@ static void command_get_info_list(PA_GCC_UNUSED pa_pdispatch *pd, uint32_t comma
}
}
}
-
+
pa_pstream_send_tagstruct(c->pstream, reply);
}
@@ -1561,7 +1561,7 @@ static void command_get_server_info(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSE
protocol_error(c);
return;
}
-
+
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
reply = reply_new(tag);
@@ -1577,7 +1577,7 @@ static void command_get_server_info(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSE
pa_tagstruct_puts(reply, n);
pa_tagstruct_putu32(reply, c->protocol->core->cookie);
-
+
pa_pstream_send_tagstruct(c->pstream, reply);
}
@@ -1607,7 +1607,7 @@ static void command_subscribe(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED uint
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
CHECK_VALIDITY(c->pstream, (m & ~PA_SUBSCRIPTION_MASK_ALL) == 0, tag, PA_ERR_INVALID);
-
+
if (c->subscription)
pa_subscription_free(c->subscription);
@@ -1626,7 +1626,7 @@ static void command_set_volume(
uint32_t tag,
pa_tagstruct *t,
void *userdata) {
-
+
struct connection *c = userdata;
uint32_t idx;
pa_cvolume volume;
@@ -1644,7 +1644,7 @@ static void command_set_volume(
protocol_error(c);
return;
}
-
+
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
CHECK_VALIDITY(c->pstream, idx != PA_INVALID_INDEX || !name || (*name && pa_utf8_valid(name)), tag, PA_ERR_INVALID);
CHECK_VALIDITY(c->pstream, pa_cvolume_valid(&volume), tag, PA_ERR_INVALID);
@@ -1682,7 +1682,7 @@ static void command_set_mute(
uint32_t tag,
pa_tagstruct *t,
void *userdata) {
-
+
struct connection *c = userdata;
uint32_t idx;
int mute;
@@ -1698,7 +1698,7 @@ static void command_set_mute(
protocol_error(c);
return;
}
-
+
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
CHECK_VALIDITY(c->pstream, idx != PA_INVALID_INDEX || !name || (*name && pa_utf8_valid(name)), tag, PA_ERR_INVALID);
@@ -1758,9 +1758,9 @@ static void command_cork_playback_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_
pa_sink_input_cork(ssync->sink_input, b);
pa_memblockq_prebuf_force(ssync->memblockq);
}
-
+
pa_pstream_send_simple_ack(c->pstream, tag);
-}
+}
static void command_flush_playback_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
struct connection *c = userdata;
@@ -1782,7 +1782,7 @@ static void command_flush_playback_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC
pa_memblockq_flush(s->memblockq);
s->underrun = 0;
-
+
/* Do the same for all other members in the sync group */
for (ssync = s->prev; ssync; ssync = ssync->prev) {
pa_memblockq_flush(ssync->memblockq);
@@ -1793,11 +1793,11 @@ static void command_flush_playback_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC
pa_memblockq_flush(ssync->memblockq);
ssync->underrun = 0;
}
-
+
pa_pstream_send_simple_ack(c->pstream, tag);
pa_sink_notify(s->sink_input->sink);
request_bytes(s);
-
+
for (ssync = s->prev; ssync; ssync = ssync->prev)
request_bytes(ssync);
@@ -1827,11 +1827,11 @@ static void command_trigger_or_prebuf_playback_stream(PA_GCC_UNUSED pa_pdispatch
case PA_COMMAND_PREBUF_PLAYBACK_STREAM:
pa_memblockq_prebuf_force(s->memblockq);
break;
-
+
case PA_COMMAND_TRIGGER_PLAYBACK_STREAM:
pa_memblockq_prebuf_disable(s->memblockq);
break;
-
+
default:
abort();
}
@@ -1914,22 +1914,22 @@ static void command_set_stream_name(PA_GCC_UNUSED pa_pdispatch *pd, uint32_t com
protocol_error(c);
return;
}
-
+
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
CHECK_VALIDITY(c->pstream, name && pa_utf8_valid(name), tag, PA_ERR_INVALID);
if (command == PA_COMMAND_SET_PLAYBACK_STREAM_NAME) {
struct playback_stream *s;
-
+
s = pa_idxset_get_by_index(c->output_streams, idx);
CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_NOENTITY);
CHECK_VALIDITY(c->pstream, s->type == PLAYBACK_STREAM, tag, PA_ERR_NOENTITY);
pa_sink_input_set_name(s->sink_input, name);
-
+
} else {
struct record_stream *s;
-
+
s = pa_idxset_get_by_index(c->record_streams, idx);
CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_NOENTITY);
@@ -1954,14 +1954,14 @@ static void command_kill(PA_GCC_UNUSED pa_pdispatch *pd, uint32_t command, uint3
if (command == PA_COMMAND_KILL_CLIENT) {
pa_client *client;
-
+
client = pa_idxset_get_by_index(c->protocol->core->clients, idx);
CHECK_VALIDITY(c->pstream, client, tag, PA_ERR_NOENTITY);
pa_client_kill(client);
-
+
} else if (command == PA_COMMAND_KILL_SINK_INPUT) {
pa_sink_input *s;
-
+
s = pa_idxset_get_by_index(c->protocol->core->sink_inputs, idx);
CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_NOENTITY);
@@ -1970,7 +1970,7 @@ static void command_kill(PA_GCC_UNUSED pa_pdispatch *pd, uint32_t command, uint3
pa_source_output *s;
assert(command == PA_COMMAND_KILL_SOURCE_OUTPUT);
-
+
s = pa_idxset_get_by_index(c->protocol->core->source_outputs, idx);
CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_NOENTITY);
@@ -1997,7 +1997,7 @@ static void command_load_module(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED ui
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
CHECK_VALIDITY(c->pstream, name && *name && pa_utf8_valid(name) && !strchr(name, '/'), tag, PA_ERR_INVALID);
CHECK_VALIDITY(c->pstream, !argument || pa_utf8_valid(argument), tag, PA_ERR_INVALID);
-
+
if (!(m = pa_module_load(c->protocol->core, name, argument))) {
pa_pstream_send_error(c->pstream, tag, PA_ERR_MODINITFAILED);
return;
@@ -2019,7 +2019,7 @@ static void command_unload_module(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED
protocol_error(c);
return;
}
-
+
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
m = pa_idxset_get_by_index(c->protocol->core->modules, idx);
CHECK_VALIDITY(c->pstream, m, tag, PA_ERR_NOENTITY);
@@ -2036,15 +2036,15 @@ static void command_add_autoload(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED u
pa_tagstruct *reply;
assert(c && t);
- if (pa_tagstruct_gets(t, &name) < 0 ||
- pa_tagstruct_getu32(t, &type) < 0 ||
- pa_tagstruct_gets(t, &module) < 0 ||
+ if (pa_tagstruct_gets(t, &name) < 0 ||
+ pa_tagstruct_getu32(t, &type) < 0 ||
+ pa_tagstruct_gets(t, &module) < 0 ||
pa_tagstruct_gets(t, &argument) < 0 ||
!pa_tagstruct_eof(t)) {
protocol_error(c);
return;
}
-
+
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
CHECK_VALIDITY(c->pstream, name && *name && pa_utf8_valid(name), tag, PA_ERR_INVALID);
CHECK_VALIDITY(c->pstream, type == 0 || type == 1, tag, PA_ERR_INVALID);
@@ -2075,12 +2075,12 @@ static void command_remove_autoload(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSE
protocol_error(c);
return;
}
-
+
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
CHECK_VALIDITY(c->pstream, name || idx != PA_IDXSET_INVALID, tag, PA_ERR_INVALID);
CHECK_VALIDITY(c->pstream, !name || (*name && pa_utf8_valid(name) && (type == 0 || type == 1)), tag, PA_ERR_INVALID);
- if (name)
+ if (name)
r = pa_autoload_remove_by_name(c->protocol->core, name, type == 0 ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE);
else
r = pa_autoload_remove_by_index(c->protocol->core, idx);
@@ -2141,7 +2141,7 @@ static void command_get_autoload_info_list(PA_GCC_UNUSED pa_pdispatch *pd, PA_GC
protocol_error(c);
return;
}
-
+
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
reply = reply_new(tag);
@@ -2153,7 +2153,7 @@ static void command_get_autoload_info_list(PA_GCC_UNUSED pa_pdispatch *pd, PA_GC
while ((a = pa_hashmap_iterate(c->protocol->core->autoload_hashmap, &state, NULL)))
autoload_fill_tagstruct(reply, a);
}
-
+
pa_pstream_send_tagstruct(c->pstream, reply);
}
@@ -2161,7 +2161,7 @@ static void command_move_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag
struct connection *c = userdata;
uint32_t idx = PA_INVALID_INDEX, idx_device = PA_INVALID_INDEX;
const char *name = NULL;
-
+
assert(c);
assert(t);
@@ -2172,7 +2172,7 @@ static void command_move_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag
protocol_error(c);
return;
}
-
+
CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
CHECK_VALIDITY(c->pstream, idx != PA_INVALID_INDEX, tag, PA_ERR_INVALID);
CHECK_VALIDITY(c->pstream, idx_device != PA_INVALID_INDEX || !name || (*name && pa_utf8_valid(name)), tag, PA_ERR_INVALID);
@@ -2182,7 +2182,7 @@ static void command_move_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag
pa_sink *sink = NULL;
si = pa_idxset_get_by_index(c->protocol->core->sink_inputs, idx);
-
+
if (idx_device != PA_INVALID_INDEX)
sink = pa_idxset_get_by_index(c->protocol->core->sinks, idx_device);
else
@@ -2199,7 +2199,7 @@ static void command_move_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag
pa_source *source;
so = pa_idxset_get_by_index(c->protocol->core->source_outputs, idx);
-
+
if (idx_device != PA_INVALID_INDEX)
source = pa_idxset_get_by_index(c->protocol->core->sources, idx_device);
else
@@ -2212,9 +2212,9 @@ static void command_move_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag
return;
}
}
-
+
pa_pstream_send_simple_ack(c->pstream, tag);
-
+
}
/*** pstream callbacks ***/
@@ -2233,7 +2233,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
struct connection *c = userdata;
struct output_stream *stream;
assert(p && chunk && userdata);
-
+
if (!(stream = pa_idxset_get_by_index(c->output_streams, channel))) {
pa_log("client sent block for invalid stream.");
/* Ignoring */
@@ -2251,12 +2251,12 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
if (pa_memblockq_push_align(ps->memblockq, chunk) < 0) {
pa_tagstruct *t;
-
+
pa_log_warn("failed to push data into queue");
/* Pushing this block into the queue failed, so we simulate
* it by skipping ahead */
-
+
pa_memblockq_seek(ps->memblockq, chunk->length, PA_SEEK_RELATIVE);
/* Notify the user */
@@ -2268,7 +2268,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
}
ps->underrun = 0;
-
+
pa_sink_notify(ps->sink_input->sink);
} else {
@@ -2286,10 +2286,10 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
u->memchunk.index = u->memchunk.length = 0;
}
}
-
+
assert(u->memchunk.memblock);
-
- l = u->length;
+
+ l = u->length;
if (l > chunk->length)
l = chunk->length;
@@ -2355,7 +2355,7 @@ static void on_connection(PA_GCC_UNUSED pa_socket_server*s, pa_iochannel *io, vo
pa_log_info("Client authenticated by IP ACL.");
c->authorized = 1;
}
-
+
if (!c->authorized) {
struct timeval tv;
pa_gettimeofday(&tv);
@@ -2374,7 +2374,7 @@ static void on_connection(PA_GCC_UNUSED pa_socket_server*s, pa_iochannel *io, vo
c->client->kill = client_kill_cb;
c->client->userdata = c;
c->client->owner = p->module;
-
+
c->pstream = pa_pstream_new(p->core->mainloop, io, p->core->mempool);
assert(c->pstream);
@@ -2399,7 +2399,7 @@ static void on_connection(PA_GCC_UNUSED pa_socket_server*s, pa_iochannel *io, vo
#ifdef HAVE_CREDS
if (pa_iochannel_creds_supported(io))
pa_iochannel_creds_enable(io);
-
+
#endif
}
@@ -2409,14 +2409,14 @@ static int load_key(pa_protocol_native*p, const char*fn) {
assert(p);
p->auth_cookie_in_property = 0;
-
+
if (!fn && pa_authkey_prop_get(p->core, PA_NATIVE_COOKIE_PROPERTY_NAME, p->auth_cookie, sizeof(p->auth_cookie)) >= 0) {
pa_log_info("using already loaded auth cookie.");
pa_authkey_prop_ref(p->core, PA_NATIVE_COOKIE_PROPERTY_NAME);
p->auth_cookie_in_property = 1;
return 0;
}
-
+
if (!fn)
fn = PA_NATIVE_COOKIE_FILE;
@@ -2427,7 +2427,7 @@ static int load_key(pa_protocol_native*p, const char*fn) {
if (pa_authkey_prop_put(p->core, PA_NATIVE_COOKIE_PROPERTY_NAME, p->auth_cookie, sizeof(p->auth_cookie)) >= 0)
p->auth_cookie_in_property = 1;
-
+
return 0;
}
@@ -2435,7 +2435,7 @@ static pa_protocol_native* protocol_new_internal(pa_core *c, pa_module *m, pa_mo
pa_protocol_native *p;
int public = 0;
const char *acl;
-
+
assert(c);
assert(ma);
@@ -2443,14 +2443,14 @@ static pa_protocol_native* protocol_new_internal(pa_core *c, pa_module *m, pa_mo
pa_log("auth-anonymous= expects a boolean argument.");
return NULL;
}
-
+
p = pa_xnew(pa_protocol_native, 1);
p->core = c;
p->module = m;
p->public = public;
p->server = NULL;
p->auth_ip_acl = NULL;
-
+
#ifdef HAVE_CREDS
{
int a = 1;
@@ -2498,7 +2498,7 @@ pa_protocol_native* pa_protocol_native_new(pa_core *core, pa_socket_server *serv
if (!(p = protocol_new_internal(core, m, ma)))
return NULL;
-
+
p->server = server;
pa_socket_server_set_callback(p->server, on_connection, p);
@@ -2508,7 +2508,7 @@ pa_protocol_native* pa_protocol_native_new(pa_core *core, pa_socket_server *serv
l = pa_strlist_prepend(l, t);
pa_property_replace(core, PA_NATIVE_SERVER_PROPERTY_NAME, l);
}
-
+
return p;
}
@@ -2522,7 +2522,7 @@ void pa_protocol_native_free(pa_protocol_native *p) {
if (p->server) {
char t[256];
-
+
if (pa_socket_server_get_address(p->server, t, sizeof(t))) {
pa_strlist *l;
l = pa_property_get(p->core, PA_NATIVE_SERVER_PROPERTY_NAME);
@@ -2533,7 +2533,7 @@ void pa_protocol_native_free(pa_protocol_native *p) {
else
pa_property_remove(p->core, PA_NATIVE_SERVER_PROPERTY_NAME);
}
-
+
pa_socket_server_unref(p->server);
}
@@ -2542,7 +2542,7 @@ void pa_protocol_native_free(pa_protocol_native *p) {
if (p->auth_ip_acl)
pa_ip_acl_free(p->auth_ip_acl);
-
+
#ifdef HAVE_CREDS
pa_xfree(p->auth_group);
#endif
@@ -2556,6 +2556,6 @@ pa_protocol_native* pa_protocol_native_new_iochannel(pa_core*core, pa_iochannel
return NULL;
on_connection(NULL, io, p);
-
+
return p;
}
diff --git a/src/pulsecore/protocol-native.h b/src/pulsecore/protocol-native.h
index 5b0910144..fcd4cb37a 100644
--- a/src/pulsecore/protocol-native.h
+++ b/src/pulsecore/protocol-native.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/protocol-simple.c b/src/pulsecore/protocol-simple.c
index 6bfba875e..0a7a7acbf 100644
--- a/src/pulsecore/protocol-simple.c
+++ b/src/pulsecore/protocol-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
@@ -55,7 +55,7 @@ struct connection {
pa_defer_event *defer_event;
int dead;
-
+
struct {
pa_memblock *current_memblock;
size_t memblock_index, fragment_size;
@@ -120,7 +120,7 @@ static int do_read(struct connection *c) {
if (l > c->playback.fragment_size)
l = c->playback.fragment_size;
- if (c->playback.current_memblock)
+ if (c->playback.current_memblock)
if (c->playback.current_memblock->length - c->playback.memblock_index < l) {
pa_memblock_unref(c->playback.current_memblock);
c->playback.current_memblock = NULL;
@@ -132,7 +132,7 @@ static int do_read(struct connection *c) {
assert(c->playback.current_memblock && c->playback.current_memblock->length >= l);
c->playback.memblock_index = 0;
}
-
+
if ((r = pa_iochannel_read(c->io, (uint8_t*) c->playback.current_memblock->data+c->playback.memblock_index, l)) <= 0) {
pa_log_debug("read(): %s", r == 0 ? "EOF" : pa_cstrerror(errno));
return -1;
@@ -144,12 +144,12 @@ static int do_read(struct connection *c) {
assert(chunk.memblock);
c->playback.memblock_index += r;
-
+
assert(c->input_memblockq);
pa_memblockq_push_align(c->input_memblockq, &chunk);
assert(c->sink_input);
pa_sink_notify(c->sink_input->sink);
-
+
return 0;
}
@@ -158,25 +158,25 @@ static int do_write(struct connection *c) {
ssize_t r;
if (!c->source_output)
- return 0;
+ return 0;
assert(c->output_memblockq);
if (pa_memblockq_peek(c->output_memblockq, &chunk) < 0)
return 0;
-
+
assert(chunk.memblock && chunk.length);
-
+
if ((r = pa_iochannel_write(c->io, (uint8_t*) chunk.memblock->data+chunk.index, chunk.length)) < 0) {
pa_memblock_unref(chunk.memblock);
pa_log("write(): %s", pa_cstrerror(errno));
return -1;
}
-
+
pa_memblockq_drop(c->output_memblockq, &chunk, r);
pa_memblock_unref(chunk.memblock);
pa_source_notify(c->source_output->source);
-
+
return 0;
}
@@ -188,7 +188,7 @@ static void do_work(struct connection *c) {
if (c->dead)
return;
-
+
if (pa_iochannel_is_readable(c->io)) {
if (do_read(c) < 0)
goto fail;
@@ -198,7 +198,7 @@ static void do_work(struct connection *c) {
if (pa_iochannel_is_writable(c->io)) {
if (do_write(c) < 0)
goto fail;
- }
+ }
return;
@@ -206,7 +206,7 @@ fail:
if (c->sink_input) {
c->dead = 1;
-
+
pa_iochannel_free(c->io);
c->io = NULL;
@@ -222,12 +222,12 @@ static int sink_input_peek_cb(pa_sink_input *i, pa_memchunk *chunk) {
struct connection*c;
assert(i && i->userdata && chunk);
c = i->userdata;
-
+
if (pa_memblockq_peek(c->input_memblockq, chunk) < 0) {
-
+
if (c->dead)
connection_free(c);
-
+
return -1;
}
@@ -331,7 +331,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
c->playback.memblock_index = 0;
c->playback.fragment_size = 0;
c->dead = 0;
-
+
pa_iochannel_socket_peer_to_string(io, cname, sizeof(cname));
c->client = pa_client_new(p->core, __FILE__, cname);
assert(c->client);
@@ -354,7 +354,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
pa_log("Failed to create sink input.");
goto fail;
}
-
+
c->sink_input->peek = sink_input_peek_cb;
c->sink_input->drop = sink_input_drop_cb;
c->sink_input->kill = sink_input_kill_cb;
@@ -416,9 +416,9 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
c->defer_event = p->core->mainloop->defer_new(p->core->mainloop, defer_callback, c);
assert(c->defer_event);
p->core->mainloop->defer_enable(c->defer_event, 0);
-
+
return;
-
+
fail:
if (c)
connection_free(c);
@@ -443,7 +443,7 @@ pa_protocol_simple* pa_protocol_simple_new(pa_core *core, pa_socket_server *serv
p->source_name = pa_xstrdup(pa_modargs_get_value(ma, "source", NULL));
p->sink_name = pa_xstrdup(pa_modargs_get_value(ma, "sink", NULL));
-
+
enable = 0;
if (pa_modargs_get_value_boolean(ma, "record", &enable) < 0) {
pa_log("record= expects a numeric argument.");
@@ -462,9 +462,9 @@ pa_protocol_simple* pa_protocol_simple_new(pa_core *core, pa_socket_server *serv
pa_log("neither playback nor recording enabled for protocol.");
goto fail;
}
-
+
pa_socket_server_set_callback(p->server, on_connection, p);
-
+
return p;
fail:
@@ -481,7 +481,7 @@ void pa_protocol_simple_free(pa_protocol_simple *p) {
if (p->connections) {
while((c = pa_idxset_first(p->connections, NULL)))
connection_free(c);
-
+
pa_idxset_free(p->connections, NULL, NULL);
}
diff --git a/src/pulsecore/protocol-simple.h b/src/pulsecore/protocol-simple.h
index 8dfaee349..183f3acc3 100644
--- a/src/pulsecore/protocol-simple.h
+++ b/src/pulsecore/protocol-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/pulsecore/pstream-util.c b/src/pulsecore/pstream-util.c
index d7c1b31b8..6ebb28630 100644
--- a/src/pulsecore/pstream-util.c
+++ b/src/pulsecore/pstream-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
diff --git a/src/pulsecore/pstream-util.h b/src/pulsecore/pstream-util.h
index c6d76a7c2..5f1bbd607 100644
--- a/src/pulsecore/pstream-util.h
+++ b/src/pulsecore/pstream-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/pstream.c b/src/pulsecore/pstream.c
index 566fb060a..7e1e5f57f 100644
--- a/src/pulsecore/pstream.c
+++ b/src/pulsecore/pstream.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,7 +111,7 @@ struct item_info {
struct pa_pstream {
PA_REFCNT_DECLARE;
-
+
pa_mainloop_api *mainloop;
pa_defer_event *defer_event;
pa_iochannel *io;
@@ -171,7 +171,7 @@ static void do_something(pa_pstream *p) {
pa_pstream_ref(p);
pa_mutex_lock(p->mutex);
-
+
p->mainloop->defer_enable(p->defer_event, 0);
if (!p->dead && pa_iochannel_is_readable(p->io)) {
@@ -193,21 +193,21 @@ static void do_something(pa_pstream *p) {
fail:
p->dead = 1;
-
+
if (p->die_callback)
p->die_callback(p, p->die_callback_userdata);
-
+
pa_mutex_unlock(p->mutex);
-
+
pa_pstream_unref(p);
}
static void io_callback(pa_iochannel*io, void *userdata) {
pa_pstream *p = userdata;
-
+
assert(p);
assert(p->io == io);
-
+
do_something(p);
}
@@ -217,7 +217,7 @@ static void defer_callback(pa_mainloop_api *m, pa_defer_event *e, void*userdata)
assert(p);
assert(p->defer_event == e);
assert(p->mainloop == m);
-
+
do_something(p);
}
@@ -225,7 +225,7 @@ static void memimport_release_cb(pa_memimport *i, uint32_t block_id, void *userd
pa_pstream *pa_pstream_new(pa_mainloop_api *m, pa_iochannel *io, pa_mempool *pool) {
pa_pstream *p;
-
+
assert(m);
assert(io);
assert(pool);
@@ -241,7 +241,7 @@ pa_pstream *pa_pstream_new(pa_mainloop_api *m, pa_iochannel *io, pa_mempool *poo
p->mainloop = m;
p->defer_event = m->defer_new(m, defer_callback, p);
m->defer_enable(p->defer_event, 0);
-
+
p->send_queue = pa_queue_new();
assert(p->send_queue);
@@ -268,7 +268,7 @@ pa_pstream *pa_pstream_new(pa_mainloop_api *m, pa_iochannel *io, pa_mempool *poo
/* We do importing unconditionally */
p->import = pa_memimport_new(p->mempool, memimport_release_cb, p);
- pa_iochannel_socket_set_rcvbuf(io, 1024*8);
+ pa_iochannel_socket_set_rcvbuf(io, 1024*8);
pa_iochannel_socket_set_sndbuf(io, 1024*8);
#ifdef HAVE_CREDS
@@ -297,7 +297,7 @@ static void pstream_free(pa_pstream *p) {
assert(p);
pa_pstream_close(p);
-
+
pa_queue_free(p->send_queue, item_free, NULL);
if (p->write.current)
@@ -305,7 +305,7 @@ static void pstream_free(pa_pstream *p) {
if (p->read.memblock)
pa_memblock_unref(p->read.memblock);
-
+
if (p->read.packet)
pa_packet_unref(p->read.packet);
@@ -323,14 +323,14 @@ void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_creds *cre
assert(packet);
pa_mutex_lock(p->mutex);
-
+
if (p->dead)
goto finish;
-
+
i = pa_xnew(struct item_info, 1);
i->type = PA_PSTREAM_ITEM_PACKET;
i->packet = pa_packet_ref(packet);
-
+
#ifdef HAVE_CREDS
if ((i->with_creds = !!creds))
i->creds = *creds;
@@ -346,14 +346,14 @@ finish:
void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa_seek_mode_t seek_mode, const pa_memchunk *chunk) {
size_t length, idx;
-
+
assert(p);
assert(PA_REFCNT_VALUE(p) > 0);
assert(channel != (uint32_t) -1);
assert(chunk);
pa_mutex_lock(p->mutex);
-
+
if (p->dead)
goto finish;
@@ -363,7 +363,7 @@ void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa
while (length > 0) {
struct item_info *i;
size_t n;
-
+
i = pa_xnew(struct item_info, 1);
i->type = PA_PSTREAM_ITEM_MEMBLOCK;
@@ -371,24 +371,24 @@ void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa
i->chunk.index = chunk->index + idx;
i->chunk.length = n;
i->chunk.memblock = pa_memblock_ref(chunk->memblock);
-
+
i->channel = channel;
i->offset = offset;
i->seek_mode = seek_mode;
#ifdef HAVE_CREDS
i->with_creds = 0;
#endif
-
+
pa_queue_push(p->send_queue, i);
idx += n;
length -= n;
}
-
+
p->mainloop->defer_enable(p->defer_event, 1);
finish:
-
+
pa_mutex_unlock(p->mutex);
}
@@ -400,7 +400,7 @@ static void memimport_release_cb(pa_memimport *i, uint32_t block_id, void *userd
assert(PA_REFCNT_VALUE(p) > 0);
pa_mutex_lock(p->mutex);
-
+
if (p->dead)
goto finish;
@@ -429,12 +429,12 @@ static void memexport_revoke_cb(pa_memexport *e, uint32_t block_id, void *userda
assert(PA_REFCNT_VALUE(p) > 0);
pa_mutex_lock(p->mutex);
-
+
if (p->dead)
goto finish;
/* pa_log("Revoking block %u", block_id); */
-
+
item = pa_xnew(struct item_info, 1);
item->type = PA_PSTREAM_ITEM_SHMREVOKE;
item->block_id = block_id;
@@ -456,7 +456,7 @@ static void prepare_next_write_item(pa_pstream *p) {
if (!(p->write.current = pa_queue_pop(p->send_queue)))
return;
-
+
p->write.index = 0;
p->write.data = NULL;
@@ -465,9 +465,9 @@ static void prepare_next_write_item(pa_pstream *p) {
p->write.descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_HI] = 0;
p->write.descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_LO] = 0;
p->write.descriptor[PA_PSTREAM_DESCRIPTOR_FLAGS] = 0;
-
+
if (p->write.current->type == PA_PSTREAM_ITEM_PACKET) {
-
+
assert(p->write.current->packet);
p->write.data = p->write.current->packet->data;
p->write.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH] = htonl(p->write.current->packet->length);
@@ -481,14 +481,14 @@ static void prepare_next_write_item(pa_pstream *p) {
p->write.descriptor[PA_PSTREAM_DESCRIPTOR_FLAGS] = htonl(PA_FLAG_SHMREVOKE);
p->write.descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_HI] = htonl(p->write.current->block_id);
-
+
} else {
uint32_t flags;
int send_payload = 1;
-
+
assert(p->write.current->type == PA_PSTREAM_ITEM_MEMBLOCK);
assert(p->write.current->chunk.memblock);
-
+
p->write.descriptor[PA_PSTREAM_DESCRIPTOR_CHANNEL] = htonl(p->write.current->channel);
p->write.descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_HI] = htonl((uint32_t) (((uint64_t) p->write.current->offset) >> 32));
p->write.descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_LO] = htonl((uint32_t) ((uint64_t) p->write.current->offset));
@@ -507,15 +507,15 @@ static void prepare_next_write_item(pa_pstream *p) {
&shm_id,
&offset,
&length) >= 0) {
-
+
flags |= PA_FLAG_SHMDATA;
send_payload = 0;
-
+
p->write.shm_info[PA_PSTREAM_SHM_BLOCKID] = htonl(block_id);
p->write.shm_info[PA_PSTREAM_SHM_SHMID] = htonl(shm_id);
p->write.shm_info[PA_PSTREAM_SHM_INDEX] = htonl((uint32_t) (offset + p->write.current->chunk.index));
p->write.shm_info[PA_PSTREAM_SHM_LENGTH] = htonl((uint32_t) p->write.current->chunk.length);
-
+
p->write.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH] = htonl(sizeof(p->write.shm_info));
p->write.data = p->write.shm_info;
}
@@ -527,7 +527,7 @@ static void prepare_next_write_item(pa_pstream *p) {
p->write.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH] = htonl(p->write.current->chunk.length);
p->write.data = (uint8_t*) p->write.current->chunk.memblock->data + p->write.current->chunk.index;
}
-
+
p->write.descriptor[PA_PSTREAM_DESCRIPTOR_FLAGS] = htonl(flags);
}
@@ -541,7 +541,7 @@ static int do_write(pa_pstream *p) {
void *d;
size_t l;
ssize_t r;
-
+
assert(p);
assert(PA_REFCNT_VALUE(p) > 0);
@@ -556,13 +556,13 @@ static int do_write(pa_pstream *p) {
l = PA_PSTREAM_DESCRIPTOR_SIZE - p->write.index;
} else {
assert(p->write.data);
-
+
d = (uint8_t*) p->write.data + p->write.index - PA_PSTREAM_DESCRIPTOR_SIZE;
l = ntohl(p->write.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH]) - (p->write.index - PA_PSTREAM_DESCRIPTOR_SIZE);
}
assert(l > 0);
-
+
#ifdef HAVE_CREDS
if (p->send_creds_now) {
@@ -592,12 +592,12 @@ static int do_write(pa_pstream *p) {
static int do_read(pa_pstream *p) {
void *d;
- size_t l;
+ size_t l;
ssize_t r;
-
+
assert(p);
assert(PA_REFCNT_VALUE(p) > 0);
-
+
if (p->read.index < PA_PSTREAM_DESCRIPTOR_SIZE) {
d = (uint8_t*) p->read.descriptor + p->read.index;
l = PA_PSTREAM_DESCRIPTOR_SIZE - p->read.index;
@@ -610,7 +610,7 @@ static int do_read(pa_pstream *p) {
#ifdef HAVE_CREDS
{
int b = 0;
-
+
if ((r = pa_iochannel_read_with_creds(p->io, d, l, &p->read_creds, &b)) <= 0)
return -1;
@@ -620,7 +620,7 @@ static int do_read(pa_pstream *p) {
if ((r = pa_iochannel_read(p->io, d, l)) <= 0)
return -1;
#endif
-
+
p->read.index += r;
if (p->read.index == PA_PSTREAM_DESCRIPTOR_SIZE) {
@@ -633,18 +633,18 @@ static int do_read(pa_pstream *p) {
pa_log_warn("Recieved SHM frame on a socket where SHM is disabled.");
return -1;
}
-
+
if (flags == PA_FLAG_SHMRELEASE) {
/* This is a SHM memblock release frame with no payload */
/* pa_log("Got release frame for %u", ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_HI])); */
-
+
assert(p->export);
pa_memexport_process_release(p->export, ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_HI]));
goto frame_done;
-
+
} else if (flags == PA_FLAG_SHMREVOKE) {
/* This is a SHM memblock revoke frame with no payload */
@@ -658,68 +658,68 @@ static int do_read(pa_pstream *p) {
}
length = ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH]);
-
+
if (length > FRAME_SIZE_MAX_ALLOW) {
pa_log_warn("Recieved invalid frame size : %lu", (unsigned long) length);
return -1;
}
-
+
assert(!p->read.packet && !p->read.memblock);
channel = ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_CHANNEL]);
-
+
if (channel == (uint32_t) -1) {
if (flags != 0) {
pa_log_warn("Received packet frame with invalid flags value.");
return -1;
}
-
+
/* Frame is a packet frame */
p->read.packet = pa_packet_new(length);
p->read.data = p->read.packet->data;
-
+
} else {
if ((flags & PA_FLAG_SEEKMASK) > PA_SEEK_RELATIVE_END) {
pa_log_warn("Received memblock frame with invalid seek mode.");
return -1;
}
-
+
if ((flags & PA_FLAG_SHMMASK) == PA_FLAG_SHMDATA) {
if (length != sizeof(p->read.shm_info)) {
pa_log_warn("Recieved SHM memblock frame with Invalid frame length.");
return -1;
}
-
+
/* Frame is a memblock frame referencing an SHM memblock */
p->read.data = p->read.shm_info;
} else if ((flags & PA_FLAG_SHMMASK) == 0) {
/* Frame is a memblock frame */
-
+
p->read.memblock = pa_memblock_new(p->mempool, length);
p->read.data = p->read.memblock->data;
} else {
-
+
pa_log_warn("Recieved memblock frame with invalid flags value.");
return -1;
}
}
-
+
} else if (p->read.index > PA_PSTREAM_DESCRIPTOR_SIZE) {
/* Frame payload available */
-
+
if (p->read.memblock && p->recieve_memblock_callback) {
/* Is this memblock data? Than pass it to the user */
l = (p->read.index - r) < PA_PSTREAM_DESCRIPTOR_SIZE ? p->read.index - PA_PSTREAM_DESCRIPTOR_SIZE : (size_t) r;
-
+
if (l > 0) {
pa_memchunk chunk;
-
+
chunk.memblock = p->read.memblock;
chunk.index = p->read.index - PA_PSTREAM_DESCRIPTOR_SIZE - l;
chunk.length = l;
@@ -730,7 +730,7 @@ static int do_read(pa_pstream *p) {
offset = (int64_t) (
(((uint64_t) ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_HI])) << 32) |
(((uint64_t) ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_LO]))));
-
+
p->recieve_memblock_callback(
p,
ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_CHANNEL]),
@@ -749,14 +749,14 @@ static int do_read(pa_pstream *p) {
/* Frame complete */
if (p->read.index >= ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH]) + PA_PSTREAM_DESCRIPTOR_SIZE) {
-
+
if (p->read.memblock) {
/* This was a memblock frame. We can unref the memblock now */
pa_memblock_unref(p->read.memblock);
} else if (p->read.packet) {
-
+
if (p->recieve_packet_callback)
#ifdef HAVE_CREDS
p->recieve_packet_callback(p, p->read.packet, p->read_creds_valid ? &p->read_creds : NULL, p->recieve_packet_callback_userdata);
@@ -767,7 +767,7 @@ static int do_read(pa_pstream *p) {
pa_packet_unref(p->read.packet);
} else {
pa_memblock *b;
-
+
assert((ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_FLAGS]) & PA_FLAG_SHMMASK) == PA_FLAG_SHMDATA);
assert(p->import);
@@ -785,7 +785,7 @@ static int do_read(pa_pstream *p) {
if (p->recieve_memblock_callback) {
int64_t offset;
pa_memchunk chunk;
-
+
chunk.memblock = b;
chunk.index = 0;
chunk.length = b->length;
@@ -793,7 +793,7 @@ static int do_read(pa_pstream *p) {
offset = (int64_t) (
(((uint64_t) ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_HI])) << 32) |
(((uint64_t) ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_LO]))));
-
+
p->recieve_memblock_callback(
p,
ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_CHANNEL]),
@@ -827,7 +827,7 @@ frame_done:
void pa_pstream_set_die_callback(pa_pstream *p, pa_pstream_notify_cb_t cb, void *userdata) {
assert(p);
assert(PA_REFCNT_VALUE(p) > 0);
-
+
pa_mutex_lock(p->mutex);
p->die_callback = cb;
p->die_callback_userdata = userdata;
@@ -893,7 +893,7 @@ void pa_pstream_unref(pa_pstream*p) {
pa_pstream* pa_pstream_ref(pa_pstream*p) {
assert(p);
assert(PA_REFCNT_VALUE(p) > 0);
-
+
PA_REFCNT_INC(p);
return p;
}
@@ -902,7 +902,7 @@ void pa_pstream_close(pa_pstream *p) {
assert(p);
pa_mutex_lock(p->mutex);
-
+
p->dead = 1;
if (p->import) {
@@ -942,7 +942,7 @@ void pa_pstream_use_shm(pa_pstream *p, int enable) {
p->use_shm = enable;
if (enable) {
-
+
if (!p->export)
p->export = pa_memexport_new(p->mempool, memexport_revoke_cb, p);
diff --git a/src/pulsecore/pstream.h b/src/pulsecore/pstream.h
index 26bb7699c..0ab16720a 100644
--- a/src/pulsecore/pstream.h
+++ b/src/pulsecore/pstream.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/queue.c b/src/pulsecore/queue.c
index 93b119ebc..3132c5c5b 100644
--- a/src/pulsecore/queue.c
+++ b/src/pulsecore/queue.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
@@ -99,7 +99,7 @@ void* pa_queue_pop(pa_queue *q) {
pa_xfree(e);
q->length--;
-
+
return p;
}
diff --git a/src/pulsecore/queue.h b/src/pulsecore/queue.h
index 3fb9dea45..cebe4cdf6 100644
--- a/src/pulsecore/queue.h
+++ b/src/pulsecore/queue.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/random.c b/src/pulsecore/random.c
index 7908e87d8..c3184c78d 100644
--- a/src/pulsecore/random.c
+++ b/src/pulsecore/random.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/random.h b/src/pulsecore/random.h
index b2bb39347..cdac9ac6e 100644
--- a/src/pulsecore/random.h
+++ b/src/pulsecore/random.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
@@ -26,5 +26,5 @@
void pa_random_seed(void);
void pa_random(void *ret_data, size_t length);
-
+
#endif
diff --git a/src/pulsecore/refcnt.h b/src/pulsecore/refcnt.h
index 6eb5ee3f9..f3918213a 100644
--- a/src/pulsecore/refcnt.h
+++ b/src/pulsecore/refcnt.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/resampler.c b/src/pulsecore/resampler.c
index b01420491..e61864dd5 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.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
@@ -54,7 +54,7 @@ struct impl_libsamplerate {
pa_memblock *buf1_block, *buf2_block, *buf3_block, *buf4_block;
float* buf1, *buf2, *buf3, *buf4;
unsigned buf1_samples, buf2_samples, buf3_samples, buf4_samples;
-
+
pa_convert_to_float32ne_func_t to_float32ne_func;
pa_convert_from_float32ne_func_t from_float32ne_func;
SRC_STATE *src_state;
@@ -78,7 +78,7 @@ pa_resampler* pa_resampler_new(
const pa_sample_spec *b,
const pa_channel_map *bm,
pa_resample_method_t resample_method) {
-
+
pa_resampler *r = NULL;
assert(pool);
@@ -110,7 +110,7 @@ pa_resampler* pa_resampler_new(
r->o_cm = *bm;
else
pa_channel_map_init_auto(&r->o_cm, r->o_ss.channels, PA_CHANNEL_MAP_DEFAULT);
-
+
r->i_fz = pa_frame_size(a);
r->o_fz = pa_frame_size(b);
@@ -126,19 +126,19 @@ pa_resampler* pa_resampler_new(
if (libsamplerate_init(r) < 0)
goto fail;
-
+
} else {
/* Use our own simple non-fp resampler for the trivial cases and when the user selects it */
if (trivial_init(r) < 0)
goto fail;
}
-
+
return r;
-
+
fail:
if (r)
pa_xfree(r);
-
+
return NULL;
}
@@ -147,7 +147,7 @@ void pa_resampler_free(pa_resampler *r) {
if (r->impl_free)
r->impl_free(r);
-
+
pa_xfree(r);
}
@@ -157,9 +157,9 @@ void pa_resampler_set_input_rate(pa_resampler *r, uint32_t rate) {
if (r->i_ss.rate == rate)
return;
-
+
r->i_ss.rate = rate;
-
+
if (r->impl_update_input_rate)
r->impl_update_input_rate(r, rate);
}
@@ -172,7 +172,7 @@ void pa_resampler_run(pa_resampler *r, const pa_memchunk *in, pa_memchunk *out)
size_t pa_resampler_request(pa_resampler *r, size_t out_length) {
assert(r);
-
+
return (((out_length / r->o_fz)*r->i_ss.rate)/r->o_ss.rate) * r->i_fz;
}
@@ -200,7 +200,7 @@ const char *pa_resample_method_to_string(pa_resample_method_t m) {
pa_resample_method_t pa_parse_resample_method(const char *string) {
pa_resample_method_t m;
-
+
assert(string);
for (m = 0; m < PA_RESAMPLER_MAX; m++)
@@ -218,9 +218,9 @@ static void libsamplerate_free(pa_resampler *r) {
assert(r);
assert(r->impl_data);
-
+
u = r->impl_data;
-
+
if (u->src_state)
src_delete(u->src_state);
@@ -251,16 +251,16 @@ static void calc_map_table(pa_resampler *r) {
for (ic = 0; ic < r->i_ss.channels; ic++) {
pa_channel_position_t a, b;
-
+
a = r->i_cm.map[ic];
b = r->o_cm.map[oc];
-
+
if (a == b ||
(a == PA_CHANNEL_POSITION_MONO && b == PA_CHANNEL_POSITION_LEFT) ||
(a == PA_CHANNEL_POSITION_MONO && b == PA_CHANNEL_POSITION_RIGHT) ||
(a == PA_CHANNEL_POSITION_LEFT && b == PA_CHANNEL_POSITION_MONO) ||
(a == PA_CHANNEL_POSITION_RIGHT && b == PA_CHANNEL_POSITION_MONO))
-
+
u->map_table[oc][i++] = ic;
}
@@ -278,12 +278,12 @@ static float * convert_to_float(pa_resampler *r, void *input, unsigned n_frames)
assert(input);
assert(r->impl_data);
u = r->impl_data;
-
+
/* Convert the incoming sample into floats and place them in buf1 */
if (!u->to_float32ne_func)
return input;
-
+
n_samples = n_frames * r->i_ss.channels;
if (u->buf1_samples < n_samples) {
@@ -294,7 +294,7 @@ static float * convert_to_float(pa_resampler *r, void *input, unsigned n_frames)
u->buf1_block = pa_memblock_new(r->mempool, sizeof(float) * n_samples);
u->buf1 = u->buf1_block->data;
}
-
+
u->to_float32ne_func(n_samples, input, u->buf1);
return u->buf1;
@@ -305,14 +305,14 @@ static float *remap_channels(pa_resampler *r, float *input, unsigned n_frames) {
unsigned n_samples;
int i_skip, o_skip;
unsigned oc;
-
+
assert(r);
assert(input);
assert(r->impl_data);
u = r->impl_data;
/* Remap channels and place the result int buf2 */
-
+
if (!u->map_required)
return input;
@@ -331,7 +331,7 @@ static float *remap_channels(pa_resampler *r, float *input, unsigned n_frames) {
o_skip = sizeof(float) * r->o_ss.channels;
i_skip = sizeof(float) * r->i_ss.channels;
-
+
for (oc = 0; oc < r->o_ss.channels; oc++) {
unsigned i;
static const float one = 1.0;
@@ -361,7 +361,7 @@ static float *resample(pa_resampler *r, float *input, unsigned *n_frames) {
u = r->impl_data;
/* Resample the data and place the result in buf3 */
-
+
if (!u->src_state)
return input;
@@ -376,16 +376,16 @@ static float *resample(pa_resampler *r, float *input, unsigned *n_frames) {
u->buf3_block = pa_memblock_new(r->mempool, sizeof(float) * out_n_samples);
u->buf3 = u->buf3_block->data;
}
-
+
data.data_in = input;
data.input_frames = *n_frames;
data.data_out = u->buf3;
data.output_frames = out_n_frames;
-
+
data.src_ratio = (double) r->o_ss.rate / r->i_ss.rate;
data.end_of_input = 0;
-
+
ret = src_process(u->src_state, &data);
assert(ret == 0);
assert((unsigned) data.input_frames_used == *n_frames);
@@ -398,17 +398,17 @@ static float *resample(pa_resampler *r, float *input, unsigned *n_frames) {
static void *convert_from_float(pa_resampler *r, float *input, unsigned n_frames) {
struct impl_libsamplerate *u;
unsigned n_samples;
-
+
assert(r);
assert(input);
assert(r->impl_data);
u = r->impl_data;
-
+
/* Convert the data into the correct sample type and place the result in buf4 */
if (!u->from_float32ne_func)
return input;
-
+
n_samples = n_frames * r->o_ss.channels;
if (u->buf4_samples < n_samples) {
@@ -419,7 +419,7 @@ static void *convert_from_float(pa_resampler *r, float *input, unsigned n_frames
u->buf4_block = pa_memblock_new(r->mempool, sizeof(float) * n_samples);
u->buf4 = u->buf4_block->data;
}
-
+
u->from_float32ne_func(n_samples, input, u->buf4);
return u->buf4;
@@ -438,13 +438,13 @@ static void libsamplerate_run(pa_resampler *r, const pa_memchunk *in, pa_memchun
assert(in->memblock);
assert(in->length % r->i_fz == 0);
assert(r->impl_data);
-
+
u = r->impl_data;
input = ((uint8_t*) in->memblock->data + in->index);
n_frames = in->length / r->i_fz;
assert(n_frames > 0);
-
+
buf = convert_to_float(r, input, n_frames);
buf = remap_channels(r, buf, n_frames);
buf = resample(r, buf, &n_frames);
@@ -461,7 +461,7 @@ static void libsamplerate_run(pa_resampler *r, const pa_memchunk *in, pa_memchun
out->length = n_frames * r->o_fz;
out->index = 0;
out->memblock = NULL;
-
+
if (output == u->buf1) {
u->buf1 = NULL;
u->buf1_samples = 0;
@@ -494,7 +494,7 @@ static void libsamplerate_run(pa_resampler *r, const pa_memchunk *in, pa_memchun
static void libsamplerate_update_input_rate(pa_resampler *r, uint32_t rate) {
struct impl_libsamplerate *u;
-
+
assert(r);
assert(rate > 0);
assert(r->impl_data);
@@ -540,7 +540,7 @@ static int libsamplerate_init(pa_resampler *r) {
r->impl_run = libsamplerate_run;
calc_map_table(r);
-
+
return 0;
fail:
@@ -559,7 +559,7 @@ static void trivial_run(pa_resampler *r, const pa_memchunk *in, pa_memchunk *out
assert(in);
assert(out);
assert(r->impl_data);
-
+
u = r->impl_data;
fz = r->i_fz;
@@ -578,34 +578,34 @@ static void trivial_run(pa_resampler *r, const pa_memchunk *in, pa_memchunk *out
/* Do real resampling */
size_t l;
unsigned o_index;
-
+
/* The length of the new memory block rounded up */
l = ((((n_frames+1) * r->o_ss.rate) / r->i_ss.rate) + 1) * fz;
-
+
out->index = 0;
out->memblock = pa_memblock_new(r->mempool, l);
-
+
for (o_index = 0;; o_index++, u->o_counter++) {
unsigned j;
-
+
j = (u->o_counter * r->i_ss.rate / r->o_ss.rate);
j = j > u->i_counter ? j - u->i_counter : 0;
-
+
if (j >= n_frames)
break;
assert(o_index*fz < out->memblock->length);
-
+
memcpy((uint8_t*) out->memblock->data + fz*o_index,
(uint8_t*) in->memblock->data + in->index + fz*j, fz);
-
+
}
-
+
out->length = o_index*fz;
}
u->i_counter += n_frames;
-
+
/* Normalize counters */
while (u->i_counter >= r->i_ss.rate) {
u->i_counter -= r->i_ss.rate;
@@ -616,7 +616,7 @@ static void trivial_run(pa_resampler *r, const pa_memchunk *in, pa_memchunk *out
static void trivial_free(pa_resampler *r) {
assert(r);
-
+
pa_xfree(r->impl_data);
}
@@ -634,7 +634,7 @@ static void trivial_update_input_rate(pa_resampler *r, uint32_t rate) {
static int trivial_init(pa_resampler*r) {
struct impl_trivial *u;
-
+
assert(r);
assert(r->i_ss.format == r->o_ss.format);
assert(r->i_ss.channels == r->o_ss.channels);
@@ -645,7 +645,7 @@ static int trivial_init(pa_resampler*r) {
r->impl_run = trivial_run;
r->impl_free = trivial_free;
r->impl_update_input_rate = trivial_update_input_rate;
-
+
return 0;
}
diff --git a/src/pulsecore/resampler.h b/src/pulsecore/resampler.h
index 327e24a29..7a781364d 100644
--- a/src/pulsecore/resampler.h
+++ b/src/pulsecore/resampler.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/sample-util.c b/src/pulsecore/sample-util.c
index a7a5ed8f0..ddf729202 100644
--- a/src/pulsecore/sample-util.c
+++ b/src/pulsecore/sample-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
@@ -78,7 +78,7 @@ void pa_silence_memory(void *p, size_t length, const pa_sample_spec *spec) {
default:
assert(0);
}
-
+
memset(p, c, length);
}
@@ -90,42 +90,42 @@ size_t pa_mix(
const pa_sample_spec *spec,
const pa_cvolume *volume,
int mute) {
-
+
assert(streams && data && length && spec);
switch (spec->format) {
case PA_SAMPLE_S16NE:{
size_t d;
unsigned channel = 0;
-
+
for (d = 0;; d += sizeof(int16_t)) {
int32_t sum = 0;
-
+
if (d >= length)
return d;
if (!mute && volume->values[channel] != PA_VOLUME_MUTED) {
unsigned i;
-
+
for (i = 0; i < nstreams; i++) {
int32_t v;
pa_volume_t cvolume = streams[i].volume.values[channel];
-
+
if (d >= streams[i].chunk.length)
return d;
-
+
if (cvolume == PA_VOLUME_MUTED)
v = 0;
else {
v = *((int16_t*) ((uint8_t*) streams[i].chunk.memblock->data + streams[i].chunk.index + d));
-
+
if (cvolume != PA_VOLUME_NORM)
v = (int32_t) (v * pa_sw_volume_to_linear(cvolume));
}
-
+
sum += v;
}
-
+
if (volume->values[channel] != PA_VOLUME_NORM)
sum = (int32_t) (sum * pa_sw_volume_to_linear(volume->values[channel]));
@@ -133,10 +133,10 @@ size_t pa_mix(
if (sum > 0x7FFF) sum = 0x7FFF;
}
-
+
*((int16_t*) data) = sum;
data = (uint8_t*) data + sizeof(int16_t);
-
+
if (++channel >= spec->channels)
channel = 0;
}
@@ -145,35 +145,35 @@ size_t pa_mix(
case PA_SAMPLE_S16RE:{
size_t d;
unsigned channel = 0;
-
+
for (d = 0;; d += sizeof(int16_t)) {
int32_t sum = 0;
-
+
if (d >= length)
return d;
if (!mute && volume->values[channel] != PA_VOLUME_MUTED) {
unsigned i;
-
+
for (i = 0; i < nstreams; i++) {
int32_t v;
pa_volume_t cvolume = streams[i].volume.values[channel];
-
+
if (d >= streams[i].chunk.length)
return d;
-
+
if (cvolume == PA_VOLUME_MUTED)
v = 0;
else {
v = INT16_SWAP(*((int16_t*) ((uint8_t*) streams[i].chunk.memblock->data + streams[i].chunk.index + d)));
-
+
if (cvolume != PA_VOLUME_NORM)
v = (int32_t) (v * pa_sw_volume_to_linear(cvolume));
}
-
+
sum += v;
}
-
+
if (volume->values[channel] != PA_VOLUME_NORM)
sum = (int32_t) (sum * pa_sw_volume_to_linear(volume->values[channel]));
@@ -181,40 +181,40 @@ size_t pa_mix(
if (sum > 0x7FFF) sum = 0x7FFF;
}
-
+
*((int16_t*) data) = INT16_SWAP(sum);
data = (uint8_t*) data + sizeof(int16_t);
-
+
if (++channel >= spec->channels)
channel = 0;
}
}
-
+
case PA_SAMPLE_U8: {
size_t d;
unsigned channel = 0;
-
+
for (d = 0;; d ++) {
int32_t sum = 0;
-
+
if (d >= length)
return d;
if (!mute && volume->values[channel] != PA_VOLUME_MUTED) {
unsigned i;
-
+
for (i = 0; i < nstreams; i++) {
int32_t v;
pa_volume_t cvolume = streams[i].volume.values[channel];
-
+
if (d >= streams[i].chunk.length)
return d;
-
+
if (cvolume == PA_VOLUME_MUTED)
v = 0;
else {
v = (int32_t) *((uint8_t*) streams[i].chunk.memblock->data + streams[i].chunk.index + d) - 0x80;
-
+
if (cvolume != PA_VOLUME_NORM)
v = (int32_t) (v * pa_sw_volume_to_linear(cvolume));
}
@@ -229,51 +229,51 @@ size_t pa_mix(
if (sum > 0x7F) sum = 0x7F;
}
-
+
*((uint8_t*) data) = (uint8_t) (sum + 0x80);
data = (uint8_t*) data + 1;
-
+
if (++channel >= spec->channels)
channel = 0;
}
}
-
+
case PA_SAMPLE_FLOAT32NE: {
size_t d;
unsigned channel = 0;
-
+
for (d = 0;; d += sizeof(float)) {
float sum = 0;
-
+
if (d >= length)
return d;
-
+
if (!mute && volume->values[channel] != PA_VOLUME_MUTED) {
unsigned i;
-
+
for (i = 0; i < nstreams; i++) {
float v;
pa_volume_t cvolume = streams[i].volume.values[channel];
-
+
if (d >= streams[i].chunk.length)
return d;
-
+
if (cvolume == PA_VOLUME_MUTED)
v = 0;
else {
v = *((float*) ((uint8_t*) streams[i].chunk.memblock->data + streams[i].chunk.index + d));
-
+
if (cvolume != PA_VOLUME_NORM)
v *= pa_sw_volume_to_linear(cvolume);
}
-
+
sum += v;
}
-
+
if (volume->values[channel] != PA_VOLUME_NORM)
sum *= pa_sw_volume_to_linear(volume->values[channel]);
}
-
+
*((float*) data) = sum;
data = (uint8_t*) data + sizeof(float);
@@ -281,7 +281,7 @@ size_t pa_mix(
channel = 0;
}
}
-
+
default:
pa_log_error("ERROR: Unable to mix audio data of format %s.", pa_sample_format_to_string(spec->format));
abort();
@@ -310,17 +310,17 @@ void pa_volume_memchunk(pa_memchunk*c, const pa_sample_spec *spec, const pa_cvol
for (channel = 0; channel < spec->channels; channel++)
linear[channel] = pa_sw_volume_to_linear(volume->values[channel]);
-
+
for (channel = 0, d = (int16_t*) ((uint8_t*) c->memblock->data+c->index), n = c->length/sizeof(int16_t); n > 0; d++, n--) {
int32_t t = (int32_t)(*d);
-
+
t = (int32_t) (t * linear[channel]);
-
+
if (t < -0x8000) t = -0x8000;
if (t > 0x7FFF) t = 0x7FFF;
-
+
*d = (int16_t) t;
-
+
if (++channel >= spec->channels)
channel = 0;
}
@@ -332,66 +332,66 @@ void pa_volume_memchunk(pa_memchunk*c, const pa_sample_spec *spec, const pa_cvol
size_t n;
unsigned channel;
double linear[PA_CHANNELS_MAX];
-
+
for (channel = 0; channel < spec->channels; channel++)
linear[channel] = pa_sw_volume_to_linear(volume->values[channel]);
-
+
for (channel = 0, d = (int16_t*) ((uint8_t*) c->memblock->data+c->index), n = c->length/sizeof(int16_t); n > 0; d++, n--) {
int32_t t = (int32_t)(INT16_SWAP(*d));
-
+
t = (int32_t) (t * linear[channel]);
-
+
if (t < -0x8000) t = -0x8000;
if (t > 0x7FFF) t = 0x7FFF;
-
+
*d = INT16_SWAP((int16_t) t);
-
+
if (++channel >= spec->channels)
channel = 0;
}
break;
}
-
+
case PA_SAMPLE_U8: {
uint8_t *d;
size_t n;
unsigned channel = 0;
-
+
for (d = (uint8_t*) c->memblock->data + c->index, n = c->length; n > 0; d++, n--) {
int32_t t = (int32_t) *d - 0x80;
-
+
t = (int32_t) (t * pa_sw_volume_to_linear(volume->values[channel]));
-
+
if (t < -0x80) t = -0x80;
if (t > 0x7F) t = 0x7F;
-
+
*d = (uint8_t) (t + 0x80);
-
+
if (++channel >= spec->channels)
channel = 0;
}
break;
}
-
+
case PA_SAMPLE_FLOAT32NE: {
float *d;
int skip;
unsigned n;
unsigned channel;
-
+
d = (float*) ((uint8_t*) c->memblock->data + c->index);
skip = spec->channels * sizeof(float);
n = c->length/sizeof(float)/spec->channels;
-
+
for (channel = 0; channel < spec->channels ; channel ++) {
float v, *t;
-
+
if (volume->values[channel] == PA_VOLUME_NORM)
continue;
-
+
v = (float) pa_sw_volume_to_linear(volume->values[channel]);
-
+
t = d + channel;
oil_scalarmult_f32(t, skip, t, skip, &v, n);
}
diff --git a/src/pulsecore/sample-util.h b/src/pulsecore/sample-util.h
index 6b7707925..1883b2cc5 100644
--- a/src/pulsecore/sample-util.h
+++ b/src/pulsecore/sample-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/pulsecore/sconv-s16be.c b/src/pulsecore/sconv-s16be.c
index 5ac96320e..3af167dfd 100644
--- a/src/pulsecore/sconv-s16be.c
+++ b/src/pulsecore/sconv-s16be.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/sconv-s16be.h b/src/pulsecore/sconv-s16be.h
index bd3fd3454..b96f59ab6 100644
--- a/src/pulsecore/sconv-s16be.h
+++ b/src/pulsecore/sconv-s16be.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/sconv-s16le.c b/src/pulsecore/sconv-s16le.c
index d8b93cbda..1743d61ff 100644
--- a/src/pulsecore/sconv-s16le.c
+++ b/src/pulsecore/sconv-s16le.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 @@ void pa_sconv_s16le_to_float32ne(unsigned n, const void *a, float *b) {
assert(b);
#if SWAP_WORDS == 1
-
+
for (; n > 0; n--) {
int16_t s = *(ca++);
*(b++) = ((float) INT16_FROM(s))/0x7FFF;
@@ -74,19 +74,19 @@ void pa_sconv_s16le_to_float32ne(unsigned n, const void *a, float *b) {
void pa_sconv_s16le_from_float32ne(unsigned n, const float *a, void *b) {
int16_t *cb = b;
-
+
assert(a);
assert(b);
#if SWAP_WORDS == 1
-
+
for (; n > 0; n--) {
int16_t s;
float v = *(a++);
if (v > 1)
v = 1;
-
+
if (v < -1)
v = -1;
diff --git a/src/pulsecore/sconv-s16le.h b/src/pulsecore/sconv-s16le.h
index ae6e22d21..37e85e2fe 100644
--- a/src/pulsecore/sconv-s16le.h
+++ b/src/pulsecore/sconv-s16le.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/sconv.c b/src/pulsecore/sconv.c
index 2e5e2dbef..6bea06083 100644
--- a/src/pulsecore/sconv.c
+++ b/src/pulsecore/sconv.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
@@ -41,12 +41,12 @@
static void u8_to_float32ne(unsigned n, const void *a, float *b) {
const uint8_t *ca = a;
static const double add = -128.0/127.0, factor = 1.0/127.0;
-
+
assert(a);
assert(b);
oil_scaleconv_f32_u8(b, ca, n, &add, &factor);
-}
+}
static void u8_from_float32ne(unsigned n, const float *a, void *b) {
uint8_t *cb = b;
@@ -93,7 +93,7 @@ static void ulaw_to_float32ne(unsigned n, const void *a, float *b) {
assert(a);
assert(b);
-
+
for (; n > 0; n--)
*(b++) = st_ulaw2linear16(*(ca++)) * 1.0F / 0x7FFF;
}
@@ -103,7 +103,7 @@ static void ulaw_from_float32ne(unsigned n, const float *a, void *b) {
assert(a);
assert(b);
-
+
for (; n > 0; n--) {
float v = *(a++);
@@ -132,7 +132,7 @@ static void alaw_from_float32ne(unsigned n, const float *a, void *b) {
assert(a);
assert(b);
-
+
for (; n > 0; n--) {
float v = *(a++);
diff --git a/src/pulsecore/sconv.h b/src/pulsecore/sconv.h
index 4aba06944..52240fd39 100644
--- a/src/pulsecore/sconv.h
+++ b/src/pulsecore/sconv.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/shm.c b/src/pulsecore/shm.c
index 19731b5f3..6188b16c7 100644
--- a/src/pulsecore/shm.c
+++ b/src/pulsecore/shm.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
@@ -45,7 +45,7 @@
#if defined(__linux__) && !defined(MADV_REMOVE)
#define MADV_REMOVE 9
-#endif
+#endif
#define MAX_SHM_SIZE (1024*1024*20)
@@ -57,7 +57,7 @@ static char *segment_name(char *fn, size_t l, unsigned id) {
int pa_shm_create_rw(pa_shm *m, size_t size, int shared, mode_t mode) {
char fn[32];
int fd = -1;
-
+
assert(m);
assert(size > 0);
assert(size < MAX_SHM_SIZE);
@@ -75,7 +75,7 @@ int pa_shm_create_rw(pa_shm *m, size_t size, int shared, mode_t mode) {
#elif defined(HAVE_POSIX_MEMALIGN)
{
int r;
-
+
if ((r = posix_memalign(&m->ptr, sysconf(_SC_PAGESIZE), size)) < 0) {
pa_log("posix_memalign() failed: %s", pa_cstrerror(r));
goto fail;
@@ -84,9 +84,9 @@ int pa_shm_create_rw(pa_shm *m, size_t size, int shared, mode_t mode) {
#else
m->ptr = pa_xmalloc(m->size);
#endif
-
+
m->do_unlink = 0;
-
+
} else {
#ifdef HAVE_SHM_OPEN
pa_random(&m->id, sizeof(m->id));
@@ -96,12 +96,12 @@ int pa_shm_create_rw(pa_shm *m, size_t size, int shared, mode_t mode) {
pa_log("shm_open() failed: %s", pa_cstrerror(errno));
goto fail;
}
-
+
if (ftruncate(fd, m->size = size) < 0) {
pa_log("ftruncate() failed: %s", pa_cstrerror(errno));
goto fail;
}
-
+
if ((m->ptr = mmap(NULL, m->size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED) {
pa_log("mmap() failed: %s", pa_cstrerror(errno));
goto fail;
@@ -115,9 +115,9 @@ int pa_shm_create_rw(pa_shm *m, size_t size, int shared, mode_t mode) {
}
m->shared = shared;
-
+
return 0;
-
+
fail:
#ifdef HAVE_SHM_OPEN
@@ -157,7 +157,7 @@ void pa_shm_free(pa_shm *m) {
char fn[32];
segment_name(fn, sizeof(fn), m->id);
-
+
if (shm_unlink(fn) < 0)
pa_log(" shm_unlink(%s) failed: %s", fn, pa_cstrerror(errno));
}
@@ -172,7 +172,7 @@ void pa_shm_free(pa_shm *m) {
void pa_shm_punch(pa_shm *m, size_t offset, size_t size) {
void *ptr;
-
+
assert(m);
assert(m->ptr);
assert(m->size > 0);
@@ -186,7 +186,7 @@ void pa_shm_punch(pa_shm *m, size_t offset, size_t size) {
* support it */
ptr = (uint8_t*) m->ptr + offset;
-
+
#ifdef __linux__
{
/* On Linux ptr must be page aligned */
@@ -194,14 +194,14 @@ void pa_shm_punch(pa_shm *m, size_t offset, size_t size) {
unsigned o;
o = ((unsigned long) ptr) - ((((unsigned long) ptr)/psz) * psz);
-
+
if (o > 0) {
ptr = (uint8_t*) ptr + (psz - o);
size -= psz - o;
}
}
#endif
-
+
#ifdef MADV_REMOVE
if (madvise(ptr, size, MADV_REMOVE) >= 0)
return;
@@ -210,8 +210,8 @@ void pa_shm_punch(pa_shm *m, size_t offset, size_t size) {
#ifdef MADV_FREE
if (madvise(ptr, size, MADV_FREE) >= 0)
return;
-#endif
-
+#endif
+
#ifdef MADV_DONTNEED
madvise(ptr, size, MADV_DONTNEED);
#endif
@@ -244,7 +244,7 @@ int pa_shm_attach_ro(pa_shm *m, unsigned id) {
}
m->size = st.st_size;
-
+
if ((m->ptr = mmap(NULL, m->size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) {
pa_log("mmap() failed: %s", pa_cstrerror(errno));
goto fail;
@@ -252,11 +252,11 @@ int pa_shm_attach_ro(pa_shm *m, unsigned id) {
m->do_unlink = 0;
m->shared = 1;
-
+
close(fd);
-
+
return 0;
-
+
fail:
if (fd >= 0)
close(fd);
diff --git a/src/pulsecore/shm.h b/src/pulsecore/shm.h
index ea72403a2..f621474cb 100644
--- a/src/pulsecore/shm.h
+++ b/src/pulsecore/shm.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/sink-input.c b/src/pulsecore/sink-input.c
index d948f0a4c..58fe37d55 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.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
@@ -51,7 +51,7 @@ if (!(condition)) \
pa_sink_input_new_data* pa_sink_input_new_data_init(pa_sink_input_new_data *data) {
assert(data);
-
+
memset(data, 0, sizeof(*data));
data->resample_method = PA_RESAMPLER_INVALID;
return data;
@@ -82,7 +82,7 @@ pa_sink_input* pa_sink_input_new(
pa_core *core,
pa_sink_input_new_data *data,
pa_sink_input_flags_t flags) {
-
+
pa_sink_input *i;
pa_resampler *resampler = NULL;
int r;
@@ -100,21 +100,21 @@ pa_sink_input* pa_sink_input_new(
if (!data->sink)
data->sink = pa_namereg_get(core, NULL, PA_NAMEREG_SINK, 1);
-
+
CHECK_VALIDITY_RETURN_NULL(data->sink);
CHECK_VALIDITY_RETURN_NULL(data->sink->state == PA_SINK_RUNNING);
if (!data->sample_spec_is_set)
data->sample_spec = data->sink->sample_spec;
-
+
CHECK_VALIDITY_RETURN_NULL(pa_sample_spec_valid(&data->sample_spec));
-
+
if (!data->channel_map_is_set)
pa_channel_map_init_auto(&data->channel_map, data->sample_spec.channels, PA_CHANNEL_MAP_DEFAULT);
-
+
CHECK_VALIDITY_RETURN_NULL(pa_channel_map_valid(&data->channel_map));
CHECK_VALIDITY_RETURN_NULL(data->channel_map.channels == data->sample_spec.channels);
-
+
if (!data->volume_is_set)
pa_cvolume_reset(&data->volume, data->sample_spec.channels);
@@ -134,9 +134,9 @@ pa_sink_input* pa_sink_input_new(
if ((flags & PA_SINK_INPUT_VARIABLE_RATE) ||
!pa_sample_spec_equal(&data->sample_spec, &data->sink->sample_spec) ||
!pa_channel_map_equal(&data->channel_map, &data->sink->channel_map))
-
+
if (!(resampler = pa_resampler_new(
- core->mempool,
+ core->mempool,
&data->sample_spec, &data->channel_map,
&data->sink->sample_spec, &data->sink->channel_map,
data->resample_method))) {
@@ -157,21 +157,21 @@ pa_sink_input* pa_sink_input_new(
i->sample_spec = data->sample_spec;
i->channel_map = data->channel_map;
i->volume = data->volume;
-
+
i->peek = NULL;
i->drop = NULL;
i->kill = NULL;
i->get_latency = NULL;
i->underrun = NULL;
i->userdata = NULL;
-
+
i->move_silence = 0;
pa_memchunk_reset(&i->resampled_chunk);
i->resampler = resampler;
i->resample_method = data->resample_method;
i->silence_memblock = NULL;
-
+
r = pa_idxset_put(core->sink_inputs, i, &i->index);
assert(r == 0);
r = pa_idxset_put(i->sink->inputs, i, NULL);
@@ -182,13 +182,13 @@ pa_sink_input* pa_sink_input_new(
i->name,
i->sink->name,
pa_sample_spec_snprint(st, sizeof(st), &i->sample_spec));
-
+
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_NEW, i->index);
/* We do not call pa_sink_notify() here, because the virtual
* functions have not yet been initialized */
-
- return i;
+
+ return i;
}
void pa_sink_input_disconnect(pa_sink_input *i) {
@@ -218,17 +218,17 @@ static void sink_input_free(pa_sink_input* i) {
if (i->state != PA_SINK_INPUT_DISCONNECTED)
pa_sink_input_disconnect(i);
- pa_log_info("freed %u \"%s\"", i->index, i->name);
-
+ pa_log_info("freed %u \"%s\"", i->index, i->name);
+
if (i->resampled_chunk.memblock)
pa_memblock_unref(i->resampled_chunk.memblock);
-
+
if (i->resampler)
pa_resampler_free(i->resampler);
if (i->silence_memblock)
pa_memblock_unref(i->silence_memblock);
-
+
pa_xfree(i->name);
pa_xfree(i->driver);
pa_xfree(i);
@@ -245,7 +245,7 @@ void pa_sink_input_unref(pa_sink_input *i) {
pa_sink_input* pa_sink_input_ref(pa_sink_input *i) {
assert(i);
assert(i->ref >= 1);
-
+
i->ref++;
return i;
}
@@ -260,10 +260,10 @@ void pa_sink_input_kill(pa_sink_input*i) {
pa_usec_t pa_sink_input_get_latency(pa_sink_input *i) {
pa_usec_t r = 0;
-
+
assert(i);
assert(i->ref >= 1);
-
+
if (i->get_latency)
r += i->get_latency(i);
@@ -280,7 +280,7 @@ int pa_sink_input_peek(pa_sink_input *i, pa_memchunk *chunk, pa_cvolume *volume)
int ret = -1;
int do_volume_adj_here;
int volume_is_norm;
-
+
assert(i);
assert(i->ref >= 1);
assert(chunk);
@@ -297,7 +297,7 @@ int pa_sink_input_peek(pa_sink_input *i, pa_memchunk *chunk, pa_cvolume *volume)
/* We have just been moved and shall play some silence for a
* while until the old sink has drained its playback buffer */
-
+
if (!i->silence_memblock)
i->silence_memblock = pa_silence_memblock_new(i->sink->core->mempool, &i->sink->sample_spec, SILENCE_BUFFER_LENGTH);
@@ -309,7 +309,7 @@ int pa_sink_input_peek(pa_sink_input *i, pa_memchunk *chunk, pa_cvolume *volume)
do_volume_adj_here = 1;
goto finish;
}
-
+
if (!i->resampler) {
do_volume_adj_here = 0;
ret = i->peek(i, chunk);
@@ -318,16 +318,16 @@ int pa_sink_input_peek(pa_sink_input *i, pa_memchunk *chunk, pa_cvolume *volume)
do_volume_adj_here = !pa_channel_map_equal(&i->channel_map, &i->sink->channel_map);
volume_is_norm = pa_cvolume_is_norm(&i->volume);
-
+
while (!i->resampled_chunk.memblock) {
pa_memchunk tchunk;
size_t l;
-
+
if ((ret = i->peek(i, &tchunk)) < 0)
goto finish;
assert(tchunk.length);
-
+
l = pa_resampler_request(i->resampler, CONVERT_BUFFER_LENGTH);
if (l > tchunk.length)
@@ -348,7 +348,7 @@ int pa_sink_input_peek(pa_sink_input *i, pa_memchunk *chunk, pa_cvolume *volume)
assert(i->resampled_chunk.memblock);
assert(i->resampled_chunk.length);
-
+
*chunk = i->resampled_chunk;
pa_memblock_ref(i->resampled_chunk.memblock);
@@ -375,9 +375,9 @@ finish:
/* We've both the same channel map, so let's have the sink do the adjustment for us*/
*volume = i->volume;
}
-
+
pa_sink_input_unref(i);
-
+
return ret;
}
@@ -392,13 +392,13 @@ void pa_sink_input_drop(pa_sink_input *i, const pa_memchunk *chunk, size_t lengt
if (chunk->memblock != i->silence_memblock ||
chunk->index != 0 ||
- (chunk->memblock && (chunk->length != (i->silence_memblock->length < i->move_silence ? i->silence_memblock->length : i->move_silence))))
+ (chunk->memblock && (chunk->length != (i->silence_memblock->length < i->move_silence ? i->silence_memblock->length : i->move_silence))))
return;
-
+
}
assert(i->move_silence >= length);
-
+
i->move_silence -= length;
if (i->move_silence <= 0) {
@@ -415,7 +415,7 @@ void pa_sink_input_drop(pa_sink_input *i, const pa_memchunk *chunk, size_t lengt
i->drop(i, chunk, length);
return;
}
-
+
assert(i->resampled_chunk.memblock);
assert(i->resampled_chunk.length >= length);
@@ -437,7 +437,7 @@ void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume) {
if (pa_cvolume_equal(&i->volume, volume))
return;
-
+
i->volume = *volume;
pa_subscription_post(i->sink->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index);
}
@@ -451,7 +451,7 @@ const pa_cvolume * pa_sink_input_get_volume(pa_sink_input *i) {
void pa_sink_input_cork(pa_sink_input *i, int b) {
int n;
-
+
assert(i);
assert(i->ref >= 1);
@@ -491,7 +491,7 @@ void pa_sink_input_set_name(pa_sink_input *i, const char *name) {
if (i->name && name && !strcmp(i->name, name))
return;
-
+
pa_xfree(i->name);
i->name = pa_xstrdup(name);
@@ -512,7 +512,7 @@ int pa_sink_input_move_to(pa_sink_input *i, pa_sink *dest, int immediately) {
pa_resampler *new_resampler = NULL;
pa_memblockq *buffer = NULL;
pa_sink *origin;
-
+
assert(i);
assert(dest);
@@ -532,13 +532,13 @@ int pa_sink_input_move_to(pa_sink_input *i, pa_sink *dest, int immediately) {
/* Try to reuse the old resampler if possible */
new_resampler = i->resampler;
-
+
else if ((i->flags & PA_SINK_INPUT_VARIABLE_RATE) ||
!pa_sample_spec_equal(&i->sample_spec, &dest->sample_spec) ||
!pa_channel_map_equal(&i->channel_map, &dest->channel_map)) {
/* Okey, we need a new resampler for the new sink */
-
+
if (!(new_resampler = pa_resampler_new(
dest->core->mempool,
&i->sample_spec, &i->channel_map,
@@ -554,13 +554,13 @@ int pa_sink_input_move_to(pa_sink_input *i, pa_sink *dest, int immediately) {
pa_usec_t silence_usec = 0;
buffer = pa_memblockq_new(0, MOVE_BUFFER_LENGTH, 0, pa_frame_size(&origin->sample_spec), 0, 0, NULL);
-
+
/* Let's do a little bit of Voodoo for compensating latency
* differences */
old_latency = pa_sink_get_latency(origin);
new_latency = pa_sink_get_latency(dest);
-
+
/* The already resampled data should go to the old sink */
if (old_latency >= new_latency) {
@@ -571,17 +571,17 @@ int pa_sink_input_move_to(pa_sink_input *i, pa_sink *dest, int immediately) {
* while */
silence_usec = old_latency - new_latency;
-
+
} else {
size_t l;
int volume_is_norm;
-
+
/* The latency of new sink is larger than the latency of
* the old sink. Therefore we have to precompute a little
* and make sure that this is still played on the old
* sink, until we can play the first sample on the new
* sink.*/
-
+
l = pa_usec_to_bytes(new_latency - old_latency, &origin->sample_spec);
volume_is_norm = pa_cvolume_is_norm(&i->volume);
@@ -655,7 +655,7 @@ int pa_sink_input_move_to(pa_sink_input *i, pa_sink *dest, int immediately) {
i->resampled_chunk.memblock = NULL;
i->resampled_chunk.index = i->resampled_chunk.length = 0;
}
-
+
/* Notify everyone */
pa_subscription_post(i->sink->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index);
pa_sink_notify(i->sink);
diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
index 2943dfaef..9d7487f7d 100644
--- a/src/pulsecore/sink-input.h
+++ b/src/pulsecore/sink-input.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
@@ -52,13 +52,13 @@ struct pa_sink_input {
uint32_t index;
pa_sink_input_state_t state;
pa_sink_input_flags_t flags;
-
+
char *name, *driver; /* may be NULL */
- pa_module *module; /* may be NULL */
- pa_client *client; /* may be NULL */
+ pa_module *module; /* may be NULL */
+ pa_client *client; /* may be NULL */
pa_sink *sink;
-
+
pa_sample_spec sample_spec;
pa_channel_map channel_map;
pa_cvolume volume;
@@ -67,7 +67,7 @@ struct pa_sink_input {
* compensate for latency differences when moving a sink input
* "hot" between sinks. */
size_t move_silence;
-
+
int (*peek) (pa_sink_input *i, pa_memchunk *chunk);
void (*drop) (pa_sink_input *i, const pa_memchunk *chunk, size_t length);
void (*kill) (pa_sink_input *i); /* may be NULL */
@@ -88,16 +88,16 @@ typedef struct pa_sink_input_new_data {
const char *name, *driver;
pa_module *module;
pa_client *client;
-
+
pa_sink *sink;
-
+
pa_sample_spec sample_spec;
int sample_spec_is_set;
pa_channel_map channel_map;
int channel_map_is_set;
pa_cvolume volume;
int volume_is_set;
-
+
pa_resample_method_t resample_method;
} pa_sink_input_new_data;
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 056952546..cb0e54c18 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/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
@@ -56,7 +56,7 @@ pa_sink* pa_sink_new(
int fail,
const pa_sample_spec *spec,
const pa_channel_map *map) {
-
+
pa_sink *s;
char *n = NULL;
char st[256];
@@ -68,7 +68,7 @@ pa_sink* pa_sink_new(
assert(spec);
CHECK_VALIDITY_RETURN_NULL(pa_sample_spec_valid(spec));
-
+
if (!map)
map = pa_channel_map_init_auto(&tmap, spec->channels, PA_CHANNEL_MAP_DEFAULT);
@@ -76,7 +76,7 @@ pa_sink* pa_sink_new(
CHECK_VALIDITY_RETURN_NULL(map->channels == spec->channels);
CHECK_VALIDITY_RETURN_NULL(!driver || pa_utf8_valid(driver));
CHECK_VALIDITY_RETURN_NULL(pa_utf8_valid(name) && *name);
-
+
s = pa_xnew(pa_sink, 1);
if (!(name = pa_namereg_register(core, name, PA_NAMEREG_SINK, s, fail))) {
@@ -94,7 +94,7 @@ pa_sink* pa_sink_new(
s->sample_spec = *spec;
s->channel_map = *map;
-
+
s->inputs = pa_idxset_new(NULL, NULL);
pa_cvolume_reset(&s->sw_volume, spec->channels);
@@ -103,7 +103,7 @@ pa_sink* pa_sink_new(
s->hw_muted = 0;
s->is_hardware = 0;
-
+
s->get_latency = NULL;
s->notify = NULL;
s->set_hw_volume = NULL;
@@ -114,12 +114,12 @@ pa_sink* pa_sink_new(
r = pa_idxset_put(core->sinks, s, &s->index);
assert(s->index != PA_IDXSET_INVALID && r >= 0);
-
+
pa_sample_spec_snprint(st, sizeof(st), spec);
pa_log_info("created %u \"%s\" with sample spec \"%s\"", s->index, s->name, st);
n = pa_sprintf_malloc("%s.monitor", name);
-
+
if (!(s->monitor_source = pa_source_new(core, driver, n, 0, spec, map)))
pa_log_warn("failed to create monitor source.");
else {
@@ -131,15 +131,15 @@ pa_sink* pa_sink_new(
}
pa_xfree(n);
-
+
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIPTION_EVENT_NEW, s->index);
-
+
return s;
}
void pa_sink_disconnect(pa_sink* s) {
pa_sink_input *i, *j = NULL;
-
+
assert(s);
assert(s->state == PA_SINK_RUNNING);
@@ -147,7 +147,7 @@ void pa_sink_disconnect(pa_sink* s) {
pa_namereg_unregister(s->core, s->name);
pa_hook_fire(&s->core->hook_sink_disconnect, s);
-
+
while ((i = pa_idxset_first(s->inputs, NULL))) {
assert(i != j);
pa_sink_input_kill(i);
@@ -165,24 +165,24 @@ void pa_sink_disconnect(pa_sink* s) {
s->set_hw_volume = NULL;
s->set_hw_mute = NULL;
s->get_hw_mute = NULL;
-
+
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIPTION_EVENT_REMOVE, s->index);
}
static void sink_free(pa_sink *s) {
assert(s);
assert(!s->ref);
-
+
if (s->state != PA_SINK_DISCONNECTED)
pa_sink_disconnect(s);
- pa_log_info("freed %u \"%s\"", s->index, s->name);
+ pa_log_info("freed %u \"%s\"", s->index, s->name);
if (s->monitor_source) {
pa_source_unref(s->monitor_source);
s->monitor_source = NULL;
}
-
+
pa_idxset_free(s->inputs, NULL, NULL);
pa_xfree(s->name);
@@ -202,7 +202,7 @@ void pa_sink_unref(pa_sink*s) {
pa_sink* pa_sink_ref(pa_sink *s) {
assert(s);
assert(s->ref >= 1);
-
+
s->ref++;
return s;
}
@@ -219,7 +219,7 @@ static unsigned fill_mix_info(pa_sink *s, pa_mix_info *info, unsigned maxinfo) {
uint32_t idx = PA_IDXSET_INVALID;
pa_sink_input *i;
unsigned n = 0;
-
+
assert(s);
assert(s->ref >= 1);
assert(info);
@@ -235,11 +235,11 @@ static unsigned fill_mix_info(pa_sink *s, pa_mix_info *info, unsigned maxinfo) {
}
info->userdata = i;
-
+
assert(info->chunk.memblock);
assert(info->chunk.memblock->data);
assert(info->chunk.length);
-
+
info++;
maxinfo--;
n++;
@@ -255,7 +255,7 @@ static void inputs_drop(pa_sink *s, pa_mix_info *info, unsigned maxinfo, size_t
for (; maxinfo > 0; maxinfo--, info++) {
pa_sink_input *i = info->userdata;
-
+
assert(i);
assert(info->chunk.memblock);
@@ -268,19 +268,19 @@ static void inputs_drop(pa_sink *s, pa_mix_info *info, unsigned maxinfo, size_t
info->userdata = NULL;
}
}
-
+
int pa_sink_render(pa_sink*s, size_t length, pa_memchunk *result) {
pa_mix_info info[MAX_MIX_CHANNELS];
unsigned n;
int r = -1;
-
+
assert(s);
assert(s->ref >= 1);
assert(length);
assert(result);
pa_sink_ref(s);
-
+
n = fill_mix_info(s, info, MAX_MIX_CHANNELS);
if (n <= 0)
@@ -296,7 +296,7 @@ int pa_sink_render(pa_sink*s, size_t length, pa_memchunk *result) {
result->length = length;
pa_sw_cvolume_multiply(&volume, &s->sw_volume, &info[0].volume);
-
+
if (s->sw_muted || !pa_cvolume_is_norm(&volume)) {
pa_memchunk_make_writable(result, 0);
if (s->sw_muted)
@@ -332,7 +332,7 @@ int pa_sink_render_into(pa_sink*s, pa_memchunk *target) {
pa_mix_info info[MAX_MIX_CHANNELS];
unsigned n;
int r = -1;
-
+
assert(s);
assert(s->ref >= 1);
assert(target);
@@ -341,7 +341,7 @@ int pa_sink_render_into(pa_sink*s, pa_memchunk *target) {
assert(target->memblock->data);
pa_sink_ref(s);
-
+
n = fill_mix_info(s, info, MAX_MIX_CHANNELS);
if (n <= 0)
@@ -352,7 +352,7 @@ int pa_sink_render_into(pa_sink*s, pa_memchunk *target) {
if (target->length > info[0].chunk.length)
target->length = info[0].chunk.length;
-
+
memcpy((uint8_t*) target->memblock->data + target->index,
(uint8_t*) info[0].chunk.memblock->data + info[0].chunk.index,
target->length);
@@ -360,7 +360,7 @@ int pa_sink_render_into(pa_sink*s, pa_memchunk *target) {
pa_sw_cvolume_multiply(&volume, &s->sw_volume, &info[0].volume);
if (s->sw_muted)
- pa_silence_memchunk(target, &s->sample_spec);
+ pa_silence_memchunk(target, &s->sample_spec);
else if (!pa_cvolume_is_norm(&volume))
pa_volume_memchunk(target, &s->sample_spec, &volume);
} else
@@ -370,7 +370,7 @@ int pa_sink_render_into(pa_sink*s, pa_memchunk *target) {
&s->sample_spec,
&s->sw_volume,
s->sw_muted);
-
+
inputs_drop(s, info, n, target->length);
if (s->monitor_source)
@@ -380,14 +380,14 @@ int pa_sink_render_into(pa_sink*s, pa_memchunk *target) {
finish:
pa_sink_unref(s);
-
+
return r;
}
void pa_sink_render_into_full(pa_sink *s, pa_memchunk *target) {
pa_memchunk chunk;
size_t l, d;
-
+
assert(s);
assert(s->ref >= 1);
assert(target);
@@ -396,14 +396,14 @@ void pa_sink_render_into_full(pa_sink *s, pa_memchunk *target) {
assert(target->memblock->data);
pa_sink_ref(s);
-
+
l = target->length;
d = 0;
while (l > 0) {
chunk = *target;
chunk.index += d;
chunk.length -= d;
-
+
if (pa_sink_render_into(s, &chunk) < 0)
break;
@@ -428,7 +428,7 @@ void pa_sink_render_full(pa_sink *s, size_t length, pa_memchunk *result) {
assert(result);
/*** This needs optimization ***/
-
+
result->memblock = pa_memblock_new(s->core->mempool, result->length = length);
result->index = 0;
@@ -451,7 +451,7 @@ void pa_sink_set_owner(pa_sink *s, pa_module *m) {
if (s->owner == m)
return;
-
+
s->owner = m;
if (s->monitor_source)
@@ -462,19 +462,19 @@ void pa_sink_set_owner(pa_sink *s, pa_module *m) {
void pa_sink_set_volume(pa_sink *s, pa_mixer_t m, const pa_cvolume *volume) {
pa_cvolume *v;
-
+
assert(s);
assert(s->ref >= 1);
assert(volume);
- if (m == PA_MIXER_HARDWARE && s->set_hw_volume)
+ if (m == PA_MIXER_HARDWARE && s->set_hw_volume)
v = &s->hw_volume;
else
v = &s->sw_volume;
if (pa_cvolume_equal(v, volume))
return;
-
+
*v = *volume;
if (v == &s->hw_volume)
@@ -492,7 +492,7 @@ const pa_cvolume *pa_sink_get_volume(pa_sink *s, pa_mixer_t m) {
if (s->get_hw_volume)
s->get_hw_volume(s);
-
+
return &s->hw_volume;
} else
return &s->sw_volume;
@@ -500,18 +500,18 @@ const pa_cvolume *pa_sink_get_volume(pa_sink *s, pa_mixer_t m) {
void pa_sink_set_mute(pa_sink *s, pa_mixer_t m, int mute) {
int *t;
-
+
assert(s);
assert(s->ref >= 1);
- if (m == PA_MIXER_HARDWARE && s->set_hw_mute)
+ if (m == PA_MIXER_HARDWARE && s->set_hw_mute)
t = &s->hw_muted;
else
t = &s->sw_muted;
if (!!*t == !!mute)
return;
-
+
*t = !!mute;
if (t == &s->hw_muted)
@@ -529,7 +529,7 @@ int pa_sink_get_mute(pa_sink *s, pa_mixer_t m) {
if (s->get_hw_mute)
s->get_hw_mute(s);
-
+
return s->hw_muted;
} else
return s->sw_muted;
@@ -544,18 +544,18 @@ void pa_sink_set_description(pa_sink *s, const char *description) {
if (description && s->description && !strcmp(description, s->description))
return;
-
+
pa_xfree(s->description);
s->description = pa_xstrdup(description);
if (s->monitor_source) {
char *n;
-
+
n = pa_sprintf_malloc("Monitor Source of %s", s->description? s->description : s->name);
pa_source_set_description(s->monitor_source, n);
pa_xfree(n);
}
-
+
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
}
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index 1d870620e..7cfc9e268 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.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
@@ -59,7 +59,7 @@ struct pa_sink {
pa_idxset *inputs;
pa_source *monitor_source; /* may be NULL */
-
+
pa_cvolume hw_volume, sw_volume;
int hw_muted, sw_muted;
@@ -69,7 +69,7 @@ struct pa_sink {
int (*get_hw_volume)(pa_sink *s); /* dito */
int (*set_hw_mute)(pa_sink *s); /* dito */
int (*get_hw_mute)(pa_sink *s); /* dito */
-
+
void *userdata;
};
@@ -89,7 +89,7 @@ int pa_sink_render(pa_sink*s, size_t length, pa_memchunk *result);
void pa_sink_render_full(pa_sink *s, size_t length, pa_memchunk *result);
int pa_sink_render_into(pa_sink*s, pa_memchunk *target);
void pa_sink_render_into_full(pa_sink *s, pa_memchunk *target);
-
+
pa_usec_t pa_sink_get_latency(pa_sink *s);
void pa_sink_notify(pa_sink*s);
diff --git a/src/pulsecore/sioman.c b/src/pulsecore/sioman.c
index d84010ee9..4d5d5562d 100644
--- a/src/pulsecore/sioman.c
+++ b/src/pulsecore/sioman.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
@@ -40,4 +40,4 @@ int pa_stdio_acquire(void) {
void pa_stdio_release(void) {
assert(stdio_inuse);
stdio_inuse = 0;
-}
+}
diff --git a/src/pulsecore/sioman.h b/src/pulsecore/sioman.h
index cd04d140e..bbd521108 100644
--- a/src/pulsecore/sioman.h
+++ b/src/pulsecore/sioman.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/socket-client.c b/src/pulsecore/socket-client.c
index 2ceaf5c3c..b08ba010d 100644
--- a/src/pulsecore/socket-client.c
+++ b/src/pulsecore/socket-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.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
@@ -110,17 +110,17 @@ static pa_socket_client*pa_socket_client_new(pa_mainloop_api *m) {
static void free_events(pa_socket_client *c) {
assert(c);
-
+
if (c->io_event) {
c->mainloop->io_free(c->io_event);
c->io_event = NULL;
}
-
+
if (c->defer_event) {
c->mainloop->defer_free(c->defer_event);
c->defer_event = NULL;
}
-
+
if (c->timeout_event) {
c->mainloop->time_free(c->timeout_event);
c->timeout_event = NULL;
@@ -137,7 +137,7 @@ static void do_call(pa_socket_client *c) {
if (c->fd < 0)
goto finish;
-
+
lerror = sizeof(error);
if (getsockopt(c->fd, SOL_SOCKET, SO_ERROR, (void*)&error, &lerror) < 0) {
pa_log("getsockopt(): %s", pa_cstrerror(errno));
@@ -157,17 +157,17 @@ static void do_call(pa_socket_client *c) {
io = pa_iochannel_new(c->mainloop, c->fd, c->fd);
assert(io);
-
+
finish:
if (!io && c->fd >= 0)
close(c->fd);
c->fd = -1;
free_events(c);
-
+
assert(c->callback);
c->callback(c, io, c->userdata);
-
+
pa_socket_client_unref(c);
}
@@ -186,9 +186,9 @@ static void connect_io_cb(pa_mainloop_api*m, pa_io_event *e, int fd, PA_GCC_UNUS
static int do_connect(pa_socket_client *c, const struct sockaddr *sa, socklen_t len) {
int r;
assert(c && sa && len);
-
+
pa_make_nonblock_fd(c->fd);
-
+
if ((r = connect(c->fd, sa, len)) < 0) {
#ifdef OS_IS_WIN32
if (WSAGetLastError() != EWOULDBLOCK) {
@@ -227,7 +227,7 @@ pa_socket_client* pa_socket_client_new_ipv4(pa_mainloop_api *m, uint32_t address
pa_socket_client* pa_socket_client_new_unix(pa_mainloop_api *m, const char *filename) {
struct sockaddr_un sa;
assert(m && filename);
-
+
memset(&sa, 0, sizeof(sa));
sa.sun_family = AF_UNIX;
strncpy(sa.sun_path, filename, sizeof(sa.sun_path)-1);
@@ -248,24 +248,24 @@ static int sockaddr_prepare(pa_socket_client *c, const struct sockaddr *sa, size
assert(c);
assert(sa);
assert(salen);
-
+
switch (sa->sa_family) {
case AF_UNIX:
c->local = 1;
break;
-
+
case AF_INET:
c->local = ((const struct sockaddr_in*) sa)->sin_addr.s_addr == INADDR_LOOPBACK;
break;
-
+
case AF_INET6:
c->local = memcmp(&((const struct sockaddr_in6*) sa)->sin6_addr, &in6addr_loopback, sizeof(struct in6_addr)) == 0;
break;
-
+
default:
c->local = 0;
}
-
+
if ((c->fd = socket(sa->sa_family, SOCK_STREAM, 0)) < 0) {
pa_log("socket(): %s", pa_cstrerror(errno));
return -1;
@@ -291,13 +291,13 @@ pa_socket_client* pa_socket_client_new_sockaddr(pa_mainloop_api *m, const struct
if (sockaddr_prepare(c, sa, salen) < 0)
goto fail;
-
+
return c;
fail:
pa_socket_client_unref(c);
return NULL;
-
+
}
static void socket_client_free(pa_socket_client *c) {
@@ -305,7 +305,7 @@ static void socket_client_free(pa_socket_client *c) {
free_events(c);
-
+
if (c->fd >= 0)
close(c->fd);
@@ -317,7 +317,7 @@ static void socket_client_free(pa_socket_client *c) {
if (c->asyncns_io_event)
c->mainloop->io_free(c->asyncns_io_event);
#endif
-
+
pa_xfree(c);
}
@@ -342,7 +342,7 @@ void pa_socket_client_set_callback(pa_socket_client *c, void (*on_connection)(pa
pa_socket_client* pa_socket_client_new_ipv6(pa_mainloop_api *m, uint8_t address[16], uint16_t port) {
struct sockaddr_in6 sa;
-
+
memset(&sa, 0, sizeof(sa));
sa.sin6_family = AF_INET6;
sa.sin6_port = htons(port);
@@ -370,24 +370,24 @@ static void asyncns_cb(pa_mainloop_api*m, pa_io_event *e, int fd, PA_GCC_UNUSED
if (ret != 0 || !res)
goto fail;
-
+
if (res->ai_addr)
sockaddr_prepare(c, res->ai_addr, res->ai_addrlen);
-
+
asyncns_freeaddrinfo(res);
m->io_free(c->asyncns_io_event);
c->asyncns_io_event = NULL;
return;
-
+
fail:
m->io_free(c->asyncns_io_event);
c->asyncns_io_event = NULL;
-
+
errno = EHOSTUNREACH;
do_call(c);
return;
-
+
}
#endif
@@ -428,7 +428,7 @@ pa_socket_client* pa_socket_client_new_string(pa_mainloop_api *m, const char*nam
if (!a.port)
a.port = default_port;
-
+
switch (a.type) {
case PA_PARSED_ADDRESS_UNIX:
if ((c = pa_socket_client_new_unix(m, a.path_or_host)))
@@ -447,11 +447,11 @@ pa_socket_client* pa_socket_client_new_string(pa_mainloop_api *m, const char*nam
memset(&hints, 0, sizeof(hints));
hints.ai_family = a.type == PA_PARSED_ADDRESS_TCP4 ? PF_INET : (a.type == PA_PARSED_ADDRESS_TCP6 ? PF_INET6 : PF_UNSPEC);
hints.ai_socktype = SOCK_STREAM;
-
+
#ifdef HAVE_LIBASYNCNS
{
asyncns_t *asyncns;
-
+
if (!(asyncns = asyncns_new(1)))
goto finish;
@@ -469,7 +469,7 @@ pa_socket_client* pa_socket_client_new_string(pa_mainloop_api *m, const char*nam
struct addrinfo *res = NULL;
ret = getaddrinfo(a.path_or_host, port, &hints, &res);
-
+
if (ret < 0 || !res)
goto finish;
@@ -477,7 +477,7 @@ pa_socket_client* pa_socket_client_new_string(pa_mainloop_api *m, const char*nam
if ((c = pa_socket_client_new_sockaddr(m, res->ai_addr, res->ai_addrlen)))
start_timeout(c);
}
-
+
freeaddrinfo(res);
#else /* HAVE_GETADDRINFO */
struct hostent *host = NULL;
@@ -514,7 +514,7 @@ pa_socket_client* pa_socket_client_new_string(pa_mainloop_api *m, const char*nam
finish:
pa_xfree(a.path_or_host);
return c;
-
+
}
/* Return non-zero when the target sockaddr is considered
diff --git a/src/pulsecore/socket-client.h b/src/pulsecore/socket-client.h
index 47e7cd5a9..146ebda87 100644
--- a/src/pulsecore/socket-client.h
+++ b/src/pulsecore/socket-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.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/socket-server.c b/src/pulsecore/socket-server.c
index 4d69b8a47..c878ab1ab 100644
--- a/src/pulsecore/socket-server.c
+++ b/src/pulsecore/socket-server.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,14 +94,14 @@ static void callback(pa_mainloop_api *mainloop, pa_io_event *e, int fd, PA_GCC_U
assert(s && s->mainloop == mainloop && s->io_event == e && e && fd >= 0 && fd == s->fd);
pa_socket_server_ref(s);
-
+
if ((nfd = accept(fd, NULL, NULL)) < 0) {
pa_log("accept(): %s", pa_cstrerror(errno));
goto finish;
}
pa_fd_set_cloexec(nfd, 1);
-
+
if (!s->on_connection) {
close(nfd);
goto finish;
@@ -123,13 +123,13 @@ static void callback(pa_mainloop_api *mainloop, pa_io_event *e, int fd, PA_GCC_U
pa_log_info("TCP connection accepted by tcpwrap.");
}
#endif
-
+
/* There should be a check for socket type here */
- if (s->type == SOCKET_SERVER_IPV4)
+ if (s->type == SOCKET_SERVER_IPV4)
pa_socket_tcp_low_delay(fd);
else
pa_socket_low_delay(fd);
-
+
io = pa_iochannel_new(s->mainloop, nfd, nfd);
assert(io);
s->on_connection(s, io, s->userdata);
@@ -141,7 +141,7 @@ finish:
pa_socket_server* pa_socket_server_new(pa_mainloop_api *m, int fd) {
pa_socket_server *s;
assert(m && fd >= 0);
-
+
s = pa_xmalloc(sizeof(pa_socket_server));
s->ref = 1;
s->fd = fd;
@@ -155,7 +155,7 @@ pa_socket_server* pa_socket_server_new(pa_mainloop_api *m, int fd) {
assert(s->io_event);
s->type = SOCKET_SERVER_GENERIC;
-
+
return s;
}
@@ -171,7 +171,7 @@ pa_socket_server* pa_socket_server_new_unix(pa_mainloop_api *m, const char *file
int fd = -1;
struct sockaddr_un sa;
pa_socket_server *s;
-
+
assert(m && filename);
if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
@@ -197,7 +197,7 @@ pa_socket_server* pa_socket_server_new_unix(pa_mainloop_api *m, const char *file
* because not all OS check the access rights on the socket
* inodes. */
chmod(filename, 0777);
-
+
if (listen(fd, 5) < 0) {
pa_log("listen(): %s", pa_cstrerror(errno));
goto fail;
@@ -208,9 +208,9 @@ pa_socket_server* pa_socket_server_new_unix(pa_mainloop_api *m, const char *file
s->filename = pa_xstrdup(filename);
s->type = SOCKET_SERVER_UNIX;
-
+
return s;
-
+
fail:
if (fd >= 0)
close(fd);
@@ -247,7 +247,7 @@ pa_socket_server* pa_socket_server_new_ipv4(pa_mainloop_api *m, uint32_t address
#endif
pa_socket_tcp_low_delay(fd);
-
+
memset(&sa, 0, sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_port = htons(port);
@@ -269,7 +269,7 @@ pa_socket_server* pa_socket_server_new_ipv4(pa_mainloop_api *m, uint32_t address
}
return ss;
-
+
fail:
if (fd >= 0)
close(fd);
@@ -323,9 +323,9 @@ pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t ad
ss->type = SOCKET_SERVER_IPV6;
ss->tcpwrap_service = pa_xstrdup(tcpwrap_service);
}
-
+
return ss;
-
+
fail:
if (fd >= 0)
close(fd);
@@ -350,20 +350,20 @@ pa_socket_server* pa_socket_server_new_ipv6_loopback(pa_mainloop_api *m, uint16_
pa_socket_server* pa_socket_server_new_ipv4_any(pa_mainloop_api *m, uint16_t port, const char *tcpwrap_service) {
assert(m);
assert(port > 0);
-
+
return pa_socket_server_new_ipv4(m, INADDR_ANY, port, tcpwrap_service);
}
pa_socket_server* pa_socket_server_new_ipv6_any(pa_mainloop_api *m, uint16_t port, const char *tcpwrap_service) {
assert(m);
assert(port > 0);
-
+
return pa_socket_server_new_ipv6(m, in6addr_any.s6_addr, port, tcpwrap_service);
}
pa_socket_server* pa_socket_server_new_ipv4_string(pa_mainloop_api *m, const char *name, uint16_t port, const char *tcpwrap_service) {
struct in_addr ipv4;
-
+
assert(m);
assert(name);
assert(port > 0);
@@ -376,7 +376,7 @@ pa_socket_server* pa_socket_server_new_ipv4_string(pa_mainloop_api *m, const cha
pa_socket_server* pa_socket_server_new_ipv6_string(pa_mainloop_api *m, const char *name, uint16_t port, const char *tcpwrap_service) {
struct in6_addr ipv6;
-
+
assert(m);
assert(name);
assert(port > 0);
@@ -419,7 +419,7 @@ void pa_socket_server_set_callback(pa_socket_server*s, void (*on_connection)(pa_
char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) {
assert(s && c && l > 0);
-
+
switch (s->type) {
case SOCKET_SERVER_IPV6: {
struct sockaddr_in6 sa;
@@ -434,23 +434,23 @@ char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) {
char fqdn[256];
if (!pa_get_fqdn(fqdn, sizeof(fqdn)))
return NULL;
-
+
snprintf(c, l, "tcp6:%s:%u", fqdn, (unsigned) ntohs(sa.sin6_port));
-
+
} else if (memcmp(&in6addr_loopback, &sa.sin6_addr, sizeof(in6addr_loopback)) == 0) {
char hn[256];
if (!pa_get_host_name(hn, sizeof(hn)))
return NULL;
-
+
snprintf(c, l, "{%s}tcp6:localhost:%u", hn, (unsigned) ntohs(sa.sin6_port));
} else {
char ip[INET6_ADDRSTRLEN];
-
+
if (!inet_ntop(AF_INET6, &sa.sin6_addr, ip, sizeof(ip))) {
pa_log("inet_ntop(): %s", pa_cstrerror(errno));
return NULL;
}
-
+
snprintf(c, l, "tcp6:[%s]:%u", ip, (unsigned) ntohs(sa.sin6_port));
}
@@ -470,13 +470,13 @@ char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) {
char fqdn[256];
if (!pa_get_fqdn(fqdn, sizeof(fqdn)))
return NULL;
-
+
snprintf(c, l, "tcp:%s:%u", fqdn, (unsigned) ntohs(sa.sin_port));
} else if (sa.sin_addr.s_addr == INADDR_LOOPBACK) {
char hn[256];
if (!pa_get_host_name(hn, sizeof(hn)))
return NULL;
-
+
snprintf(c, l, "{%s}tcp:localhost:%u", hn, (unsigned) ntohs(sa.sin_port));
} else {
char ip[INET_ADDRSTRLEN];
@@ -485,11 +485,11 @@ char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) {
pa_log("inet_ntop(): %s", pa_cstrerror(errno));
return NULL;
}
-
+
snprintf(c, l, "tcp:[%s]:%u", ip, (unsigned) ntohs(sa.sin_port));
}
-
+
return c;
}
@@ -498,7 +498,7 @@ char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) {
if (!s->filename)
return NULL;
-
+
if (!pa_get_host_name(hn, sizeof(hn)))
return NULL;
diff --git a/src/pulsecore/socket-server.h b/src/pulsecore/socket-server.h
index d90c8194e..489878cb9 100644
--- a/src/pulsecore/socket-server.h
+++ b/src/pulsecore/socket-server.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/socket-util.c b/src/pulsecore/socket-util.c
index 856c28e8a..e16f89795 100644
--- a/src/pulsecore/socket-util.c
+++ b/src/pulsecore/socket-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
@@ -78,7 +78,7 @@ void pa_socket_peer_to_string(int fd, char *c, size_t l) {
struct stat st;
assert(c && l && fd >= 0);
-
+
#ifndef OS_IS_WIN32
if (fstat(fd, &st) < 0) {
snprintf(c, l, "Invalid client fd");
@@ -88,7 +88,7 @@ void pa_socket_peer_to_string(int fd, char *c, size_t l) {
#ifndef OS_IS_WIN32
if (S_ISSOCK(st.st_mode)) {
-#endif
+#endif
union {
struct sockaddr sa;
struct sockaddr_in in;
@@ -98,12 +98,12 @@ void pa_socket_peer_to_string(int fd, char *c, size_t l) {
#endif
} sa;
socklen_t sa_len = sizeof(sa);
-
+
if (getpeername(fd, &sa.sa, &sa_len) >= 0) {
if (sa.sa.sa_family == AF_INET) {
uint32_t ip = ntohl(sa.in.sin_addr.s_addr);
-
+
snprintf(c, l, "TCP/IP client from %i.%i.%i.%i:%u",
ip >> 24,
(ip >> 16) & 0xFF,
@@ -159,7 +159,7 @@ int pa_socket_tcp_low_delay(int fd) {
assert(fd >= 0);
ret = pa_socket_low_delay(fd);
-
+
on = 1;
tos = 0;
@@ -239,13 +239,13 @@ finish:
int pa_unix_socket_remove_stale(const char *fn) {
int r;
-
+
if ((r = pa_unix_socket_is_stale(fn)) < 0)
return errno != ENOENT ? -1 : 0;
if (!r)
return 0;
-
+
/* Yes, here is a race condition. But who cares? */
if (unlink(fn) < 0)
return -1;
diff --git a/src/pulsecore/socket-util.h b/src/pulsecore/socket-util.h
index f8248ae72..59b4980db 100644
--- a/src/pulsecore/socket-util.h
+++ b/src/pulsecore/socket-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/pulsecore/sound-file-stream.c b/src/pulsecore/sound-file-stream.c
index e6f24a795..a277f1f0c 100644
--- a/src/pulsecore/sound-file-stream.c
+++ b/src/pulsecore/sound-file-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
@@ -52,7 +52,7 @@ static void free_userdata(struct userdata *u) {
pa_sink_input_disconnect(u->sink_input);
pa_sink_input_unref(u->sink_input);
}
-
+
if (u->memchunk.memblock)
pa_memblock_unref(u->memchunk.memblock);
if (u->sndfile)
@@ -86,10 +86,10 @@ static int sink_input_peek(pa_sink_input *i, pa_memchunk *chunk) {
} else {
if ((n = sf_read_raw(u->sndfile, u->memchunk.memblock->data, BUF_SIZE)) <= 0)
n = 0;
-
+
u->memchunk.length = n;
}
-
+
if (!u->memchunk.length) {
free_userdata(u);
return -1;
@@ -124,12 +124,12 @@ int pa_play_file(
pa_sink *sink,
const char *fname,
const pa_cvolume *volume) {
-
+
struct userdata *u = NULL;
SF_INFO sfinfo;
pa_sample_spec ss;
pa_sink_input_new_data data;
-
+
assert(sink);
assert(fname);
@@ -147,7 +147,7 @@ int pa_play_file(
}
u->readf_function = NULL;
-
+
switch (sfinfo.format & 0xFF) {
case SF_FORMAT_PCM_16:
case SF_FORMAT_PCM_U8:
@@ -159,7 +159,7 @@ int pa_play_file(
case SF_FORMAT_ULAW:
ss.format = PA_SAMPLE_ULAW;
break;
-
+
case SF_FORMAT_ALAW:
ss.format = PA_SAMPLE_ALAW;
break;
@@ -170,7 +170,7 @@ int pa_play_file(
u->readf_function = (sf_count_t (*)(SNDFILE *sndfile, void *ptr, sf_count_t frames)) sf_readf_float;
break;
}
-
+
ss.rate = sfinfo.samplerate;
ss.channels = sfinfo.channels;
@@ -185,7 +185,7 @@ int pa_play_file(
data.name = fname;
pa_sink_input_new_data_set_sample_spec(&data, &ss);
pa_sink_input_new_data_set_volume(&data, volume);
-
+
if (!(u->sink_input = pa_sink_input_new(sink->core, &data, 0)))
goto fail;
@@ -193,7 +193,7 @@ int pa_play_file(
u->sink_input->drop = sink_input_drop;
u->sink_input->kill = sink_input_kill;
u->sink_input->userdata = u;
-
+
pa_sink_notify(u->sink_input->sink);
return 0;
@@ -201,6 +201,6 @@ int pa_play_file(
fail:
if (u)
free_userdata(u);
-
+
return -1;
}
diff --git a/src/pulsecore/sound-file-stream.h b/src/pulsecore/sound-file-stream.h
index 28e6a8ba9..0798b4233 100644
--- a/src/pulsecore/sound-file-stream.h
+++ b/src/pulsecore/sound-file-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
diff --git a/src/pulsecore/sound-file.c b/src/pulsecore/sound-file.c
index 1bf650e22..284bbdda0 100644
--- a/src/pulsecore/sound-file.c
+++ b/src/pulsecore/sound-file.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 @@ int pa_sound_file_load(pa_mempool *pool, const char *fname, pa_sample_spec *ss,
case SF_FORMAT_ULAW:
ss->format = PA_SAMPLE_ULAW;
break;
-
+
case SF_FORMAT_ALAW:
ss->format = PA_SAMPLE_ALAW;
break;
@@ -86,7 +86,7 @@ int pa_sound_file_load(pa_mempool *pool, const char *fname, pa_sample_spec *ss,
if (map)
pa_channel_map_init_auto(map, ss->channels, PA_CHANNEL_MAP_DEFAULT);
-
+
if ((l = pa_frame_size(ss)*sfinfo.frames) > PA_SCACHE_ENTRY_SIZE_MAX) {
pa_log("File too large");
goto finish;
@@ -102,7 +102,7 @@ int pa_sound_file_load(pa_mempool *pool, const char *fname, pa_sample_spec *ss,
pa_log("Premature file end");
goto finish;
}
-
+
ret = 0;
finish:
@@ -112,9 +112,9 @@ finish:
if (ret != 0 && chunk->memblock)
pa_memblock_unref(chunk->memblock);
-
+
return ret;
-
+
}
int pa_sound_file_too_big_to_cache(const char *fname) {
@@ -139,7 +139,7 @@ int pa_sound_file_too_big_to_cache(const char *fname) {
case SF_FORMAT_ULAW:
ss.format = PA_SAMPLE_ULAW;
break;
-
+
case SF_FORMAT_ALAW:
ss.format = PA_SAMPLE_ALAW;
break;
diff --git a/src/pulsecore/sound-file.h b/src/pulsecore/sound-file.h
index 7e3c82eab..cf8168d00 100644
--- a/src/pulsecore/sound-file.h
+++ b/src/pulsecore/sound-file.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/source-output.c b/src/pulsecore/source-output.c
index 352fce142..5783b44a4 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.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
@@ -45,7 +45,7 @@ if (!(condition)) \
pa_source_output_new_data* pa_source_output_new_data_init(pa_source_output_new_data *data) {
assert(data);
-
+
memset(data, 0, sizeof(*data));
data->resample_method = PA_RESAMPLER_INVALID;
return data;
@@ -69,7 +69,7 @@ pa_source_output* pa_source_output_new(
pa_core *core,
pa_source_output_new_data *data,
pa_source_output_flags_t flags) {
-
+
pa_source_output *o;
pa_resampler *resampler = NULL;
int r;
@@ -90,15 +90,15 @@ pa_source_output* pa_source_output_new(
CHECK_VALIDITY_RETURN_NULL(data->source);
CHECK_VALIDITY_RETURN_NULL(data->source->state == PA_SOURCE_RUNNING);
-
+
if (!data->sample_spec_is_set)
data->sample_spec = data->source->sample_spec;
-
+
CHECK_VALIDITY_RETURN_NULL(pa_sample_spec_valid(&data->sample_spec));
if (!data->channel_map_is_set)
pa_channel_map_init_auto(&data->channel_map, data->sample_spec.channels, PA_CHANNEL_MAP_DEFAULT);
-
+
CHECK_VALIDITY_RETURN_NULL(pa_channel_map_valid(&data->channel_map));
CHECK_VALIDITY_RETURN_NULL(data->channel_map.channels == data->sample_spec.channels);
@@ -106,7 +106,7 @@ pa_source_output* pa_source_output_new(
data->resample_method = core->resample_method;
CHECK_VALIDITY_RETURN_NULL(data->resample_method < PA_RESAMPLER_MAX);
-
+
if (pa_idxset_size(data->source->outputs) >= PA_MAX_OUTPUTS_PER_SOURCE) {
pa_log("Failed to create source output: too many outputs per source.");
return NULL;
@@ -122,7 +122,7 @@ pa_source_output* pa_source_output_new(
pa_log_warn("Unsupported resampling operation.");
return NULL;
}
-
+
o = pa_xnew(pa_source_output, 1);
o->ref = 1;
o->state = PA_SOURCE_OUTPUT_RUNNING;
@@ -131,7 +131,7 @@ pa_source_output* pa_source_output_new(
o->module = data->module;
o->source = data->source;
o->client = data->client;
-
+
o->sample_spec = data->sample_spec;
o->channel_map = data->channel_map;
@@ -139,10 +139,10 @@ pa_source_output* pa_source_output_new(
o->kill = NULL;
o->get_latency = NULL;
o->userdata = NULL;
-
+
o->resampler = resampler;
o->resample_method = data->resample_method;
-
+
r = pa_idxset_put(core->source_outputs, o, &o->index);
assert(r == 0);
r = pa_idxset_put(o->source->outputs, o, NULL);
@@ -153,13 +153,13 @@ pa_source_output* pa_source_output_new(
o->name,
o->source->name,
pa_sample_spec_snprint(st, sizeof(st), &o->sample_spec));
-
+
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_NEW, o->index);
/* We do not call pa_source_notify() here, because the virtual
* functions have not yet been initialized */
-
- return o;
+
+ return o;
}
void pa_source_output_disconnect(pa_source_output*o) {
@@ -167,7 +167,7 @@ void pa_source_output_disconnect(pa_source_output*o) {
assert(o->state != PA_SOURCE_OUTPUT_DISCONNECTED);
assert(o->source);
assert(o->source->core);
-
+
pa_idxset_remove_by_data(o->source->core->source_outputs, o, NULL);
pa_idxset_remove_by_data(o->source->outputs, o, NULL);
@@ -177,7 +177,7 @@ void pa_source_output_disconnect(pa_source_output*o) {
o->push = NULL;
o->kill = NULL;
o->get_latency = NULL;
-
+
o->state = PA_SOURCE_OUTPUT_DISCONNECTED;
}
@@ -187,8 +187,8 @@ static void source_output_free(pa_source_output* o) {
if (o->state != PA_SOURCE_OUTPUT_DISCONNECTED)
pa_source_output_disconnect(o);
- pa_log_info("freed %u \"%s\"", o->index, o->name);
-
+ pa_log_info("freed %u \"%s\"", o->index, o->name);
+
if (o->resampler)
pa_resampler_free(o->resampler);
@@ -208,7 +208,7 @@ void pa_source_output_unref(pa_source_output* o) {
pa_source_output* pa_source_output_ref(pa_source_output *o) {
assert(o);
assert(o->ref >= 1);
-
+
o->ref++;
return o;
}
@@ -223,7 +223,7 @@ void pa_source_output_kill(pa_source_output*o) {
void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) {
pa_memchunk rchunk;
-
+
assert(o);
assert(chunk);
assert(chunk->length);
@@ -231,7 +231,7 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) {
if (o->state == PA_SOURCE_OUTPUT_CORKED)
return;
-
+
if (!o->resampler) {
o->push(o, chunk);
return;
@@ -240,7 +240,7 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) {
pa_resampler_run(o->resampler, chunk, &rchunk);
if (!rchunk.length)
return;
-
+
assert(rchunk.memblock);
o->push(o, &rchunk);
pa_memblock_unref(rchunk.memblock);
@@ -255,7 +255,7 @@ void pa_source_output_set_name(pa_source_output *o, const char *name) {
if (o->name && name && !strcmp(o->name, name))
return;
-
+
pa_xfree(o->name);
o->name = pa_xstrdup(name);
@@ -265,7 +265,7 @@ void pa_source_output_set_name(pa_source_output *o, const char *name) {
pa_usec_t pa_source_output_get_latency(pa_source_output *o) {
assert(o);
assert(o->ref >= 1);
-
+
if (o->get_latency)
return o->get_latency(o);
@@ -274,7 +274,7 @@ pa_usec_t pa_source_output_get_latency(pa_source_output *o) {
void pa_source_output_cork(pa_source_output *o, int b) {
int n;
-
+
assert(o);
assert(o->ref >= 1);
@@ -282,9 +282,9 @@ void pa_source_output_cork(pa_source_output *o, int b) {
return;
n = o->state == PA_SOURCE_OUTPUT_CORKED && !b;
-
+
o->state = b ? PA_SOURCE_OUTPUT_CORKED : PA_SOURCE_OUTPUT_RUNNING;
-
+
if (n)
pa_source_notify(o->source);
}
@@ -292,7 +292,7 @@ void pa_source_output_cork(pa_source_output *o, int b) {
pa_resample_method_t pa_source_output_get_resample_method(pa_source_output *o) {
assert(o);
assert(o->ref >= 1);
-
+
if (!o->resampler)
return o->resample_method;
@@ -323,12 +323,12 @@ int pa_source_output_move_to(pa_source_output *o, pa_source *dest) {
/* Try to reuse the old resampler if possible */
new_resampler = o->resampler;
-
+
else if (!pa_sample_spec_equal(&o->sample_spec, &dest->sample_spec) ||
!pa_channel_map_equal(&o->channel_map, &dest->channel_map)) {
/* Okey, we need a new resampler for the new sink */
-
+
if (!(new_resampler = pa_resampler_new(
dest->core->mempool,
&dest->sample_spec, &dest->channel_map,
diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h
index f7396a195..827b68eef 100644
--- a/src/pulsecore/source-output.h
+++ b/src/pulsecore/source-output.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
@@ -47,7 +47,7 @@ struct pa_source_output {
int ref;
uint32_t index;
pa_source_output_state_t state;
-
+
char *name, *driver; /* may be NULL */
pa_module *module; /* may be NULL */
@@ -56,14 +56,14 @@ struct pa_source_output {
pa_sample_spec sample_spec;
pa_channel_map channel_map;
-
+
void (*push)(pa_source_output *o, const pa_memchunk *chunk);
void (*kill)(pa_source_output* o); /* may be NULL */
pa_usec_t (*get_latency) (pa_source_output *o); /* may be NULL */
pa_resampler* resampler; /* may be NULL */
pa_resample_method_t resample_method;
-
+
void *userdata;
};
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index c48d6aaae..702dbeffb 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/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
@@ -52,12 +52,12 @@ pa_source* pa_source_new(
int fail,
const pa_sample_spec *spec,
const pa_channel_map *map) {
-
+
pa_source *s;
char st[256];
int r;
pa_channel_map tmap;
-
+
assert(core);
assert(name);
assert(spec);
@@ -86,7 +86,7 @@ pa_source* pa_source_new(
s->description = NULL;
s->driver = pa_xstrdup(driver);
s->owner = NULL;
-
+
s->sample_spec = *spec;
s->channel_map = *map;
@@ -112,16 +112,16 @@ pa_source* pa_source_new(
assert(s->index != PA_IDXSET_INVALID && r >= 0);
pa_sample_spec_snprint(st, sizeof(st), spec);
- pa_log_info("created %u \"%s\" with sample spec \"%s\"", s->index, s->name, st);
+ pa_log_info("created %u \"%s\" with sample spec \"%s\"", s->index, s->name, st);
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCRIPTION_EVENT_NEW, s->index);
-
+
return s;
}
void pa_source_disconnect(pa_source *s) {
pa_source_output *o, *j = NULL;
-
+
assert(s);
assert(s->state == PA_SOURCE_RUNNING);
@@ -129,7 +129,7 @@ void pa_source_disconnect(pa_source *s) {
pa_namereg_unregister(s->core, s->name);
pa_hook_fire(&s->core->hook_source_disconnect, s);
-
+
while ((o = pa_idxset_first(s->outputs, NULL))) {
assert(o != j);
pa_source_output_kill(o);
@@ -144,18 +144,18 @@ void pa_source_disconnect(pa_source *s) {
s->set_hw_volume = NULL;
s->set_hw_mute = NULL;
s->get_hw_mute = NULL;
-
+
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCRIPTION_EVENT_REMOVE, s->index);
}
static void source_free(pa_source *s) {
assert(s);
assert(!s->ref);
-
+
if (s->state != PA_SOURCE_DISCONNECTED)
pa_source_disconnect(s);
-
- pa_log_info("freed %u \"%s\"", s->index, s->name);
+
+ pa_log_info("freed %u \"%s\"", s->index, s->name);
pa_idxset_free(s->outputs, NULL, NULL);
@@ -176,7 +176,7 @@ void pa_source_unref(pa_source *s) {
pa_source* pa_source_ref(pa_source *s) {
assert(s);
assert(s->ref >= 1);
-
+
s->ref++;
return s;
}
@@ -192,7 +192,7 @@ void pa_source_notify(pa_source*s) {
static int do_post(void *p, PA_GCC_UNUSED uint32_t idx, PA_GCC_UNUSED int *del, void*userdata) {
pa_source_output *o = p;
const pa_memchunk *chunk = userdata;
-
+
assert(o);
assert(chunk);
@@ -209,7 +209,7 @@ void pa_source_post(pa_source*s, const pa_memchunk *chunk) {
if (s->sw_muted || !pa_cvolume_is_norm(&s->sw_volume)) {
pa_memchunk vchunk = *chunk;
-
+
pa_memblock_ref(vchunk.memblock);
pa_memchunk_make_writable(&vchunk, 0);
if (s->sw_muted)
@@ -230,7 +230,7 @@ void pa_source_set_owner(pa_source *s, pa_module *m) {
if (m == s->owner)
return;
-
+
s->owner = m;
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
}
@@ -247,19 +247,19 @@ pa_usec_t pa_source_get_latency(pa_source *s) {
void pa_source_set_volume(pa_source *s, pa_mixer_t m, const pa_cvolume *volume) {
pa_cvolume *v;
-
+
assert(s);
assert(s->ref >= 1);
assert(volume);
- if (m == PA_MIXER_HARDWARE && s->set_hw_volume)
+ if (m == PA_MIXER_HARDWARE && s->set_hw_volume)
v = &s->hw_volume;
else
v = &s->sw_volume;
if (pa_cvolume_equal(v, volume))
return;
-
+
*v = *volume;
if (v == &s->hw_volume)
@@ -277,7 +277,7 @@ const pa_cvolume *pa_source_get_volume(pa_source *s, pa_mixer_t m) {
if (s->get_hw_volume)
s->get_hw_volume(s);
-
+
return &s->hw_volume;
} else
return &s->sw_volume;
@@ -285,18 +285,18 @@ const pa_cvolume *pa_source_get_volume(pa_source *s, pa_mixer_t m) {
void pa_source_set_mute(pa_source *s, pa_mixer_t m, int mute) {
int *t;
-
+
assert(s);
assert(s->ref >= 1);
- if (m == PA_MIXER_HARDWARE && s->set_hw_mute)
+ if (m == PA_MIXER_HARDWARE && s->set_hw_mute)
t = &s->hw_muted;
else
t = &s->sw_muted;
if (!!*t == !!mute)
return;
-
+
*t = !!mute;
if (t == &s->hw_muted)
@@ -314,7 +314,7 @@ int pa_source_get_mute(pa_source *s, pa_mixer_t m) {
if (s->get_hw_mute)
s->get_hw_mute(s);
-
+
return s->hw_muted;
} else
return s->sw_muted;
@@ -329,7 +329,7 @@ void pa_source_set_description(pa_source *s, const char *description) {
if (description && s->description && !strcmp(description, s->description))
return;
-
+
pa_xfree(s->description);
s->description = pa_xstrdup(description);
diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h
index 4dbe4e01d..462bc6ff4 100644
--- a/src/pulsecore/source.h
+++ b/src/pulsecore/source.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
@@ -49,10 +49,10 @@ struct pa_source {
uint32_t index;
pa_core *core;
pa_source_state_t state;
-
+
char *name;
char *description, *driver; /* may be NULL */
-
+
pa_module *owner; /* may be NULL */
pa_sample_spec sample_spec;
@@ -65,14 +65,14 @@ struct pa_source {
int hw_muted, sw_muted;
int is_hardware;
-
+
void (*notify)(pa_source*source); /* may be NULL */
pa_usec_t (*get_latency)(pa_source *s); /* dito */
int (*set_hw_volume)(pa_source *s); /* dito */
- int (*get_hw_volume)(pa_source *s); /* dito */
+ int (*get_hw_volume)(pa_source *s); /* dito */
int (*set_hw_mute)(pa_source *s); /* dito */
int (*get_hw_mute)(pa_source *s); /* dito */
-
+
void *userdata;
};
diff --git a/src/pulsecore/strbuf.c b/src/pulsecore/strbuf.c
index ef8160dc5..59d572601 100644
--- a/src/pulsecore/strbuf.c
+++ b/src/pulsecore/strbuf.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
@@ -84,7 +84,7 @@ char *pa_strbuf_tostring(pa_strbuf *sb) {
*e = 0;
assert(e == t+sb->length);
-
+
return t;
}
@@ -124,10 +124,10 @@ static void append(pa_strbuf *sb, struct chunk *c) {
void pa_strbuf_putsn(pa_strbuf *sb, const char *t, size_t l) {
struct chunk *c;
assert(sb && t);
-
+
if (!l)
return;
-
+
c = pa_xmalloc(sizeof(struct chunk)+l);
c->length = l;
memcpy(CHUNK_TO_TEXT(c), t, l);
@@ -142,7 +142,7 @@ int pa_strbuf_printf(pa_strbuf *sb, const char *format, ...) {
struct chunk *c = NULL;
assert(sb);
-
+
for(;;) {
va_list ap;
int r;
@@ -152,7 +152,7 @@ int pa_strbuf_printf(pa_strbuf *sb, const char *format, ...) {
va_start(ap, format);
r = vsnprintf(CHUNK_TO_TEXT(c), size, format, ap);
va_end(ap);
-
+
if (r > -1 && r < size) {
c->length = r;
append(sb, c);
@@ -160,7 +160,7 @@ int pa_strbuf_printf(pa_strbuf *sb, const char *format, ...) {
}
if (r > -1) /* glibc 2.1 */
- size = r+1;
+ size = r+1;
else /* glibc 2.0 */
size *= 2;
}
diff --git a/src/pulsecore/strbuf.h b/src/pulsecore/strbuf.h
index c45fb15f6..04109197e 100644
--- a/src/pulsecore/strbuf.h
+++ b/src/pulsecore/strbuf.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/strlist.c b/src/pulsecore/strlist.c
index df3a02751..23547bbac 100644
--- a/src/pulsecore/strlist.c
+++ b/src/pulsecore/strlist.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_strlist* pa_strlist_remove(pa_strlist *l, const char *s) {
while (l) {
if (!strcmp(l->str, s)) {
pa_strlist *n = l->next;
-
+
if (!prev) {
assert(ret == l);
ret = n;
@@ -80,7 +80,7 @@ pa_strlist* pa_strlist_remove(pa_strlist *l, const char *s) {
pa_xfree(l);
l = n;
-
+
} else {
prev = l;
l = l->next;
@@ -103,12 +103,12 @@ void pa_strlist_free(pa_strlist *l) {
pa_strlist* pa_strlist_pop(pa_strlist *l, char **s) {
pa_strlist *r;
assert(s);
-
+
if (!l) {
*s = NULL;
return NULL;
}
-
+
*s = l->str;
r = l->next;
pa_xfree(l);
diff --git a/src/pulsecore/strlist.h b/src/pulsecore/strlist.h
index 87925d5ec..07d04677e 100644
--- a/src/pulsecore/strlist.h
+++ b/src/pulsecore/strlist.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/tagstruct.c b/src/pulsecore/tagstruct.c
index 11e85c19c..3a0915cf6 100644
--- a/src/pulsecore/tagstruct.c
+++ b/src/pulsecore/tagstruct.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
@@ -53,7 +53,7 @@ pa_tagstruct *pa_tagstruct_new(const uint8_t* data, size_t length) {
pa_tagstruct*t;
assert(!data || (data && length));
-
+
t = pa_xmalloc(sizeof(pa_tagstruct));
t->data = (uint8_t*) data;
t->allocated = t->length = data ? length : 0;
@@ -61,7 +61,7 @@ pa_tagstruct *pa_tagstruct_new(const uint8_t* data, size_t length) {
t->dynamic = !data;
return t;
}
-
+
void pa_tagstruct_free(pa_tagstruct*t) {
assert(t);
if (t->dynamic)
@@ -203,13 +203,13 @@ void pa_tagstruct_puts64(pa_tagstruct*t, int64_t u) {
void pa_tagstruct_put_channel_map(pa_tagstruct *t, const pa_channel_map *map) {
unsigned i;
-
+
assert(t);
extend(t, 2 + map->channels);
t->data[t->length++] = PA_TAG_CHANNEL_MAP;
t->data[t->length++] = map->channels;
-
+
for (i = 0; i < map->channels; i ++)
t->data[t->length++] = (uint8_t) map->map[i];
}
@@ -217,13 +217,13 @@ void pa_tagstruct_put_channel_map(pa_tagstruct *t, const pa_channel_map *map) {
void pa_tagstruct_put_cvolume(pa_tagstruct *t, const pa_cvolume *cvolume) {
unsigned i;
pa_volume_t vol;
-
+
assert(t);
extend(t, 2 + cvolume->channels * sizeof(pa_volume_t));
t->data[t->length++] = PA_TAG_CVOLUME;
t->data[t->length++] = cvolume->channels;
-
+
for (i = 0; i < cvolume->channels; i ++) {
vol = htonl(cvolume->values[i]);
memcpy(t->data + t->length, &vol, sizeof(pa_volume_t));
@@ -245,10 +245,10 @@ int pa_tagstruct_gets(pa_tagstruct*t, const char **s) {
*s = NULL;
return 0;
}
-
+
if (t->rindex+2 > t->length)
return -1;
-
+
if (t->data[t->rindex] != PA_TAG_STRING)
return -1;
@@ -305,7 +305,7 @@ int pa_tagstruct_get_sample_spec(pa_tagstruct *t, pa_sample_spec *ss) {
if (t->data[t->rindex] != PA_TAG_SAMPLE_SPEC)
return -1;
-
+
ss->format = t->data[t->rindex+1];
ss->channels = t->data[t->rindex+2];
memcpy(&ss->rate, t->data+t->rindex+3, 4);
@@ -318,7 +318,7 @@ int pa_tagstruct_get_sample_spec(pa_tagstruct *t, pa_sample_spec *ss) {
int pa_tagstruct_get_arbitrary(pa_tagstruct *t, const void **p, size_t length) {
uint32_t len;
assert(t && p);
-
+
if (t->rindex+5+length > t->length)
return -1;
@@ -357,7 +357,7 @@ int pa_tagstruct_get_boolean(pa_tagstruct*t, int *b) {
*b = 0;
else
return -1;
-
+
t->rindex +=1;
return 0;
}
@@ -434,7 +434,7 @@ int pa_tagstruct_gets64(pa_tagstruct*t, int64_t *u) {
int pa_tagstruct_get_channel_map(pa_tagstruct *t, pa_channel_map *map) {
unsigned i;
-
+
assert(t);
assert(map);
@@ -449,7 +449,7 @@ int pa_tagstruct_get_channel_map(pa_tagstruct *t, pa_channel_map *map) {
if (t->rindex+2+map->channels > t->length)
return -1;
-
+
for (i = 0; i < map->channels; i ++)
map->map[i] = (int8_t) t->data[t->rindex + 2 + i];
@@ -460,7 +460,7 @@ int pa_tagstruct_get_channel_map(pa_tagstruct *t, pa_channel_map *map) {
int pa_tagstruct_get_cvolume(pa_tagstruct *t, pa_cvolume *cvolume) {
unsigned i;
pa_volume_t vol;
-
+
assert(t);
assert(cvolume);
@@ -475,7 +475,7 @@ int pa_tagstruct_get_cvolume(pa_tagstruct *t, pa_cvolume *cvolume) {
if (t->rindex+2+cvolume->channels*sizeof(pa_volume_t) > t->length)
return -1;
-
+
for (i = 0; i < cvolume->channels; i ++) {
memcpy(&vol, t->data + t->rindex + 2 + i * sizeof(pa_volume_t), sizeof(pa_volume_t));
cvolume->values[i] = (pa_volume_t) ntohl(vol);
@@ -488,7 +488,7 @@ int pa_tagstruct_get_cvolume(pa_tagstruct *t, pa_cvolume *cvolume) {
void pa_tagstruct_put(pa_tagstruct *t, ...) {
va_list va;
assert(t);
-
+
va_start(va, t);
for (;;) {
@@ -551,16 +551,16 @@ void pa_tagstruct_put(pa_tagstruct *t, ...) {
abort();
}
}
-
+
va_end(va);
}
int pa_tagstruct_get(pa_tagstruct *t, ...) {
va_list va;
int ret = 0;
-
+
assert(t);
-
+
va_start(va, t);
while (ret == 0) {
int tag = va_arg(va, int);
@@ -618,11 +618,11 @@ int pa_tagstruct_get(pa_tagstruct *t, ...) {
ret = pa_tagstruct_get_cvolume(t, va_arg(va, pa_cvolume *));
break;
-
+
default:
abort();
}
-
+
}
va_end(va);
diff --git a/src/pulsecore/tagstruct.h b/src/pulsecore/tagstruct.h
index 4c56f3281..0177ff9d6 100644
--- a/src/pulsecore/tagstruct.h
+++ b/src/pulsecore/tagstruct.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/thread-posix.c b/src/pulsecore/thread-posix.c
index d69790a53..dcd45ea73 100644
--- a/src/pulsecore/thread-posix.c
+++ b/src/pulsecore/thread-posix.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,8 +58,8 @@ static void tls_free_cb(void *p) {
pa_thread *t = p;
assert(t);
-
- if (!t->thread_func)
+
+ if (!t->thread_func)
/* This is a foreign thread, we need to free the struct */
pa_xfree(t);
}
@@ -76,13 +76,13 @@ static void* internal_thread_func(void *userdata) {
t->id = pthread_self();
pa_once(&thread_tls_once, thread_tls_once_func);
-
+
pa_tls_set(thread_tls, t);
-
+
pa_atomic_inc(&t->running);
t->thread_func(t->userdata);
pa_atomic_add(&t->running, -2);
-
+
return NULL;
}
@@ -90,7 +90,7 @@ pa_thread* pa_thread_new(pa_thread_func_t thread_func, void *userdata) {
pa_thread *t;
assert(thread_func);
-
+
t = pa_xnew(pa_thread, 1);
t->thread_func = thread_func;
t->userdata = userdata;
@@ -116,7 +116,7 @@ int pa_thread_is_running(pa_thread *t) {
int policy;
struct sched_param param;
-
+
return pthread_getschedparam(t->id, &policy, &param) >= 0 || errno != ESRCH;
}
@@ -125,20 +125,20 @@ int pa_thread_is_running(pa_thread *t) {
void pa_thread_free(pa_thread *t) {
assert(t);
-
+
pa_thread_join(t);
pa_xfree(t);
}
int pa_thread_join(pa_thread *t) {
assert(t);
-
+
return pthread_join(t->id, NULL);
}
pa_thread* pa_thread_self(void) {
pa_thread *t;
-
+
pa_once(&thread_tls_once, thread_tls_once_func);
if ((t = pa_tls_get(thread_tls)))
@@ -146,7 +146,7 @@ pa_thread* pa_thread_self(void) {
/* This is a foreign thread, let's create a pthread structure to
* make sure that we can always return a sensible pointer */
-
+
t = pa_xnew(pa_thread, 1);
t->id = pthread_self();
t->thread_func = NULL;
@@ -154,7 +154,7 @@ pa_thread* pa_thread_self(void) {
pa_atomic_store(&t->running, 2);
pa_tls_set(thread_tls, t);
-
+
return t;
}
@@ -187,7 +187,7 @@ pa_tls* pa_tls_new(pa_free_cb_t free_cb) {
pa_xfree(t);
return NULL;
}
-
+
return t;
}
@@ -200,13 +200,13 @@ void pa_tls_free(pa_tls *t) {
void *pa_tls_get(pa_tls *t) {
assert(t);
-
+
return pthread_getspecific(t->key);
}
void *pa_tls_set(pa_tls *t, void *userdata) {
void *r;
-
+
r = pthread_getspecific(t->key);
ASSERT_SUCCESS(pthread_setspecific(t->key, userdata));
return r;
diff --git a/src/pulsecore/thread-win32.c b/src/pulsecore/thread-win32.c
index 98ea06912..38dd4dd65 100644
--- a/src/pulsecore/thread-win32.c
+++ b/src/pulsecore/thread-win32.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/thread.h b/src/pulsecore/thread.h
index d08990a20..b383bb49b 100644
--- a/src/pulsecore/thread.h
+++ b/src/pulsecore/thread.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/tokenizer.c b/src/pulsecore/tokenizer.c
index e799c1e64..0bc1c0954 100644
--- a/src/pulsecore/tokenizer.c
+++ b/src/pulsecore/tokenizer.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 @@ static void parse(pa_dynarray*a, const char *s, unsigned args) {
pa_tokenizer* pa_tokenizer_new(const char *s, unsigned args) {
pa_tokenizer *t;
-
+
t = pa_xmalloc(sizeof(pa_tokenizer));
t->dynarray = pa_dynarray_new();
assert(t->dynarray);
diff --git a/src/pulsecore/tokenizer.h b/src/pulsecore/tokenizer.h
index b9a5c55b9..82cd6db18 100644
--- a/src/pulsecore/tokenizer.h
+++ b/src/pulsecore/tokenizer.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/x11prop.c b/src/pulsecore/x11prop.c
index dd4ff99eb..03d7990e4 100644
--- a/src/pulsecore/x11prop.c
+++ b/src/pulsecore/x11prop.c
@@ -48,7 +48,7 @@ char* pa_x11_get_prop(Display *d, const char *name, char *p, size_t l) {
unsigned long nbytes_after;
unsigned char *prop = NULL;
char *ret = NULL;
-
+
Atom a = XInternAtom(d, name, False);
if (XGetWindowProperty(d, RootWindow(d, 0), a, 0, (l+2)/4, False, XA_STRING, &actual_type, &actual_format, &nitems, &nbytes_after, &prop) != Success)
goto finish;
@@ -65,6 +65,6 @@ finish:
if (prop)
XFree(prop);
-
+
return ret;
}
diff --git a/src/pulsecore/x11wrap.c b/src/pulsecore/x11wrap.c
index cc993e78d..e4b048baa 100644
--- a/src/pulsecore/x11wrap.c
+++ b/src/pulsecore/x11wrap.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
@@ -42,7 +42,7 @@ struct pa_x11_internal {
struct pa_x11_wrapper {
pa_core *core;
int ref;
-
+
char *property_name;
Display *display;
@@ -63,7 +63,7 @@ struct pa_x11_client {
/* Dispatch all pending X11 events */
static void work(pa_x11_wrapper *w) {
assert(w && w->ref >= 1);
-
+
while (XPending(w->display)) {
pa_x11_client *c;
XEvent e;
@@ -90,7 +90,7 @@ static void defer_event(pa_mainloop_api *m, pa_defer_event *e, void *userdata) {
assert(m && e && w && w->ref >= 1);
m->defer_enable(e, 0);
-
+
work(w);
}
@@ -154,7 +154,7 @@ static pa_x11_wrapper* x11_wrapper_new(pa_core *c, const char *name, const char
w->ref = 1;
w->property_name = pa_xstrdup(t);
w->display = d;
-
+
PA_LLIST_HEAD_INIT(pa_x11_client, w->clients);
PA_LLIST_HEAD_INIT(pa_x11_internal, w->internals);
@@ -162,10 +162,10 @@ static pa_x11_wrapper* x11_wrapper_new(pa_core *c, const char *name, const char
w->io_event = c->mainloop->io_new(c->mainloop, ConnectionNumber(d), PA_IO_EVENT_INPUT, display_io_event, w);
XAddConnectionWatch(d, x11_watch, (XPointer) w);
-
+
r = pa_property_set(c, w->property_name, w);
assert(r >= 0);
-
+
return w;
}
@@ -180,13 +180,13 @@ static void x11_wrapper_free(pa_x11_wrapper*w) {
XRemoveConnectionWatch(w->display, x11_watch, (XPointer) w);
XCloseDisplay(w->display);
-
+
w->core->mainloop->io_free(w->io_event);
w->core->mainloop->defer_free(w->defer_event);
while (w->internals)
x11_internal_remove(w, w->internals);
-
+
pa_xfree(w->property_name);
pa_xfree(w);
}
@@ -195,7 +195,7 @@ pa_x11_wrapper* pa_x11_wrapper_get(pa_core *c, const char *name) {
char t[256];
pa_x11_wrapper *w;
assert(c);
-
+
snprintf(t, sizeof(t), "x11-wrapper%s%s", name ? "-" : "", name ? name : "");
if ((w = pa_property_get(c, t)))
return pa_x11_wrapper_ref(w);
@@ -221,7 +221,7 @@ Display *pa_x11_wrapper_get_display(pa_x11_wrapper *w) {
/* Somebody is using us, schedule a output buffer flush */
w->core->mainloop->defer_enable(w->defer_event, 1);
-
+
return w->display;
}
diff --git a/src/pulsecore/x11wrap.h b/src/pulsecore/x11wrap.h
index fcdd9f6c8..b2e8e5349 100644
--- a/src/pulsecore/x11wrap.h
+++ b/src/pulsecore/x11wrap.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/tests/channelmap-test.c b/src/tests/channelmap-test.c
index 124ce5768..98f36b617 100644
--- a/src/tests/channelmap-test.c
+++ b/src/tests/channelmap-test.c
@@ -11,23 +11,23 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
pa_channel_map map, map2;
pa_channel_map_init_auto(&map, 6, PA_CHANNEL_MAP_AIFF);
-
+
fprintf(stderr, "map: <%s>\n", pa_channel_map_snprint(cm, sizeof(cm), &map));
pa_channel_map_init_auto(&map, 6, PA_CHANNEL_MAP_AUX);
-
+
fprintf(stderr, "map: <%s>\n", pa_channel_map_snprint(cm, sizeof(cm), &map));
pa_channel_map_init_auto(&map, 6, PA_CHANNEL_MAP_ALSA);
-
+
fprintf(stderr, "map: <%s>\n", pa_channel_map_snprint(cm, sizeof(cm), &map));
-
+
pa_channel_map_parse(&map2, cm);
assert(pa_channel_map_equal(&map, &map2));
pa_channel_map_parse(&map2, "left,test");
-
+
return 0;
}
diff --git a/src/tests/cpulimit-test.c b/src/tests/cpulimit-test.c
index 2302a26d5..d582e9c58 100644
--- a/src/tests/cpulimit-test.c
+++ b/src/tests/cpulimit-test.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 @@ static time_t start;
static void func(pa_mainloop_api *m, PA_GCC_UNUSED pa_signal_event *e, PA_GCC_UNUSED int sig, PA_GCC_UNUSED void *userdata) {
time_t now;
time(&now);
-
+
if ((now - start) >= 30) {
m->quit(m, 1);
fprintf(stderr, "Test failed\n");
@@ -59,7 +59,7 @@ static void func(pa_mainloop_api *m, PA_GCC_UNUSED pa_signal_event *e, PA_GCC_UN
int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
pa_mainloop *m;
-
+
m = pa_mainloop_new();
assert(m);
@@ -77,7 +77,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
for (;;) {
time_t now;
time(&now);
-
+
if ((now - start) >= 30) {
fprintf(stderr, "Test failed\n");
break;
@@ -86,7 +86,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
#endif
pa_cpu_limit_done();
-
+
pa_mainloop_free(m);
return 0;
diff --git a/src/tests/flist-test.c b/src/tests/flist-test.c
index abc0659d9..17ba55c17 100644
--- a/src/tests/flist-test.c
+++ b/src/tests/flist-test.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
@@ -41,7 +41,7 @@ static int quit = 0;
static void spin(void) {
int k;
-
+
/* Spin a little */
k = rand() % 10000;
for (; k > 0; k--)
@@ -100,6 +100,6 @@ int main(int argc, char* argv[]) {
pa_thread_free(threads[i]);
pa_flist_free(flist, pa_xfree);
-
+
return 0;
}
diff --git a/src/tests/get-binary-name-test.c b/src/tests/get-binary-name-test.c
index 0cea2b6d4..29ebbe223 100644
--- a/src/tests/get-binary-name-test.c
+++ b/src/tests/get-binary-name-test.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/tests/hook-list-test.c b/src/tests/hook-list-test.c
index d68d1b7d1..6879eae53 100644
--- a/src/tests/hook-list-test.c
+++ b/src/tests/hook-list-test.c
@@ -22,7 +22,7 @@ int main(int argc, char *argv[]) {
pa_hook_connect(&hook, (pa_hook_cb_t) func1, (void*) "slot1");
slot = pa_hook_connect(&hook, (pa_hook_cb_t) func2, (void*) "slot2");
pa_hook_connect(&hook, (pa_hook_cb_t) func1, (void*) "slot3");
-
+
pa_hook_fire(&hook, (void*) "call1");
pa_hook_slot_free(slot);
@@ -30,6 +30,6 @@ int main(int argc, char *argv[]) {
pa_hook_fire(&hook, (void*) "call2");
pa_hook_free(&hook);
-
+
return 0;
}
diff --git a/src/tests/interpol-test.c b/src/tests/interpol-test.c
index 54bdd7750..3953043fb 100644
--- a/src/tests/interpol-test.c
+++ b/src/tests/interpol-test.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,7 +57,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
case PA_CONTEXT_AUTHORIZING:
case PA_CONTEXT_SETTING_NAME:
break;
-
+
case PA_CONTEXT_READY: {
static const pa_sample_spec ss = {
@@ -65,18 +65,18 @@ static void context_state_callback(pa_context *c, void *userdata) {
.rate = 44100,
.channels = 1
};
-
+
fprintf(stderr, "Connection established.\n");
stream = pa_stream_new(c, "interpol-test", &ss, NULL);
assert(stream);
-
+
pa_stream_connect_playback(stream, NULL, NULL, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE, NULL, NULL);
pa_stream_set_write_callback(stream, stream_write_cb, NULL);
-
+
break;
}
-
+
case PA_CONTEXT_TERMINATED:
break;
@@ -108,19 +108,19 @@ int main(int argc, char *argv[]) {
assert(r >= 0);
pa_gettimeofday(&start);
-
+
pa_threaded_mainloop_start(m);
for (k = 0; k < 5000; k++) {
int success = 0, changed = 0;
pa_usec_t t, rtc;
struct timeval now, tv;
-
+
pa_threaded_mainloop_lock(m);
if (stream) {
const pa_timing_info *info;
-
+
if (pa_stream_get_time(stream, &t) >= 0)
success = 1;
@@ -130,9 +130,9 @@ int main(int argc, char *argv[]) {
last_info = info->timestamp;
}
}
-
+
pa_threaded_mainloop_unlock(m);
-
+
if (success) {
pa_gettimeofday(&now);
@@ -156,7 +156,7 @@ int main(int argc, char *argv[]) {
pa_stream_disconnect(stream);
pa_stream_unref(stream);
}
-
+
if (context) {
pa_context_disconnect(context);
pa_context_unref(context);
@@ -164,6 +164,6 @@ int main(int argc, char *argv[]) {
if (m)
pa_threaded_mainloop_free(m);
-
+
return 0;
}
diff --git a/src/tests/ipacl-test.c b/src/tests/ipacl-test.c
index 2566b038e..d1bcb3e3c 100644
--- a/src/tests/ipacl-test.c
+++ b/src/tests/ipacl-test.c
@@ -37,13 +37,13 @@ int main(int argc, char *argv[]) {
int r;
pa_ip_acl *acl;
- fd = socket(PF_INET, SOCK_STREAM, 0);
+ fd = socket(PF_INET, SOCK_STREAM, 0);
assert(fd >= 0);
-
+
sa.sin_family = AF_INET;
sa.sin_port = htons(22);
sa.sin_addr.s_addr = inet_addr("127.0.0.1");
-
+
r = connect(fd, (struct sockaddr*) &sa, sizeof(sa));
assert(r >= 0);
@@ -66,7 +66,7 @@ int main(int argc, char *argv[]) {
assert(acl);
printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
pa_ip_acl_free(acl);
-
+
acl = pa_ip_acl_new("127.0.0.2");
assert(acl);
printf("result=%u (should be 0)\n", pa_ip_acl_check(acl, fd));
@@ -86,7 +86,7 @@ int main(int argc, char *argv[]) {
assert(acl);
printf("result=%u (should be 0)\n", pa_ip_acl_check(acl, fd));
pa_ip_acl_free(acl);
-
+
close(fd);
fd = socket(PF_INET6, SOCK_STREAM, 0);
@@ -96,7 +96,7 @@ int main(int argc, char *argv[]) {
sa6.sin6_family = AF_INET6;
sa6.sin6_port = htons(22);
inet_pton(AF_INET6, "::1", &sa6.sin6_addr);
-
+
r = connect(fd, (struct sockaddr*) &sa6, sizeof(sa6));
assert(r >= 0);
@@ -131,6 +131,6 @@ int main(int argc, char *argv[]) {
pa_ip_acl_free(acl);
close(fd);
-
+
return 0;
}
diff --git a/src/tests/mainloop-test.c b/src/tests/mainloop-test.c
index b06d0ed1d..c386251c9 100644
--- a/src/tests/mainloop-test.c
+++ b/src/tests/mainloop-test.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
@@ -121,6 +121,6 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
#else
pa_mainloop_free(m);
#endif
-
+
return 0;
}
diff --git a/src/tests/mcalign-test.c b/src/tests/mcalign-test.c
index 356916984..db76712b4 100644
--- a/src/tests/mcalign-test.c
+++ b/src/tests/mcalign-test.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
@@ -45,7 +45,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
p = pa_mempool_new(0);
a = pa_mcalign_new(11);
-
+
pa_memchunk_reset(&c);
srand(time(NULL));
@@ -64,7 +64,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
l = c.memblock->length - c.index;
l = l <= 1 ? l : rand() % (l-1) +1 ;
-
+
if ((r = read(STDIN_FILENO, (uint8_t*) c.memblock->data + c.index, l)) <= 0) {
fprintf(stderr, "read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
break;
diff --git a/src/tests/memblock-test.c b/src/tests/memblock-test.c
index ef2e0ad71..13bfdf0d4 100644
--- a/src/tests/memblock-test.c
+++ b/src/tests/memblock-test.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
@@ -78,7 +78,7 @@ int main(int argc, char *argv[]) {
size_t offset, size;
const char txt[] = "This is a test!";
-
+
pool_a = pa_mempool_new(1);
pool_b = pa_mempool_new(1);
pool_c = pa_mempool_new(1);
@@ -86,9 +86,9 @@ int main(int argc, char *argv[]) {
pa_mempool_get_shm_id(pool_a, &id_a);
pa_mempool_get_shm_id(pool_b, &id_b);
pa_mempool_get_shm_id(pool_c, &id_c);
-
+
assert(pool_a && pool_b && pool_c);
-
+
blocks[0] = pa_memblock_new_fixed(pool_a, (void*) txt, sizeof(txt), 1);
blocks[1] = pa_memblock_new(pool_a, sizeof(txt));
snprintf(blocks[1]->data, blocks[1]->length, "%s", txt);
@@ -102,23 +102,23 @@ int main(int argc, char *argv[]) {
mb_a = blocks[i];
assert(mb_a);
-
+
export_a = pa_memexport_new(pool_a, revoke_cb, (void*) "A");
export_b = pa_memexport_new(pool_b, revoke_cb, (void*) "B");
-
+
assert(export_a && export_b);
-
+
import_b = pa_memimport_new(pool_b, release_cb, (void*) "B");
import_c = pa_memimport_new(pool_c, release_cb, (void*) "C");
-
+
assert(import_b && import_c);
-
+
r = pa_memexport_put(export_a, mb_a, &id, &shm_id, &offset, &size);
assert(r >= 0);
assert(shm_id == id_a);
printf("A: Memory block exported as %u\n", id);
-
+
mb_b = pa_memimport_get(import_b, id, shm_id, offset, size);
assert(mb_b);
r = pa_memexport_put(export_b, mb_b, &id, &shm_id, &offset, &size);
@@ -127,7 +127,7 @@ int main(int argc, char *argv[]) {
pa_memblock_unref(mb_b);
printf("B: Memory block exported as %u\n", id);
-
+
mb_c = pa_memimport_get(import_c, id, shm_id, offset, size);
assert(mb_c);
printf("1 data=%s\n", (char*) mb_c->data);
@@ -135,21 +135,21 @@ int main(int argc, char *argv[]) {
print_stats(pool_a, "A");
print_stats(pool_b, "B");
print_stats(pool_c, "C");
-
+
pa_memexport_free(export_b);
printf("2 data=%s\n", (char*) mb_c->data);
pa_memblock_unref(mb_c);
-
+
pa_memimport_free(import_b);
-
+
pa_memblock_unref(mb_a);
-
+
pa_memimport_free(import_c);
pa_memexport_free(export_a);
}
printf("vaccuuming...\n");
-
+
pa_mempool_vacuum(pool_a);
pa_mempool_vacuum(pool_b);
pa_mempool_vacuum(pool_c);
diff --git a/src/tests/memblockq-test.c b/src/tests/memblockq-test.c
index 1ac4577b5..1c0b7fed3 100644
--- a/src/tests/memblockq-test.c
+++ b/src/tests/memblockq-test.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
@@ -41,7 +41,7 @@ int main(int argc, char *argv[]) {
pa_log_set_maximal_level(PA_LOG_DEBUG);
p = pa_mempool_new(0);
-
+
silence = pa_memblock_new_fixed(p, (char*) "__", 2, 1);
assert(silence);
@@ -52,7 +52,7 @@ int main(int argc, char *argv[]) {
chunk1.index = 0;
chunk1.length = 2;
assert(chunk1.memblock);
-
+
chunk2.memblock = pa_memblock_new_fixed(p, (char*) "TTBB", 4, 1);
chunk2.index = 2;
chunk2.length = 2;
@@ -70,13 +70,13 @@ int main(int argc, char *argv[]) {
ret = pa_memblockq_push(bq, &chunk1);
assert(ret == 0);
-
+
ret = pa_memblockq_push(bq, &chunk1);
assert(ret == 0);
-
+
ret = pa_memblockq_push(bq, &chunk2);
assert(ret == 0);
-
+
ret = pa_memblockq_push(bq, &chunk2);
assert(ret == 0);
@@ -115,19 +115,19 @@ int main(int argc, char *argv[]) {
chunk3.index += 2;
chunk3.length -= 2;
-
+
ret = pa_memblockq_push(bq, &chunk3);
assert(ret == 0);
-
+
printf(">");
pa_memblockq_shorten(bq, 6);
-
+
for (;;) {
pa_memchunk out;
char *e;
size_t n;
-
+
if (pa_memblockq_peek(bq, &out) < 0)
break;
@@ -137,15 +137,15 @@ int main(int argc, char *argv[]) {
pa_memblock_unref(out.memblock);
pa_memblockq_drop(bq, &out, out.length);
}
-
+
printf("<\n");
-
+
pa_memblockq_free(bq);
pa_memblock_unref(silence);
pa_memblock_unref(chunk1.memblock);
pa_memblock_unref(chunk2.memblock);
pa_memblock_unref(chunk3.memblock);
pa_memblock_unref(chunk4.memblock);
-
+
return 0;
}
diff --git a/src/tests/pacat-simple.c b/src/tests/pacat-simple.c
index 364e1ad61..2da67c1a5 100644
--- a/src/tests/pacat-simple.c
+++ b/src/tests/pacat-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
@@ -43,7 +43,7 @@ int main(PA_GCC_UNUSED int argc, char*argv[]) {
.rate = 44100,
.channels = 2
};
-
+
pa_simple *s = NULL;
int ret = 1;
int error;
@@ -61,10 +61,10 @@ int main(PA_GCC_UNUSED int argc, char*argv[]) {
fprintf(stderr, __FILE__": dup2() failed: %s\n", strerror(errno));
goto finish;
}
-
+
close(fd);
}
-
+
/* Create a new playback stream */
if (!(s = pa_simple_new(NULL, argv[0], PA_STREAM_PLAYBACK, NULL, "playback", &ss, NULL, NULL, &error))) {
fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error));
@@ -90,7 +90,7 @@ int main(PA_GCC_UNUSED int argc, char*argv[]) {
if ((r = read(STDIN_FILENO, buf, sizeof(buf))) <= 0) {
if (r == 0) /* EOF */
break;
-
+
fprintf(stderr, __FILE__": read() failed: %s\n", strerror(errno));
goto finish;
}
@@ -114,6 +114,6 @@ finish:
if (s)
pa_simple_free(s);
-
+
return ret;
}
diff --git a/src/tests/parec-simple.c b/src/tests/parec-simple.c
index 45a522888..d7d883607 100644
--- a/src/tests/parec-simple.c
+++ b/src/tests/parec-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
@@ -46,7 +46,7 @@ static ssize_t loop_write(int fd, const void*data, size_t size) {
if (r == 0)
break;
-
+
ret += r;
data = (const uint8_t*) data + r;
size -= r;
@@ -95,6 +95,6 @@ finish:
if (s)
pa_simple_free(s);
-
+
return ret;
}
diff --git a/src/tests/strlist-test.c b/src/tests/strlist-test.c
index 4262a0015..47770b5d9 100644
--- a/src/tests/strlist-test.c
+++ b/src/tests/strlist-test.c
@@ -16,7 +16,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char* argv[]) {
t = pa_strlist_tostring(l);
pa_strlist_free(l);
-
+
fprintf(stderr, "1: %s\n", t);
l = pa_strlist_parse(t);
@@ -29,9 +29,9 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char* argv[]) {
l = pa_strlist_pop(l, &u);
fprintf(stderr, "3: %s\n", u);
pa_xfree(u);
-
+
l = pa_strlist_remove(l, "c");
-
+
t = pa_strlist_tostring(l);
fprintf(stderr, "4: %s\n", t);
pa_xfree(t);
diff --git a/src/tests/sync-playback.c b/src/tests/sync-playback.c
index 39c6aac46..63510eb6b 100644
--- a/src/tests/sync-playback.c
+++ b/src/tests/sync-playback.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
@@ -67,7 +67,7 @@ static void underflow_cb(struct pa_stream *s, void *userdata) {
int i = (int) (long) userdata;
fprintf(stderr, "Stream %i finished\n", i);
-
+
if (++n_streams_ready >= 2*NSTREAMS) {
fprintf(stderr, "We're done\n");
mainloop_api->quit(mainloop_api, 0);
@@ -89,19 +89,19 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
int r, i = (int) (long) userdata;
fprintf(stderr, "Writing data to stream %i.\n", i);
-
+
r = pa_stream_write(s, data, sizeof(data), nop_free_cb, sizeof(data) * i, PA_SEEK_ABSOLUTE);
assert(r == 0);
/* Be notified when this stream is drained */
pa_stream_set_underflow_callback(s, underflow_cb, userdata);
-
+
/* All streams have been set up, let's go! */
if (++n_streams_ready >= NSTREAMS) {
fprintf(stderr, "Uncorking\n");
pa_operation_unref(pa_stream_cork(s, 0, NULL, NULL));
}
-
+
break;
}
@@ -121,7 +121,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
case PA_CONTEXT_AUTHORIZING:
case PA_CONTEXT_SETTING_NAME:
break;
-
+
case PA_CONTEXT_READY: {
int i;
@@ -131,18 +131,18 @@ static void context_state_callback(pa_context *c, void *userdata) {
char name[64];
fprintf(stderr, "Creating stream %i\n", i);
-
+
snprintf(name, sizeof(name), "stream #%i", i);
-
+
streams[i] = pa_stream_new(c, name, &sample_spec, NULL);
assert(streams[i]);
pa_stream_set_state_callback(streams[i], stream_state_callback, (void*) (long) i);
pa_stream_connect_playback(streams[i], NULL, &buffer_attr, PA_STREAM_START_CORKED, NULL, i == 0 ? NULL : streams[0]);
}
-
+
break;
}
-
+
case PA_CONTEXT_TERMINATED:
mainloop_api->quit(mainloop_api, 0);
break;
@@ -163,7 +163,7 @@ int main(int argc, char *argv[]) {
for (i = 0; i < NSTREAMS; i++)
streams[i] = NULL;
-
+
/* Set up a new main loop */
m = pa_mainloop_new();
assert(m);
@@ -187,6 +187,6 @@ int main(int argc, char *argv[]) {
pa_stream_unref(streams[i]);
pa_mainloop_free(m);
-
+
return ret;
}
diff --git a/src/tests/thread-mainloop-test.c b/src/tests/thread-mainloop-test.c
index bf3d4cd2c..9d0e5de16 100644
--- a/src/tests/thread-mainloop-test.c
+++ b/src/tests/thread-mainloop-test.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
@@ -53,19 +53,19 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
pa_threaded_mainloop_start(m);
pa_threaded_mainloop_lock(m);
-
+
pa_gettimeofday(&tv);
tv.tv_sec += 5;
a->time_new(a, &tv, tcb, m);
-
+
fprintf(stderr, "waiting 5s (signal)\n");
pa_threaded_mainloop_wait(m);
fprintf(stderr, "wait completed\n");
pa_threaded_mainloop_accept(m);
fprintf(stderr, "signal accepted\n");
-
+
pa_threaded_mainloop_unlock(m);
-
+
fprintf(stderr, "waiting 5s (sleep)\n");
pa_msleep(5000);
diff --git a/src/tests/thread-test.c b/src/tests/thread-test.c
index 9559cdbbb..2153c9854 100644
--- a/src/tests/thread-test.c
+++ b/src/tests/thread-test.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 void thread_func(void *data) {
pa_tls_set(tls, data);
pa_log("thread_func() for %s starting...", (char*) pa_tls_get(tls));
-
+
pa_mutex_lock(mutex);
for (;;) {
@@ -57,13 +57,13 @@ static void thread_func(void *data) {
pa_log("%s waiting ...", (char*) pa_tls_get(tls));
for (;;) {
-
+
if (magic_number < 0)
goto quit;
if (magic_number != 0)
break;
-
+
pa_cond_wait(cond1, mutex);
}
@@ -75,18 +75,18 @@ static void thread_func(void *data) {
pa_once(&once, once_func);
pa_cond_signal(cond2, 0);
-
+
pa_log("%s got number %i", (char*) pa_tls_get(tls), k);
-
+
/* Spin! */
for (n = 0; n < k; n++)
pa_thread_yield();
-
+
pa_mutex_lock(mutex);
}
quit:
-
+
pa_mutex_unlock(mutex);
pa_log("thread_func() for %s done...", (char*) pa_tls_get(tls));
@@ -97,25 +97,25 @@ int main(int argc, char *argv[]) {
pa_thread* t[THREADS_MAX];
assert(pa_thread_is_running(pa_thread_self()));
-
+
mutex = pa_mutex_new(0);
cond1 = pa_cond_new();
cond2 = pa_cond_new();
tls = pa_tls_new(pa_xfree);
-
+
for (i = 0; i < THREADS_MAX; i++) {
t[i] = pa_thread_new(thread_func, pa_sprintf_malloc("Thread #%i", i+1));
assert(t[i]);
}
pa_mutex_lock(mutex);
-
+
pa_log("loop-init");
for (k = 0; k < 100; k++) {
assert(magic_number == 0);
-
+
magic_number = (int) rand() % 0x10000;
pa_log("iteration %i (%i)", k, magic_number);
@@ -126,10 +126,10 @@ int main(int argc, char *argv[]) {
}
pa_log("loop-exit");
-
+
magic_number = -1;
pa_cond_signal(cond1, 1);
-
+
pa_mutex_unlock(mutex);
for (i = 0; i < THREADS_MAX; i++)
diff --git a/src/tests/utf8-test.c b/src/tests/utf8-test.c
index 2e9f128a7..b9594dcc8 100644
--- a/src/tests/utf8-test.c
+++ b/src/tests/utf8-test.c
@@ -8,13 +8,13 @@
int main(int argc, char *argv[]) {
char *c;
-
+
assert(pa_utf8_valid("hallo"));
assert(pa_utf8_valid("hallo\n"));
assert(!pa_utf8_valid("hüpfburg\n"));
assert(pa_utf8_valid("hallo\n"));
assert(pa_utf8_valid("hüpfburg\n"));
-
+
printf("LATIN1: %s\n", c = pa_utf8_filter("hüpfburg"));
pa_xfree(c);
printf("UTF8: %sx\n", c = pa_utf8_filter("hüpfburg"));
diff --git a/src/tests/voltest.c b/src/tests/voltest.c
index 3de884aff..dcc1ec51b 100644
--- a/src/tests/voltest.c
+++ b/src/tests/voltest.c
@@ -12,7 +12,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
double dB = pa_sw_volume_to_dB(v);
double f = pa_sw_volume_to_linear(v);
-
+
printf("Volume: %3i; percent: %i%%; decibel %0.2f; linear = %0.2f; volume(decibel): %3i; volume(linear): %3i\n",
v, (v*100)/PA_VOLUME_NORM, dB, f, pa_sw_volume_from_dB(dB), pa_sw_volume_from_linear(f));
diff --git a/src/utils/pabrowse.c b/src/utils/pabrowse.c
index 450182f5f..f756ac011 100644
--- a/src/utils/pabrowse.c
+++ b/src/utils/pabrowse.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
@@ -40,7 +40,7 @@ static void dump_server(const pa_browse_info *i) {
if (i->cookie)
snprintf(t, sizeof(t), "0x%08x", *i->cookie);
-
+
printf("server: %s\n"
"server-version: %s\n"
"user-name: %s\n"
@@ -65,7 +65,7 @@ static void dump_device(const pa_browse_info *i) {
i->device,
i->description ? i->description : "n/a",
i->sample_spec ? ss : "n/a");
-
+
}
static void browser_callback(pa_browser *b, pa_browse_opcode_t c, const pa_browse_info *i, void *userdata) {
@@ -89,7 +89,7 @@ static void browser_callback(pa_browser *b, pa_browse_opcode_t c, const pa_brows
dump_server(i);
dump_device(i);
break;
-
+
case PA_BROWSE_REMOVE_SERVER:
printf("\n=> removed server <%s>\n", i->name);
break;
@@ -109,7 +109,7 @@ static void browser_callback(pa_browser *b, pa_browse_opcode_t c, const pa_brows
static void error_callback(pa_browser *b, const char *s, void *userdata) {
pa_mainloop_api*m = userdata;
-
+
fprintf(stderr, "Failure: %s\n", s);
m->quit(m, 1);
}
@@ -128,7 +128,7 @@ int main(int argc, char *argv[]) {
pa_signal_new(SIGINT, exit_signal_callback, NULL);
pa_signal_new(SIGTERM, exit_signal_callback, NULL);
signal(SIGPIPE, SIG_IGN);
-
+
if (!(browser = pa_browser_new_full(pa_mainloop_get_api(mainloop), PA_BROWSE_FOR_SERVERS|PA_BROWSE_FOR_SINKS|PA_BROWSE_FOR_SOURCES, &s))) {
fprintf(stderr, "pa_browse_new_full(): %s\n", s);
goto finish;
@@ -136,7 +136,7 @@ int main(int argc, char *argv[]) {
pa_browser_set_callback(browser, browser_callback, NULL);
pa_browser_set_error_callback(browser, error_callback, pa_mainloop_get_api(mainloop));
-
+
ret = 0;
pa_mainloop_run(mainloop, &ret);
diff --git a/src/utils/pacat.c b/src/utils/pacat.c
index 1c581f4d9..cb103c999 100644
--- a/src/utils/pacat.c
+++ b/src/utils/pacat.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
@@ -79,20 +79,20 @@ static void do_stream_write(size_t length) {
if (!buffer || !buffer_length)
return;
-
+
l = length;
if (l > buffer_length)
l = buffer_length;
-
+
if (pa_stream_write(stream, (uint8_t*) buffer + buffer_index, l, NULL, 0, PA_SEEK_RELATIVE) < 0) {
fprintf(stderr, "pa_stream_write() failed: %s\n", pa_strerror(pa_context_errno(context)));
quit(1);
return;
}
-
+
buffer_length -= l;
buffer_index += l;
-
+
if (!buffer_length) {
pa_xfree(buffer);
buffer = NULL;
@@ -126,7 +126,7 @@ static void stream_read_callback(pa_stream *s, size_t length, void *userdata) {
quit(1);
return;
}
-
+
assert(data && length);
if (buffer) {
@@ -156,7 +156,7 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
case PA_STREAM_READY:
if (verbose) {
const pa_buffer_attr *a;
-
+
fprintf(stderr, "Stream successfully created.\n");
if (!(a = pa_stream_get_buffer_attr(s)))
@@ -169,13 +169,13 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
assert(mode == RECORD);
fprintf(stderr, "Buffer metrics: maxlength=%u, fragsize=%u\n", a->maxlength, a->fragsize);
}
-
+
}
}
-
+
break;
-
+
case PA_STREAM_FAILED:
default:
fprintf(stderr, "Stream error: %s\n", pa_strerror(pa_context_errno(pa_stream_get_context(s))));
@@ -192,10 +192,10 @@ static void context_state_callback(pa_context *c, void *userdata) {
case PA_CONTEXT_AUTHORIZING:
case PA_CONTEXT_SETTING_NAME:
break;
-
+
case PA_CONTEXT_READY: {
int r;
-
+
assert(c && !stream);
if (verbose)
@@ -216,17 +216,17 @@ static void context_state_callback(pa_context *c, void *userdata) {
fprintf(stderr, "pa_stream_connect_playback() failed: %s\n", pa_strerror(pa_context_errno(c)));
goto fail;
}
-
+
} else {
if ((r = pa_stream_connect_record(stream, device, NULL, 0)) < 0) {
fprintf(stderr, "pa_stream_connect_record() failed: %s\n", pa_strerror(pa_context_errno(c)));
goto fail;
}
}
-
+
break;
}
-
+
case PA_CONTEXT_TERMINATED:
quit(0);
break;
@@ -238,10 +238,10 @@ static void context_state_callback(pa_context *c, void *userdata) {
}
return;
-
+
fail:
quit(1);
-
+
}
/* Connection draining complete */
@@ -257,14 +257,14 @@ static void stream_drain_complete(pa_stream*s, int success, void *userdata) {
fprintf(stderr, "Failed to drain stream: %s\n", pa_strerror(pa_context_errno(context)));
quit(1);
}
-
- if (verbose)
+
+ if (verbose)
fprintf(stderr, "Playback stream drained.\n");
pa_stream_disconnect(stream);
pa_stream_unref(stream);
stream = NULL;
-
+
if (!(o = pa_context_drain(context, context_drain_complete, NULL)))
pa_context_disconnect(context);
else {
@@ -286,7 +286,7 @@ static void stdin_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_even
if (!stream || pa_stream_get_state(stream) != PA_STREAM_READY || !(l = w = pa_stream_writable_size(stream)))
l = 4096;
-
+
buffer = pa_xmalloc(l);
if ((r = read(fd, buffer, l)) <= 0) {
@@ -296,17 +296,17 @@ static void stdin_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_even
if (stream) {
pa_operation *o;
-
+
if (!(o = pa_stream_drain(stream, stream_drain_complete, NULL))) {
fprintf(stderr, "pa_stream_drain(): %s\n", pa_strerror(pa_context_errno(context)));
quit(1);
return;
}
-
+
pa_operation_unref(o);
} else
quit(0);
-
+
} else {
fprintf(stderr, "read() failed: %s\n", strerror(errno));
quit(1);
@@ -335,7 +335,7 @@ static void stdout_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_eve
}
assert(buffer_length);
-
+
if ((r = write(fd, (uint8_t*) buffer+buffer_index, buffer_length)) <= 0) {
fprintf(stderr, "write() failed: %s\n", strerror(errno));
quit(1);
@@ -366,7 +366,7 @@ static void exit_signal_callback(pa_mainloop_api*m, pa_signal_event *e, int sig,
static void stream_update_timing_callback(pa_stream *s, int success, void *userdata) {
pa_usec_t latency, usec;
int negative = 0;
-
+
assert(s);
if (!success ||
@@ -387,13 +387,13 @@ static void sigusr1_signal_callback(pa_mainloop_api*m, pa_signal_event *e, int s
if (!stream)
return;
-
+
pa_operation_unref(pa_stream_update_timing_info(stream, stream_update_timing_callback, NULL));
}
static void time_event_callback(pa_mainloop_api*m, pa_time_event *e, const struct timeval *tv, void *userdata) {
struct timeval next;
-
+
if (stream && pa_stream_get_state(stream) == PA_STREAM_READY) {
pa_operation *o;
if (!(o = pa_stream_update_timing_info(stream, stream_update_timing_callback, NULL)))
@@ -481,7 +481,7 @@ int main(int argc, char *argv[]) {
help(bn);
ret = 0;
goto quit;
-
+
case ARG_VERSION:
printf("pacat "PACKAGE_VERSION"\nCompiled with libpulse %s\nLinked with libpulse %s\n", pa_get_headers_version(), pa_get_library_version());
ret = 0;
@@ -525,7 +525,7 @@ int main(int argc, char *argv[]) {
break;
}
- case ARG_CHANNELS:
+ case ARG_CHANNELS:
sample_spec.channels = atoi(optarg);
break;
@@ -545,7 +545,7 @@ int main(int argc, char *argv[]) {
channel_map_set = 1;
break;
-
+
default:
goto quit;
}
@@ -560,7 +560,7 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "Channel map doesn't match sample specification\n");
goto quit;
}
-
+
if (verbose) {
char t[PA_SAMPLE_SPEC_SNPRINT_MAX];
pa_sample_spec_snprint(t, sizeof(t), &sample_spec);
@@ -570,22 +570,22 @@ int main(int argc, char *argv[]) {
if (!(optind >= argc)) {
if (optind+1 == argc) {
int fd;
-
+
if ((fd = open(argv[optind], mode == PLAYBACK ? O_RDONLY : O_WRONLY|O_TRUNC|O_CREAT, 0666)) < 0) {
fprintf(stderr, "open(): %s\n", strerror(errno));
goto quit;
}
-
+
if (dup2(fd, mode == PLAYBACK ? 0 : 1) < 0) {
fprintf(stderr, "dup2(): %s\n", strerror(errno));
goto quit;
}
-
+
close(fd);
if (!stream_name)
stream_name = pa_xstrdup(argv[optind]);
-
+
} else {
fprintf(stderr, "Too many arguments.\n");
goto quit;
@@ -616,7 +616,7 @@ int main(int argc, char *argv[]) {
#ifdef SIGPIPE
signal(SIGPIPE, SIG_IGN);
#endif
-
+
if (!(stdio_event = mainloop_api->io_new(mainloop_api,
mode == PLAYBACK ? STDIN_FILENO : STDOUT_FILENO,
mode == PLAYBACK ? PA_IO_EVENT_INPUT : PA_IO_EVENT_OUTPUT,
@@ -641,7 +641,7 @@ int main(int argc, char *argv[]) {
pa_gettimeofday(&tv);
pa_timeval_add(&tv, TIME_EVENT_USEC);
-
+
if (!(time_event = mainloop_api->time_new(mainloop_api, &tv, time_event_callback, NULL))) {
fprintf(stderr, "time_new() failed.\n");
goto quit;
@@ -653,7 +653,7 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "pa_mainloop_run() failed.\n");
goto quit;
}
-
+
quit:
if (stream)
pa_stream_unref(stream);
@@ -670,7 +670,7 @@ quit:
assert(mainloop_api);
mainloop_api->time_free(time_event);
}
-
+
if (m) {
pa_signal_done();
pa_mainloop_free(m);
@@ -682,6 +682,6 @@ quit:
pa_xfree(device);
pa_xfree(client_name);
pa_xfree(stream_name);
-
+
return ret;
}
diff --git a/src/utils/pacmd.c b/src/utils/pacmd.c
index b99127016..d25b26c36 100644
--- a/src/utils/pacmd.c
+++ b/src/utils/pacmd.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,12 +64,12 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
for (i = 0; i < 5; i++) {
int r;
-
+
if ((r = connect(fd, (struct sockaddr*) &sa, sizeof(sa))) < 0 && (errno != ECONNREFUSED && errno != ENOENT)) {
pa_log("connect(): %s", strerror(errno));
goto fail;
}
-
+
if (r >= 0)
break;
@@ -94,7 +94,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
FD_SET(fd, &ifds);
FD_ZERO(&ofds);
-
+
for (;;) {
if (select(FD_SETSIZE, &ifds, &ofds, NULL, NULL) < 0) {
pa_log("select(): %s", strerror(errno));
@@ -104,19 +104,19 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
if (FD_ISSET(0, &ifds)) {
ssize_t r;
assert(!ibuf_length);
-
+
if ((r = read(0, ibuf, sizeof(ibuf))) <= 0) {
if (r == 0)
break;
-
+
pa_log("read(): %s", strerror(errno));
goto fail;
}
-
+
ibuf_length = (size_t) r;
ibuf_index = 0;
}
-
+
if (FD_ISSET(fd, &ifds)) {
ssize_t r;
assert(!obuf_length);
@@ -124,7 +124,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
if ((r = read(fd, obuf, sizeof(obuf))) <= 0) {
if (r == 0)
break;
-
+
pa_log("read(): %s", strerror(errno));
goto fail;
}
@@ -136,12 +136,12 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
if (FD_ISSET(1, &ofds)) {
ssize_t r;
assert(obuf_length);
-
+
if ((r = write(1, obuf + obuf_index, obuf_length)) < 0) {
pa_log("write(): %s", strerror(errno));
goto fail;
}
-
+
obuf_length -= (size_t) r;
obuf_index += obuf_index;
@@ -150,12 +150,12 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
if (FD_ISSET(fd, &ofds)) {
ssize_t r;
assert(ibuf_length);
-
+
if ((r = write(fd, ibuf + ibuf_index, ibuf_length)) < 0) {
pa_log("write(): %s", strerror(errno));
goto fail;
}
-
+
ibuf_length -= (size_t) r;
ibuf_index += obuf_index;
@@ -163,24 +163,24 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
FD_ZERO(&ifds);
FD_ZERO(&ofds);
-
+
if (obuf_length <= 0)
FD_SET(fd, &ifds);
else
FD_SET(1, &ofds);
-
+
if (ibuf_length <= 0)
FD_SET(0, &ifds);
else
FD_SET(fd, &ofds);
}
-
+
ret = 0;
-
+
fail:
if (fd >= 0)
close(fd);
-
+
return ret;
}
diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index 110585f79..0c418c4fb 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.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
@@ -112,13 +112,13 @@ static void stat_callback(pa_context *c, const pa_stat_info *i, void *userdata)
pa_bytes_snprint(s, sizeof(s), i->scache_size);
printf("Sample cache size: %s\n", s);
-
+
complete_action();
}
static void get_server_info_callback(pa_context *c, const pa_server_info *i, void *useerdata) {
char s[PA_SAMPLE_SPEC_SNPRINT_MAX];
-
+
if (!i) {
fprintf(stderr, "Failed to get server information: %s\n", pa_strerror(pa_context_errno(c)));
quit(1);
@@ -149,7 +149,7 @@ static void get_server_info_callback(pa_context *c, const pa_server_info *i, voi
static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_last, void *userdata) {
char s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
-
+
if (is_last < 0) {
fprintf(stderr, "Failed to get sink information: %s\n", pa_strerror(pa_context_errno(c)));
quit(1);
@@ -160,7 +160,7 @@ static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_
complete_action();
return;
}
-
+
assert(i);
if (nl)
@@ -207,7 +207,7 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int
complete_action();
return;
}
-
+
assert(i);
if (nl)
@@ -215,7 +215,7 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int
nl = 1;
snprintf(t, sizeof(t), "%u", i->monitor_of_sink);
-
+
printf("*** Source #%u ***\n"
"Name: %s\n"
"Driver: %s\n"
@@ -256,7 +256,7 @@ static void get_module_info_callback(pa_context *c, const pa_module_info *i, int
complete_action();
return;
}
-
+
assert(i);
if (nl)
@@ -264,7 +264,7 @@ static void get_module_info_callback(pa_context *c, const pa_module_info *i, int
nl = 1;
snprintf(t, sizeof(t), "%u", i->n_used);
-
+
printf("*** Module #%u ***\n"
"Name: %s\n"
"Argument: %s\n"
@@ -290,7 +290,7 @@ static void get_client_info_callback(pa_context *c, const pa_client_info *i, int
complete_action();
return;
}
-
+
assert(i);
if (nl)
@@ -298,7 +298,7 @@ static void get_client_info_callback(pa_context *c, const pa_client_info *i, int
nl = 1;
snprintf(t, sizeof(t), "%u", i->owner_module);
-
+
printf("*** Client #%u ***\n"
"Name: %s\n"
"Driver: %s\n"
@@ -322,7 +322,7 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info
complete_action();
return;
}
-
+
assert(i);
if (nl)
@@ -331,7 +331,7 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info
snprintf(t, sizeof(t), "%u", i->owner_module);
snprintf(k, sizeof(k), "%u", i->client);
-
+
printf("*** Sink Input #%u ***\n"
"Name: %s\n"
"Driver: %s\n"
@@ -372,17 +372,17 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu
complete_action();
return;
}
-
+
assert(i);
if (nl)
printf("\n");
nl = 1;
-
+
snprintf(t, sizeof(t), "%u", i->owner_module);
snprintf(k, sizeof(k), "%u", i->client);
-
+
printf("*** Source Output #%u ***\n"
"Name: %s\n"
"Driver: %s\n"
@@ -420,16 +420,16 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int
complete_action();
return;
}
-
+
assert(i);
if (nl)
printf("\n");
nl = 1;
-
+
pa_bytes_snprint(t, sizeof(t), i->bytes);
-
+
printf("*** Sample #%u ***\n"
"Name: %s\n"
"Volume: %s\n"
@@ -461,7 +461,7 @@ static void get_autoload_info_callback(pa_context *c, const pa_autoload_info *i,
complete_action();
return;
}
-
+
assert(i);
if (nl)
@@ -497,11 +497,11 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
case PA_STREAM_CREATING:
case PA_STREAM_READY:
break;
-
+
case PA_STREAM_TERMINATED:
drain();
break;
-
+
case PA_STREAM_FAILED:
default:
fprintf(stderr, "Failed to upload sample: %s\n", pa_strerror(pa_context_errno(pa_stream_get_context(s))));
@@ -524,7 +524,7 @@ static void stream_write_callback(pa_stream *s, size_t length, void *userdata) {
fprintf(stderr, "Premature end of file\n");
quit(1);
}
-
+
pa_stream_write(s, d, length, pa_xfree, 0, PA_SEEK_RELATIVE);
sample_length -= length;
@@ -551,7 +551,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
pa_operation_unref(pa_context_get_server_info(c, get_server_info_callback, NULL));
break;
- case PLAY_SAMPLE:
+ case PLAY_SAMPLE:
pa_operation_unref(pa_context_play_sample(c, sample_name, device, PA_VOLUME_NORM, simple_callback, NULL));
break;
@@ -562,12 +562,12 @@ static void context_state_callback(pa_context *c, void *userdata) {
case UPLOAD_SAMPLE:
sample_stream = pa_stream_new(c, sample_name, &sample_spec, NULL);
assert(sample_stream);
-
+
pa_stream_set_state_callback(sample_stream, stream_state_callback, NULL);
pa_stream_set_write_callback(sample_stream, stream_write_callback, NULL);
pa_stream_connect_upload(sample_stream, sample_length);
break;
-
+
case EXIT:
pa_operation_unref(pa_context_exit_daemon(c, NULL, NULL));
drain();
@@ -578,7 +578,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
pa_operation_unref(pa_context_get_sink_info_list(c, get_sink_info_callback, NULL));
pa_operation_unref(pa_context_get_source_info_list(c, get_source_info_callback, NULL));
pa_operation_unref(pa_context_get_sink_input_info_list(c, get_sink_input_info_callback, NULL));
- pa_operation_unref(pa_context_get_source_output_info_list(c, get_source_output_info_callback, NULL));
+ pa_operation_unref(pa_context_get_source_output_info_list(c, get_source_output_info_callback, NULL));
pa_operation_unref(pa_context_get_client_info_list(c, get_client_info_callback, NULL));
pa_operation_unref(pa_context_get_sample_info_list(c, get_sample_info_callback, NULL));
pa_operation_unref(pa_context_get_autoload_info_list(c, get_autoload_info_callback, NULL));
@@ -591,7 +591,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
case MOVE_SOURCE_OUTPUT:
pa_operation_unref(pa_context_move_source_output_by_name(c, source_output_idx, source_name, simple_callback, NULL));
break;
-
+
default:
assert(0);
}
@@ -650,14 +650,14 @@ int main(int argc, char *argv[]) {
bn = argv[0];
else
bn++;
-
+
while ((c = getopt_long(argc, argv, "s:n:h", long_options, NULL)) != -1) {
switch (c) {
case 'h' :
help(bn);
ret = 0;
goto quit;
-
+
case ARG_VERSION:
printf("pactl "PACKAGE_VERSION"\nCompiled with libpulse %s\nLinked with libpulse %s\n", pa_get_headers_version(), pa_get_library_version());
ret = 0;
@@ -680,7 +680,7 @@ int main(int argc, char *argv[]) {
if (!client_name)
client_name = pa_xstrdup(bn);
-
+
if (optind < argc) {
if (!strcmp(argv[optind], "stat"))
action = STAT;
@@ -712,13 +712,13 @@ int main(int argc, char *argv[]) {
tmp[n] = 0;
sample_name = pa_xstrdup(tmp);
}
-
+
memset(&sfinfo, 0, sizeof(sfinfo));
if (!(sndfile = sf_open(argv[optind+1], SFM_READ, &sfinfo))) {
fprintf(stderr, "Failed to open sound file.\n");
goto quit;
}
-
+
sample_spec.format = PA_SAMPLE_FLOAT32;
sample_spec.rate = sfinfo.samplerate;
sample_spec.channels = sfinfo.channels;
@@ -735,7 +735,7 @@ int main(int argc, char *argv[]) {
if (optind+2 < argc)
device = pa_xstrdup(argv[optind+2]);
-
+
} else if (!strcmp(argv[optind], "remove-sample")) {
action = REMOVE_SAMPLE;
if (optind+1 >= argc) {
@@ -783,7 +783,7 @@ int main(int argc, char *argv[]) {
#ifdef SIGPIPE
signal(SIGPIPE, SIG_IGN);
#endif
-
+
if (!(context = pa_context_new(mainloop_api, client_name))) {
fprintf(stderr, "pa_context_new() failed.\n");
goto quit;
@@ -808,7 +808,7 @@ quit:
pa_signal_done();
pa_mainloop_free(m);
}
-
+
if (sndfile)
sf_close(sndfile);
diff --git a/src/utils/padsp.c b/src/utils/padsp.c
index a8ac8667e..679a5d012 100644
--- a/src/utils/padsp.c
+++ b/src/utils/padsp.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 fd_info {
pthread_mutex_t mutex;
int ref;
int unusable;
-
+
fd_info_type_t type;
int app_fd, thread_fd;
@@ -95,7 +95,7 @@ struct fd_info {
int volume_modify_count;
int optr_n_blocks;
-
+
PA_LLIST_FIELDS(fd_info);
};
@@ -248,7 +248,7 @@ static int padsp_disabled(void) {
* -> disable /dev/dsp emulation, bit 2 -> disable /dev/sndstat
* emulation, bit 3 -> disable /dev/mixer emulation. Hence a value
* of 7 disables padsp entirely. */
-
+
pthread_mutex_lock(&func_mutex);
if (!sym_resolved) {
sym = (int*) dlsym(RTLD_DEFAULT, "__padsp_disabled__");
@@ -259,14 +259,14 @@ static int padsp_disabled(void) {
if (!sym)
return 0;
-
+
return *sym;
}
static int dsp_cloak_enable(void) {
if (padsp_disabled() & 1)
return 0;
-
+
if (getenv("PADSP_NO_DSP"))
return 0;
@@ -302,7 +302,7 @@ static int function_enter(void) {
/* Avoid recursive calls */
static pthread_once_t recursion_key_once = PTHREAD_ONCE_INIT;
pthread_once(&recursion_key_once, recursion_key_alloc);
-
+
if (pthread_getspecific(recursion_key))
return 0;
@@ -320,10 +320,10 @@ static void fd_info_free(fd_info *i) {
debug(DEBUG_LEVEL_NORMAL, __FILE__": freeing fd info (fd=%i)\n", i->app_fd);
dsp_drain(i);
-
+
if (i->mainloop)
pa_threaded_mainloop_stop(i->mainloop);
-
+
if (i->play_stream) {
pa_stream_disconnect(i->play_stream);
pa_stream_unref(i->play_stream);
@@ -338,7 +338,7 @@ static void fd_info_free(fd_info *i) {
pa_context_disconnect(i->context);
pa_context_unref(i->context);
}
-
+
if (i->mainloop)
pa_threaded_mainloop_free(i->mainloop);
@@ -360,7 +360,7 @@ static void fd_info_free(fd_info *i) {
static fd_info *fd_info_ref(fd_info *i) {
assert(i);
-
+
pthread_mutex_lock(&i->mutex);
assert(i->ref >= 1);
i->ref++;
@@ -404,7 +404,7 @@ static void context_state_cb(pa_context *c, void *userdata) {
static void reset_params(fd_info *i) {
assert(i);
-
+
i->sample_spec.format = PA_SAMPLE_U8;
i->sample_spec.channels = 1;
i->sample_spec.rate = 8000;
@@ -418,7 +418,7 @@ static const char *client_name(char *buf, size_t n) {
if ((e = getenv("PADSP_CLIENT_NAME")))
return e;
-
+
if (pa_get_binary_name(p, sizeof(p)))
snprintf(buf, n, "OSS Emulation[%s]", p);
else
@@ -440,7 +440,7 @@ static void atfork_prepare(void) {
fd_info *i;
debug(DEBUG_LEVEL_NORMAL, __FILE__": atfork_prepare() enter\n");
-
+
function_enter();
pthread_mutex_lock(&fd_infos_mutex);
@@ -452,13 +452,13 @@ static void atfork_prepare(void) {
pthread_mutex_lock(&func_mutex);
-
+
debug(DEBUG_LEVEL_NORMAL, __FILE__": atfork_prepare() exit\n");
}
static void atfork_parent(void) {
fd_info *i;
-
+
debug(DEBUG_LEVEL_NORMAL, __FILE__": atfork_parent() enter\n");
pthread_mutex_unlock(&func_mutex);
@@ -471,19 +471,19 @@ static void atfork_parent(void) {
pthread_mutex_unlock(&fd_infos_mutex);
function_exit();
-
+
debug(DEBUG_LEVEL_NORMAL, __FILE__": atfork_parent() exit\n");
}
static void atfork_child(void) {
fd_info *i;
-
+
debug(DEBUG_LEVEL_NORMAL, __FILE__": atfork_child() enter\n");
/* We do only the bare minimum to get all fds closed */
pthread_mutex_init(&func_mutex, NULL);
pthread_mutex_init(&fd_infos_mutex, NULL);
-
+
for (i = fd_infos; i; i = i->next) {
pthread_mutex_init(&i->mutex, NULL);
@@ -556,7 +556,7 @@ static fd_info* fd_info_new(fd_info_type_t type, int *_errno) {
signal(SIGPIPE, SIG_IGN); /* Yes, ugly as hell */
pthread_once(&install_atfork_once, install_atfork);
-
+
if (!(i = malloc(sizeof(fd_info)))) {
*_errno = ENOMEM;
goto fail;
@@ -638,12 +638,12 @@ static fd_info* fd_info_new(fd_info_type_t type, int *_errno) {
unlock_and_fail:
pa_threaded_mainloop_unlock(i->mainloop);
-
+
fail:
if (i)
fd_info_unref(i);
-
+
return NULL;
}
@@ -671,7 +671,7 @@ static fd_info* fd_info_find(int fd) {
fd_info *i;
pthread_mutex_lock(&fd_infos_mutex);
-
+
for (i = fd_infos; i; i = i->next)
if (i->app_fd == fd && !i->unusable) {
fd_info_ref(i);
@@ -679,7 +679,7 @@ static fd_info* fd_info_find(int fd) {
}
pthread_mutex_unlock(&fd_infos_mutex);
-
+
return i;
}
@@ -907,7 +907,7 @@ static void stream_state_cb(pa_stream *s, void * userdata) {
case PA_STREAM_READY:
debug(DEBUG_LEVEL_NORMAL, __FILE__": stream established.\n");
break;
-
+
case PA_STREAM_FAILED:
debug(DEBUG_LEVEL_NORMAL, __FILE__": pa_stream_connect_playback() failed: %s\n", pa_strerror(pa_context_errno(i->context)));
fd_info_shutdown(i);
@@ -923,7 +923,7 @@ static void stream_state_cb(pa_stream *s, void * userdata) {
static int create_playback_stream(fd_info *i) {
pa_buffer_attr attr;
int n;
-
+
assert(i);
fix_metrics(i);
@@ -942,7 +942,7 @@ static int create_playback_stream(fd_info *i) {
attr.tlength = i->fragment_size * i->n_fragments;
attr.prebuf = i->fragment_size;
attr.minreq = i->fragment_size;
-
+
if (pa_stream_connect_playback(i->play_stream, NULL, &attr, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE, NULL, NULL) < 0) {
debug(DEBUG_LEVEL_NORMAL, __FILE__": pa_stream_connect_playback() failed: %s\n", pa_strerror(pa_context_errno(i->context)));
goto fail;
@@ -952,7 +952,7 @@ static int create_playback_stream(fd_info *i) {
setsockopt(i->app_fd, SOL_SOCKET, SO_SNDBUF, &n, sizeof(n));
n = i->fragment_size;
setsockopt(i->thread_fd, SOL_SOCKET, SO_RCVBUF, &n, sizeof(n));
-
+
return 0;
fail:
@@ -962,7 +962,7 @@ fail:
static int create_record_stream(fd_info *i) {
pa_buffer_attr attr;
int n;
-
+
assert(i);
fix_metrics(i);
@@ -979,7 +979,7 @@ static int create_record_stream(fd_info *i) {
memset(&attr, 0, sizeof(attr));
attr.maxlength = i->fragment_size * (i->n_fragments+1);
attr.fragsize = i->fragment_size;
-
+
if (pa_stream_connect_record(i->rec_stream, NULL, &attr, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE) < 0) {
debug(DEBUG_LEVEL_NORMAL, __FILE__": pa_stream_connect_playback() failed: %s\n", pa_strerror(pa_context_errno(i->context)));
goto fail;
@@ -989,7 +989,7 @@ static int create_record_stream(fd_info *i) {
setsockopt(i->app_fd, SOL_SOCKET, SO_RCVBUF, &n, sizeof(n));
n = i->fragment_size;
setsockopt(i->thread_fd, SOL_SOCKET, SO_SNDBUF, &n, sizeof(n));
-
+
return 0;
fail:
@@ -1025,7 +1025,7 @@ static void io_event_cb(pa_mainloop_api *api, pa_io_event *e, int fd, pa_io_even
fd_info *i = userdata;
pa_threaded_mainloop_signal(i->mainloop, 0);
-
+
if (flags & PA_IO_EVENT_INPUT) {
if (!i->play_stream) {
@@ -1035,7 +1035,7 @@ static void io_event_cb(pa_mainloop_api *api, pa_io_event *e, int fd, pa_io_even
if (fd_info_copy_data(i, 0) < 0)
goto fail;
}
-
+
} else if (flags & PA_IO_EVENT_OUTPUT) {
if (!i->rec_stream) {
@@ -1050,7 +1050,7 @@ static void io_event_cb(pa_mainloop_api *api, pa_io_event *e, int fd, pa_io_even
goto fail;
return;
-
+
fail:
/* We can't do anything better than removing the event source */
fd_info_shutdown(i);
@@ -1100,7 +1100,7 @@ static int dsp_open(int flags, int *_errno) {
if (!(i->io_event = api->io_new(api, i->thread_fd, i->io_flags, io_event_cb, i)))
goto fail;
-
+
pa_threaded_mainloop_unlock(i->mainloop);
debug(DEBUG_LEVEL_NORMAL, __FILE__": dsp_open() succeeded, fd=%i\n", i->app_fd);
@@ -1108,7 +1108,7 @@ static int dsp_open(int flags, int *_errno) {
fd_info_add_to_list(i);
ret = i->app_fd;
fd_info_unref(i);
-
+
return ret;
fail:
@@ -1116,7 +1116,7 @@ fail:
if (i)
fd_info_unref(i);
-
+
*_errno = EIO;
debug(DEBUG_LEVEL_NORMAL, __FILE__": dsp_open() failed\n");
@@ -1138,7 +1138,7 @@ static void sink_info_cb(pa_context *context, const pa_sink_info *si, int eol, v
if (!pa_cvolume_equal(&i->sink_volume, &si->volume))
i->volume_modify_count++;
-
+
i->sink_volume = si->volume;
i->sink_index = si->index;
@@ -1160,7 +1160,7 @@ static void source_info_cb(pa_context *context, const pa_source_info *si, int eo
if (!pa_cvolume_equal(&i->source_volume, &si->volume))
i->volume_modify_count++;
-
+
i->source_volume = si->volume;
i->source_index = si->index;
@@ -1193,13 +1193,13 @@ static int mixer_open(int flags, int *_errno) {
debug(DEBUG_LEVEL_NORMAL, __FILE__": mixer_open()\n");
- if (!(i = fd_info_new(FD_INFO_MIXER, _errno)))
+ if (!(i = fd_info_new(FD_INFO_MIXER, _errno)))
return -1;
-
+
pa_threaded_mainloop_lock(i->mainloop);
pa_context_set_subscribe_callback(i->context, subscribe_cb, i);
-
+
if (!(o = pa_context_subscribe(i->context, PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SOURCE, context_success_cb, i))) {
debug(DEBUG_LEVEL_NORMAL, __FILE__": Failed to subscribe to events: %s", pa_strerror(pa_context_errno(i->context)));
*_errno = EIO;
@@ -1274,7 +1274,7 @@ static int mixer_open(int flags, int *_errno) {
fd_info_add_to_list(i);
ret = i->app_fd;
fd_info_unref(i);
-
+
return ret;
fail:
@@ -1285,7 +1285,7 @@ fail:
if (i)
fd_info_unref(i);
-
+
*_errno = EIO;
debug(DEBUG_LEVEL_NORMAL, __FILE__": mixer_open() failed\n");
@@ -1323,7 +1323,7 @@ static int sndstat_open(int flags, int *_errno) {
int e;
debug(DEBUG_LEVEL_NORMAL, __FILE__": sndstat_open()\n");
-
+
if (flags != O_RDONLY
#ifdef O_LARGEFILE
&& flags != (O_RDONLY|O_LARGEFILE)
@@ -1401,16 +1401,16 @@ int open(const char *filename, int flags, ...) {
}
function_exit();
-
+
if (_errno)
errno = _errno;
-
+
return r;
}
static int mixer_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno) {
int ret = -1;
-
+
switch (request) {
case SOUND_MIXER_READ_DEVMASK :
debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_MIXER_READ_DEVMASK\n");
@@ -1423,7 +1423,7 @@ static int mixer_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno
*(int*) argp = SOUND_MASK_IGAIN;
break;
-
+
case SOUND_MIXER_READ_STEREODEVS:
debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_MIXER_READ_STEREODEVS\n");
@@ -1434,7 +1434,7 @@ static int mixer_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno
if (i->source_volume.channels > 1)
*(int*) argp |= SOUND_MASK_IGAIN;
pa_threaded_mainloop_unlock(i->mainloop);
-
+
break;
case SOUND_MIXER_READ_RECSRC:
@@ -1452,7 +1452,7 @@ static int mixer_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno
*(int*) argp = 0;
break;
-
+
case SOUND_MIXER_READ_PCM:
case SOUND_MIXER_READ_IGAIN: {
pa_cvolume *v;
@@ -1515,23 +1515,23 @@ static int mixer_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno
i->operation_success = 0;
while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
CONTEXT_CHECK_DEAD_GOTO(i, exit_loop);
-
+
pa_threaded_mainloop_wait(i->mainloop);
}
exit_loop:
-
+
if (!i->operation_success)
debug(DEBUG_LEVEL_NORMAL, __FILE__": Failed to set volume: %s\n", pa_strerror(pa_context_errno(i->context)));
pa_operation_unref(o);
}
-
+
/* We don't wait for completion here */
i->volume_modify_count++;
}
-
+
pa_threaded_mainloop_unlock(i->mainloop);
-
+
break;
}
@@ -1548,7 +1548,7 @@ static int mixer_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno
pa_threaded_mainloop_unlock(i->mainloop);
break;
}
-
+
default:
debug(DEBUG_LEVEL_NORMAL, __FILE__": unknown ioctl 0x%08lx\n", request);
@@ -1557,44 +1557,44 @@ static int mixer_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno
}
ret = 0;
-
+
fail:
-
+
return ret;
}
static int map_format(int *fmt, pa_sample_spec *ss) {
-
+
switch (*fmt) {
case AFMT_MU_LAW:
ss->format = PA_SAMPLE_ULAW;
break;
-
+
case AFMT_A_LAW:
ss->format = PA_SAMPLE_ALAW;
break;
-
+
case AFMT_S8:
*fmt = AFMT_U8;
/* fall through */
case AFMT_U8:
ss->format = PA_SAMPLE_U8;
break;
-
+
case AFMT_U16_BE:
*fmt = AFMT_S16_BE;
/* fall through */
case AFMT_S16_BE:
ss->format = PA_SAMPLE_S16BE;
break;
-
+
case AFMT_U16_LE:
*fmt = AFMT_S16_LE;
/* fall through */
case AFMT_S16_LE:
ss->format = PA_SAMPLE_S16LE;
break;
-
+
default:
ss->format = PA_SAMPLE_S16NE;
*fmt = AFMT_S16_NE;
@@ -1666,14 +1666,14 @@ static int dsp_flush_socket(fd_info *i) {
static int dsp_empty_socket(fd_info *i) {
#ifdef SIOCINQ
int ret = -1;
-
+
/* Empty the socket */
for (;;) {
int l;
-
+
if (i->thread_fd < 0)
break;
-
+
if (ioctl(i->thread_fd, SIOCINQ, &l) < 0) {
debug(DEBUG_LEVEL_NORMAL, __FILE__": SIOCINQ: %s\n", strerror(errno));
break;
@@ -1683,7 +1683,7 @@ static int dsp_empty_socket(fd_info *i) {
ret = 0;
break;
}
-
+
pa_threaded_mainloop_wait(i->mainloop);
}
@@ -1700,19 +1700,19 @@ static int dsp_drain(fd_info *i) {
if (!i->mainloop)
return 0;
-
+
debug(DEBUG_LEVEL_NORMAL, __FILE__": Draining.\n");
pa_threaded_mainloop_lock(i->mainloop);
if (dsp_empty_socket(i) < 0)
goto fail;
-
+
if (!i->play_stream)
goto fail;
debug(DEBUG_LEVEL_NORMAL, __FILE__": Really draining.\n");
-
+
if (!(o = pa_stream_drain(i->play_stream, stream_success_cb, i))) {
debug(DEBUG_LEVEL_NORMAL, __FILE__": pa_stream_drain(): %s\n", pa_strerror(pa_context_errno(i->context)));
goto fail;
@@ -1721,7 +1721,7 @@ static int dsp_drain(fd_info *i) {
i->operation_success = 0;
while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
PLAYBACK_STREAM_CHECK_DEAD_GOTO(i, fail);
-
+
pa_threaded_mainloop_wait(i->mainloop);
}
@@ -1731,9 +1731,9 @@ static int dsp_drain(fd_info *i) {
}
r = 0;
-
+
fail:
-
+
if (o)
pa_operation_unref(o);
@@ -1755,7 +1755,7 @@ static int dsp_trigger(fd_info *i) {
goto fail;
debug(DEBUG_LEVEL_NORMAL, __FILE__": Triggering.\n");
-
+
if (!(o = pa_stream_trigger(i->play_stream, stream_success_cb, i))) {
debug(DEBUG_LEVEL_NORMAL, __FILE__": pa_stream_trigger(): %s\n", pa_strerror(pa_context_errno(i->context)));
goto fail;
@@ -1764,7 +1764,7 @@ static int dsp_trigger(fd_info *i) {
i->operation_success = 0;
while (!pa_operation_get_state(o) != PA_OPERATION_DONE) {
PLAYBACK_STREAM_CHECK_DEAD_GOTO(i, fail);
-
+
pa_threaded_mainloop_wait(i->mainloop);
}
@@ -1774,9 +1774,9 @@ static int dsp_trigger(fd_info *i) {
}
r = 0;
-
+
fail:
-
+
if (o)
pa_operation_unref(o);
@@ -1787,11 +1787,11 @@ fail:
static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno) {
int ret = -1;
-
+
switch (request) {
case SNDCTL_DSP_SETFMT: {
debug(DEBUG_LEVEL_NORMAL, __FILE__": SNDCTL_DSP_SETFMT: %i\n", *(int*) argp);
-
+
pa_threaded_mainloop_lock(i->mainloop);
if (*(int*) argp == AFMT_QUERY)
@@ -1804,12 +1804,12 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
pa_threaded_mainloop_unlock(i->mainloop);
break;
}
-
+
case SNDCTL_DSP_SPEED: {
pa_sample_spec ss;
int valid;
char t[256];
-
+
debug(DEBUG_LEVEL_NORMAL, __FILE__": SNDCTL_DSP_SPEED: %i\n", *(int*) argp);
pa_threaded_mainloop_lock(i->mainloop);
@@ -1821,7 +1821,7 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
i->sample_spec = ss;
free_streams(i);
}
-
+
debug(DEBUG_LEVEL_NORMAL, __FILE__": ss: %s\n", pa_sample_spec_snprint(t, sizeof(t), &i->sample_spec));
pa_threaded_mainloop_unlock(i->mainloop);
@@ -1833,24 +1833,24 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
break;
}
-
+
case SNDCTL_DSP_STEREO:
debug(DEBUG_LEVEL_NORMAL, __FILE__": SNDCTL_DSP_STEREO: %i\n", *(int*) argp);
-
+
pa_threaded_mainloop_lock(i->mainloop);
-
+
i->sample_spec.channels = *(int*) argp ? 2 : 1;
free_streams(i);
-
+
pa_threaded_mainloop_unlock(i->mainloop);
return 0;
case SNDCTL_DSP_CHANNELS: {
pa_sample_spec ss;
int valid;
-
+
debug(DEBUG_LEVEL_NORMAL, __FILE__": SNDCTL_DSP_CHANNELS: %i\n", *(int*) argp);
-
+
pa_threaded_mainloop_lock(i->mainloop);
ss = i->sample_spec;
@@ -1860,7 +1860,7 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
i->sample_spec = ss;
free_streams(i);
}
-
+
pa_threaded_mainloop_unlock(i->mainloop);
if (!valid) {
@@ -1878,16 +1878,16 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
fix_metrics(i);
*(int*) argp = i->fragment_size;
-
+
pa_threaded_mainloop_unlock(i->mainloop);
-
+
break;
case SNDCTL_DSP_SETFRAGMENT:
debug(DEBUG_LEVEL_NORMAL, __FILE__": SNDCTL_DSP_SETFRAGMENT: 0x%08x\n", *(int*) argp);
-
+
pa_threaded_mainloop_lock(i->mainloop);
-
+
i->fragment_size = 1 << ((*(int*) argp) & 31);
i->n_fragments = (*(int*) argp) >> 16;
@@ -1896,14 +1896,14 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
i->n_fragments = 12;
free_streams(i);
-
+
pa_threaded_mainloop_unlock(i->mainloop);
-
+
break;
-
+
case SNDCTL_DSP_GETCAPS:
debug(DEBUG_LEVEL_NORMAL, __FILE__": SNDCTL_DSP_CAPS\n");
-
+
*(int*) argp = DSP_CAP_DUPLEX
#ifdef DSP_CAP_MULTI
| DSP_CAP_MULTI
@@ -1913,13 +1913,13 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
case SNDCTL_DSP_GETODELAY: {
int l;
-
+
debug(DEBUG_LEVEL_NORMAL, __FILE__": SNDCTL_DSP_GETODELAY\n");
-
+
pa_threaded_mainloop_lock(i->mainloop);
*(int*) argp = 0;
-
+
for (;;) {
pa_usec_t usec;
@@ -1937,10 +1937,10 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
pa_threaded_mainloop_wait(i->mainloop);
}
-
+
exit_loop:
-#ifdef SIOCINQ
+#ifdef SIOCINQ
if (ioctl(i->thread_fd, SIOCINQ, &l) < 0)
debug(DEBUG_LEVEL_NORMAL, __FILE__": SIOCINQ failed: %s\n", strerror(errno));
else
@@ -1955,39 +1955,39 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
break;
}
-
+
case SNDCTL_DSP_RESET: {
debug(DEBUG_LEVEL_NORMAL, __FILE__": SNDCTL_DSP_RESET\n");
-
+
pa_threaded_mainloop_lock(i->mainloop);
free_streams(i);
dsp_flush_socket(i);
i->optr_n_blocks = 0;
-
+
pa_threaded_mainloop_unlock(i->mainloop);
break;
}
-
+
case SNDCTL_DSP_GETFMTS: {
debug(DEBUG_LEVEL_NORMAL, __FILE__": SNDCTL_DSP_GETFMTS\n");
-
+
*(int*) argp = AFMT_MU_LAW|AFMT_A_LAW|AFMT_U8|AFMT_S16_LE|AFMT_S16_BE;
break;
}
case SNDCTL_DSP_POST:
debug(DEBUG_LEVEL_NORMAL, __FILE__": SNDCTL_DSP_POST\n");
-
- if (dsp_trigger(i) < 0)
+
+ if (dsp_trigger(i) < 0)
*_errno = EIO;
break;
- case SNDCTL_DSP_SYNC:
+ case SNDCTL_DSP_SYNC:
debug(DEBUG_LEVEL_NORMAL, __FILE__": SNDCTL_DSP_SYNC\n");
-
- if (dsp_drain(i) < 0)
+
+ if (dsp_drain(i) < 0)
*_errno = EIO;
break;
@@ -2055,36 +2055,36 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
case SOUND_PCM_READ_RATE:
debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_RATE\n");
-
+
pa_threaded_mainloop_lock(i->mainloop);
*(int*) argp = i->sample_spec.rate;
pa_threaded_mainloop_unlock(i->mainloop);
- break;
+ break;
case SOUND_PCM_READ_CHANNELS:
debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_CHANNELS\n");
-
+
pa_threaded_mainloop_lock(i->mainloop);
*(int*) argp = i->sample_spec.channels;
pa_threaded_mainloop_unlock(i->mainloop);
- break;
+ break;
case SOUND_PCM_READ_BITS:
debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_BITS\n");
-
+
pa_threaded_mainloop_lock(i->mainloop);
*(int*) argp = pa_sample_size(&i->sample_spec)*8;
pa_threaded_mainloop_unlock(i->mainloop);
- break;
-
+ break;
+
case SNDCTL_DSP_GETOPTR: {
count_info *info;
-
+
debug(DEBUG_LEVEL_NORMAL, __FILE__": SNDCTL_DSP_GETOPTR\n");
info = (count_info*) argp;
memset(info, 0, sizeof(*info));
-
+
pa_threaded_mainloop_lock(i->mainloop);
for (;;) {
@@ -2095,7 +2095,7 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
if (pa_stream_get_time(i->play_stream, &usec) >= 0) {
size_t k = pa_usec_to_bytes(usec, &i->sample_spec);
int m;
-
+
info->bytes = (int) k;
m = k / i->fragment_size;
info->blocks = m - i->optr_n_blocks;
@@ -2111,7 +2111,7 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
pa_threaded_mainloop_wait(i->mainloop);
}
-
+
pa_threaded_mainloop_unlock(i->mainloop);
debug(DEBUG_LEVEL_NORMAL, __FILE__": GETOPTR bytes=%i, blocks=%i, ptr=%i\n", info->bytes, info->blocks, info->ptr);
@@ -2122,7 +2122,7 @@ static int dsp_ioctl(fd_info *i, unsigned long request, void*argp, int *_errno)
case SNDCTL_DSP_GETIPTR:
debug(DEBUG_LEVEL_NORMAL, __FILE__": invalid ioctl SNDCTL_DSP_GETIPTR\n");
goto inval;
-
+
default:
debug(DEBUG_LEVEL_NORMAL, __FILE__": unknown ioctl 0x%08lx\n", request);
@@ -2132,9 +2132,9 @@ inval:
}
ret = 0;
-
+
fail:
-
+
return ret;
}
@@ -2165,14 +2165,14 @@ int ioctl(int fd, unsigned long request, ...) {
r = mixer_ioctl(i, request, argp, &_errno);
else
r = dsp_ioctl(i, request, argp, &_errno);
-
+
fd_info_unref(i);
if (_errno)
errno = _errno;
function_exit();
-
+
return r;
}
@@ -2194,7 +2194,7 @@ int close(int fd) {
fd_info_remove_from_list(i);
fd_info_unref(i);
-
+
function_exit();
return 0;
@@ -2207,7 +2207,7 @@ int access(const char *pathname, int mode) {
errno = EFAULT;
return -1;
}
-
+
debug(DEBUG_LEVEL_VERBOSE, __FILE__": access(%s)\n", pathname);
if (strcmp(pathname, "/dev/dsp") != 0 &&
@@ -2236,7 +2236,7 @@ int open64(const char *filename, int flags, ...) {
mode_t mode = 0;
debug(DEBUG_LEVEL_VERBOSE, __FILE__": open64(%s)\n", filename);
-
+
va_start(args, flags);
if (flags & O_CREAT)
mode = va_arg(args, mode_t);
@@ -2259,7 +2259,7 @@ FILE* fopen(const char *filename, const char *mode) {
FILE *f = NULL;
int fd;
mode_t m;
-
+
debug(DEBUG_LEVEL_VERBOSE, __FILE__": fopen(%s)\n", filename);
if (strcmp(filename, "/dev/dsp") != 0 &&
@@ -2293,7 +2293,7 @@ FILE* fopen(const char *filename, const char *mode) {
close(fd);
return NULL;
}
-
+
return f;
}
@@ -2337,9 +2337,9 @@ int fclose(FILE *f) {
/* Dirty trick to avoid that the fd is not freed twice, once by us
* and once by the real fclose() */
i->app_fd = -1;
-
+
fd_info_unref(i);
-
+
function_exit();
LOAD_FCLOSE_FUNC();
diff --git a/src/utils/paplay.c b/src/utils/paplay.c
index 0386c9df8..1617b27dd 100644
--- a/src/utils/paplay.c
+++ b/src/utils/paplay.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 void stream_drain_complete(pa_stream*s, int success, void *userdata) {
fprintf(stderr, "Failed to drain stream: %s\n", pa_strerror(pa_context_errno(context)));
quit(1);
}
-
- if (verbose)
+
+ if (verbose)
fprintf(stderr, "Playback stream drained.\n");
pa_stream_disconnect(stream);
pa_stream_unref(stream);
stream = NULL;
-
+
if (!(o = pa_context_drain(context, context_drain_complete, NULL)))
pa_context_disconnect(context);
else {
@@ -111,7 +111,7 @@ static void stream_write_callback(pa_stream *s, size_t length, void *userdata) {
if ((bytes = readf_function(sndfile, data, length/k)) > 0)
bytes *= k;
-
+
} else
bytes = sf_read_raw(sndfile, data, length);
@@ -140,7 +140,7 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
if (verbose)
fprintf(stderr, "Stream successfully created\n");
break;
-
+
case PA_STREAM_FAILED:
default:
fprintf(stderr, "Stream errror: %s\n", pa_strerror(pa_context_errno(pa_stream_get_context(s))));
@@ -157,10 +157,10 @@ static void context_state_callback(pa_context *c, void *userdata) {
case PA_CONTEXT_AUTHORIZING:
case PA_CONTEXT_SETTING_NAME:
break;
-
+
case PA_CONTEXT_READY: {
pa_cvolume cv;
-
+
assert(c && !stream);
if (verbose)
@@ -172,10 +172,10 @@ static void context_state_callback(pa_context *c, void *userdata) {
pa_stream_set_state_callback(stream, stream_state_callback, NULL);
pa_stream_set_write_callback(stream, stream_write_callback, NULL);
pa_stream_connect_playback(stream, device, NULL, 0, pa_cvolume_set(&cv, sample_spec.channels, volume), NULL);
-
+
break;
}
-
+
case PA_CONTEXT_TERMINATED:
quit(0);
break;
@@ -192,7 +192,7 @@ static void exit_signal_callback(pa_mainloop_api*m, pa_signal_event *e, int sig,
if (verbose)
fprintf(stderr, "Got SIGINT, exiting.\n");
quit(0);
-
+
}
static void help(const char *argv0) {
@@ -251,7 +251,7 @@ int main(int argc, char *argv[]) {
help(bn);
ret = 0;
goto quit;
-
+
case ARG_VERSION:
printf("paplay "PACKAGE_VERSION"\nCompiled with libpulse %s\nLinked with libpulse %s\n", pa_get_headers_version(), pa_get_library_version());
ret = 0;
@@ -302,7 +302,7 @@ int main(int argc, char *argv[]) {
}
filename = optind < argc ? argv[optind] : "STDIN";
-
+
memset(&sfinfo, 0, sizeof(sfinfo));
if (optind < argc)
@@ -317,9 +317,9 @@ int main(int argc, char *argv[]) {
sample_spec.rate = sfinfo.samplerate;
sample_spec.channels = sfinfo.channels;
-
+
readf_function = NULL;
-
+
switch (sfinfo.format & 0xFF) {
case SF_FORMAT_PCM_16:
case SF_FORMAT_PCM_U8:
@@ -327,11 +327,11 @@ int main(int argc, char *argv[]) {
sample_spec.format = PA_SAMPLE_S16NE;
readf_function = (sf_count_t (*)(SNDFILE *_sndfile, void *ptr, sf_count_t frames)) sf_readf_short;
break;
-
+
case SF_FORMAT_ULAW:
sample_spec.format = PA_SAMPLE_ULAW;
break;
-
+
case SF_FORMAT_ALAW:
sample_spec.format = PA_SAMPLE_ALAW;
break;
@@ -369,13 +369,13 @@ int main(int argc, char *argv[]) {
if (!stream_name)
stream_name = pa_utf8_filter(n);
}
-
+
if (verbose) {
char t[PA_SAMPLE_SPEC_SNPRINT_MAX];
pa_sample_spec_snprint(t, sizeof(t), &sample_spec);
fprintf(stderr, "Using sample spec '%s'\n", t);
}
-
+
/* Set up a new main loop */
if (!(m = pa_mainloop_new())) {
fprintf(stderr, "pa_mainloop_new() failed.\n");
@@ -390,7 +390,7 @@ int main(int argc, char *argv[]) {
#ifdef SIGPIPE
signal(SIGPIPE, SIG_IGN);
#endif
-
+
/* Create a new connection context */
if (!(context = pa_context_new(mainloop_api, client_name))) {
fprintf(stderr, "pa_context_new() failed.\n");
@@ -407,7 +407,7 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "pa_mainloop_run() failed.\n");
goto quit;
}
-
+
quit:
if (stream)
pa_stream_unref(stream);
@@ -427,6 +427,6 @@ quit:
if (sndfile)
sf_close(sndfile);
-
+
return ret;
}
diff --git a/src/utils/pax11publish.c b/src/utils/pax11publish.c
index 6a3c6dbce..00332f657 100644
--- a/src/utils/pax11publish.c
+++ b/src/utils/pax11publish.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
@@ -99,7 +99,7 @@ int main(int argc, char *argv[]) {
switch (mode) {
case DUMP: {
char t[1024];
- if (pa_x11_get_prop(d, "PULSE_SERVER", t, sizeof(t)))
+ if (pa_x11_get_prop(d, "PULSE_SERVER", t, sizeof(t)))
printf("Server: %s\n", t);
if (pa_x11_get_prop(d, "PULSE_SOURCE", t, sizeof(t)))
printf("Source: %s\n", t);
@@ -110,10 +110,10 @@ int main(int argc, char *argv[]) {
break;
}
-
+
case IMPORT: {
char t[1024];
- if (pa_x11_get_prop(d, "PULSE_SERVER", t, sizeof(t)))
+ if (pa_x11_get_prop(d, "PULSE_SERVER", t, sizeof(t)))
printf("PULSE_SERVER='%s'\nexport PULSE_SERVER\n", t);
if (pa_x11_get_prop(d, "PULSE_SOURCE", t, sizeof(t)))
printf("PULSE_SOURCE='%s'\nexport PULSE_SOURCE\n", t);
@@ -158,7 +158,7 @@ int main(int argc, char *argv[]) {
pa_x11_del_prop(d, "PULSE_SOURCE");
pa_x11_del_prop(d, "PULSE_ID");
pa_x11_del_prop(d, "PULSE_COOKIE");
-
+
if (server)
pa_x11_set_prop(d, "PULSE_SERVER", server);
else if (conf->default_server)
@@ -169,7 +169,7 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "Failed to get FQDN.\n");
goto finish;
}
-
+
pa_x11_set_prop(d, "PULSE_SERVER", hn);
}
@@ -184,7 +184,7 @@ int main(int argc, char *argv[]) {
pa_x11_set_prop(d, "PULSE_SOURCE", conf->default_source);
pa_client_conf_free(conf);
-
+
if (pa_authkey_load_auto(cookie_file, cookie, sizeof(cookie)) < 0) {
fprintf(stderr, "Failed to load cookie data\n");
goto finish;
@@ -201,20 +201,20 @@ int main(int argc, char *argv[]) {
pa_x11_del_prop(d, "PULSE_ID");
pa_x11_del_prop(d, "PULSE_COOKIE");
break;
-
+
default:
fprintf(stderr, "No yet implemented.\n");
goto finish;
}
ret = 0;
-
+
finish:
if (d) {
XSync(d, False);
XCloseDisplay(d);
}
-
+
return ret;
}