25 #include "lv_plugin.h"
26 #include "lv_common.h"
27 #include "lv_libvisual.h"
29 #include "lv_plugin_registry.h"
38 VisPluginInfo
const *info;
40 EventQueue eventqueue;
52 for (
unsigned int i = 0; i < list.size (); i++)
54 if (std::strcmp (list[i].info->plugname, name) == 0)
56 unsigned int next_i = (i + 1) % list.size ();
57 return list[next_i].info->plugname;
66 for (
unsigned int i = 0; i < list.size (); i++)
68 if (std::strcmp (list[i].info->plugname, name) == 0)
70 unsigned int prev_i = (i + list.size () - 1) % list.size ();
71 return list[prev_i].info->plugname;
78 PluginData::PluginData ()
92 visual_return_if_fail (plugin !=
nullptr);
94 if (plugin->info->events) {
95 plugin->info->events (plugin, &plugin->eventqueue);
101 visual_return_val_if_fail (plugin !=
nullptr,
nullptr);
103 return &plugin->eventqueue;
108 visual_return_val_if_fail (plugin !=
nullptr,
nullptr);
115 visual_return_val_if_fail (plugin !=
nullptr,
nullptr);
117 return &plugin->params;
122 visual_return_val_if_fail (plugin !=
nullptr,
nullptr);
124 return &plugin->random;
129 visual_return_val_if_fail (plugin !=
nullptr,
nullptr);
132 visual_return_val_if_fail (pluginfo !=
nullptr,
nullptr);
134 return pluginfo->plugin;
137 static VisPluginData *visual_plugin_new ()
139 return new VisPluginData;
142 static void visual_plugin_free (VisPluginData *plugin)
149 visual_return_if_fail (plugin !=
nullptr);
151 if (plugin->realized) {
152 plugin->info->cleanup (plugin);
155 visual_plugin_free (plugin);
167 auto plugin = visual_plugin_new ();
175 visual_return_val_if_fail (plugin !=
nullptr, FALSE);
177 if (plugin->realized) {
184 params->set_event_queue (plugin->eventqueue);
186 if (!plugin->info->init (plugin)) {
191 plugin->realized = TRUE;
198 visual_return_val_if_fail (plugin !=
nullptr, FALSE);
200 return plugin->realized;
205 visual_return_if_fail (plugin !=
nullptr);
212 visual_return_val_if_fail (plugin !=
nullptr,
nullptr);