spBase
Loading...
Searching...
No Matches
spPlugin.h
Go to the documentation of this file.
1
4#ifndef __SPPLUGIN_H
5#define __SPPLUGIN_H
6
7#include <sp/spDefs.h>
8#include <sp/spOption.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
17 /*----@addtogroup spPluginGroup----*/
18
25#define SP_PLUGIN_VERSION_STRING "1.7.1"
26#define SP_PLUGIN_VERSION 1
27#define SP_PLUGIN_REVISION 7
28#define SP_PLUGIN_UPDATE_LEVEL 1
29#define SP_PLUGIN_VERSION_ID (SP_PLUGIN_VERSION * 1000 + SP_PLUGIN_REVISION)
30
36#define SP_PLUGIN_CHECK_VERSION(version, revision, update) \
37 (SP_PLUGIN_VERSION > (version) || \
38 (SP_PLUGIN_VERSION == (version) && SP_PLUGIN_REVISION > (revision)) || \
39 (SP_PLUGIN_VERSION == (version) && SP_PLUGIN_REVISION == (revision) && SP_PLUGIN_UPDATE_LEVEL >= (update)))
40
41#define SP_PLUGIN_VERIFY_VERSION
42#define SP_PLUGIN_SUPPORTED_VERSION_ID /*SP_PLUGIN_VERSION_ID*/1003
44/*
45 * spPluginType: "plugin_type_name version_id"
46 * version_id: version.revision
47 */
48typedef const char *spPluginType;
49#define SP_PLUGIN_UNKNOWN NULL
50
52typedef enum {
53 SP_PLUGIN_CR_NONE = -1,
57
65
75
76/* this parameter is used for finding file. */
77#define SP_PLUGIN_PRIORITY_HIGHEST 0
78#define SP_PLUGIN_PRIORITY_HIGHER 1
79#define SP_PLUGIN_PRIORITY_MIDDLE 2
80#define SP_PLUGIN_PRIORITY_LOWER 3
81#define SP_PLUGIN_PRIORITY_LOWEST 4
82#define SP_PLUGIN_PRIORITY_NULL 5
85typedef int spPluginError;
86#define SP_PLUGIN_ERROR_SUCCESS SP_TRUE
87#define SP_PLUGIN_ERROR_FAILURE SP_FALSE
88#define SP_PLUGIN_ERROR_NO_ERROR SP_TRUE
89#define SP_PLUGIN_ERROR_WRONG_PLUGIN (-1)
90#define SP_PLUGIN_ERROR_OPEN (-2)
91#define SP_PLUGIN_ERROR_READ (-3)
92#define SP_PLUGIN_ERROR_WRITE (-4)
93#define SP_PLUGIN_ERROR_LOAD (-5)
94#define SP_PLUGIN_ERROR_SUITABLE_NOT_FOUND (-6)
95#define SP_PLUGIN_ERROR_MULTIPLE_INSTANCE (-7)
96#define SP_PLUGIN_ERROR_INSTANTIATE (-8)
97#define SP_PLUGIN_ERROR_BOGUS_FILE (-10)
98#define SP_PLUGIN_ERROR_FILE_TYPE (-11)
99#define SP_PLUGIN_ERROR_SAMP_RATE (-12)
100#define SP_PLUGIN_ERROR_SAMP_BIT (-13)
101#define SP_PLUGIN_ERROR_NUM_CHANNEL (-14)
102#define SP_PLUGIN_ERROR_OTHER_INFO (-15)
103#define SP_PLUGIN_ERROR_TOTAL_LENGTH_REQUIRED (-16)
104#define SP_PLUGIN_ERROR_UNKNOWN_DEVICE (-20)
105#define SP_PLUGIN_ERROR_USER (-256)
107#define SP_PLUGIN_CAPS_THREAD_SAFE (1<<1)
108#define SP_PLUGIN_CAPS_NEED_LOCK (1<<2)
109#define SP_PLUGIN_CAPS_MEMORY_SAFE (1<<3)
110#define SP_PLUGIN_CAPS_KEEP_IN_MEMORY (1<<4)
112/* Version 1.4.1+ */
113#define SP_PLUGIN_CAPS_CUSTOM_OPTION_DIALOG (1<<5)
115/* Version 1.5.1+ */
116#define SP_PLUGIN_CAPS_THREAD_BY_THREAD_SAFE (1<<6)
119#define SP_PLUGIN_CAPS_SUBPLUGIN_SHIFT 12
120#define SP_PLUGIN_CAPS_SUBPLUGIN (1<<SP_PLUGIN_CAPS_SUBPLUGIN_SHIFT)
121
122#define SP_PLUGIN_CAPS_USER_SHIFT 16
123#define SP_PLUGIN_CAPS_USER (1<<SP_PLUGIN_CAPS_USER_SHIFT)
124
125#if defined(IPHONE)
126#define spRegisterUniquePluginRec(unique_id) \
127 { \
128 extern spPluginRec *spGetPluginRec_ ## unique_id (long *, long *); \
129 spPluginRec *rec; \
130 if ((rec = spCallUniqueGetPluginRecFunc( spGetPluginRec_ ## unique_id )) != NULL) { \
131 spAddPluginRecList(rec, #unique_id ); \
132 } \
133 }
134#else
135#define spRegisterUniquePluginRec(unique_id)
136#endif
137
138struct _spPluginRect
139{
140 short top;
141 short left;
142 short bottom;
143 short right;
144};
145typedef struct _spPluginRect spPluginRect;
146
147typedef struct _spPluginRec spPluginRec;
148typedef struct _spPluginHost spPluginHost;
149typedef struct _spPlugin spPlugin;
150
151typedef struct _spIoPluginRec spIoPluginRec;
152
153typedef spPluginRec *(*spGetPluginRecFunc)(void);
154typedef long (*spPluginVersionFunc)(void);
155typedef spPluginRec *(*spUniqueGetPluginRecFunc)(long *system_version_id, long *supported_version_id);
156
157typedef spBool (*spPluginOpenCallback)(spPlugin *plugin, spPluginCallbackReason reason, void *host_data, void *call_data);
158
159typedef spBool (*spSearchSpecificPluginCallback)(spPlugin *plugin, void *call_data);
160
161#if defined(MACOS)
162#pragma import on
163#endif
164
203 /*----@addtogroup spPluginGroup----*/
204
205extern void spSetPluginLang(const char *lang);
206extern const char *spGetPluginSearchPath(void);
207extern void spSetPluginSearchPath(const char *pathlist); /* NULL pathlist clears current list */
208extern spBool spAppendPluginSearchPath(const char *pathlist);
209extern spBool spPrependPluginSearchPath(const char *pathlist);
210
211extern spBool spAddPluginRecList(spPluginRec *plugin_rec, const char *name);
212extern spBool spRemovePluginRecList(spPluginRec *plugin_rec);
213extern spBool _spRegisterPluginRec(spPluginRec *plugin_rec, const char *name, long system_version_id, long supported_version_id);
214#define spRegisterPluginRec(plugin_rec, name) _spRegisterPluginRec(plugin_rec, name, SP_PLUGIN_SUPPORTED_VERSION_ID, SP_PLUGIN_VERSION_ID)
215extern spPlugin *spAllocNullPlugin(void);
216extern spPluginRec *spCallUniqueGetPluginRecFunc(spUniqueGetPluginRecFunc func);
217
226extern spPlugin *spLoadPlugin(const char *plugin_name);
233
236extern spBool spEqPluginType(spPlugin *plugin, spPluginType type);
239extern const char *spGetPluginName(spPlugin *plugin);
242extern const char *spGetPluginId(spPlugin *plugin);
245extern const char *spGetPluginDescription(spPlugin *plugin);
248extern const char *spGetPluginInformation(spPlugin *plugin);
251extern long spGetPluginVersionId(spPlugin *plugin);
256extern int spGetPluginPriority(spPlugin *plugin);
259extern spBool spGetPluginVersion(spPlugin *plugin, int *version, int *revision);
260extern unsigned long spGetPluginCaps(spPlugin *plugin);
261extern spBool spIsPluginCapable(spPlugin *plugin, unsigned long cap);
262
263extern void *spGetPluginInstance(spPlugin *plugin);
264extern long spGetNumPluginInstance(spPlugin *plugin);
265extern spBool spIsPluginInstantiatable(spPlugin *plugin);
266extern spBool spInitPluginInstance(spPlugin *plugin);
267extern spBool spFreePluginInstance(spPlugin *plugin);
268extern spPlugin *spInstantiatePlugin(const char *plugin_name);
269
270extern spOptions spInitPluginOptions(spPlugin *plugin);
271extern spBool spFreePluginOptions(spPlugin *plugin, spOptions options);
272extern spBool spDisplayPluginCustomOptionDialog(spPlugin *plugin);
273extern void spPrintPluginOptions(spPlugin *plugin);
274extern spBool spPluginUsage(const char *plugin_name);
275
276extern spBool spIsPluginFile(const char *filename);
277extern const char *spSearchPluginFile(int index);
278extern char *xspSearchPluginFile(int index);
279extern void spFreePluginGlobals(void);
280
281extern spBool spEqPluginNameString(const char *name1, const char *name2);
282extern spBool spEqPluginName(spPlugin *plugin, const char *name);
283extern spPlugin *spSearchSpecificPlugin(int *index, spSearchSpecificPluginCallback call_func, void *call_data);
284extern char *xspSearchSpecificPluginFile(int *index, spSearchSpecificPluginCallback call_func, void *call_data);
285extern int spGetNumSpecificPlugin(spSearchSpecificPluginCallback call_func, void *call_data);
286
287#if defined(MACOS)
288#pragma import off
289#endif
290
291#ifdef __cplusplus
292} /* Close scope of 'extern "C"' declaration */
293#endif
294
295#endif /* __SPPLUGIN_H */
A class to handle plugin-based processing.
const char * spGetPluginName(spPlugin *plugin)
long spGetPluginVersionId(spPlugin *plugin)
spBool spGetPluginVersion(spPlugin *plugin, int *version, int *revision)
spPlugin * spLoadPlugin(const char *plugin_name)
spBool spEqPluginType(spPlugin *plugin, spPluginType type)
const char * spGetPluginInformation(spPlugin *plugin)
spBool spFreePlugin(spPlugin *plugin)
int spGetPluginPriority(spPlugin *plugin)
const char * spGetPluginId(spPlugin *plugin)
const char * spGetPluginDescription(spPlugin *plugin)
int spBool
Definition spDefs.h:248
struct _spOptions * spOptions
Definition spOption.h:62
void spSetPluginSearchPath(const char *pathlist)
spPluginDeviceType
Definition spPlugin.h:67
spBool spIsPluginFile(const char *filename)
spBool spAppendPluginSearchPath(const char *pathlist)
int spPluginError
Definition spPlugin.h:85
char * xspSearchPluginFile(int index)
const char * spGetPluginSearchPath(void)
spBool spPrependPluginSearchPath(const char *pathlist)
spPluginState
Definition spPlugin.h:59
spPluginCallbackReason
Definition spPlugin.h:52
@ SP_PLUGIN_DEVICE_FILE
Definition spPlugin.h:69
@ SP_PLUGIN_DEVICE_MIXER
Definition spPlugin.h:72
@ SP_PLUGIN_DEVICE_AUDIO
Definition spPlugin.h:70
@ SP_PLUGIN_DEVICE_OTHERS
Definition spPlugin.h:73
@ SP_PLUGIN_DEVICE_CD
Definition spPlugin.h:71
@ SP_PLUGIN_DEVICE_UNKNOWN
Definition spPlugin.h:68
@ SP_PLUGIN_STATE_ERROR
Definition spPlugin.h:60
@ SP_PLUGIN_STATE_STOP
Definition spPlugin.h:61
@ SP_PLUGIN_STATE_START
Definition spPlugin.h:62
@ SP_PLUGIN_STATE_PAUSE
Definition spPlugin.h:63
@ SP_PLUGIN_CR_OPTION
Definition spPlugin.h:55
@ SP_PLUGIN_CR_ERROR
Definition spPlugin.h:54