From: Dennis S. <sy...@yo...> - 2004-08-29 20:41:06
|
Alright I landed most of the new plugin system, it's based mostly on the work by Vitaly. It's not yet completely set in stone, not yet in CVS (have to finish a few bits tomorrow), and it's open for discussion. Although with a bit of hurry because I won't have a lot of time upcoming 2 weeks and the 10th of September I want to release 0.1.6. The structures: struct _VisPluginRef { char *file; int usecount; VisPluginInfo *info; /* This info is a duplicate because plugins are closed after the registry is build (I don't like the idea of having unused plugins dlopened.) */ }; /** * The VisPluginInfo data structure contains information about a plugin * and is filled within the plugin itself. */ struct _VisPluginInfo { uint32_t struct_size; /* Hey isn't that cool, we can now check for ABI compatability! was about time, thanks vitaly! :) */ uint32_t api_version; VisPluginType type; char *plugname; char *name; char *author; char *version; char *about; char *help; plugin_init_func_t init; plugin_cleanup_func_t cleanup; plugin_events_func_t events; /* FIXME do we move prefs to the separate plugin structures, or do we move everything (the methods as well) into an union here ? */ union { struct { int depth; } actor; struct { int depth; } morph; } prefs; }; struct _VisPluginData { VisPluginRef *ref; /* This info the real plugin info that is retrieved from the plugin after the plugin is loaded, the ref contains a copy for closed plugins */ const VisPluginInfo *info; VisEventQueue eventqueue; VisParamContainer params; int plugflags; VisSongInfo *songinfo; int realized; void *handle; union { void *generic; /* These contain plugin specific methods, IMPORTANT do we rather have a union in VisPluginInfo, or not ? */ VisActorPlugin *actor; VisInputPlugin *input; VisMorphPlugin *morph; } plugin; void *priv; }; /** * The VisActorPlugin structure is the main data structure * for the actor (visualisation) plugin. * * The actor plugin is the visualisation plugin. */ struct _VisActorPlugin { plugin_actor_requisition_func_t requisition; /**< The requisition function. This is used to * get the desired VisVideo surface size of the plugin. */ plugin_actor_palette_func_t palette; /**< Used to retrieve the desired palette from the plugin. */ plugin_actor_render_func_t render; /**< The main render loop. This is called to draw a frame. */ }; /** * The VisInputPlugin structure is the main data structure * for the input plugin. * * The input plugin is used to retrieve PCM samples from * certain sources. */ struct _VisInputPlugin { plugin_input_upload_func_t upload; /**< The sample upload function. This is the main function * of the plugin which uploads sample data into * libvisual. */ }; /** * The VisMorphPlugin structure is the main data structure * for the morph plugin. * * The morph plugin is capable of morphing between two VisVideo * sources, and thus is capable of morphing between two * VisActors. */ struct _VisMorphPlugin { plugin_morph_palette_func_t palette; /**< The plugin it's palette function. This can be used * to obtain a palette for VISUAL_VIDEO_DEPTH_8BIT surfaces. * However the function may be set to NULL. In this case the * VisMorph system morphs between palettes itself. */ plugin_morph_apply_func_t apply; /**< The plugin it's main function. This is used to morph * between two VisVideo sources. */ }; ______ And the plugin part (get_plugin_info, init, cleanup): const VisPluginInfo *get_plugin_info (int *count) { static const VisPluginInfo info[] = {{ .struct_size = sizeof (VisPluginInfo), .api_version = VISUAL_PLUGIN_API_VERSION, .type = VISUAL_PLUGIN_TYPE_ACTOR, .plugname = "infinite", .name = "infinite plugin", .author = "Original by: Julien Carme <jul...@ac...>, Port by: Dennis Smit <ds...@ne...>", .version = "0.1", .about = "The infinite visual plugin", .help = "This is the libvisual plugin for the infinite visual", .init = act_infinite_init, .cleanup = act_infinite_cleanup, .events = act_infinite_events, .prefs.actor.depth = VISUAL_VIDEO_DEPTH_8BIT }}; *count = sizeof (info) / sizeof (*info); return info; } int act_infinite_init (VisPluginData *plugin) { InfinitePrivate *priv; VisActorPlugin *actplug = visual_plugin_actor_new ();; visual_log_return_val_if_fail (plugin != NULL, -1); plugin->plugin.actor = actplug; actplug->requisition = act_infinite_requisition; actplug->palette = act_infinite_palette; actplug->render = act_infinite_render; priv = visual_mem_new0 (InfinitePrivate, 1); plugin->priv = priv; priv->plugwidth = 32; priv->plugheight = 32; visual_palette_allocate_colors (&priv->pal, 256); _inf_init_renderer (priv); return 0; } int act_infinite_cleanup (VisPluginData *plugin) { InfinitePrivate *priv; visual_log_return_val_if_fail (plugin != NULL, -1); priv = plugin->priv; _inf_close_renderer (priv); visual_palette_free_colors (&priv->pal); visual_mem_free (priv); visual_mem_free (plugin->plugin.actor); return 0; } ______ So that is that, now do we want things different, what do we want different ? Please do your call kinda quick so I can port the other bunch of plugins over in the evenings after school! :) After this is done most work for 0.1.6 is done and we're near ready for a release! Cheers and thanks a lot, Dennis |
From: Dennis S. <sy...@yo...> - 2004-08-31 22:16:11
|
I've changed a few things: Plugin initializer: ___ static const VisActorPlugin actor[] = {{ .requisition = act_infinite_requisition, .palette = act_infinite_palette, .render = act_infinite_render, .depth = VISUAL_VIDEO_DEPTH_8BIT }}; static const VisPluginInfo info[] = {{ .struct_size = sizeof (VisPluginInfo), .api_version = VISUAL_PLUGIN_API_VERSION, .type = VISUAL_PLUGIN_TYPE_ACTOR, .plugname = "infinite", .name = "infinite plugin", .author = "Original by: Julien Carme <jul...@ac...>, Port by: Dennis Smit <ds...@ne...>", .version = "0.1", .about = "The infinite visual plugin", .help = "This is the libvisual plugin for the infinite visual", .init = act_infinite_init, .cleanup = act_infinite_cleanup, .events = act_infinite_events, .plugin = (void *) &actor[0] }}; ___ Now the plugin system can load any type of plugin (also non actor, input, morph) plugins. |
From: Duilio J. P. <dp...@fc...> - 2004-09-02 02:22:45
|
> /** > * The VisPluginInfo data structure contains information about a plugin > * and is filled within the plugin itself. > */ > struct _VisPluginInfo { > > ..... > > /* FIXME do we move prefs to the separate plugin structures, or > do we move everything (the methods as well) into an union here ? */ > union { > struct { > int depth; > } actor; > > struct { > int depth; > } morph; > } prefs; > > }; I think would be good to move prefs to _VisPluginData, because it is data subject to change on the fly. This way we kept all 'static' info on _VisPluginInfo and 'dynamic' plugin info go to _VisPluginData. Bye, Duilio. |
From: Dennis S. <sy...@yo...> - 2004-09-02 06:16:39
|
I have moved it into the plugin specific data structure and I totally think it belongs here (VisActorPlugin etc etc) This way generic plugins can be created as well, for libvisual-display for example. Cheers, Dennis On Wed, 2004-09-01 at 23:28 -0300, Duilio Javier Protti wrote: > > /** > > * The VisPluginInfo data structure contains information about a plugin > > * and is filled within the plugin itself. > > */ > > struct _VisPluginInfo { > > > > ..... > > > > /* FIXME do we move prefs to the separate plugin structures, or > > do we move everything (the methods as well) into an union here ? */ > > union { > > struct { > > int depth; > > } actor; > > > > struct { > > int depth; > > } morph; > > } prefs; > > > > }; > > I think would be good to move prefs to _VisPluginData, because it is > data subject to change on the fly. This way we kept all 'static' info on > _VisPluginInfo and 'dynamic' plugin info go to _VisPluginData. > > Bye, > Duilio. |