summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/modules/module-null-sink.c36
-rw-r--r--src/modules/module-pipe-sink.c30
-rw-r--r--src/pulsecore/asyncmsgq.c16
-rw-r--r--src/pulsecore/asyncq.c26
-rw-r--r--src/pulsecore/core.c12
-rw-r--r--src/pulsecore/core.h2
-rw-r--r--src/pulsecore/flist.c2
-rw-r--r--src/pulsecore/msgobject.c2
-rw-r--r--src/pulsecore/object.c2
-rw-r--r--src/pulsecore/object.h2
-rw-r--r--src/pulsecore/once-posix.c12
-rw-r--r--src/pulsecore/protocol-simple.c64
-rw-r--r--src/pulsecore/semaphore-posix.c2
-rw-r--r--src/pulsecore/sink-input.c38
-rw-r--r--src/pulsecore/sink-input.h12
-rw-r--r--src/pulsecore/sink.c64
-rw-r--r--src/pulsecore/source-output.c28
-rw-r--r--src/pulsecore/source-output.h6
-rw-r--r--src/pulsecore/source.c54
-rw-r--r--src/pulsecore/source.h4
-rw-r--r--src/tests/asyncmsgq-test.c8
-rw-r--r--src/tests/asyncq-test.c8
22 files changed, 215 insertions, 215 deletions
diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c
index 8cf961b9..ce3b29b0 100644
--- a/src/modules/module-null-sink.c
+++ b/src/modules/module-null-sink.c
@@ -94,7 +94,7 @@ static void thread_func(void *userdata) {
pollfd.events = POLLIN;
pa_gettimeofday(u->timestamp);
-
+
for (;;) {
int code;
void *data, *object;
@@ -116,7 +116,7 @@ static void thread_func(void *userdata) {
pa_sink_process_msg(u->sink->asyncmsgq, object, code, data);
}
-
+
} else if (object == u->sink) {
switch (code) {
@@ -124,29 +124,29 @@ static void thread_func(void *userdata) {
pa_assert(running);
running = 0;
break;
-
+
case PA_SINK_MESSAGE_START:
pa_assert(!running);
running = 1;
-
+
pa_gettimeofday(u->timestamp);
break;
-
+
case PA_SINK_MESSAGE_GET_LATENCY:
-
+
if (pa_timeval_cmp(&u->timestamp, &now) > 0)
*((pa_usec_t*) data) = 0;
else
*((pa_usec_t*) data) = pa_timeval_diff(&u->timestamp, &now);
break;
-
+
/* ... */
default:
pa_sink_process_msg(u->sink->asyncmsgq, object, code, data);
}
}
-
+
pa_asyncmsgq_done(u->sink->asyncmsgq);
continue;
}
@@ -155,30 +155,30 @@ static void thread_func(void *userdata) {
if (running) {
pa_gettimeofday(&now);
-
+
if (pa_timeval_cmp(u->timestamp, &now) <= 0) {
pa_memchunk chunk;
size_t l;
-
+
if (pa_sink_render(u->sink, u->block_size, &chunk) >= 0) {
l = chunk.length;
pa_memblock_unref(chunk.memblock);
} else
l = u->block_size;
-
+
pa_timeval_add(&u->timestamp, pa_bytes_to_usec(l, &u->sink->sample_spec));
continue;
}
timeout = pa_timeval_diff(&u->timestamp, &now)/1000;
-
+
if (timeout < 1)
timeout = 1;
} else
timeout = -1;
/* Hmm, nothing to do. Let's sleep */
-
+
if (pa_asyncmsgq_before_poll(u->sink->asyncmsgq) < 0)
continue;
@@ -192,7 +192,7 @@ static void thread_func(void *userdata) {
pa_log("poll() failed: %s", pa_cstrerror(errno));
goto fail;
}
-
+
pa_assert(r == 0 || pollfd.revents == POLLIN);
}
@@ -241,7 +241,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_sink_set_description(u->sink, pa_modargs_get_value(ma, "description", "NULL sink"));
u->block_size = pa_bytes_per_second(&ss) / 20; /* 50 ms */
-
+
if (u->block_size <= 0)
u->block_size = pa_frame_size(&ss);
@@ -249,7 +249,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("Failed to create thread.");
goto fail;
}
-
+
pa_modargs_free(ma);
return 0;
@@ -265,7 +265,7 @@ fail:
void pa__done(pa_core *c, pa_module*m) {
struct userdata *u;
-
+
pa_assert(c);
pa_assert(m);
@@ -278,7 +278,7 @@ void pa__done(pa_core *c, pa_module*m) {
pa_asyncmsgq_send(u->sink->asyncmsgq, PA_SINK_MESSAGE_SHUTDOWN, NULL);
pa_thread_free(u->thread);
}
-
+
pa_sink_unref(u->sink);
pa_xfree(u);
diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index 61672ede..e4735f61 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -124,9 +124,9 @@ static void thread_func(void *userdata) {
default:
pa_sink_process_msg(u->sink->asyncmsgq, object, code, data);
}
-
+
} else if (object == u->sink) {
-
+
case PA_SINK_MESSAGE_STOP:
pa_assert(running);
running = 0;
@@ -155,7 +155,7 @@ static void thread_func(void *userdata) {
default:
pa_sink_process_msg(u->sink->asyncmsgq, object, code, data);
}
-
+
pa_asyncmsgq_done(u->sink->asyncmsgq);
continue;
}
@@ -171,20 +171,20 @@ static void thread_func(void *userdata) {
if (!underrun) {
ssize_t l;
-
+
p = pa_memblock_acquire(u->memchunk.memblock);
l = pa_write(u->fd, (uint8_t*) p + u->memchunk.index, u->memchunk.length);
pa_memblock_release(p);
-
+
if (l < 0) {
if (errno != EINTR && errno != EAGAIN) {
pa_log("Failed to write data to FIFO: %s", pa_cstrerror(errno));
goto fail;
}
-
+
} else {
-
+
u->memchunk.index += l;
u->memchunk.length -= l;
@@ -202,7 +202,7 @@ static void thread_func(void *userdata) {
pollfd[POLLFD_FIFO].events = running && !underrun ? POLLOUT : 0;
/* Hmm, nothing to do. Let's sleep */
-
+
if (pa_asyncmsgq_before_poll(u->sink->asyncmsgq) < 0)
continue;
@@ -221,10 +221,10 @@ static void thread_func(void *userdata) {
pa_log("FIFO shutdown.");
goto fail;
}
-
+
pa_assert(pollfd[POLLFD_ASYNCQ].revents & ~POLLIN == 0);
}
-
+
fail:
/* We have to continue processing messages until we receive the
* SHUTDOWN message */
@@ -265,9 +265,9 @@ int pa__init(pa_core *c, pa_module*m) {
u->memchunk.memblock = NULL;
u->memchunk.length = 0;
m->userdata = u;
-
+
mkfifo(u->filename, 0666);
-
+
if ((u->fd = open(u->filename, O_RDWR)) < 0) {
pa_log("open('%s'): %s", p, pa_cstrerror(errno));
goto fail;
@@ -290,7 +290,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("Failed to create sink.");
goto fail;
}
-
+
u->sink->userdata = u;
pa_sink_set_owner(u->sink, m);
pa_sink_set_description(u->sink, t = pa_sprintf_malloc("Unix FIFO sink '%s'", p));
@@ -300,7 +300,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("Failed to create thread.");
goto fail;
}
-
+
pa_modargs_free(ma);
return 0;
@@ -328,7 +328,7 @@ void pa__done(pa_core *c, pa_module*m) {
pa_asyncmsgq_send(u->sink->asyncmsgq, PA_SINK_MESSAGE_SHUTDOWN, NULL);
pa_thread_free(u->thread);
}
-
+
pa_sink_unref(u->sink);
if (u->memchunk.memblock)
diff --git a/src/pulsecore/asyncmsgq.c b/src/pulsecore/asyncmsgq.c
index 31e27e7d..de5b2f9d 100644
--- a/src/pulsecore/asyncmsgq.c
+++ b/src/pulsecore/asyncmsgq.c
@@ -65,7 +65,7 @@ pa_asyncmsgq *pa_asyncmsgq_new(unsigned size) {
pa_assert_se(a->asyncq = pa_asyncq_new(size));
pa_assert_se(a->mutex = pa_mutex_new(0));
a->current = NULL;
-
+
return a;
}
@@ -82,10 +82,10 @@ void pa_asyncmsgq_free(pa_asyncmsgq *a) {
if (i->memchunk.memblock)
pa_memblock_unref(i->object);
-
+
if (i->userdata_free_cb)
i->userdata_free_cb(i->userdata);
-
+
if (pa_flist_push(PA_STATIC_FLIST_GET(asyncmsgq), i) < 0)
pa_xfree(i);
}
@@ -162,7 +162,7 @@ int pa_asyncmsgq_get(pa_asyncmsgq *a, pa_msgobject **object, int *code, void **u
*object = a->current->object;
if (chunk)
*chunk = a->chunk;
-
+
return 0;
}
@@ -183,7 +183,7 @@ void pa_asyncmsgq_done(pa_asyncmsgq *a, int ret) {
if (a->current->memchunk.memblock)
pa_memblock_unref(a->current->memchunk.memblock);
-
+
if (pa_flist_push(PA_STATIC_FLIST_GET(asyncmsgq), a->current) < 0)
pa_xfree(a->current);
}
@@ -194,14 +194,14 @@ void pa_asyncmsgq_done(pa_asyncmsgq *a, int ret) {
int pa_asyncmsgq_wait_for(pa_asyncmsgq *a, int code) {
int c;
pa_assert(a);
-
+
do {
-
+
if (pa_asyncmsgq_get(a, NULL, &c, NULL, 1) < 0)
return -1;
pa_asyncmsgq_done(a);
-
+
} while (c != code);
return 0;
diff --git a/src/pulsecore/asyncq.c b/src/pulsecore/asyncq.c
index 779cd479..54d36dc0 100644
--- a/src/pulsecore/asyncq.c
+++ b/src/pulsecore/asyncq.c
@@ -85,7 +85,7 @@ pa_asyncq *pa_asyncq_new(unsigned size) {
pa_xfree(l);
return NULL;
}
-
+
if (pipe(l->write_fds) < 0) {
pa_close(l->read_fds[0]);
pa_close(l->read_fds[1]);
@@ -104,7 +104,7 @@ void pa_asyncq_free(pa_asyncq *l, pa_free_cb_t free_cb) {
if (free_cb) {
void *p;
-
+
while ((p = pa_asyncq_pop(l, 0)))
free_cb(p);
}
@@ -113,7 +113,7 @@ void pa_asyncq_free(pa_asyncq *l, pa_free_cb_t free_cb) {
pa_close(l->read_fds[1]);
pa_close(l->write_fds[0]);
pa_close(l->write_fds[1]);
-
+
pa_xfree(l);
}
@@ -125,12 +125,12 @@ int pa_asyncq_push(pa_asyncq*l, void *p, int wait) {
pa_assert(p);
cells = PA_ASYNCQ_CELLS(l);
-
+
_Y;
idx = reduce(l, l->write_idx);
if (!pa_atomic_ptr_cmpxchg(&cells[idx], NULL, p)) {
-
+
/* First try failed. Let's wait for changes. */
if (!wait)
@@ -142,7 +142,7 @@ int pa_asyncq_push(pa_asyncq*l, void *p, int wait) {
for (;;) {
char x[20];
-
+
_Y;
if (pa_atomic_ptr_cmpxchg(&cells[idx], NULL, p))
@@ -155,21 +155,21 @@ int pa_asyncq_push(pa_asyncq*l, void *p, int wait) {
return -1;
}
}
-
+
_Y;
pa_atomic_dec(&l->write_waiting);
}
-
+
_Y;
l->write_idx++;
-
+
if (pa_atomic_load(&l->read_waiting)) {
char x = 'x';
_Y;
write(l->read_fds[1], &x, sizeof(x));
}
-
+
return 0;
}
@@ -188,7 +188,7 @@ void* pa_asyncq_pop(pa_asyncq*l, int wait) {
if (!(ret = pa_atomic_ptr_load(&cells[idx]))) {
/* First try failed. Let's wait for changes. */
-
+
if (!wait)
return NULL;
@@ -228,7 +228,7 @@ void* pa_asyncq_pop(pa_asyncq*l, int wait) {
_Y;
write(l->write_fds[1], &x, sizeof(x));
}
-
+
return ret;
}
@@ -253,7 +253,7 @@ int pa_asyncq_before_poll(pa_asyncq *l) {
return -1;
pa_atomic_inc(&l->read_waiting);
-
+
if (pa_atomic_ptr_load(&cells[idx])) {
pa_atomic_dec(&l->read_waiting);
return -1;
diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
index c80caf14..99ac74e1 100644
--- a/src/pulsecore/core.c
+++ b/src/pulsecore/core.c
@@ -53,9 +53,9 @@ static int core_process_msg(pa_msgobject *o, int code, void *userdata, pa_memchu
pa_core *c = PA_CORE(o);
pa_core_assert_ref(c);
-
+
switch (code) {
-
+
case PA_CORE_MESSAGE_UNLOAD_MODULE:
pa_module_unload(c, userdata);
return 0;
@@ -67,7 +67,7 @@ static int core_process_msg(pa_msgobject *o, int code, void *userdata, pa_memchu
static void asyncmsgq_cb(pa_mainloop_api*api, pa_io_event* e, int fd, pa_io_event_flags_t events, void *userdata) {
pa_core *c = userdata;
-
+
pa_assert(pa_asyncmsgq_get_fd(c->asyncmsgq) == fd);
pa_assert(events == PA_IO_EVENT_INPUT);
@@ -84,7 +84,7 @@ static void asyncmsgq_cb(pa_mainloop_api*api, pa_io_event* e, int fd, pa_io_even
pa_asyncmsgq_dispatch(object, code, data, &chunk);
pa_asyncmsgq_done(c->asyncmsgq, 0);
}
-
+
if (pa_asyncmsgq_before_poll(c->asyncmsgq) == 0)
break;
}
@@ -97,7 +97,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, int shared) {
pa_mempool *pool;
pa_assert(m);
-
+
if (shared) {
if (!(pool = pa_mempool_new(shared))) {
pa_log_warn("failed to allocate shared memory pool. Falling back to a normal memory pool.");
@@ -175,7 +175,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, int shared) {
pa_assert_se(c->asyncmsgq = pa_asyncmsgq_new(0));
pa_assert_se(pa_asyncmsgq_before_poll(c->asyncmsgq) == 0);
pa_assert_se(c->asyncmsgq_event = c->mainloop->io_new(c->mainloop, pa_asyncmsgq_get_fd(c->asyncmsgq), PA_IO_EVENT_INPUT, asyncmsgq_cb, c));
-
+
return c;
}
diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index dc2ebb48..86660b7a 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -48,7 +48,7 @@ typedef struct pa_core pa_core;
struct pa_core {
pa_msgobject parent;
-
+
/* A random value which may be used to identify this instance of
* PulseAudio. Not cryptographically secure in any way. */
uint32_t cookie;
diff --git a/src/pulsecore/flist.c b/src/pulsecore/flist.c
index 3805e1d1..022010b3 100644
--- a/src/pulsecore/flist.c
+++ b/src/pulsecore/flist.c
@@ -163,7 +163,7 @@ int pa_flist_push(pa_flist*l, void *p) {
assert(p);
cells = PA_FLIST_CELLS(l);
-
+
n = len = (int) l->size - pa_atomic_load(&l->length) + N_EXTRA_SCAN;
_Y;
idx = reduce(l, pa_atomic_load(&l->write_idx));
diff --git a/src/pulsecore/msgobject.c b/src/pulsecore/msgobject.c
index ea404ccf..ce9f22f2 100644
--- a/src/pulsecore/msgobject.c
+++ b/src/pulsecore/msgobject.c
@@ -30,7 +30,7 @@
pa_msgobject *pa_msgobject_new_internal(size_t size, const char *type_name) {
pa_msgobject *o;
-
+
pa_assert(size > sizeof(pa_msgobject));
pa_assert(type_name);
diff --git a/src/pulsecore/object.c b/src/pulsecore/object.c
index de7d5ad5..e6ed53b2 100644
--- a/src/pulsecore/object.c
+++ b/src/pulsecore/object.c
@@ -30,7 +30,7 @@
pa_object *pa_object_new_internal(size_t size, const char *type_name) {
pa_object *o;
-
+
pa_assert(size > sizeof(pa_object));
pa_assert(type_name);
diff --git a/src/pulsecore/object.h b/src/pulsecore/object.h
index 8fccf191..e195a359 100644
--- a/src/pulsecore/object.h
+++ b/src/pulsecore/object.h
@@ -68,5 +68,5 @@ static inline int pa_object_refcnt(pa_object *o) {
pa_object_assert_ref(PA_OBJECT(o)); \
} \
struct __stupid_useless_struct_to_allow_trailing_semicolon
-
+
#endif
diff --git a/src/pulsecore/once-posix.c b/src/pulsecore/once-posix.c
index 7ccd08ed..25ccb035 100644
--- a/src/pulsecore/once-posix.c
+++ b/src/pulsecore/once-posix.c
@@ -35,17 +35,17 @@
/* Not reentrant -- how could it be? */
void pa_once(pa_once_t *control, pa_once_func_t func) {
pa_mutex *m;
-
+
pa_assert(control);
pa_assert(func);
if (pa_atomic_load(&control->done))
return;
-
+
pa_atomic_inc(&control->ref);
-
+
for (;;) {
-
+
if ((m = pa_atomic_ptr_load(&control->mutex))) {
/* The mutex is stored in locked state, hence let's just
@@ -57,7 +57,7 @@ void pa_once(pa_once_t *control, pa_once_func_t func) {
pa_assert_se(m = pa_mutex_new(0));
pa_mutex_lock(m);
-
+
if (pa_atomic_ptr_cmpxchg(&control->mutex, NULL, m)) {
func();
pa_atomic_store(&control->done, 1);
@@ -71,7 +71,7 @@ void pa_once(pa_once_t *control, pa_once_func_t func) {
}
pa_assert(pa_atomic_load(&control->done));
-
+
if (pa_atomic_dec(&control->ref) <= 1) {
pa_assert(pa_atomic_ptr_cmpxchg(&control->mutex, m, NULL));
pa_mutex_free(m);
diff --git a/src/pulsecore/protocol-simple.c b/src/pulsecore/protocol-simple.c
index 288cf87a..b7a4cc78 100644
--- a/src/pulsecore/protocol-simple.c
+++ b/src/pulsecore/protocol-simple.c
@@ -86,11 +86,11 @@ enum {
};
enum {
- MESSAGE_REQUEST_DATA, /* data from source output to main loop */
+ MESSAGE_REQUEST_DATA, /* data from source output to main loop */
MESSAGE_POST_DATA /* data from source output to main loop */
};
-
+
#define PLAYBACK_BUFFER_SECONDS (.5)
#define PLAYBACK_BUFFER_FRAGMENTS (10)
#define RECORD_BUFFER_SECONDS (5)
@@ -105,15 +105,15 @@ static void connection_free(struct connection *c) {
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->playback.current_memblock)
pa_memblock_unref(c->playback.current_memblock);
-
+
if (c->client)
pa_client_free(c->client);
if (c->io)
@@ -122,7 +122,7 @@ static void connection_free(struct connection *c) {
pa_memblockq_free(c->input_memblockq);
if (c->output_memblockq)
pa_memblockq_free(c->output_memblockq);
-
+
pa_xfree(c);
}
@@ -133,7 +133,7 @@ static int do_read(struct connection *c) {
void *p;
pa_assert(c);
-
+
if (!c->sink_input || !(l = pa_atomic_load(&c->playback.missing)))
return 0;
@@ -155,12 +155,12 @@ static int do_read(struct connection *c) {
p = pa_memblock_acquire(c->playback.current_memblock);
r = pa_iochannel_read(c->io, (uint8_t*) p + c->playback.memblock_index, l);
pa_memblock_release(c->playback.current_memblock);
-
+
if (r <= 0) {
if (errno == EINTR || errno == EAGAIN)
return 0;
-
+
pa_log_debug("read(): %s", r == 0 ? "EOF" : pa_cstrerror(errno));
return -1;
}
@@ -195,7 +195,7 @@ static int do_write(struct connection *c) {
p = pa_memblock_acquire(chunk.memblock);
r = pa_iochannel_write(c->io, (uint8_t*) p+chunk.index, chunk.length);
pa_memblock_release(chunk.memblock);
-
+
pa_memblock_unref(chunk.memblock);
if (r < 0) {
@@ -208,7 +208,7 @@ static int do_write(struct connection *c) {
}
pa_memblockq_drop(c->output_memblockq, &chunk, r);
-
+
return 0;
}
@@ -251,7 +251,7 @@ fail:
/* Called from thread context */
static int sink_input_process_msg(pa_sink_input *i, int code, void *userdata, const pa_memchunk *chunk) {
struct connection*c;
-
+
pa_assert(i);
c = i->userdata;
pa_assert(c);
@@ -265,10 +265,10 @@ static int sink_input_process_msg(pa_sink_input *i, int code, void *userdata, co
pa_memblockq_push_align(c->input_memblockq, chunk);
return 0;
}
-
+
case PA_SINK_INPUT_MESSAGE_GET_LATENCY: {
pa_usec_t *r = userdata;
-
+
*r = pa_bytes_to_usec(pa_memblockq_get_length(c->input_memblockq), &c->sink_input->sample_spec);
/* Fall through, the default handler will add in the extra
@@ -283,7 +283,7 @@ static int sink_input_process_msg(pa_sink_input *i, int code, void *userdata, co
/* Called from thread context */
static int sink_input_peek_cb(pa_sink_input *i, pa_memchunk *chunk) {
struct connection*c;
-
+
pa_assert(i);
c = i->userdata;
pa_assert(c);
@@ -301,7 +301,7 @@ static int sink_input_peek_cb(pa_sink_input *i, pa_memchunk *chunk) {
static void sink_input_drop_cb(pa_sink_input *i, const pa_memchunk *chunk, size_t length) {
struct connection*c = i->userdata;
size_t old, new;
-
+
pa_assert(i);
pa_assert(c);
pa_assert(length);
@@ -320,7 +320,7 @@ static void sink_input_drop_cb(pa_sink_input *i, const pa_memchunk *chunk, size_
static void sink_input_kill_cb(pa_sink_input *i) {
pa_assert(i);
pa_assert(i->userdata);
-
+
connection_free((struct connection *) i->userdata);
}
@@ -328,7 +328,7 @@ static void sink_input_kill_cb(pa_sink_input *i) {
static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk) {
struct connection *c;
-
+
pa_assert(o);
c = o->userdata;
pa_assert(c);
@@ -343,17 +343,17 @@ static void source_output_kill_cb(pa_source_output *o) {
pa_assert(o);
c = o->userdata;
pa_assert(c);
-
+
connection_free(c);
}
static pa_usec_t source_output_get_latency_cb(pa_source_output *o) {
struct connection*c;
-
+
pa_assert(o);
c = o->userdata;
pa_assert(c);
-
+
return pa_bytes_to_usec(pa_memblockq_get_length(c->output_memblockq), &c->source_output->sample_spec);
}
@@ -361,7 +361,7 @@ static pa_usec_t source_output_get_latency_cb(pa_source_output *o) {
static void client_kill_cb(pa_client *client) {
struct connection*c;
-
+
pa_assert(client);
c = client->userdata;
pa_assert(c);
@@ -386,7 +386,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
pa_protocol_simple *p = userdata;
struct connection *c = NULL;
char cname[256];
-
+
pa_assert(s);
pa_assert(io);
pa_assert(p);
@@ -415,7 +415,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
c->client->kill = client_kill_cb;
c->client->userdata = c;
-
+
if (p->mode & PLAYBACK) {
pa_sink_input_new_data data;
size_t l;
@@ -493,7 +493,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
pa_iochannel_set_callback(c->io, io_callback, c);
pa_idxset_put(p->connections, c, NULL);
-
+
return;
fail:
@@ -504,7 +504,7 @@ fail:
static void asyncmsgq_cb(pa_mainloop_api*api, pa_io_event* e, int fd, pa_io_event_flags_t events, void *userdata) {
pa_protocol_simple *p = userdata;
int do_some_work = 0;
-
+
pa_assert(pa_asyncmsgq_get_fd(p->asyncmsgq) == fd);
pa_assert(events == PA_IO_EVENT_INPUT);
@@ -520,7 +520,7 @@ static void asyncmsgq_cb(pa_mainloop_api*api, pa_io_event* e, int fd, pa_io_even
connection *c = object;
pa_assert(c);
-
+
switch (code) {
case MESSAGE_REQUEST_DATA:
@@ -535,7 +535,7 @@ static void asyncmsgq_cb(pa_mainloop_api*api, pa_io_event* e, int fd, pa_io_even
pa_asyncmsgq_done(p->asyncmsgq);
}
-
+
if (pa_asyncmsgq_before_poll(p->asyncmsgq) == 0)
break;
}
@@ -544,7 +544,7 @@ static void asyncmsgq_cb(pa_mainloop_api*api, pa_io_event* e, int fd, pa_io_even
pa_protocol_simple* pa_protocol_simple_new(pa_core *core, pa_socket_server *server, pa_module *m, pa_modargs *ma) {
pa_protocol_simple* p = NULL;
int enable;
-
+
pa_assert(core);
pa_assert(server);
pa_assert(ma);
@@ -588,13 +588,13 @@ pa_protocol_simple* pa_protocol_simple_new(pa_core *core, pa_socket_server *serv
pa_assert_se(pa_asyncmsgq_before_poll(p->asyncmsgq) == 0);
pa_assert_se(p->asyncmsgq_event = core->mainloop->io_event_new(core->mainloop, pa_asyncmsgq_get_fd(p->asyncmsgq), PA_IO_EVENT_INPUT, p));
-
+
return p;
fail:
if (p)
pa_protocol_simple_free(p);
-
+
return NULL;
}
@@ -618,7 +618,7 @@ void pa_protocol_simple_free(pa_protocol_simple *p) {
pa_asyncmsgq_after_poll(c->asyncmsgq);
pa_asyncmsgq_free(p->asyncmsgq);
}
-
+
pa_xfree(p);
}
diff --git a/src/pulsecore/semaphore-posix.c b/src/pulsecore/semaphore-posix.c
index 71ec57a2..750c2afc 100644
--- a/src/pulsecore/semaphore-posix.c
+++ b/src/pulsecore/semaphore-posix.c
@@ -60,7 +60,7 @@ void pa_semaphore_post(pa_semaphore *s) {
void pa_semaphore_wait(pa_semaphore *s) {
int ret;
pa_assert(s);
-
+
do {
ret = sem_wait(&s->sem);
} while (ret < 0 && errno == EINTR);
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index da7b58b7..00b82d26 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -52,7 +52,7 @@ pa_sink_input_new_data* pa_sink_input_new_data_init(pa_sink_input_new_data *data
memset(data, 0, sizeof(*data));
data->resample_method = PA_RESAMPLER_INVALID;
-
+
return data;
}
@@ -117,7 +117,7 @@ pa_sink_input* pa_sink_input_new(
if (!data->channel_map_is_set) {
if (data->sink->channel_map.channels == data->sample_spec.channels)
data->channel_map = data->sink->channel_map;
- else
+ else
pa_channel_map_init_auto(&data->channel_map, data->sample_spec.channels, PA_CHANNEL_MAP_DEFAULT);
}
@@ -132,7 +132,7 @@ pa_sink_input* pa_sink_input_new(
if (!data->muted_is_set)
data->muted = 0;
-
+
if (data->resample_method == PA_RESAMPLER_INVALID)
data->resample_method = core->resample_method;
@@ -163,7 +163,7 @@ pa_sink_input* pa_sink_input_new(
i->parent.parent.free = sink_input_free;
i->parent.process_msg = pa_sink_input_process_msg;
-
+
i->core = core;
pa_atomic_load(&i->state, PA_SINK_INPUT_DRAINED);
i->flags = flags;
@@ -172,14 +172,14 @@ pa_sink_input* pa_sink_input_new(
i->module = data->module;
i->sink = data->sink;
i->client = data->client;
-
+
i->resample_method = data->resample_method;
i->sample_spec = data->sample_spec;
i->channel_map = data->channel_map;
i->volume = data->volume;
i->muted = data->muted;
-
+
i->process_msg = NULL;
i->peek = NULL;
i->drop = NULL;
@@ -214,7 +214,7 @@ void pa_sink_input_disconnect(pa_sink_input *i) {
pa_return_if_fail(pa_sink_input_get_state(i) != PA_SINK_INPUT_DISCONNECTED);
pa_asyncmsgq_send(i->sink->asyncmsgq, i->sink, PA_SINK_MESSAGE_REMOVE_INPUT, i, NULL);
-
+
pa_idxset_remove_by_data(i->sink->core->sink_inputs, i, NULL);
pa_idxset_remove_by_data(i->sink->inputs, i, NULL);
@@ -236,7 +236,7 @@ static void sink_input_free(pa_msgobject *o) {
pa_assert(i);
pa_assert(pa_sink_input_refcnt(i) == 0);
-
+
pa_sink_input_disconnect(i);
pa_log_info("Freeing output %u \"%s\"", i->index, i->name);
@@ -281,7 +281,7 @@ pa_usec_t pa_sink_input_get_latency(pa_sink_input *i) {
if (pa_asyncmsgq_send(i->sink->asyncmsgq, i->sink, PA_SINK_INPUT_MESSAGE_GET_LATENCY, &r, NULL) < 0)
r = 0;
-
+
if (i->get_latency)
r += i->get_latency(i);
@@ -293,7 +293,7 @@ int pa_sink_input_peek(pa_sink_input *i, pa_memchunk *chunk, pa_cvolume *volume)
int do_volume_adj_here;
int volume_is_norm;
pa_sink_input_state_t state;
-
+
pa_sink_input_assert_ref(i);
pa_assert(chunk);
pa_assert(volume);
@@ -508,7 +508,7 @@ int pa_sink_input_set_rate(pa_sink_input *i, uint32_t rate) {
i->sample_spec.rate = rate;
pa_asyncmsgq_post(s->asyncmsgq, pa_sink_input_ref(i), PA_SINK_INPUT_MESSAGE_SET_RATE, PA_UINT_TO_PTR(rate), NULL, pa_sink_input_unref, NULL);
-
+
pa_subscription_post(i->sink->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index);
return 0
}
@@ -543,7 +543,7 @@ int pa_sink_input_move_to(pa_sink_input *i, pa_sink *dest, int immediately) {
pa_sink_assert_ref(dest);
return -1;
-
+
/* origin = i->sink; */
/* if (dest == origin) */
@@ -697,32 +697,32 @@ int pa_sink_input_move_to(pa_sink_input *i, pa_sink *dest, int immediately) {
int pa_sink_input_process_msg(pa_msgobject *o, int code, void *userdata, pa_memchunk *chunk) {
pa_sink_input *i = PA_SINK_INPUT(o);
-
+
pa_sink_input_assert_ref(i);
switch (code) {
case PA_SINK_INPUT_MESSAGE_SET_VOLUME:
s->thread_info.soft_volume = *((pa_cvolume*) userdata);
return 0;
-
+
case PA_SINK_INPUT_MESSAGE_SET_MUTE:
s->thread_info.soft_muted = PA_PTR_TO_UINT(userdata);
return 0;
-
+
case PA_SINK_INPUT_MESSAGE_GET_LATENCY: {
pa_usec_t *r = userdata;
-
+
if (i->thread_info.resampled_chunk.memblock)
*r += pa_bytes_to_usec(i->resampled_chunk.length, &i->sink->sample_spec);
/* if (i->move_silence) */
/* r += pa_bytes_to_usec(i->move_silence, &i->sink->sample_spec); */
-
+
return 0;
}
-
+
case PA_SINK_INPUT_MESSAGE_SET_RATE: {
-
+
i->thread_info.sample_spec.rate = PA_PTR_TO_UINT(userdata);
pa_resampler_set_input_rate(i->resampler, PA_PTR_TO_UINT(userdata));
diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
index 64a7a73f..338d6962 100644
--- a/src/pulsecore/sink-input.h
+++ b/src/pulsecore/sink-input.h
@@ -52,7 +52,7 @@ typedef enum pa_sink_input_flags {
struct pa_sink_input {
pa_msgobject parent;
-
+
uint32_t index;
pa_core *core;
pa_atomic_t state;
@@ -66,11 +66,11 @@ struct pa_sink_input {
pa_sample_spec sample_spec;
pa_channel_map channel_map;
-
+
pa_cvolume volume;
int muted;
- int (*process_msg)(pa_sink_input *i, int code, void *userdata);
+ int (*process_msg)(pa_sink_input *i, int code, void *userdata);
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 */
@@ -81,10 +81,10 @@ struct pa_sink_input {
struct {
pa_sample_spec sample_spec;
-
+
pa_memchunk resampled_chunk;
pa_resampler *resampler; /* may be NULL */
-
+
/* Some silence to play before the actual data. This is used to
* compensate for latency differences when moving a sink input
* "hot" between sinks. */
@@ -94,7 +94,7 @@ struct pa_sink_input {
pa_cvolume volume;
int muted;
} thread_info;
-
+
void *userdata;
};
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 36205597..0e022d92 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -86,7 +86,7 @@ pa_sink* pa_sink_new(
s->parent.parent.free = sink_free;
s->parent.process_msg = pa_sink_process_msg;
-
+
s->core = core;
pa_atomic_store(&s->state, PA_SINK_IDLE);
s->name = pa_xstrdup(name);
@@ -115,7 +115,7 @@ pa_sink* pa_sink_new(
s->userdata = NULL;
pa_assert_se(s->asyncmsgq = pa_asyncmsgq_new(0));
-
+
r = pa_idxset_put(core->sinks, s, &s->index);
pa_assert(s->index != PA_IDXSET_INVALID && r >= 0);
@@ -139,7 +139,7 @@ pa_sink* pa_sink_new(
s->thread_info.inputs = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
s->thread_info.soft_volume = s->volume;
s->thread_info.soft_muted = s->muted;
-
+
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIPTION_EVENT_NEW, s->index);
return s;
@@ -163,7 +163,7 @@ static void sink_start(pa_sink *s) {
static void sink_stop(pa_sink *s) {
pa_sink_state_t state;
int stop;
-
+
pa_assert(s);
state = pa_sink_get_state(s);
pa_return_if_fail(state == PA_SINK_RUNNING || state == PA_SINK_SUSPENDED);
@@ -216,7 +216,7 @@ void pa_sink_disconnect(pa_sink* s) {
static void sink_free(pa_object *o) {
pa_sink *s = PA_SINK(o);
-
+
pa_assert(s);
pa_assert(pa_sink_refcnt(s) == 0);
@@ -230,11 +230,11 @@ static void sink_free(pa_object *o) {
}
pa_idxset_free(s->inputs, NULL, NULL);
-
+
pa_hashmap_free(s->thread_info.inputs, (pa_free2_cb_t) pa_sink_input_unref, NULL);
pa_asyncmsgq_free(s->asyncmsgq);
-
+
pa_xfree(s->name);
pa_xfree(s->description);
pa_xfree(s->driver);
@@ -246,7 +246,7 @@ void pa_sink_update_status(pa_sink*s) {
if (pa_sink_get_state(s) == PA_SINK_SUSPENDED)
return;
-
+
if (pa_sink_used_by(s) > 0)
sink_start(s);
else
@@ -270,7 +270,7 @@ void pa_sink_suspend(pa_sink *s, int suspend) {
s->stop(s);
else
pa_asyncmsgq_post(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_STOP, NULL, NULL, NULL);
-
+
} else {
pa_atomic_store(&s->state, PA_SINK_RUNNING);
@@ -417,38 +417,38 @@ int pa_sink_render_into(pa_sink*s, pa_memchunk *target) {
else {
void *src, *ptr;
pa_cvolume volume;
-
+
ptr = pa_memblock_acquire(target->memblock);
src = pa_memblock_acquire(info[0].chunk.memblock);
-
+
memcpy((uint8_t*) ptr + target->index,
(uint8_t*) src + info[0].chunk.index,
target->length);
-
+
pa_memblock_release(target->memblock);
pa_memblock_release(info[0].chunk.memblock);
-
+
pa_sw_cvolume_multiply(&volume, &s->thread_info.soft_volume, &info[0].volume);
if (!pa_cvolume_is_norm(&volume))
pa_volume_memchunk(target, &s->sample_spec, &volume);
}
-
+
} else {
void *ptr;
ptr = pa_memblock_acquire(target->memblock);
-
+
target->length = pa_mix(info, n,
(uint8_t*) ptr + target->index,
target->length,
&s->sample_spec,
&s->thread_info.soft_volume,
s->thread_info.soft_muted);
-
+
pa_memblock_release(target->memblock);
}
-
+
inputs_drop(s, info, n, target->length);
if (s->monitor_source)
@@ -512,12 +512,12 @@ void pa_sink_render_full(pa_sink *s, size_t length, pa_memchunk *result) {
pa_usec_t pa_sink_get_latency(pa_sink *s) {
pa_usec_t usec = 0;
-
+
pa_sink_assert_ref(s);
if (s->get_latency)
return s->get_latency(s);
-
+
if (pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_LATENCY, &usec, NULL) < 0)
return 0;
@@ -532,7 +532,7 @@ void pa_sink_set_volume(pa_sink *s, const pa_cvolume *volume) {
changed = !pa_cvolume_equal(volume, &s->volume);
s->volume = *volume;
-
+
if (s->set_volume && s->set_volume(s) < 0)
s->set_volume = NULL;
@@ -549,7 +549,7 @@ const pa_cvolume *pa_sink_get_volume(pa_sink *s) {
pa_sink_assert_ref(s);
old_volume = s->volume;
-
+
if (s->get_volume && s->get_volume(s) < 0)
s->get_volume = NULL;
@@ -558,13 +558,13 @@ const pa_cvolume *pa_sink_get_volume(pa_sink *s) {
if (!pa_cvolume_equal(&old_volume, &s->volume))
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
-
+
return &s->volume;
}
void pa_sink_set_mute(pa_sink *s, int mute) {
int changed;
-
+
pa_sink_assert_ref(s);
changed = s->muted != mute;
@@ -581,11 +581,11 @@ void pa_sink_set_mute(pa_sink *s, int mute) {
int pa_sink_get_mute(pa_sink *s) {
int old_muted;
-
+
pa_sink_assert_ref(s);
old_muted = s->muted;
-
+
if (s->get_mute && s->get_mute(s) < 0)
s->get_mute = NULL;
@@ -594,7 +594,7 @@ int pa_sink_get_mute(pa_sink *s) {
if (old_muted != s->muted)
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
-
+
return s->muted;
}
@@ -658,29 +658,29 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, pa_memchunk *
pa_hashmap_put(s->thread_info.inputs, PA_UINT32_TO_PTR(i->index), pa_sink_input_ref(i));
return 0;
}
-
+
case PA_SINK_MESSAGE_REMOVE_INPUT: {
pa_sink_input *i = userdata;
pa_hashmap_remove(s->thread_info.inputs, PA_UINT32_TO_PTR(i->index));
return 0;
}
-
+
case PA_SINK_MESSAGE_SET_VOLUME:
s->thread_info.soft_volume = *((pa_cvolume*) userdata);
return 0;
-
+
case PA_SINK_MESSAGE_SET_MUTE:
s->thread_info.soft_muted = PA_PTR_TO_UINT(userdata);
return 0;
-
+
case PA_SINK_MESSAGE_GET_VOLUME:
*((pa_cvolume*) userdata) = s->thread_info.soft_volume;
return 0;
-
+
case PA_SINK_MESSAGE_GET_MUTE:
*((int*) userdata) = s->thread_info.soft_muted;
return 0;
-
+
default:
return -1;
}
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index c1aa3393..517c033d 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -113,7 +113,7 @@ pa_source_output* pa_source_output_new(
if ((flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ||
!pa_sample_spec_equal(&data->sample_spec, &data->source->sample_spec) ||
!pa_channel_map_equal(&data->channel_map, &data->source->channel_map)) {
-
+
if (!(resampler = pa_resampler_new(
core->mempool,
&data->source->sample_spec, &data->source->channel_map,
@@ -127,10 +127,10 @@ pa_source_output* pa_source_output_new(
}
o = pa_source_output_new(pa_source_output);
-
+
o->parent.parent.free = source_output_free;
o->parent.process_msg = pa_source_output_process_msg;
-
+
o->core = core;
pa_atomic_load(&o->state, PA_SOURCE_OUTPUT_RUNNING);
o->flags = flags;
@@ -173,7 +173,7 @@ void pa_source_output_disconnect(pa_source_output*o) {
pa_assert(o->source->core);
pa_asyncmsgq_send(i->sink->asyncmsgq, i->sink, PA_SOURCE_MESSAGE_REMOVE_OUTPUT, o, NULL);
-
+
pa_idxset_remove_by_data(o->source->core->source_outputs, o, NULL);
pa_idxset_remove_by_data(o->source->outputs, o, NULL);
@@ -190,7 +190,7 @@ void pa_source_output_disconnect(pa_source_output*o) {
static void source_output_free(pa_msgobject* mo) {
pa_source_output *o = PA_SOURCE_OUTPUT(mo);
-
+
pa_assert(pa_source_output_refcnt(o) == 0);
pa_source_output_disconnect(o);
@@ -207,7 +207,7 @@ static void source_output_free(pa_msgobject* mo) {
void pa_source_output_put(pa_source_output *o) {
pa_source_output_assert_ref(o);
-
+
pa_asyncmsgq_post(o->source->asyncmsgq, o->source, PA_SOURCE_MESSAGE_ADD_OUTPUT, o, NULL, pa_source_unref, pa_source_output_unref);
pa_source_update_status(o->source);
@@ -228,7 +228,7 @@ pa_usec_t pa_source_output_get_latency(pa_source_output *o) {
if (pa_asyncmsgq_send(o->source->asyncmsgq, i->source, PA_SOURCE_OUTPUT_MESSAGE_GET_LATENCY, &r, NULL) < 0)
r = 0;
-
+
if (o->get_latency)
r += o->get_latency(o);
@@ -244,12 +244,12 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) {
pa_assert(chunk->length);
state = pa_source_output_get_state(o);
-
+
if (!o->push || state == PA_SOURCE_OUTPUT_DISCONNECTED || state == PA_SOURCE_OUTPUT_CORKED)
return;
pa_assert(state = PA_SOURCE_OUTPUT_RUNNING);
-
+
if (!o->resampler) {
o->push(o, chunk);
return;
@@ -289,7 +289,7 @@ int pa_source_output_set_rate(pa_source_output *o, uint32_t rate) {
i->sample_spec.rate = rate;
pa_asyncmsgq_post(s->asyncmsgq, pa_source_output_ref(i), PA_SOURCE_OUTPUT_MESSAGE_SET_RATE, PA_UINT_TO_PTR(rate), NULL, pa_source_output_unref, NULL);
-
+
pa_subscription_post(o->source->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT!|PA_SUBSCRIPTION_EVENT_CHANGE, i->index);
return 0;
}
@@ -312,7 +312,7 @@ void pa_source_output_set_name(pa_source_output *o, const char *name) {
pa_resample_method_t pa_source_output_get_resample_method(pa_source_output *o) {
pa_source_output_assert_ref(o);
- return o->resample_method;
+ return o->resample_method;
}
int pa_source_output_move_to(pa_source_output *o, pa_source *dest) {
@@ -323,7 +323,7 @@ int pa_source_output_move_to(pa_source_output *o, pa_source *dest) {
pa_source_assert_ref(dest);
return -1;
-
+
/* origin = o->source; */
/* if (dest == origin) */
@@ -377,13 +377,13 @@ int pa_source_output_move_to(pa_source_output *o, pa_source *dest) {
int pa_source_output_process_msg(pa_msgobject *mo, int code, void *userdata, pa_memchunk* chunk) {
pa_source_output *o = PA_SOURCE_OUTPUT(o);
-
+
pa_source_output_assert_ref(i);
switch (code) {
case PA_SOURCE_OUTPUT_MESSAGE_SET_RATE: {
-
+
i->thread_info.sample_spec.rate = PA_PTR_TO_UINT(userdata);
pa_resampler_set_output_rate(i->resampler, PA_PTR_TO_UINT(userdata));
diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h
index 0f9c3bae..e7c2c131 100644
--- a/src/pulsecore/source-output.h
+++ b/src/pulsecore/source-output.h
@@ -48,7 +48,7 @@ typedef enum pa_source_output_flags {
struct pa_source_output {
pa_msgobject parent;
-
+
uint32_t index;
pa_core *core;
pa_atomic_t state;
@@ -72,10 +72,10 @@ struct pa_source_output {
struct {
pa_sample_spec sample_spec;
-
+
pa_resampler* resampler; /* may be NULL */
} thread_info;
-
+
void *userdata;
};
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index fd3c85d7..7d013387 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -78,7 +78,7 @@ pa_source* pa_source_new(
s->parent.parent.free = source_free;
s->parent.process_msg = pa_source_process_msg;
-
+
s->core = core;
pa_atomic_store(&s->state, PA_SOURCE_IDLE);
s->name = pa_xstrdup(name);
@@ -108,7 +108,7 @@ pa_source* pa_source_new(
s->userdata = NULL;
pa_assert_se(s->asyncmsgq = pa_asyncmsgq_new(0));
-
+
r = pa_idxset_put(core->sources, s, &s->index);
assert(s->index != PA_IDXSET_INVALID && r >= 0);
@@ -118,7 +118,7 @@ pa_source* pa_source_new(
s->thread_info.outputs = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
s->thread_info.soft_volume = s->volume;
s->thread_info.soft_muted = s->muted;
-
+
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCRIPTION_EVENT_NEW, s->index);
return s;
@@ -142,7 +142,7 @@ static void source_start(pa_source *s) {
static void source_stop(pa_source *s) {
pa_source_state_t state;
int stop;
-
+
pa_assert(s);
state = pa_source_get_state(s);
pa_return_if_fail(state == PA_SOURCE_RUNNING || state == PA_SOURCE_SUSPENDED);
@@ -165,7 +165,7 @@ void pa_source_disconnect(pa_source *s) {
pa_return_if_fail(pa_sink_get_state(s) != PA_SINK_DISCONNECT);
source_stop(s);
-
+
pa_atomic_store(&s->state, PA_SOURCE_DISCONNECTED);
pa_namereg_unregister(s->core, s->name);
@@ -192,7 +192,7 @@ void pa_source_disconnect(pa_source *s) {
static void source_free(pa_msgobject *o) {
pa_source *s = PA_SOURCE(o);
-
+
pa_assert(s);
pa_assert(pa_source_refcnt(s) == 0);
@@ -204,7 +204,7 @@ static void source_free(pa_msgobject *o) {
pa_hashmap_free(s->thread_info.outputs, pa_sink_output_unref, NULL);
pa_asyncmsgq_free(s->asyncmsgq);
-
+
pa_xfree(s->name);
pa_xfree(s->description);
pa_xfree(s->driver);
@@ -216,7 +216,7 @@ void pa_source_update_status(pa_source*s) {
if (pa_source_get_state(s) == PA_SOURCE_STATE_SUSPENDED)
return;
-
+
if (pa_source_used_by(s) > 0)
source_start(s);
else
@@ -240,7 +240,7 @@ void pa_source_suspend(pa_source *s, int suspend) {
s->stop(s);
else
pa_asyncmsgq_post(s->asyncmsgq, s, PA_SOURCE_MESSAGE_STOP, NULL, NULL, pa_source_unref, NULL);
-
+
} else {
pa_atomic_store(&s->state, PA_SOURCE_RUNNING);
@@ -254,7 +254,7 @@ void pa_source_suspend(pa_source *s, int suspend) {
void pa_source_post(pa_source*s, const pa_memchunk *chunk) {
pa_source_output *o;
void *state = NULL;
-
+
pa_source_assert_ref(s);
pa_assert(chunk);
@@ -263,7 +263,7 @@ void pa_source_post(pa_source*s, const pa_memchunk *chunk) {
pa_memblock_ref(vchunk.memblock);
pa_memchunk_make_writable(&vchunk, 0);
-
+
if (s->thread_info.muted || pa_cvolume_is_muted(s->thread_info.volume))
pa_silence_memchunk(&vchunk, &s->sample_spec);
else
@@ -271,10 +271,10 @@ void pa_source_post(pa_source*s, const pa_memchunk *chunk) {
while ((o = pa_hashmap_iterate(s->thread_info.outputs, &state, NULL)))
pa_source_output_push(o, &vchunk);
-
+
pa_memblock_unref(vchunk.memblock);
} else {
-
+
while ((o = pa_hashmap_iterate(s->thread_info.outputs, &state, NULL)))
pa_source_output_push(o, chunk);
@@ -303,7 +303,7 @@ void pa_source_set_volume(pa_source *s, const pa_cvolume *volume) {
changed = !pa_cvolume_equal(volume, s->volume);
s->volume = *volume;
-
+
if (s->set_volume && s->set_volume(s) < 0)
s->set_volume = NULL;
@@ -318,7 +318,7 @@ const pa_cvolume *pa_source_get_volume(pa_source *s) {
pa_source_assert_ref(s);
old_volume = s->volume;
-
+
if (s->get_volume && s->get_volume(s) < 0)
s->get_volume = NULL;
@@ -327,13 +327,13 @@ const pa_cvolume *pa_source_get_volume(pa_source *s) {
if (!pa_cvolume_equal(&old_volume, &s->volume))
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
-
+
return &s->volume;
}
void pa_source_set_mute(pa_source *s, pa_mixer_t m, int mute) {
int changed;
-
+
pa_source_assert_ref(s);
changed = s->muted != mute;
@@ -350,11 +350,11 @@ void pa_source_set_mute(pa_source *s, pa_mixer_t m, int mute) {
int pa_source_get_mute(pa_source *s, pa_mixer_t m) {
int old_muted;
-
+
pa_source_assert_ref(s);
old_muted = s->muted;
-
+
if (s->get_mute && s->get_mute(s) < 0)
s->get_mute = NULL;
@@ -363,7 +363,7 @@ int pa_source_get_mute(pa_source *s, pa_mixer_t m) {
if (old_muted != s->muted)
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
-
+
return s->muted;
}
@@ -374,7 +374,7 @@ void pa_source_set_module(pa_source *s, pa_module *m) {
return;
s->module = m;
-
+
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
}
@@ -409,29 +409,29 @@ int pa_source_process_msg(pa_msgobject *o, void *object, int code, pa_memchunk *
pa_hashmap_put(s->thread_info.outputs, PA_UINT32_TO_PTR(i->index), pa_source_output_ref(i));
return 0;
}
-
+
case PA_SOURCE_MESSAGE_REMOVE_INPUT: {
pa_source_input *i = userdata;
pa_hashmap_remove(s->thread_info.outputs, PA_UINT32_TO_PTR(i->index), pa_source_output_ref(i));
return 0;
}
-
+
case PA_SOURCE_MESSAGE_SET_VOLUME:
s->thread_info.soft_volume = *((pa_cvolume*) userdata);
return 0;
-
+
case PA_SOURCE_MESSAGE_SET_MUTE:
s->thread_info.soft_muted = PA_PTR_TO_UINT(userdata);
return 0;
-
+
case PA_SOURCE_MESSAGE_GET_VOLUME:
*((pa_cvolume*) userdata) = s->thread_info.soft_volume;
return 0;
-
+
case PA_SOURCE_MESSAGE_GET_MUTE:
*((int*) userdata) = s->thread_info.soft_muted;
return 0;
-
+
default:
return -1;
}
diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h
index 1e20c6e1..b41b1bc3 100644
--- a/src/pulsecore/source.h
+++ b/src/pulsecore/source.h
@@ -54,7 +54,7 @@ typedef enum pa_source_state {
struct pa_source {
pa_msgobject parent;
-
+
uint32_t index;
pa_core *core;
pa_atomic_t state;
@@ -91,7 +91,7 @@ struct pa_source {
pa_cvolume soft_volume;
int soft_muted;
} thread_info;
-
+
void *userdata;
};
diff --git a/src/tests/asyncmsgq-test.c b/src/tests/asyncmsgq-test.c
index 8a0f5a3f..d10b512d 100644
--- a/src/tests/asyncmsgq-test.c
+++ b/src/tests/asyncmsgq-test.c
@@ -48,11 +48,11 @@ static void the_thread(void *_q) {
do {
int code = 0;
-
+
pa_assert_se(pa_asyncmsgq_get(q, NULL, &code, NULL, 1) == 0);
switch (code) {
-
+
case OPERATION_A:
printf("Operation A\n");
break;
@@ -64,7 +64,7 @@ static void the_thread(void *_q) {
case OPERATION_C:
printf("Operation C\n");
break;
-
+
case QUIT:
printf("quit\n");
quit = 1;
@@ -79,7 +79,7 @@ static void the_thread(void *_q) {
int main(int argc, char *argv[]) {
pa_asyncmsgq *q;
pa_thread *t;
-
+
pa_assert_se(q = pa_asyncmsgq_new(0));
pa_assert_se(t = pa_thread_new(the_thread, q));
diff --git a/src/tests/asyncq-test.c b/src/tests/asyncq-test.c
index 10566db1..600d9d07 100644
--- a/src/tests/asyncq-test.c
+++ b/src/tests/asyncq-test.c
@@ -38,7 +38,7 @@
static void producer(void *_q) {
pa_asyncq *q = _q;
int i;
-
+
for (i = 0; i < 1000; i++) {
pa_asyncq_push(q, (void*) (i+1), 1);
printf("pushed %i\n", i);
@@ -54,7 +54,7 @@ static void consumer(void *_q) {
int i;
sleep(1);
-
+
for (i = 0;; i++) {
p = pa_asyncq_pop(q, 1);
@@ -62,7 +62,7 @@ static void consumer(void *_q) {
break;
pa_assert(p == (void *) (i+1));
-
+
printf("popped %i\n", i);
}
@@ -72,7 +72,7 @@ static void consumer(void *_q) {
int main(int argc, char *argv[]) {
pa_asyncq *q;
pa_thread *t1, *t2;
-
+
pa_assert_se(q = pa_asyncq_new(0));
pa_assert_se(t1 = pa_thread_new(producer, q));