Changeset 5511:e2207bedaf0e in roaraudio for include


Ignore:
Timestamp:
05/28/12 12:25:20 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Added a way to register plugin parts with a universal API (Closes: #245)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/roardl.h

    r5501 r5511  
    4848#define ROAR_DL_HANDLE_DEFAULT          ((struct roar_dl_lhandle*)(void*)0) 
    4949#define ROAR_DL_HANDLE_NEXT             ((struct roar_dl_lhandle*)(void*)1) 
    50  
    51 #define ROAR_DL_FN_DSTR                 0 
    52 #define ROAR_DL_FN_CDRIVER              1 
    53 #define ROAR_DL_FN_TRANSCODER           2 
    54 #define ROAR_DL_FN_DRIVER               3 
    55 #define ROAR_DL_FN_SOURCE               4 
    56 #define ROAR_DL_FN_FILTER               5 
    57 #define ROAR_DL_FN_FF                   6 /* file format */ 
    58 #define ROAR_DL_FN_AUTH                 7 
    59 #define ROAR_DL_FN_BRIDGE               8 
    60 #define ROAR_DL_FN_ROARDSCHED           9 
    61 #define ROAR_DL_FN_APPSCHED            10 
    62 #define ROAR_DL_FN_PROTO               11 
    63 #define ROAR_DL_FN_NOTIFY              12 
     50#define ROAR_DL_HANDLE_LIBROAR          ((struct roar_dl_lhandle*)(void*)2) 
     51#define ROAR_DL_HANDLE_APPLICATION      ((struct roar_dl_lhandle*)(void*)3) 
     52 
     53#define ROAR_DL_FN_DSTR                 0 /* VIO and DSTR drivers */ 
     54#define ROAR_DL_FN_CDRIVER              1 /* Client drivers, libroareio */ 
     55#define ROAR_DL_FN_TRANSCODER           2 /* Transcoder, libroardsp */ 
     56#define ROAR_DL_FN_DRIVER               3 /* Driver, roard? */ 
     57#define ROAR_DL_FN_SOURCE               4 /* Sources, roard? */ 
     58#define ROAR_DL_FN_FILTER               5 /* Filter, libroardsp */ 
     59#define ROAR_DL_FN_FF                   6 /* file format??? */ 
     60#define ROAR_DL_FN_AUTH                 7 /* Auth */ 
     61#define ROAR_DL_FN_BRIDGE               8 /* Bridges, roard? */ 
     62#define ROAR_DL_FN_ROARDSCHED           9 /* Like appsched, but roard specific, old */ 
     63#define ROAR_DL_FN_APPSCHED            10 /* AppSched, old interface */ 
     64#define ROAR_DL_FN_PROTO               11 /* Protocols, roard? */ 
     65#define ROAR_DL_FN_NOTIFY              12 /* ??? */ 
    6466#define ROAR_DL_FN_INIT                13 /* global plugin instance init. should be avoided */ 
     67#define ROAR_DL_FN_REGFN               14 /* FN Registrations */ 
     68#define ROAR_DL_FN_APPLICATION         15 /* Application specific stuff */ 
    6569//#define ROAR_DL_FN_               9 
    6670#define ROAR_DL_FN_MAX                 24 
     
    296300int                      roar_dl_appsched_trigger(struct roar_dl_lhandle * lhandle, enum roar_dl_appsched_trigger trigger); 
    297301 
     302// FN Registration: 
     303 
     304// Actions objects can emit: 
     305enum roar_dl_fnreg_action { 
     306 ROAR_DL_FNREG   = 1, // The object is been registered 
     307 ROAR_DL_FNUNREG = 2  // The object is been unregistered 
     308}; 
     309 
     310// Callback for registering/unregistering objects: 
     311struct roar_dl_fnreg { 
     312 int fn;          // Filter: The FN of the registering object or -1 for any. 
     313 int subtype;     // Filter: The subtype of the registering object or -1 for any. 
     314 int version;     // Filter: The version of the registering object or -1 for any. 
     315 int (*callback)( // Callback to call on register/unregister. 
     316   enum roar_dl_fnreg_action action, // The action happening 
     317   int fn,                           // The FN of the object 
     318   int subtype,                      // The subtype of the object 
     319   const void * object,              // Pointer to the object 
     320   size_t objectlen,                 // Length of the object 
     321   int version,                      // Version of the object 
     322   int options,                      // Object Options. 
     323   void * userdata,                  // User data for the callback. 
     324   struct roar_dl_lhandle * lhandle  // The registering handle. 
     325                                     // This is valid until the object is unregistered. 
     326                                     // Only roar_dl_context_restore() and roar_dl_context_store() 
     327                                     // may be used on this object. Result of all other functions 
     328                                     // is undefined. 
     329 ); 
     330 void * userdata; // The user data pointer passed to the callback. 
     331}; 
     332 
     333// Parameters for FNREG registration: 
     334#define ROAR_DL_FNREG_SUBTYPE  0 
     335#define ROAR_DL_FNREG_VERSION  0 
     336#define ROAR_DL_FNREG_SIZE     sizeof(struct roar_dl_fnreg) 
     337 
     338 
     339// Reg FN: 
     340 
     341// Options: 
     342#define ROAR_DL_FNREG_OPT_NONE 0   /* no options */ 
     343 
     344// Register an FN. 
     345int                      roar_dl_register_fn(struct roar_dl_lhandle * lhandle, int fn, int subtype, const void * object, size_t objectlen, int version, int options); 
     346 
     347// Unregister FN for the given plugin. 
     348// This should not be called directly and is called internally when needed. 
     349int                      roar_dl_unregister_fn(struct roar_dl_lhandle * lhandle); 
     350 
    298351#endif 
    299352 
Note: See TracChangeset for help on using the changeset viewer.