[polypaudio-commits] r521 - in /trunk/src: modules/module-tunnel.c polyp/context.c polyp/context.h polyp/internal.h polypcore/pdispatch.c polypcore/pdispatch.h polypcore/protocol-native.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Mon Feb 20 08:01:54 PST 2006
Author: lennart
Date: Mon Feb 20 17:01:53 2006
New Revision: 521
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=521&root=polypaudio&view=rev
Log:
* Make typdefs for the pa_context callback prototypes
* s/pa_context_notify_cb/pa_context_notify_cb_t/g
Modified:
trunk/src/modules/module-tunnel.c
trunk/src/polyp/context.c
trunk/src/polyp/context.h
trunk/src/polyp/internal.h
trunk/src/polypcore/pdispatch.c
trunk/src/polypcore/pdispatch.h
trunk/src/polypcore/protocol-native.c
Modified: trunk/src/modules/module-tunnel.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-tunnel.c?rev=521&root=polypaudio&r1=520&r2=521&view=diff
==============================================================================
--- trunk/src/modules/module-tunnel.c (original)
+++ trunk/src/modules/module-tunnel.c Mon Feb 20 17:01:53 2006
@@ -94,7 +94,7 @@
static void command_request(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
#endif
-static const pa_pdispatch_callback command_table[PA_COMMAND_MAX] = {
+static const pa_pdispatch_callback_t command_table[PA_COMMAND_MAX] = {
#ifdef TUNNEL_SINK
[PA_COMMAND_REQUEST] = command_request,
#endif
Modified: trunk/src/polyp/context.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/context.c?rev=521&root=polypaudio&r1=520&r2=521&view=diff
==============================================================================
--- trunk/src/polyp/context.c (original)
+++ trunk/src/polyp/context.c Mon Feb 20 17:01:53 2006
@@ -72,7 +72,7 @@
#define AUTOSPAWN_LOCK "autospawn.lock"
-static const pa_pdispatch_callback command_table[PA_COMMAND_MAX] = {
+static const pa_pdispatch_callback_t command_table[PA_COMMAND_MAX] = {
[PA_COMMAND_REQUEST] = pa_command_request,
[PA_COMMAND_OVERFLOW] = pa_command_overflow_or_underflow,
[PA_COMMAND_UNDERFLOW] = pa_command_overflow_or_underflow,
@@ -671,7 +671,7 @@
return c->error;
}
-void pa_context_set_state_callback(pa_context *c, void (*cb)(pa_context *c, void *userdata), void *userdata) {
+void pa_context_set_state_callback(pa_context *c, pa_context_notify_cb_t cb, void *userdata) {
assert(c && c->ref >= 1);
c->state_callback = cb;
c->state_userdata = userdata;
@@ -730,7 +730,7 @@
pa_operation_unref(o);
}
-pa_operation* pa_context_drain(pa_context *c, void (*cb) (pa_context*c, void *userdata), void *userdata) {
+pa_operation* pa_context_drain(pa_context *c, pa_context_notify_cb_t cb, void *userdata) {
pa_operation *o;
assert(c && c->ref >= 1);
@@ -777,7 +777,7 @@
}
if (o->callback) {
- void (*cb)(pa_context *c, int _success, void *_userdata) = (void (*)(pa_context *c, int _success, void *_userdata)) o->callback;
+ pa_context_success_cb_t cb = (pa_context_success_cb_t) o->callback;
cb(o->context, success, o->userdata);
}
@@ -805,7 +805,7 @@
return pa_operation_ref(o);
}
-pa_operation* pa_context_set_default_sink(pa_context *c, const char *name, void(*cb)(pa_context*c, int success, void *userdata), void *userdata) {
+pa_operation* pa_context_set_default_sink(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata) {
pa_tagstruct *t;
pa_operation *o;
uint32_t tag;
@@ -825,7 +825,7 @@
return pa_operation_ref(o);
}
-pa_operation* pa_context_set_default_source(pa_context *c, const char *name, void(*cb)(pa_context*c, int success, void *userdata), void *userdata) {
+pa_operation* pa_context_set_default_source(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata) {
pa_tagstruct *t;
pa_operation *o;
uint32_t tag;
@@ -850,7 +850,7 @@
return c->local;
}
-pa_operation* pa_context_set_name(pa_context *c, const char *name, void(*cb)(pa_context*c, int success, void *userdata), void *userdata) {
+pa_operation* pa_context_set_name(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata) {
pa_tagstruct *t;
pa_operation *o;
uint32_t tag;
Modified: trunk/src/polyp/context.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/context.h?rev=521&root=polypaudio&r1=520&r2=521&view=diff
==============================================================================
--- trunk/src/polyp/context.h (original)
+++ trunk/src/polyp/context.h Mon Feb 20 17:01:53 2006
@@ -53,6 +53,12 @@
* An opaque connection context to a daemon */
typedef struct pa_context pa_context;
+/** Generic notification callback prototype */
+typedef void (*pa_context_notify_cb_t)(pa_context *c, void *userdata);
+
+/** A generic callback for operation completion */
+typedef void (*pa_context_success_cb_t) (pa_context *c, int success, void *userdata);
+
/** Instantiate a new connection context with an abstract mainloop API
* and an application name */
pa_context *pa_context_new(pa_mainloop_api *mainloop, const char *name);
@@ -63,10 +69,8 @@
/** Increase the reference counter of the context by one */
pa_context* pa_context_ref(pa_context *c);
-typedef void (*pa_context_state_callback)(pa_context *c, void *userdata);
-
/** Set a callback function that is called whenever the context status changes */
-void pa_context_set_state_callback(pa_context *c, pa_context_state_callback callback, void *userdata);
+void pa_context_set_state_callback(pa_context *c, pa_context_notify_cb_t cb, void *userdata);
/** Return the error number of the last failed operation */
int pa_context_errno(pa_context *c);
@@ -90,7 +94,7 @@
void pa_context_disconnect(pa_context *c);
/** Drain the context. If there is nothing to drain, the function returns NULL */
-pa_operation* pa_context_drain(pa_context *c, void (*cb) (pa_context*c, void *userdata), void *userdata);
+pa_operation* pa_context_drain(pa_context *c, pa_context_notify_cb_t cb, void *userdata);
/** Tell the daemon to exit. No operation object is returned as the
* connection is terminated when the daemon quits, thus this operation
@@ -98,16 +102,16 @@
void pa_context_exit_daemon(pa_context *c);
/** Set the name of the default sink. \since 0.4 */
-pa_operation* pa_context_set_default_sink(pa_context *c, const char *name, void(*cb)(pa_context*c, int success, void *userdata), void *userdata);
+pa_operation* pa_context_set_default_sink(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata);
/** Set the name of the default source. \since 0.4 */
-pa_operation* pa_context_set_default_source(pa_context *c, const char *name, void(*cb)(pa_context*c, int success, void *userdata), void *userdata);
+pa_operation* pa_context_set_default_source(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata);
/** Returns 1 when the connection is to a local daemon. Returns negative when no connection has been made yet. \since 0.5 */
int pa_context_is_local(pa_context *c);
/** Set a different application name for context on the server. \since 0.5 */
-pa_operation* pa_context_set_name(pa_context *c, const char *name, void(*cb)(pa_context*c, int success, void *userdata), void *userdata);
+pa_operation* pa_context_set_name(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata);
/** Return the server name this context is connected to. \since 0.7 */
const char* pa_context_get_server(pa_context *c);
Modified: trunk/src/polyp/internal.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/internal.h?rev=521&root=polypaudio&r1=520&r2=521&view=diff
==============================================================================
--- trunk/src/polyp/internal.h (original)
+++ trunk/src/polyp/internal.h Mon Feb 20 17:01:53 2006
@@ -59,8 +59,8 @@
uint32_t csyncid;
uint32_t error;
pa_context_state_t state;
-
- void (*state_callback)(pa_context*c, void *userdata);
+
+ pa_context_notify_cb_t state_callback;
void *state_userdata;
void (*subscribe_callback)(pa_context *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata);
Modified: trunk/src/polypcore/pdispatch.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/pdispatch.c?rev=521&root=polypaudio&r1=520&r2=521&view=diff
==============================================================================
--- trunk/src/polypcore/pdispatch.c (original)
+++ trunk/src/polypcore/pdispatch.c Mon Feb 20 17:01:53 2006
@@ -94,7 +94,7 @@
struct reply_info {
pa_pdispatch *pdispatch;
PA_LLIST_FIELDS(struct reply_info);
- pa_pdispatch_callback callback;
+ pa_pdispatch_callback_t callback;
void *userdata;
uint32_t tag;
pa_time_event *time_event;
@@ -103,7 +103,7 @@
struct pa_pdispatch {
int ref;
pa_mainloop_api *mainloop;
- const pa_pdispatch_callback *callback_table;
+ const pa_pdispatch_callback_t *callback_table;
unsigned n_commands;
PA_LLIST_HEAD(struct reply_info, replies);
pa_pdispatch_drain_callback drain_callback;
@@ -121,7 +121,7 @@
pa_xfree(r);
}
-pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *mainloop, const pa_pdispatch_callback*table, unsigned entries) {
+pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *mainloop, const pa_pdispatch_callback_t*table, unsigned entries) {
pa_pdispatch *pd;
assert(mainloop);
@@ -149,7 +149,7 @@
}
static void run_action(pa_pdispatch *pd, struct reply_info *r, uint32_t command, pa_tagstruct *ts) {
- pa_pdispatch_callback callback;
+ pa_pdispatch_callback_t callback;
void *userdata;
uint32_t tag;
assert(r);
@@ -210,7 +210,7 @@
run_action(pd, r, command, ts);
} else if (pd->callback_table && (command < pd->n_commands) && pd->callback_table[command]) {
- const pa_pdispatch_callback *c = pd->callback_table+command;
+ const pa_pdispatch_callback_t *c = pd->callback_table+command;
(*c)(pd, command, tag, ts, userdata);
} else {
@@ -236,7 +236,7 @@
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 cb, void *userdata) {
+void pa_pdispatch_register_reply(pa_pdispatch *pd, uint32_t tag, int timeout, pa_pdispatch_callback_t cb, void *userdata) {
struct reply_info *r;
struct timeval tv;
assert(pd && pd->ref >= 1 && cb);
Modified: trunk/src/polypcore/pdispatch.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/pdispatch.h?rev=521&root=polypaudio&r1=520&r2=521&view=diff
==============================================================================
--- trunk/src/polypcore/pdispatch.h (original)
+++ trunk/src/polypcore/pdispatch.h Mon Feb 20 17:01:53 2006
@@ -29,15 +29,15 @@
typedef struct pa_pdispatch pa_pdispatch;
-typedef void (*pa_pdispatch_callback)(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
+typedef void (*pa_pdispatch_callback_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*table, unsigned entries);
+pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *m, const pa_pdispatch_callback_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 callback, void *userdata);
+void pa_pdispatch_register_reply(pa_pdispatch *pd, uint32_t tag, int timeout, pa_pdispatch_callback_t callback, void *userdata);
int pa_pdispatch_is_pending(pa_pdispatch *pd);
Modified: trunk/src/polypcore/protocol-native.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/protocol-native.c?rev=521&root=polypaudio&r1=520&r2=521&view=diff
==============================================================================
--- trunk/src/polypcore/protocol-native.c (original)
+++ trunk/src/polypcore/protocol-native.c Mon Feb 20 17:01:53 2006
@@ -174,7 +174,7 @@
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 command_table[PA_COMMAND_MAX] = {
+static const pa_pdispatch_callback_t command_table[PA_COMMAND_MAX] = {
[PA_COMMAND_ERROR] = NULL,
[PA_COMMAND_TIMEOUT] = NULL,
[PA_COMMAND_REPLY] = NULL,
More information about the pulseaudio-commits
mailing list