mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
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
This commit is contained in:
parent
1a460ee40a
commit
521daf6f0a
283 changed files with 3742 additions and 3742 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue