Changeset 5639:b8cdcac37ffe in roaraudio for roard
- Timestamp:
- 09/10/12 15:56:42 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/include/plugins.h
r5592 r5639 32 32 #define ROARD_DL_ABIVERSION "1.0beta1" 33 33 34 struct roard_plugins_sched {35 int (*init)(void);36 int (*free)(void);37 int (*update)(void);38 };39 40 34 int plugins_preinit (void); 41 35 int plugins_init (void); … … 47 41 void print_pluginlist(enum output_format format); 48 42 49 int plugins_reg_sched(struct roard_plugins_sched * sched);50 43 int plugins_reg_proto(struct roard_proto * proto); 51 44 … … 60 53 return 0; \ 61 54 } 62 63 #define ROARD_DL_REG_SCHED(sched) \64 ROARD_DL_REG__UNI_PRE(sched) \65 for (i = 0; i < (sizeof((sched))/sizeof(*(sched))); i++) \66 plugins_reg_sched(&((sched)[i])); \67 ROARD_DL_REG__UNI_POST68 69 // Register Scheduler callbacks:70 #define ROARD_DL_REGFN_SCHED() ROAR_DL_PLUGIN_REG(ROAR_DL_FN_ROARDSCHED, __reg_sched)71 55 72 56 #define ROARD_DL_REG_PROTO(proto) \ -
roard/plugins.c
r5592 r5639 30 30 static struct _roard_plugin { 31 31 struct roar_dl_lhandle * lhandle; 32 struct roard_plugins_sched * sched;33 32 int protocols[MAX_PROTOS]; 34 33 } g_plugins[MAX_PLUGINS]; … … 81 80 ROAR_DBG("plugins_delete(plugin=%p) = ?", plugin); 82 81 83 if ( plugin->sched != NULL ) {84 if ( plugin->sched->free != NULL ) {85 roar_dl_context_restore(plugin->lhandle);86 plugin->sched->free();87 roar_dl_context_store(plugin->lhandle);88 }89 }90 91 82 roar_dl_appsched_trigger(plugin->lhandle, ROAR_DL_APPSCHED_FREE); 92 83 … … 109 100 110 101 _pp = plugin; 111 _pp->sched = NULL;112 102 113 103 if ( roar_dl_ra_init(plugin->lhandle, NULL, NULL) == -1 ) { … … 117 107 } 118 108 119 if ( plugin->sched != NULL ) {120 if ( plugin->sched->init != NULL ) {121 roar_dl_context_restore(plugin->lhandle);122 plugin->sched->init();123 roar_dl_context_store(plugin->lhandle);124 }125 }126 127 109 roar_dl_appsched_trigger(plugin->lhandle, ROAR_DL_APPSCHED_INIT); 128 110 … … 185 167 for (i = 0; i < MAX_PLUGINS; i++) { 186 168 if ( g_plugins[i].lhandle != NULL ) { 187 if ( g_plugins[i].sched != NULL ) {188 if ( g_plugins[i].sched->update != NULL ) {189 roar_dl_context_restore(g_plugins[i].lhandle);190 if ( g_plugins[i].sched->update() == -1 )191 ret = -1;192 roar_dl_context_store(g_plugins[i].lhandle);193 }194 }195 169 if ( roar_dl_appsched_trigger(g_plugins[i].lhandle, ROAR_DL_APPSCHED_UPDATE) == -1 ) 196 170 if ( roar_error != ROAR_ERROR_NOENT ) … … 261 235 } else { 262 236 printf(" %s\n", libname->libname); 263 printf(" Flags: %s\n", p->sched != NULL ? "roardsched" :"");237 printf(" Flags: %s\n", ""); 264 238 if ( libname->description != NULL ) 265 239 printf(" Description: %s\n", libname->description); … … 268 242 } 269 243 } 270 }271 272 int plugins_reg_sched(struct roard_plugins_sched * sched) {273 if ( _pp == NULL )274 return -1;275 276 _pp->sched = sched;277 278 return 0;279 244 } 280 245
Note: See TracChangeset
for help on using the changeset viewer.