mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
* 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:
parent
98cb6aa4a3
commit
71b3bff681
20 changed files with 784 additions and 515 deletions
|
|
@ -40,7 +40,7 @@ struct pa_iochannel {
|
|||
int ifd, ofd;
|
||||
pa_mainloop_api* mainloop;
|
||||
|
||||
pa_iochannel_callback_t callback;
|
||||
pa_iochannel_cb_t callback;
|
||||
void*userdata;
|
||||
|
||||
int readable;
|
||||
|
|
@ -242,7 +242,7 @@ ssize_t pa_iochannel_read(pa_iochannel*io, void*data, size_t l) {
|
|||
return r;
|
||||
}
|
||||
|
||||
void pa_iochannel_set_callback(pa_iochannel*io, pa_iochannel_callback_t _callback, void *userdata) {
|
||||
void pa_iochannel_set_callback(pa_iochannel*io, pa_iochannel_cb_t _callback, void *userdata) {
|
||||
assert(io);
|
||||
|
||||
io->callback = _callback;
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ int pa_iochannel_is_hungup(pa_iochannel*io);
|
|||
void pa_iochannel_set_noclose(pa_iochannel*io, int b);
|
||||
|
||||
/* Set the callback function that is called whenever data becomes available for read or write */
|
||||
typedef void (*pa_iochannel_callback_t)(pa_iochannel*io, void *userdata);
|
||||
void pa_iochannel_set_callback(pa_iochannel*io, pa_iochannel_callback_t callback, void *userdata);
|
||||
typedef void (*pa_iochannel_cb_t)(pa_iochannel*io, void *userdata);
|
||||
void pa_iochannel_set_callback(pa_iochannel*io, pa_iochannel_cb_t callback, void *userdata);
|
||||
|
||||
/* In case the file descriptor is a socket, return a pretty-printed string in *s which describes the peer connected */
|
||||
void pa_iochannel_socket_peer_to_string(pa_iochannel*io, char*s, size_t l);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ static const char *command_names[PA_COMMAND_MAX] = {
|
|||
struct reply_info {
|
||||
pa_pdispatch *pdispatch;
|
||||
PA_LLIST_FIELDS(struct reply_info);
|
||||
pa_pdispatch_callback_t callback;
|
||||
pa_pdispatch_cb_t callback;
|
||||
void *userdata;
|
||||
uint32_t tag;
|
||||
pa_time_event *time_event;
|
||||
|
|
@ -103,7 +103,7 @@ struct reply_info {
|
|||
struct pa_pdispatch {
|
||||
int ref;
|
||||
pa_mainloop_api *mainloop;
|
||||
const pa_pdispatch_callback_t *callback_table;
|
||||
const pa_pdispatch_cb_t *callback_table;
|
||||
unsigned n_commands;
|
||||
PA_LLIST_HEAD(struct reply_info, replies);
|
||||
pa_pdispatch_drain_callback drain_callback;
|
||||
|
|
@ -121,7 +121,7 @@ static void reply_info_free(struct reply_info *r) {
|
|||
pa_xfree(r);
|
||||
}
|
||||
|
||||
pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *mainloop, const pa_pdispatch_callback_t*table, unsigned entries) {
|
||||
pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *mainloop, const pa_pdispatch_cb_t*table, unsigned entries) {
|
||||
pa_pdispatch *pd;
|
||||
assert(mainloop);
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ static void pdispatch_free(pa_pdispatch *pd) {
|
|||
}
|
||||
|
||||
static void run_action(pa_pdispatch *pd, struct reply_info *r, uint32_t command, pa_tagstruct *ts) {
|
||||
pa_pdispatch_callback_t callback;
|
||||
pa_pdispatch_cb_t callback;
|
||||
void *userdata;
|
||||
uint32_t tag;
|
||||
assert(r);
|
||||
|
|
@ -210,7 +210,7 @@ int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*packet, void *userdata) {
|
|||
run_action(pd, r, command, ts);
|
||||
|
||||
} else if (pd->callback_table && (command < pd->n_commands) && pd->callback_table[command]) {
|
||||
const pa_pdispatch_callback_t *c = pd->callback_table+command;
|
||||
const pa_pdispatch_cb_t *c = pd->callback_table+command;
|
||||
|
||||
(*c)(pd, command, tag, ts, userdata);
|
||||
} else {
|
||||
|
|
@ -236,7 +236,7 @@ static void timeout_callback(pa_mainloop_api*m, pa_time_event*e, PA_GCC_UNUSED c
|
|||
run_action(r->pdispatch, r, PA_COMMAND_TIMEOUT, NULL);
|
||||
}
|
||||
|
||||
void pa_pdispatch_register_reply(pa_pdispatch *pd, uint32_t tag, int timeout, pa_pdispatch_callback_t cb, void *userdata) {
|
||||
void pa_pdispatch_register_reply(pa_pdispatch *pd, uint32_t tag, int timeout, pa_pdispatch_cb_t cb, void *userdata) {
|
||||
struct reply_info *r;
|
||||
struct timeval tv;
|
||||
assert(pd && pd->ref >= 1 && cb);
|
||||
|
|
|
|||
|
|
@ -29,15 +29,15 @@
|
|||
|
||||
typedef struct pa_pdispatch pa_pdispatch;
|
||||
|
||||
typedef void (*pa_pdispatch_callback_t)(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
|
||||
typedef void (*pa_pdispatch_cb_t)(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
|
||||
|
||||
pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *m, const pa_pdispatch_callback_t*table, unsigned entries);
|
||||
pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *m, const pa_pdispatch_cb_t*table, unsigned entries);
|
||||
void pa_pdispatch_unref(pa_pdispatch *pd);
|
||||
pa_pdispatch* pa_pdispatch_ref(pa_pdispatch *pd);
|
||||
|
||||
int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*p, void *userdata);
|
||||
|
||||
void pa_pdispatch_register_reply(pa_pdispatch *pd, uint32_t tag, int timeout, pa_pdispatch_callback_t callback, void *userdata);
|
||||
void pa_pdispatch_register_reply(pa_pdispatch *pd, uint32_t tag, int timeout, pa_pdispatch_cb_t callback, void *userdata);
|
||||
|
||||
int pa_pdispatch_is_pending(pa_pdispatch *pd);
|
||||
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ static void command_get_autoload_info_list(pa_pdispatch *pd, uint32_t command, u
|
|||
static void command_cork_record_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
|
||||
static void command_flush_record_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
|
||||
|
||||
static const pa_pdispatch_callback_t command_table[PA_COMMAND_MAX] = {
|
||||
static const pa_pdispatch_cb_t command_table[PA_COMMAND_MAX] = {
|
||||
[PA_COMMAND_ERROR] = NULL,
|
||||
[PA_COMMAND_TIMEOUT] = NULL,
|
||||
[PA_COMMAND_REPLY] = NULL,
|
||||
|
|
|
|||
|
|
@ -51,8 +51,6 @@ enum {
|
|||
PA_TAG_CVOLUME = 'v'
|
||||
};
|
||||
|
||||
|
||||
|
||||
pa_tagstruct *pa_tagstruct_new(const uint8_t* data, size_t length);
|
||||
void pa_tagstruct_free(pa_tagstruct*t);
|
||||
uint8_t* pa_tagstruct_free_data(pa_tagstruct*t, size_t *l);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue