mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-18 08:56:40 -05:00
merge 'lennart' branch back into trunk.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1971 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
6687dd0131
commit
a67c21f093
294 changed files with 79057 additions and 11614 deletions
|
|
@ -25,19 +25,18 @@
|
|||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <pulse/xmalloc.h>
|
||||
#include <pulsecore/macro.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "operation.h"
|
||||
|
||||
pa_operation *pa_operation_new(pa_context *c, pa_stream *s, pa_operation_cb_t cb, void *userdata) {
|
||||
pa_operation *o;
|
||||
assert(c);
|
||||
pa_assert(c);
|
||||
|
||||
o = pa_xnew(pa_operation, 1);
|
||||
o->ref = 1;
|
||||
PA_REFCNT_INIT(o);
|
||||
o->context = c;
|
||||
o->stream = s;
|
||||
|
||||
|
|
@ -53,27 +52,27 @@ pa_operation *pa_operation_new(pa_context *c, pa_stream *s, pa_operation_cb_t cb
|
|||
}
|
||||
|
||||
pa_operation *pa_operation_ref(pa_operation *o) {
|
||||
assert(o);
|
||||
assert(o->ref >= 1);
|
||||
pa_assert(o);
|
||||
pa_assert(PA_REFCNT_VALUE(o) >= 1);
|
||||
|
||||
o->ref++;
|
||||
PA_REFCNT_INC(o);
|
||||
return o;
|
||||
}
|
||||
|
||||
void pa_operation_unref(pa_operation *o) {
|
||||
assert(o);
|
||||
assert(o->ref >= 1);
|
||||
pa_assert(o);
|
||||
pa_assert(PA_REFCNT_VALUE(o) >= 1);
|
||||
|
||||
if ((--(o->ref)) == 0) {
|
||||
assert(!o->context);
|
||||
assert(!o->stream);
|
||||
if (PA_REFCNT_DEC(o) <= 0) {
|
||||
pa_assert(!o->context);
|
||||
pa_assert(!o->stream);
|
||||
pa_xfree(o);
|
||||
}
|
||||
}
|
||||
|
||||
static void operation_set_state(pa_operation *o, pa_operation_state_t st) {
|
||||
assert(o);
|
||||
assert(o->ref >= 1);
|
||||
pa_assert(o);
|
||||
pa_assert(PA_REFCNT_VALUE(o) >= 1);
|
||||
|
||||
if (st == o->state)
|
||||
return;
|
||||
|
|
@ -85,7 +84,7 @@ static void operation_set_state(pa_operation *o, pa_operation_state_t st) {
|
|||
if ((o->state == PA_OPERATION_DONE) || (o->state == PA_OPERATION_CANCELED)) {
|
||||
|
||||
if (o->context) {
|
||||
assert(o->ref >= 2);
|
||||
pa_assert(PA_REFCNT_VALUE(o) >= 2);
|
||||
|
||||
PA_LLIST_REMOVE(pa_operation, o->context->operations, o);
|
||||
pa_operation_unref(o);
|
||||
|
|
@ -101,22 +100,22 @@ static void operation_set_state(pa_operation *o, pa_operation_state_t st) {
|
|||
}
|
||||
|
||||
void pa_operation_cancel(pa_operation *o) {
|
||||
assert(o);
|
||||
assert(o->ref >= 1);
|
||||
pa_assert(o);
|
||||
pa_assert(PA_REFCNT_VALUE(o) >= 1);
|
||||
|
||||
operation_set_state(o, PA_OPERATION_CANCELED);
|
||||
}
|
||||
|
||||
void pa_operation_done(pa_operation *o) {
|
||||
assert(o);
|
||||
assert(o->ref >= 1);
|
||||
pa_assert(o);
|
||||
pa_assert(PA_REFCNT_VALUE(o) >= 1);
|
||||
|
||||
operation_set_state(o, PA_OPERATION_DONE);
|
||||
}
|
||||
|
||||
pa_operation_state_t pa_operation_get_state(pa_operation *o) {
|
||||
assert(o);
|
||||
assert(o->ref >= 1);
|
||||
pa_assert(o);
|
||||
pa_assert(PA_REFCNT_VALUE(o) >= 1);
|
||||
|
||||
return o->state;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue