[pulseaudio-commits] r1470 - in /branches/lennart/src: modules/ pulsecore/ tests/
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Mon Jun 11 05:17:42 PDT 2007
Author: lennart
Date: Mon Jun 11 14:17:40 2007
New Revision: 1470
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1470&root=3Dpulseaudio&vi=
ew=3Drev
Log:
make eolspace
Modified:
branches/lennart/src/modules/module-null-sink.c
branches/lennart/src/modules/module-pipe-sink.c
branches/lennart/src/pulsecore/asyncmsgq.c
branches/lennart/src/pulsecore/asyncq.c
branches/lennart/src/pulsecore/core.c
branches/lennart/src/pulsecore/core.h
branches/lennart/src/pulsecore/flist.c
branches/lennart/src/pulsecore/msgobject.c
branches/lennart/src/pulsecore/object.c
branches/lennart/src/pulsecore/object.h
branches/lennart/src/pulsecore/once-posix.c
branches/lennart/src/pulsecore/protocol-simple.c
branches/lennart/src/pulsecore/semaphore-posix.c
branches/lennart/src/pulsecore/sink-input.c
branches/lennart/src/pulsecore/sink-input.h
branches/lennart/src/pulsecore/sink.c
branches/lennart/src/pulsecore/source-output.c
branches/lennart/src/pulsecore/source-output.h
branches/lennart/src/pulsecore/source.c
branches/lennart/src/pulsecore/source.h
branches/lennart/src/tests/asyncmsgq-test.c
branches/lennart/src/tests/asyncq-test.c
Modified: branches/lennart/src/modules/module-null-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-null-sink.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddi=
ff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-null-sink.c (original)
+++ branches/lennart/src/modules/module-null-sink.c Mon Jun 11 14:17:40 2007
@@ -94,7 +94,7 @@
pollfd.events =3D POLLIN;
=
pa_gettimeofday(u->timestamp);
- =
+
for (;;) {
int code;
void *data, *object;
@@ -116,7 +116,7 @@
pa_sink_process_msg(u->sink->asyncmsgq, object, co=
de, data);
=
}
- =
+
} else if (object =3D=3D u->sink) {
=
switch (code) {
@@ -124,29 +124,29 @@
pa_assert(running);
running =3D 0;
break;
- =
+
case PA_SINK_MESSAGE_START:
pa_assert(!running);
running =3D 1;
- =
+
pa_gettimeofday(u->timestamp);
break;
- =
+
case PA_SINK_MESSAGE_GET_LATENCY:
- =
+
if (pa_timeval_cmp(&u->timestamp, &now) > 0)
*((pa_usec_t*) data) =3D 0;
else
*((pa_usec_t*) data) =3D pa_timeval_diff(&u->t=
imestamp, &now);
break;
- =
+
/* ... */
=
default:
pa_sink_process_msg(u->sink->asyncmsgq, object, co=
de, data);
}
}
- =
+
pa_asyncmsgq_done(u->sink->asyncmsgq);
continue;
}
@@ -155,30 +155,30 @@
=
if (running) {
pa_gettimeofday(&now);
- =
+
if (pa_timeval_cmp(u->timestamp, &now) <=3D 0) {
pa_memchunk chunk;
size_t l;
- =
+
if (pa_sink_render(u->sink, u->block_size, &chunk) >=3D 0)=
{
l =3D chunk.length;
pa_memblock_unref(chunk.memblock);
} else
l =3D u->block_size;
- =
+
pa_timeval_add(&u->timestamp, pa_bytes_to_usec(l, &u->sink=
->sample_spec));
continue;
}
=
timeout =3D pa_timeval_diff(&u->timestamp, &now)/1000;
- =
+
if (timeout < 1)
timeout =3D 1;
} else
timeout =3D -1;
=
/* Hmm, nothing to do. Let's sleep */
- =
+
if (pa_asyncmsgq_before_poll(u->sink->asyncmsgq) < 0)
continue;
=
@@ -192,7 +192,7 @@
pa_log("poll() failed: %s", pa_cstrerror(errno));
goto fail;
}
- =
+
pa_assert(r =3D=3D 0 || pollfd.revents =3D=3D POLLIN);
}
=
@@ -241,7 +241,7 @@
pa_sink_set_description(u->sink, pa_modargs_get_value(ma, "description=
", "NULL sink"));
=
u->block_size =3D pa_bytes_per_second(&ss) / 20; /* 50 ms */
- =
+
if (u->block_size <=3D 0)
u->block_size =3D pa_frame_size(&ss);
=
@@ -249,7 +249,7 @@
pa_log("Failed to create thread.");
goto fail;
}
- =
+
pa_modargs_free(ma);
=
return 0;
@@ -265,7 +265,7 @@
=
void pa__done(pa_core *c, pa_module*m) {
struct userdata *u;
- =
+
pa_assert(c);
pa_assert(m);
=
@@ -278,7 +278,7 @@
pa_asyncmsgq_send(u->sink->asyncmsgq, PA_SINK_MESSAGE_SHUTDOWN, NU=
LL);
pa_thread_free(u->thread);
}
- =
+
pa_sink_unref(u->sink);
=
pa_xfree(u);
Modified: branches/lennart/src/modules/module-pipe-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-pipe-sink.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddi=
ff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-pipe-sink.c (original)
+++ branches/lennart/src/modules/module-pipe-sink.c Mon Jun 11 14:17:40 2007
@@ -124,9 +124,9 @@
default:
pa_sink_process_msg(u->sink->asyncmsgq, object, co=
de, data);
}
- =
+
} else if (object =3D=3D u->sink) {
- =
+
case PA_SINK_MESSAGE_STOP:
pa_assert(running);
running =3D 0;
@@ -155,7 +155,7 @@
default:
pa_sink_process_msg(u->sink->asyncmsgq, object, code, =
data);
}
- =
+
pa_asyncmsgq_done(u->sink->asyncmsgq);
continue;
}
@@ -171,20 +171,20 @@
=
if (!underrun) {
ssize_t l;
- =
+
p =3D pa_memblock_acquire(u->memchunk.memblock);
l =3D pa_write(u->fd, (uint8_t*) p + u->memchunk.index, u-=
>memchunk.length);
pa_memblock_release(p);
- =
+
if (l < 0) {
=
if (errno !=3D EINTR && errno !=3D EAGAIN) {
pa_log("Failed to write data to FIFO: %s", pa_cstr=
error(errno));
goto fail;
}
- =
+
} else {
- =
+
u->memchunk.index +=3D l;
u->memchunk.length -=3D l;
=
@@ -202,7 +202,7 @@
pollfd[POLLFD_FIFO].events =3D 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 @@
pa_log("FIFO shutdown.");
goto fail;
}
- =
+
pa_assert(pollfd[POLLFD_ASYNCQ].revents & ~POLLIN =3D=3D 0);
}
- =
+
fail:
/* We have to continue processing messages until we receive the
* SHUTDOWN message */
@@ -265,9 +265,9 @@
u->memchunk.memblock =3D NULL;
u->memchunk.length =3D 0;
m->userdata =3D u;
- =
+
mkfifo(u->filename, 0666);
- =
+
if ((u->fd =3D open(u->filename, O_RDWR)) < 0) {
pa_log("open('%s'): %s", p, pa_cstrerror(errno));
goto fail;
@@ -290,7 +290,7 @@
pa_log("Failed to create sink.");
goto fail;
}
- =
+
u->sink->userdata =3D u;
pa_sink_set_owner(u->sink, m);
pa_sink_set_description(u->sink, t =3D pa_sprintf_malloc("Unix FIFO si=
nk '%s'", p));
@@ -300,7 +300,7 @@
pa_log("Failed to create thread.");
goto fail;
}
- =
+
pa_modargs_free(ma);
=
return 0;
@@ -328,7 +328,7 @@
pa_asyncmsgq_send(u->sink->asyncmsgq, PA_SINK_MESSAGE_SHUTDOWN, NU=
LL);
pa_thread_free(u->thread);
}
- =
+
pa_sink_unref(u->sink);
=
if (u->memchunk.memblock)
Modified: branches/lennart/src/pulsecore/asyncmsgq.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
asyncmsgq.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/asyncmsgq.c (original)
+++ branches/lennart/src/pulsecore/asyncmsgq.c Mon Jun 11 14:17:40 2007
@@ -65,7 +65,7 @@
pa_assert_se(a->asyncq =3D pa_asyncq_new(size));
pa_assert_se(a->mutex =3D pa_mutex_new(0));
a->current =3D NULL;
- =
+
return a;
}
=
@@ -82,10 +82,10 @@
=
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 @@
*object =3D a->current->object;
if (chunk)
*chunk =3D a->chunk;
- =
+
return 0;
}
=
@@ -183,7 +183,7 @@
=
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 @@
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 !=3D code);
=
return 0;
Modified: branches/lennart/src/pulsecore/asyncq.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
asyncq.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/asyncq.c (original)
+++ branches/lennart/src/pulsecore/asyncq.c Mon Jun 11 14:17:40 2007
@@ -85,7 +85,7 @@
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 @@
=
if (free_cb) {
void *p;
- =
+
while ((p =3D pa_asyncq_pop(l, 0)))
free_cb(p);
}
@@ -113,7 +113,7 @@
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 @@
pa_assert(p);
=
cells =3D PA_ASYNCQ_CELLS(l);
- =
+
_Y;
idx =3D 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 @@
=
for (;;) {
char x[20];
- =
+
_Y;
=
if (pa_atomic_ptr_cmpxchg(&cells[idx], NULL, p))
@@ -155,21 +155,21 @@
return -1;
}
}
- =
+
_Y;
=
pa_atomic_dec(&l->write_waiting);
}
- =
+
_Y;
l->write_idx++;
- =
+
if (pa_atomic_load(&l->read_waiting)) {
char x =3D 'x';
_Y;
write(l->read_fds[1], &x, sizeof(x));
}
- =
+
return 0;
}
=
@@ -188,7 +188,7 @@
if (!(ret =3D pa_atomic_ptr_load(&cells[idx]))) {
=
/* First try failed. Let's wait for changes. */
- =
+
if (!wait)
return NULL;
=
@@ -228,7 +228,7 @@
_Y;
write(l->write_fds[1], &x, sizeof(x));
}
- =
+
return ret;
}
=
@@ -253,7 +253,7 @@
return -1;
=
pa_atomic_inc(&l->read_waiting);
- =
+
if (pa_atomic_ptr_load(&cells[idx])) {
pa_atomic_dec(&l->read_waiting);
return -1;
Modified: branches/lennart/src/pulsecore/core.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
core.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/core.c (original)
+++ branches/lennart/src/pulsecore/core.c Mon Jun 11 14:17:40 2007
@@ -53,9 +53,9 @@
pa_core *c =3D 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 void asyncmsgq_cb(pa_mainloop_api*api, pa_io_event* e, int fd, pa_i=
o_event_flags_t events, void *userdata) {
pa_core *c =3D userdata;
- =
+
pa_assert(pa_asyncmsgq_get_fd(c->asyncmsgq) =3D=3D fd);
pa_assert(events =3D=3D PA_IO_EVENT_INPUT);
=
@@ -84,7 +84,7 @@
pa_asyncmsgq_dispatch(object, code, data, &chunk);
pa_asyncmsgq_done(c->asyncmsgq, 0);
}
- =
+
if (pa_asyncmsgq_before_poll(c->asyncmsgq) =3D=3D 0)
break;
}
@@ -97,7 +97,7 @@
pa_mempool *pool;
=
pa_assert(m);
- =
+
if (shared) {
if (!(pool =3D pa_mempool_new(shared))) {
pa_log_warn("failed to allocate shared memory pool. Falling ba=
ck to a normal memory pool.");
@@ -175,7 +175,7 @@
pa_assert_se(c->asyncmsgq =3D pa_asyncmsgq_new(0));
pa_assert_se(pa_asyncmsgq_before_poll(c->asyncmsgq) =3D=3D 0);
pa_assert_se(c->asyncmsgq_event =3D c->mainloop->io_new(c->mainloop, p=
a_asyncmsgq_get_fd(c->asyncmsgq), PA_IO_EVENT_INPUT, asyncmsgq_cb, c));
- =
+
return c;
}
=
Modified: branches/lennart/src/pulsecore/core.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
core.h?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/core.h (original)
+++ branches/lennart/src/pulsecore/core.h Mon Jun 11 14:17:40 2007
@@ -48,7 +48,7 @@
=
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;
Modified: branches/lennart/src/pulsecore/flist.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
flist.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/flist.c (original)
+++ branches/lennart/src/pulsecore/flist.c Mon Jun 11 14:17:40 2007
@@ -163,7 +163,7 @@
assert(p);
=
cells =3D PA_FLIST_CELLS(l);
- =
+
n =3D len =3D (int) l->size - pa_atomic_load(&l->length) + N_EXTRA_SCA=
N;
_Y;
idx =3D reduce(l, pa_atomic_load(&l->write_idx));
Modified: branches/lennart/src/pulsecore/msgobject.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
msgobject.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/msgobject.c (original)
+++ branches/lennart/src/pulsecore/msgobject.c Mon Jun 11 14:17:40 2007
@@ -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);
=
Modified: branches/lennart/src/pulsecore/object.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
object.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/object.c (original)
+++ branches/lennart/src/pulsecore/object.c Mon Jun 11 14:17:40 2007
@@ -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);
=
Modified: branches/lennart/src/pulsecore/object.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
object.h?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/object.h (original)
+++ branches/lennart/src/pulsecore/object.h Mon Jun 11 14:17:40 2007
@@ -68,5 +68,5 @@
pa_object_assert_ref(PA_OBJECT(o)); \
} \
struct __stupid_useless_struct_to_allow_trailing_semicolon
- =
+
#endif
Modified: branches/lennart/src/pulsecore/once-posix.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
once-posix.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/once-posix.c (original)
+++ branches/lennart/src/pulsecore/once-posix.c Mon Jun 11 14:17:40 2007
@@ -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 =3D pa_atomic_ptr_load(&control->mutex))) {
=
/* The mutex is stored in locked state, hence let's just
@@ -57,7 +57,7 @@
=
pa_assert_se(m =3D 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 @@
}
=
pa_assert(pa_atomic_load(&control->done));
- =
+
if (pa_atomic_dec(&control->ref) <=3D 1) {
pa_assert(pa_atomic_ptr_cmpxchg(&control->mutex, m, NULL));
pa_mutex_free(m);
Modified: branches/lennart/src/pulsecore/protocol-simple.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
protocol-simple.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Dd=
iff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/protocol-simple.c (original)
+++ branches/lennart/src/pulsecore/protocol-simple.c Mon Jun 11 14:17:40 20=
07
@@ -86,11 +86,11 @@
};
=
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 @@
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 @@
pa_memblockq_free(c->input_memblockq);
if (c->output_memblockq)
pa_memblockq_free(c->output_memblockq);
- =
+
pa_xfree(c);
}
=
@@ -133,7 +133,7 @@
void *p;
=
pa_assert(c);
- =
+
if (!c->sink_input || !(l =3D pa_atomic_load(&c->playback.missing)))
return 0;
=
@@ -155,12 +155,12 @@
p =3D pa_memblock_acquire(c->playback.current_memblock);
r =3D pa_iochannel_read(c->io, (uint8_t*) p + c->playback.memblock_ind=
ex, l);
pa_memblock_release(c->playback.current_memblock);
- =
+
if (r <=3D 0) {
=
if (errno =3D=3D EINTR || errno =3D=3D EAGAIN)
return 0;
- =
+
pa_log_debug("read(): %s", r =3D=3D 0 ? "EOF" : pa_cstrerror(errno=
));
return -1;
}
@@ -195,7 +195,7 @@
p =3D pa_memblock_acquire(chunk.memblock);
r =3D 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 @@
}
=
pa_memblockq_drop(c->output_memblockq, &chunk, r);
- =
+
return 0;
}
=
@@ -251,7 +251,7 @@
/* Called from thread context */
static int sink_input_process_msg(pa_sink_input *i, int code, void *userda=
ta, const pa_memchunk *chunk) {
struct connection*c;
- =
+
pa_assert(i);
c =3D i->userdata;
pa_assert(c);
@@ -265,10 +265,10 @@
pa_memblockq_push_align(c->input_memblockq, chunk);
return 0;
}
- =
+
case PA_SINK_INPUT_MESSAGE_GET_LATENCY: {
pa_usec_t *r =3D userdata;
- =
+
*r =3D pa_bytes_to_usec(pa_memblockq_get_length(c->input_membl=
ockq), &c->sink_input->sample_spec);
=
/* Fall through, the default handler will add in the extra
@@ -283,7 +283,7 @@
/* Called from thread context */
static int sink_input_peek_cb(pa_sink_input *i, pa_memchunk *chunk) {
struct connection*c;
- =
+
pa_assert(i);
c =3D i->userdata;
pa_assert(c);
@@ -301,7 +301,7 @@
static void sink_input_drop_cb(pa_sink_input *i, const pa_memchunk *chunk,=
size_t length) {
struct connection*c =3D i->userdata;
size_t old, new;
- =
+
pa_assert(i);
pa_assert(c);
pa_assert(length);
@@ -320,7 +320,7 @@
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 source_output_push_cb(pa_source_output *o, const pa_memchunk *=
chunk) {
struct connection *c;
- =
+
pa_assert(o);
c =3D o->userdata;
pa_assert(c);
@@ -343,17 +343,17 @@
pa_assert(o);
c =3D 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 =3D 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 void client_kill_cb(pa_client *client) {
struct connection*c;
- =
+
pa_assert(client);
c =3D client->userdata;
pa_assert(c);
@@ -386,7 +386,7 @@
pa_protocol_simple *p =3D userdata;
struct connection *c =3D NULL;
char cname[256];
- =
+
pa_assert(s);
pa_assert(io);
pa_assert(p);
@@ -415,7 +415,7 @@
c->client->kill =3D client_kill_cb;
c->client->userdata =3D c;
=
- =
+
if (p->mode & PLAYBACK) {
pa_sink_input_new_data data;
size_t l;
@@ -493,7 +493,7 @@
=
pa_iochannel_set_callback(c->io, io_callback, c);
pa_idxset_put(p->connections, c, NULL);
- =
+
return;
=
fail:
@@ -504,7 +504,7 @@
static void asyncmsgq_cb(pa_mainloop_api*api, pa_io_event* e, int fd, pa_i=
o_event_flags_t events, void *userdata) {
pa_protocol_simple *p =3D userdata;
int do_some_work =3D 0;
- =
+
pa_assert(pa_asyncmsgq_get_fd(p->asyncmsgq) =3D=3D fd);
pa_assert(events =3D=3D PA_IO_EVENT_INPUT);
=
@@ -520,7 +520,7 @@
connection *c =3D object;
=
pa_assert(c);
- =
+
switch (code) {
=
case MESSAGE_REQUEST_DATA:
@@ -535,7 +535,7 @@
=
pa_asyncmsgq_done(p->asyncmsgq);
}
- =
+
if (pa_asyncmsgq_before_poll(p->asyncmsgq) =3D=3D 0)
break;
}
@@ -544,7 +544,7 @@
pa_protocol_simple* pa_protocol_simple_new(pa_core *core, pa_socket_server=
*server, pa_module *m, pa_modargs *ma) {
pa_protocol_simple* p =3D NULL;
int enable;
- =
+
pa_assert(core);
pa_assert(server);
pa_assert(ma);
@@ -588,13 +588,13 @@
=
pa_assert_se(pa_asyncmsgq_before_poll(p->asyncmsgq) =3D=3D 0);
pa_assert_se(p->asyncmsgq_event =3D 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 @@
pa_asyncmsgq_after_poll(c->asyncmsgq);
pa_asyncmsgq_free(p->asyncmsgq);
}
- =
+
pa_xfree(p);
}
=
Modified: branches/lennart/src/pulsecore/semaphore-posix.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
semaphore-posix.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Dd=
iff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/semaphore-posix.c (original)
+++ branches/lennart/src/pulsecore/semaphore-posix.c Mon Jun 11 14:17:40 20=
07
@@ -60,7 +60,7 @@
void pa_semaphore_wait(pa_semaphore *s) {
int ret;
pa_assert(s);
- =
+
do {
ret =3D sem_wait(&s->sem);
} while (ret < 0 && errno =3D=3D EINTR);
Modified: branches/lennart/src/pulsecore/sink-input.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sink-input.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/sink-input.c (original)
+++ branches/lennart/src/pulsecore/sink-input.c Mon Jun 11 14:17:40 2007
@@ -52,7 +52,7 @@
=
memset(data, 0, sizeof(*data));
data->resample_method =3D PA_RESAMPLER_INVALID;
- =
+
return data;
}
=
@@ -117,7 +117,7 @@
if (!data->channel_map_is_set) {
if (data->sink->channel_map.channels =3D=3D data->sample_spec.chan=
nels)
data->channel_map =3D 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 @@
=
if (!data->muted_is_set)
data->muted =3D 0;
- =
+
if (data->resample_method =3D=3D PA_RESAMPLER_INVALID)
data->resample_method =3D core->resample_method;
=
@@ -163,7 +163,7 @@
=
i->parent.parent.free =3D sink_input_free;
i->parent.process_msg =3D pa_sink_input_process_msg;
- =
+
i->core =3D core;
pa_atomic_load(&i->state, PA_SINK_INPUT_DRAINED);
i->flags =3D flags;
@@ -172,14 +172,14 @@
i->module =3D data->module;
i->sink =3D data->sink;
i->client =3D data->client;
- =
+
i->resample_method =3D data->resample_method;
i->sample_spec =3D data->sample_spec;
i->channel_map =3D data->channel_map;
=
i->volume =3D data->volume;
i->muted =3D data->muted;
- =
+
i->process_msg =3D NULL;
i->peek =3D NULL;
i->drop =3D NULL;
@@ -214,7 +214,7 @@
pa_return_if_fail(pa_sink_input_get_state(i) !=3D PA_SINK_INPUT_DISCON=
NECTED);
=
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 @@
=
pa_assert(i);
pa_assert(pa_sink_input_refcnt(i) =3D=3D 0);
- =
+
pa_sink_input_disconnect(i);
=
pa_log_info("Freeing output %u \"%s\"", i->index, i->name);
@@ -281,7 +281,7 @@
=
if (pa_asyncmsgq_send(i->sink->asyncmsgq, i->sink, PA_SINK_INPUT_MESSA=
GE_GET_LATENCY, &r, NULL) < 0)
r =3D 0;
- =
+
if (i->get_latency)
r +=3D i->get_latency(i);
=
@@ -293,7 +293,7 @@
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 @@
i->sample_spec.rate =3D rate;
=
pa_asyncmsgq_post(s->asyncmsgq, pa_sink_input_ref(i), PA_SINK_INPUT_ME=
SSAGE_SET_RATE, PA_UINT_TO_PTR(rate), NULL, pa_sink_input_unref, NULL);
- =
+
pa_subscription_post(i->sink->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|P=
A_SUBSCRIPTION_EVENT_CHANGE, i->index);
return 0
}
@@ -543,7 +543,7 @@
pa_sink_assert_ref(dest);
=
return -1;
- =
+
/* origin =3D i->sink; */
=
/* if (dest =3D=3D origin) */
@@ -697,32 +697,32 @@
=
int pa_sink_input_process_msg(pa_msgobject *o, int code, void *userdata, p=
a_memchunk *chunk) {
pa_sink_input *i =3D PA_SINK_INPUT(o);
- =
+
pa_sink_input_assert_ref(i);
=
switch (code) {
case PA_SINK_INPUT_MESSAGE_SET_VOLUME:
s->thread_info.soft_volume =3D *((pa_cvolume*) userdata);
return 0;
- =
+
case PA_SINK_INPUT_MESSAGE_SET_MUTE:
s->thread_info.soft_muted =3D PA_PTR_TO_UINT(userdata);
return 0;
- =
+
case PA_SINK_INPUT_MESSAGE_GET_LATENCY: {
pa_usec_t *r =3D userdata;
- =
+
if (i->thread_info.resampled_chunk.memblock)
*r +=3D pa_bytes_to_usec(i->resampled_chunk.length, &i->si=
nk->sample_spec);
=
/* if (i->move_silence) */
/* r +=3D pa_bytes_to_usec(i->move_silence, &i->sink->samp=
le_spec); */
- =
+
return 0;
}
- =
+
case PA_SINK_INPUT_MESSAGE_SET_RATE: {
- =
+
i->thread_info.sample_spec.rate =3D PA_PTR_TO_UINT(userdata);
pa_resampler_set_input_rate(i->resampler, PA_PTR_TO_UINT(userd=
ata));
=
Modified: branches/lennart/src/pulsecore/sink-input.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sink-input.h?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/sink-input.h (original)
+++ branches/lennart/src/pulsecore/sink-input.h Mon Jun 11 14:17:40 2007
@@ -52,7 +52,7 @@
=
struct pa_sink_input {
pa_msgobject parent;
- =
+
uint32_t index;
pa_core *core;
pa_atomic_t state;
@@ -66,11 +66,11 @@
=
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 lengt=
h);
void (*kill) (pa_sink_input *i); /* may be NULL */
@@ -81,10 +81,10 @@
=
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 @@
pa_cvolume volume;
int muted;
} thread_info;
- =
+
void *userdata;
};
=
Modified: branches/lennart/src/pulsecore/sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sink.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/sink.c (original)
+++ branches/lennart/src/pulsecore/sink.c Mon Jun 11 14:17:40 2007
@@ -86,7 +86,7 @@
=
s->parent.parent.free =3D sink_free;
s->parent.process_msg =3D pa_sink_process_msg;
- =
+
s->core =3D core;
pa_atomic_store(&s->state, PA_SINK_IDLE);
s->name =3D pa_xstrdup(name);
@@ -115,7 +115,7 @@
s->userdata =3D NULL;
=
pa_assert_se(s->asyncmsgq =3D pa_asyncmsgq_new(0));
- =
+
r =3D pa_idxset_put(core->sinks, s, &s->index);
pa_assert(s->index !=3D PA_IDXSET_INVALID && r >=3D 0);
=
@@ -139,7 +139,7 @@
s->thread_info.inputs =3D pa_hashmap_new(pa_idxset_trivial_hash_func, =
pa_idxset_trivial_compare_func);
s->thread_info.soft_volume =3D s->volume;
s->thread_info.soft_muted =3D s->muted;
- =
+
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIPTIO=
N_EVENT_NEW, s->index);
=
return s;
@@ -163,7 +163,7 @@
static void sink_stop(pa_sink *s) {
pa_sink_state_t state;
int stop;
- =
+
pa_assert(s);
state =3D pa_sink_get_state(s);
pa_return_if_fail(state =3D=3D PA_SINK_RUNNING || state =3D=3D PA_SINK=
_SUSPENDED);
@@ -216,7 +216,7 @@
=
static void sink_free(pa_object *o) {
pa_sink *s =3D PA_SINK(o);
- =
+
pa_assert(s);
pa_assert(pa_sink_refcnt(s) =3D=3D 0);
=
@@ -230,11 +230,11 @@
}
=
pa_idxset_free(s->inputs, NULL, NULL);
- =
+
pa_hashmap_free(s->thread_info.inputs, (pa_free2_cb_t) pa_sink_input_u=
nref, NULL);
=
pa_asyncmsgq_free(s->asyncmsgq);
- =
+
pa_xfree(s->name);
pa_xfree(s->description);
pa_xfree(s->driver);
@@ -246,7 +246,7 @@
=
if (pa_sink_get_state(s) =3D=3D PA_SINK_SUSPENDED)
return;
- =
+
if (pa_sink_used_by(s) > 0)
sink_start(s);
else
@@ -270,7 +270,7 @@
s->stop(s);
else
pa_asyncmsgq_post(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSA=
GE_STOP, NULL, NULL, NULL);
- =
+
} else {
pa_atomic_store(&s->state, PA_SINK_RUNNING);
=
@@ -417,38 +417,38 @@
else {
void *src, *ptr;
pa_cvolume volume;
- =
+
ptr =3D pa_memblock_acquire(target->memblock);
src =3D 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 =3D pa_memblock_acquire(target->memblock);
- =
+
target->length =3D 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 @@
=
pa_usec_t pa_sink_get_latency(pa_sink *s) {
pa_usec_t usec =3D 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_G=
ET_LATENCY, &usec, NULL) < 0)
return 0;
=
@@ -532,7 +532,7 @@
=
changed =3D !pa_cvolume_equal(volume, &s->volume);
s->volume =3D *volume;
- =
+
if (s->set_volume && s->set_volume(s) < 0)
s->set_volume =3D NULL;
=
@@ -549,7 +549,7 @@
pa_sink_assert_ref(s);
=
old_volume =3D s->volume;
- =
+
if (s->get_volume && s->get_volume(s) < 0)
s->get_volume =3D NULL;
=
@@ -558,13 +558,13 @@
=
if (!pa_cvolume_equal(&old_volume, &s->volume))
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCR=
IPTION_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 =3D s->muted !=3D mute;
@@ -581,11 +581,11 @@
=
int pa_sink_get_mute(pa_sink *s) {
int old_muted;
- =
+
pa_sink_assert_ref(s);
=
old_muted =3D s->muted;
- =
+
if (s->get_mute && s->get_mute(s) < 0)
s->get_mute =3D NULL;
=
@@ -594,7 +594,7 @@
=
if (old_muted !=3D s->muted)
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCR=
IPTION_EVENT_CHANGE, s->index);
- =
+
return s->muted;
}
=
@@ -658,29 +658,29 @@
pa_hashmap_put(s->thread_info.inputs, PA_UINT32_TO_PTR(i->inde=
x), pa_sink_input_ref(i));
return 0;
}
- =
+
case PA_SINK_MESSAGE_REMOVE_INPUT: {
pa_sink_input *i =3D userdata;
pa_hashmap_remove(s->thread_info.inputs, PA_UINT32_TO_PTR(i->i=
ndex));
return 0;
}
- =
+
case PA_SINK_MESSAGE_SET_VOLUME:
s->thread_info.soft_volume =3D *((pa_cvolume*) userdata);
return 0;
- =
+
case PA_SINK_MESSAGE_SET_MUTE:
s->thread_info.soft_muted =3D PA_PTR_TO_UINT(userdata);
return 0;
- =
+
case PA_SINK_MESSAGE_GET_VOLUME:
*((pa_cvolume*) userdata) =3D s->thread_info.soft_volume;
return 0;
- =
+
case PA_SINK_MESSAGE_GET_MUTE:
*((int*) userdata) =3D s->thread_info.soft_muted;
return 0;
- =
+
default:
return -1;
}
Modified: branches/lennart/src/pulsecore/source-output.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
source-output.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/source-output.c (original)
+++ branches/lennart/src/pulsecore/source-output.c Mon Jun 11 14:17:40 2007
@@ -113,7 +113,7 @@
if ((flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ||
!pa_sample_spec_equal(&data->sample_spec, &data->source->sample_sp=
ec) ||
!pa_channel_map_equal(&data->channel_map, &data->source->channel_m=
ap)) {
- =
+
if (!(resampler =3D pa_resampler_new(
core->mempool,
&data->source->sample_spec, &data->source->channel_m=
ap,
@@ -127,10 +127,10 @@
}
=
o =3D pa_source_output_new(pa_source_output);
- =
+
o->parent.parent.free =3D source_output_free;
o->parent.process_msg =3D pa_source_output_process_msg;
- =
+
o->core =3D core;
pa_atomic_load(&o->state, PA_SOURCE_OUTPUT_RUNNING);
o->flags =3D flags;
@@ -173,7 +173,7 @@
pa_assert(o->source->core);
=
pa_asyncmsgq_send(i->sink->asyncmsgq, i->sink, PA_SOURCE_MESSAGE_REMOV=
E_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 @@
=
static void source_output_free(pa_msgobject* mo) {
pa_source_output *o =3D PA_SOURCE_OUTPUT(mo);
- =
+
pa_assert(pa_source_output_refcnt(o) =3D=3D 0);
=
pa_source_output_disconnect(o);
@@ -207,7 +207,7 @@
=
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_A=
DD_OUTPUT, o, NULL, pa_source_unref, pa_source_output_unref);
pa_source_update_status(o->source);
=
@@ -228,7 +228,7 @@
=
if (pa_asyncmsgq_send(o->source->asyncmsgq, i->source, PA_SOURCE_OUTPU=
T_MESSAGE_GET_LATENCY, &r, NULL) < 0)
r =3D 0;
- =
+
if (o->get_latency)
r +=3D o->get_latency(o);
=
@@ -244,12 +244,12 @@
pa_assert(chunk->length);
=
state =3D pa_source_output_get_state(o);
- =
+
if (!o->push || state =3D=3D PA_SOURCE_OUTPUT_DISCONNECTED || state =
=3D=3D PA_SOURCE_OUTPUT_CORKED)
return;
=
pa_assert(state =3D PA_SOURCE_OUTPUT_RUNNING);
- =
+
if (!o->resampler) {
o->push(o, chunk);
return;
@@ -289,7 +289,7 @@
i->sample_spec.rate =3D rate;
=
pa_asyncmsgq_post(s->asyncmsgq, pa_source_output_ref(i), PA_SOURCE_OUT=
PUT_MESSAGE_SET_RATE, PA_UINT_TO_PTR(rate), NULL, pa_source_output_unref, N=
ULL);
- =
+
pa_subscription_post(o->source->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUT=
PUT!|PA_SUBSCRIPTION_EVENT_CHANGE, i->index);
return 0;
}
@@ -312,7 +312,7 @@
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 @@
pa_source_assert_ref(dest);
=
return -1;
- =
+
/* origin =3D o->source; */
=
/* if (dest =3D=3D origin) */
@@ -377,13 +377,13 @@
=
int pa_source_output_process_msg(pa_msgobject *mo, int code, void *userdat=
a, pa_memchunk* chunk) {
pa_source_output *o =3D 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 =3D PA_PTR_TO_UINT(userdata);
pa_resampler_set_output_rate(i->resampler, PA_PTR_TO_UINT(user=
data));
=
Modified: branches/lennart/src/pulsecore/source-output.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
source-output.h?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/source-output.h (original)
+++ branches/lennart/src/pulsecore/source-output.h Mon Jun 11 14:17:40 2007
@@ -48,7 +48,7 @@
=
struct pa_source_output {
pa_msgobject parent;
- =
+
uint32_t index;
pa_core *core;
pa_atomic_t state;
@@ -72,10 +72,10 @@
=
struct {
pa_sample_spec sample_spec;
- =
+
pa_resampler* resampler; /* may be NULL */
} thread_info;
- =
+
void *userdata;
};
=
Modified: branches/lennart/src/pulsecore/source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
source.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/source.c (original)
+++ branches/lennart/src/pulsecore/source.c Mon Jun 11 14:17:40 2007
@@ -78,7 +78,7 @@
=
s->parent.parent.free =3D source_free;
s->parent.process_msg =3D pa_source_process_msg;
- =
+
s->core =3D core;
pa_atomic_store(&s->state, PA_SOURCE_IDLE);
s->name =3D pa_xstrdup(name);
@@ -108,7 +108,7 @@
s->userdata =3D NULL;
=
pa_assert_se(s->asyncmsgq =3D pa_asyncmsgq_new(0));
- =
+
r =3D pa_idxset_put(core->sources, s, &s->index);
assert(s->index !=3D PA_IDXSET_INVALID && r >=3D 0);
=
@@ -118,7 +118,7 @@
s->thread_info.outputs =3D pa_hashmap_new(pa_idxset_trivial_hash_func,=
pa_idxset_trivial_compare_func);
s->thread_info.soft_volume =3D s->volume;
s->thread_info.soft_muted =3D s->muted;
- =
+
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCRIPT=
ION_EVENT_NEW, s->index);
=
return s;
@@ -142,7 +142,7 @@
static void source_stop(pa_source *s) {
pa_source_state_t state;
int stop;
- =
+
pa_assert(s);
state =3D pa_source_get_state(s);
pa_return_if_fail(state =3D=3D PA_SOURCE_RUNNING || state =3D=3D PA_SO=
URCE_SUSPENDED);
@@ -165,7 +165,7 @@
pa_return_if_fail(pa_sink_get_state(s) !=3D 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 @@
=
static void source_free(pa_msgobject *o) {
pa_source *s =3D PA_SOURCE(o);
- =
+
pa_assert(s);
pa_assert(pa_source_refcnt(s) =3D=3D 0);
=
@@ -204,7 +204,7 @@
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 @@
=
if (pa_source_get_state(s) =3D=3D PA_SOURCE_STATE_SUSPENDED)
return;
- =
+
if (pa_source_used_by(s) > 0)
source_start(s);
else
@@ -240,7 +240,7 @@
s->stop(s);
else
pa_asyncmsgq_post(s->asyncmsgq, s, PA_SOURCE_MESSAGE_STOP, NUL=
L, NULL, pa_source_unref, NULL);
- =
+
} else {
pa_atomic_store(&s->state, PA_SOURCE_RUNNING);
=
@@ -254,7 +254,7 @@
void pa_source_post(pa_source*s, const pa_memchunk *chunk) {
pa_source_output *o;
void *state =3D NULL;
- =
+
pa_source_assert_ref(s);
pa_assert(chunk);
=
@@ -263,7 +263,7 @@
=
pa_memblock_ref(vchunk.memblock);
pa_memchunk_make_writable(&vchunk, 0);
- =
+
if (s->thread_info.muted || pa_cvolume_is_muted(s->thread_info.vol=
ume))
pa_silence_memchunk(&vchunk, &s->sample_spec);
else
@@ -271,10 +271,10 @@
=
while ((o =3D pa_hashmap_iterate(s->thread_info.outputs, &state, N=
ULL)))
pa_source_output_push(o, &vchunk);
- =
+
pa_memblock_unref(vchunk.memblock);
} else {
- =
+
while ((o =3D pa_hashmap_iterate(s->thread_info.outputs, &state, N=
ULL)))
pa_source_output_push(o, chunk);
=
@@ -303,7 +303,7 @@
=
changed =3D !pa_cvolume_equal(volume, s->volume);
s->volume =3D *volume;
- =
+
if (s->set_volume && s->set_volume(s) < 0)
s->set_volume =3D NULL;
=
@@ -318,7 +318,7 @@
pa_source_assert_ref(s);
=
old_volume =3D s->volume;
- =
+
if (s->get_volume && s->get_volume(s) < 0)
s->get_volume =3D NULL;
=
@@ -327,13 +327,13 @@
=
if (!pa_cvolume_equal(&old_volume, &s->volume))
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBS=
CRIPTION_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 =3D s->muted !=3D mute;
@@ -350,11 +350,11 @@
=
int pa_source_get_mute(pa_source *s, pa_mixer_t m) {
int old_muted;
- =
+
pa_source_assert_ref(s);
=
old_muted =3D s->muted;
- =
+
if (s->get_mute && s->get_mute(s) < 0)
s->get_mute =3D NULL;
=
@@ -363,7 +363,7 @@
=
if (old_muted !=3D s->muted)
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBS=
CRIPTION_EVENT_CHANGE, s->index);
- =
+
return s->muted;
}
=
@@ -374,7 +374,7 @@
return;
=
s->module =3D m;
- =
+
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIP=
TION_EVENT_CHANGE, s->index);
}
=
@@ -409,29 +409,29 @@
pa_hashmap_put(s->thread_info.outputs, PA_UINT32_TO_PTR(i->ind=
ex), pa_source_output_ref(i));
return 0;
}
- =
+
case PA_SOURCE_MESSAGE_REMOVE_INPUT: {
pa_source_input *i =3D 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 =3D *((pa_cvolume*) userdata);
return 0;
- =
+
case PA_SOURCE_MESSAGE_SET_MUTE:
s->thread_info.soft_muted =3D PA_PTR_TO_UINT(userdata);
return 0;
- =
+
case PA_SOURCE_MESSAGE_GET_VOLUME:
*((pa_cvolume*) userdata) =3D s->thread_info.soft_volume;
return 0;
- =
+
case PA_SOURCE_MESSAGE_GET_MUTE:
*((int*) userdata) =3D s->thread_info.soft_muted;
return 0;
- =
+
default:
return -1;
}
Modified: branches/lennart/src/pulsecore/source.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
source.h?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/source.h (original)
+++ branches/lennart/src/pulsecore/source.h Mon Jun 11 14:17:40 2007
@@ -54,7 +54,7 @@
=
struct pa_source {
pa_msgobject parent;
- =
+
uint32_t index;
pa_core *core;
pa_atomic_t state;
@@ -91,7 +91,7 @@
pa_cvolume soft_volume;
int soft_muted;
} thread_info;
- =
+
void *userdata;
};
=
Modified: branches/lennart/src/tests/asyncmsgq-test.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/tests/asyn=
cmsgq-test.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/tests/asyncmsgq-test.c (original)
+++ branches/lennart/src/tests/asyncmsgq-test.c Mon Jun 11 14:17:40 2007
@@ -48,11 +48,11 @@
=
do {
int code =3D 0;
- =
+
pa_assert_se(pa_asyncmsgq_get(q, NULL, &code, NULL, 1) =3D=3D 0);
=
switch (code) {
- =
+
case OPERATION_A:
printf("Operation A\n");
break;
@@ -64,7 +64,7 @@
case OPERATION_C:
printf("Operation C\n");
break;
- =
+
case QUIT:
printf("quit\n");
quit =3D 1;
@@ -79,7 +79,7 @@
int main(int argc, char *argv[]) {
pa_asyncmsgq *q;
pa_thread *t;
- =
+
pa_assert_se(q =3D pa_asyncmsgq_new(0));
=
pa_assert_se(t =3D pa_thread_new(the_thread, q));
Modified: branches/lennart/src/tests/asyncq-test.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/tests/asyn=
cq-test.c?rev=3D1470&root=3Dpulseaudio&r1=3D1469&r2=3D1470&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/tests/asyncq-test.c (original)
+++ branches/lennart/src/tests/asyncq-test.c Mon Jun 11 14:17:40 2007
@@ -38,7 +38,7 @@
static void producer(void *_q) {
pa_asyncq *q =3D _q;
int i;
- =
+
for (i =3D 0; i < 1000; i++) {
pa_asyncq_push(q, (void*) (i+1), 1);
printf("pushed %i\n", i);
@@ -54,7 +54,7 @@
int i;
=
sleep(1);
- =
+
for (i =3D 0;; i++) {
p =3D pa_asyncq_pop(q, 1);
=
@@ -62,7 +62,7 @@
break;
=
pa_assert(p =3D=3D (void *) (i+1));
- =
+
printf("popped %i\n", i);
}
=
@@ -72,7 +72,7 @@
int main(int argc, char *argv[]) {
pa_asyncq *q;
pa_thread *t1, *t2;
- =
+
pa_assert_se(q =3D pa_asyncq_new(0));
=
pa_assert_se(t1 =3D pa_thread_new(producer, q));
More information about the pulseaudio-commits
mailing list