summaryrefslogtreecommitdiffstats
path: root/src/utils
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 /src/utils
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
Diffstat (limited to 'src/utils')
-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
7 files changed, 285 insertions, 285 deletions
diff --git a/src/utils/pabrowse.c b/src/utils/pabrowse.c
index 450182f5..f756ac01 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 1c581f4d..cb103c99 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 b9912701..d25b26c3 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 110585f7..0c418c4f 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 a8ac8667..679a5d01 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 0386c9df..1617b27d 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 6a3c6dbc..00332f65 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;
}