Changeset 5504:ff89becc47ab in roaraudio


Ignore:
Timestamp:
05/15/12 14:19:08 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Added support for AutoAppSched? to the plugin container.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r5501 r5504  
    11v. 1.0beta2 - ? 
    22        * ROAR_DL_PLUGIN_START() now checks para structure (Closes: #236) 
     3        * Added support for AutoAppSched to the plugin container. 
    34 
    45v. 1.0beta1 - Sat May 12 2012 11:49 CEST 
  • include/libroar/plugincontainer.h

    r5488 r5504  
    118118int roar_plugincontainer_unref(struct roar_plugincontainer * cont); 
    119119 
     120/* Set Autoappsched. 
     121 * If set the INIT and FREE appsched events are send automatically. 
     122 */ 
     123int roar_plugincontainer_set_autoappsched(struct roar_plugincontainer * cont, int val); 
     124 
    120125/* Set callbacks. 
    121126 */ 
  • libroar/plugincontainer.c

    r5488 r5504  
    3838#define MAX_PLUGINS 64 
    3939 
     40#define OPT_AUTOAPPSCHED 0x0001 
     41 
    4042struct roar_plugincontainer { 
    4143 size_t refc; 
    4244 const struct roar_plugincontainer_callbacks * callbacks; 
    4345 void * userdata; 
     46 unsigned int options; 
    4447 struct roar_dl_librarypara * default_para; 
    4548 struct roar_dl_lhandle * handle[MAX_PLUGINS]; 
     
    5154static inline void _unload(struct roar_plugincontainer * cont, size_t index) { 
    5255 int err = roar_error; 
     56 
     57 if ( cont->options & OPT_AUTOAPPSCHED ) 
     58  roar_dl_appsched_trigger(cont->handle[index], ROAR_DL_APPSCHED_FREE); 
    5359 
    5460 if ( cont->callbacks != NULL && cont->callbacks->preunload != NULL ) 
     
    275281} 
    276282 
     283int roar_plugincontainer_set_autoappsched(struct roar_plugincontainer * cont, int val) { 
     284 if ( cont == NULL ) { 
     285  roar_err_set(ROAR_ERROR_FAULT); 
     286  return -1; 
     287 } 
     288 
     289 if ( val ) { 
     290  cont->options |= OPT_AUTOAPPSCHED; 
     291  return 0; 
     292 } else { 
     293  if ( cont->options & OPT_AUTOAPPSCHED ) { 
     294   roar_err_set(ROAR_ERROR_BUSY); 
     295   return -1; 
     296  } else { 
     297   return 0; 
     298  } 
     299 } 
     300} 
     301 
    277302int roar_plugincontainer_set_callbacks(struct roar_plugincontainer * cont, 
    278303                                       const struct roar_plugincontainer_callbacks * callbacks) { 
     
    450475  if ( cont->callbacks != NULL && cont->callbacks->postra_init != NULL ) 
    451476   cont->callbacks->postra_init(cont, &(cont->context[idx]), cont->handle[idx], para); 
     477 
     478  if ( cont->options & OPT_AUTOAPPSCHED ) 
     479   roar_dl_appsched_trigger(cont->handle[idx], ROAR_DL_APPSCHED_INIT); 
    452480 } 
    453481 
     
    522550  if ( cont->callbacks != NULL && cont->callbacks->postra_init != NULL ) 
    523551   cont->callbacks->postra_init(cont, &(cont->context[i]), cont->handle[i], cont->default_para); 
     552 
     553  if ( cont->options & OPT_AUTOAPPSCHED ) 
     554   roar_dl_appsched_trigger(cont->handle[i], ROAR_DL_APPSCHED_INIT); 
    524555 } 
    525556 
Note: See TracChangeset for help on using the changeset viewer.