libvisual  0.5.0
lv_plugin.h
1 /* Libvisual - The audio visualisation framework.
2  *
3  * Copyright (C) 2012 Libvisual team
4  * 2004-2006 Dennis Smit
5  *
6  * Authors: Dennis Smit <ds@nerds-incorporated.org>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as
10  * published by the Free Software Foundation; either version 2.1
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  */
22 
23 #ifndef _LV_PLUGIN_H
24 #define _LV_PLUGIN_H
25 
26 #include <libvisual/lvconfig.h>
27 #include <libvisual/lv_event.h>
28 #include <libvisual/lv_param.h>
29 #include <libvisual/lv_random.h>
30 
37 #define VISUAL_PLUGIN_API_VERSION 3005
38 
39 #define VISUAL_PLUGIN_LICENSE_GPLv1 "GPLv1"
40 #define VISUAL_PLUGIN_LICENSE_GPL "GPLv2"
41 #define VISUAL_PLUGIN_LICENSE_GPLv3 "GPLv3"
42 #define VISUAL_PLUGIN_LICENSE_LGPL "LGPL"
43 #define VISUAL_PLUGIN_LICENSE_BSD "BSD"
44 
45 #define VISUAL_PLUGIN_VERSION_TAG "__lv_plugin_libvisual_api_version"
46 #define VISUAL_PLUGIN_API_VERSION_VALIDATOR \
47  LV_C_LINKAGE LV_PLUGIN_EXPORT const int __lv_plugin_libvisual_api_version = VISUAL_PLUGIN_API_VERSION; \
48  LV_C_LINKAGE LV_PLUGIN_EXPORT const VisPluginInfo* get_plugin_info (void);
49 
51 typedef enum {
55 
57 typedef enum {
58  VISUAL_PLUGIN_TYPE_ACTOR,
59  VISUAL_PLUGIN_TYPE_INPUT,
60  VISUAL_PLUGIN_TYPE_MORPH
62 
63 #ifdef __cplusplus
64 
65 namespace LV {
66 
68  class LV_API PluginData;
69 
70 } // LV namespace
71 
72 typedef LV::PluginData VisPluginData;
73 
74 #else
75 
76 typedef struct _VisPluginData VisPluginData;
77 struct _VisPluginData;
78 
79 #endif
80 
81 typedef struct _VisPluginRef VisPluginRef;
82 typedef struct _VisPluginInfo VisPluginInfo;
83 
94 typedef int (*VisPluginInitFunc)(VisPluginData *plugin);
95 
103 typedef void (*VisPluginCleanupFunc)(VisPluginData *plugin);
104 
115 typedef int (*VisPluginEventsFunc)(VisPluginData *plugin, VisEventQueue *events);
116 
123  const char *plugname;
125  const char *name;
126  const char *author;
127  const char *version;
128  const char *about;
129  const char *help;
130  const char *license;
131  const char *url;
137  int flags;
139  void *plugin;
140 };
141 
142 LV_BEGIN_DECLS
143 
149 LV_API int visual_plugin_get_api_version (void);
150 
160 LV_API VisEventQueue *visual_plugin_get_event_queue (VisPluginData *plugin);
161 
167 LV_API void visual_plugin_events_pump (VisPluginData *plugin);
168 
176 LV_API const VisPluginInfo *visual_plugin_get_info (VisPluginData *plugin);
177 
185 LV_API void *visual_plugin_get_specific (VisPluginData *plugin);
186 
194 LV_API VisParamList *visual_plugin_get_params (VisPluginData *plugin);
195 
203 LV_API VisRandomContext *visual_plugin_get_random_context (VisPluginData *plugin);
204 
217 LV_API void visual_plugin_set_private (VisPluginData *plugin, void *priv);
218 
226 LV_API void *visual_plugin_get_private (VisPluginData *plugin);
227 
240 LV_API VisPluginData *visual_plugin_load (VisPluginType type, const char *name);
241 
247 LV_API void visual_plugin_unload (VisPluginData *plugin);
248 
258 LV_API int visual_plugin_realize (VisPluginData *plugin);
259 
269 LV_API int visual_plugin_is_realized (VisPluginData *plugin);
270 
271 
272 LV_END_DECLS
273 
274 #ifdef __cplusplus
275 
276 #include <libvisual/lv_module.hpp>
277 #include <vector>
278 #include <string>
279 
280 namespace LV {
281 
282  struct PluginRef
283  {
284  std::string file;
285  VisPluginInfo const* info;
286  ModulePtr module;
287  };
288 
289  typedef std::vector<PluginRef> PluginList;
290 
299  LV_API char const* plugin_get_next_by_name (PluginList const& list, char const* name);
300 
309  LV_API char const* plugin_get_prev_by_name (PluginList const& list, char const* name);
310 
311 } // LV namespace
312 
313 #endif /* __cplusplus */
314 
319 #endif /* _LV_PLUGIN_H */