* modify pa_context_exit_daemon() to return a pa_operation object

* add callback prototypes to all introspection functions in client lib
* add proper validity checking and error handling to all functions in the client lib
* other minor cleanups
* todo update


git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@531 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2006-02-20 22:41:02 +00:00
parent 98cb6aa4a3
commit 71b3bff681
20 changed files with 784 additions and 515 deletions

View file

@ -37,7 +37,11 @@ void pa_command_subscribe_event(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSE
pa_context *c = userdata;
pa_subscription_event_type_t e;
uint32_t index;
assert(pd && command == PA_COMMAND_SUBSCRIBE_EVENT && t && c);
assert(pd);
assert(command == PA_COMMAND_SUBSCRIBE_EVENT);
assert(t);
assert(c);
pa_context_ref(c);
@ -60,24 +64,28 @@ pa_operation* pa_context_subscribe(pa_context *c, pa_subscription_mask_t m, pa_c
pa_operation *o;
pa_tagstruct *t;
uint32_t tag;
assert(c);
o = pa_operation_new(c, NULL);
o->callback = (pa_operation_callback_t) cb;
o->userdata = userdata;
assert(c);
assert(c->ref >= 1);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
t = pa_tagstruct_new(NULL, 0);
pa_tagstruct_putu32(t, PA_COMMAND_SUBSCRIBE);
pa_tagstruct_putu32(t, tag = c->ctag++);
pa_tagstruct_putu32(t, m);
pa_pstream_send_tagstruct(c->pstream, t);
pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, o);
pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
return pa_operation_ref(o);
return o;
}
void pa_context_set_subscribe_callback(pa_context *c, pa_context_subscribe_cb_t cb, void *userdata) {
assert(c);
assert(c->ref >= 1);
c->subscribe_callback = cb;
c->subscribe_userdata = userdata;
}