From: Vitaly V. B. <vit...@us...> - 2004-07-24 13:44:05
|
> Vitaly, how is the display lib stuff and the new plugin framework stuff > going ? Not much, sorry. Is it OK to do smth like this? I also tried to eliminate repeating entries in a structs. ============================== #ifndef VO_PLUGIN #define VO_PLUGIN typedef enum { VISUAL_PLUGIN_TYPE_NULL, VISUAL_PLUGIN_TYPE_ACTOR, VISUAL_PLUGIN_TYPE_INPUT, VISUAL_PLUGIN_TYPE_MORPH, } VisPluginType; typedef _VisPluginInfo VisPluginInfo; typedef _VisPluginData VisPluginData; typedef _VisPluginRef VisPluginRef; struct _VisPluginRef { char *file; void *handle; VisPluginType type; VisPluginInfo *info; int usecount; }; struct _VisPluginData { VisPluginRef *ref; VisEventQueue eventqueue; void *priv; union { /* only pointers here! */ void *genericplugin; VisActorPlugin *actorplugin; VisInputPlugin *inputplugin; VisMorphPlugin *morphplugin; } plugin; }; struct _VisPluginInfo { uint32_t struct_size; uint32_t api_version; VisPluginType plugin_type; const char *name; const char *author; const char *version; const char *about; const char *help; /* VisPluginData* will be allocated by Libvisual. * Plugin only needs to init priv, if necessary. */ int (*init)(VisPluginData*); int (*cleanup)(VisPluginData*); union { struct { int (*x)(); } actor; struct { int (*x)(); } input; struct { int (*x)(); } morph; } preferences; }; /* // count defaults to 1 const VisPluginInfo *get_plugin_info(int *count) { const VisPluginInfo info[] = { / * blah-blah-blah * / }; *count = sizeof(info)/sizeof(*info); return info; } */ #endif ======================== So, one library can provide more than only one plugin interface :) -- Regards, Vitaly GPG Key ID: F95A23B9 |