Changeset 5576:a98545bcc3f1 in roaraudio for roard/plugins.c
- Timestamp:
- 07/21/12 16:05:33 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/plugins.c
r5567 r5576 37 37 static int _plugins_inited = 0; 38 38 39 static int plugin_callback(enum roar_dl_fnreg_action action, int fn, int subtype, const void * object, size_t objectlen, int version, int options, void * userdata, struct roar_dl_lhandle * lhandle); 40 static const struct roar_dl_fnreg _plugin_callbacks = { 41 .fn = -1, 42 .subtype = -1, 43 .version = -1, 44 .callback = plugin_callback, 45 .userdata = NULL 46 }; 47 39 48 static struct _roard_plugin * _find_free(void) { 40 49 int i; … … 115 124 return -1; 116 125 } 126 127 roar_dl_register_fn(ROAR_DL_HANDLE_APPLICATION, ROAR_DL_FN_REGFN, ROAR_DL_FNREG_SUBTYPE, &_plugin_callbacks, ROAR_DL_FNREG_SIZE, ROAR_DL_FNREG_VERSION, ROAR_DL_FNREG_OPT_NONE); 117 128 118 129 for (i = 0; i < MAX_PLUGINS; i++) { … … 222 233 } 223 234 235 static int plugin_callback(enum roar_dl_fnreg_action action, int fn, int subtype, const void * object, size_t objectlen, int version, int options, void * userdata, struct roar_dl_lhandle * lhandle) { 236 237 ROAR_DBG("plugin_callback(action=%i, fn=%i, subtype=%i, object=%p, objectlen=%llu, version=%i, options=0x%x, userdata=%p, lhandle=%p) = ?", (int)action, fn, subtype, object, (long long unsigned int)objectlen, version, options, userdata, lhandle); 238 239 switch (fn) { 240 case ROAR_DL_FN_PROTO: 241 if ( subtype != ROAR_DL_PROTO_SUBTYPE ) { 242 ROAR_DBG("plugin_callback(action=%i, fn=%i, subtype=%i, object=%p, objectlen=%llu, version=%i, options=0x%x, userdata=%p, lhandle=%p) = -1 // error=TYPEMM", (int)action, fn, subtype, object, (long long unsigned int)objectlen, version, options, userdata, lhandle); 243 244 roar_err_set(ROAR_ERROR_TYPEMM); 245 return -1; 246 } 247 if ( objectlen != ROAR_DL_PROTO_SIZE ) { 248 ROAR_DBG("plugin_callback(action=%i, fn=%i, subtype=%i, object=%p, objectlen=%llu, version=%i, options=0x%x, userdata=%p, lhandle=%p) = -1 // error=BADLIB", (int)action, fn, subtype, object, (long long unsigned int)objectlen, version, options, userdata, lhandle); 249 roar_err_set(ROAR_ERROR_BADLIB); 250 return -1; 251 } 252 if ( version != ROAR_DL_PROTO_VERSION ) { 253 ROAR_DBG("plugin_callback(action=%i, fn=%i, subtype=%i, object=%p, objectlen=%llu, version=%i, options=0x%x, userdata=%p, lhandle=%p) = -1 // error=BADVERSION", (int)action, fn, subtype, object, (long long unsigned int)objectlen, version, options, userdata, lhandle); 254 roar_err_set(ROAR_ERROR_BADVERSION); 255 return -1; 256 } 257 switch (action) { 258 case ROAR_DL_FNREG: 259 return clients_register_proto_common(object, lhandle); 260 break; 261 case ROAR_DL_FNUNREG: 262 return clients_unregister_proto(((const struct roard_proto *)object)->proto); 263 break; 264 } 265 break; 266 } 267 268 ROAR_DBG("plugin_callback(action=%i, fn=%i, subtype=%i, object=%p, objectlen=%llu, version=%i, options=0x%x, userdata=%p, lhandle=%p) = -1 // error=NOTSUP", (int)action, fn, subtype, object, (long long unsigned int)objectlen, version, options, userdata, lhandle); 269 roar_err_set(ROAR_ERROR_NOTSUP); 270 return -1; 271 } 272 224 273 //ll
Note: See TracChangeset
for help on using the changeset viewer.