2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
5 * gstplugin.h: Header for plugin subsystem
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
24 #ifndef __GST_PLUGIN_H__
25 #define __GST_PLUGIN_H__
27 #include <gst/gstconfig.h>
30 #include <gst/gstpluginfeature.h>
34 GQuark gst_plugin_error_quark (void);
35 #define GST_PLUGIN_ERROR gst_plugin_error_quark ()
39 GST_PLUGIN_ERROR_MODULE,
40 GST_PLUGIN_ERROR_DEPENDENCIES
43 #define GST_PLUGIN(plugin) ((GstPlugin *) (plugin))
45 typedef struct _GstPlugin GstPlugin;
46 typedef struct _GstPluginDesc GstPluginDesc;
49 gchar *name; /* name of the plugin */
50 gchar *longname; /* long name of plugin */
51 gchar *filename; /* filename it came from */
53 GList *features; /* list of features provided */
56 gpointer manager; /* managing registry */
57 GModule *module; /* contains the module if the plugin is loaded */
58 gboolean init_called; /* if the init function has been called */
61 /* Initialiser function: returns TRUE if plugin initialised successfully */
62 typedef gboolean (*GstPluginInitFunc) (GModule *module, GstPlugin *plugin);
64 struct _GstPluginDesc {
65 gint major_version; /* major version of core that plugin was compiled for */
66 gint minor_version; /* minor version of core that plugin was compiled for */
67 gchar *name; /* name of plugin */
68 GstPluginInitFunc plugin_init; /* pointer to plugin_init function */
71 #ifndef GST_PLUGIN_STATIC
72 #define GST_PLUGIN_DESC_DYNAMIC(major,minor,name,init) \
73 GstPluginDesc plugin_desc = { \
80 #define GST_PLUGIN_DESC_DYNAMIC(major,minor,name,init)
82 #define GST_PLUGIN_DESC_STATIC(major,minor,name,init) \
83 static void __attribute__ ((constructor)) \
84 _gst_plugin_static_init__ ##init (void) \
86 static GstPluginDesc plugin_desc_ = { \
92 _gst_plugin_register_static (&plugin_desc_); \
95 #define GST_PLUGIN_DESC(major,minor,name,init) \
96 GST_PLUGIN_DESC_DYNAMIC (major,minor,name,init) \
97 GST_PLUGIN_DESC_STATIC (major,minor,name,init)
99 void _gst_plugin_initialize (void);
100 void _gst_plugin_register_static (GstPluginDesc *desc);
102 GstPlugin* gst_plugin_new (const gchar *filename);
104 const gchar* gst_plugin_get_name (GstPlugin *plugin);
105 void gst_plugin_set_name (GstPlugin *plugin, const gchar *name);
106 const gchar* gst_plugin_get_longname (GstPlugin *plugin);
107 void gst_plugin_set_longname (GstPlugin *plugin, const gchar *longname);
108 const gchar* gst_plugin_get_filename (GstPlugin *plugin);
109 gboolean gst_plugin_is_loaded (GstPlugin *plugin);
111 GList* gst_plugin_get_feature_list (GstPlugin *plugin);
112 GstPluginFeature* gst_plugin_find_feature (GstPlugin *plugin, const gchar *name, GType type);
114 gboolean gst_plugin_load_plugin (GstPlugin *plugin, GError** error);
115 gboolean gst_plugin_unload_plugin (GstPlugin *plugin);
117 void gst_plugin_add_feature (GstPlugin *plugin, GstPluginFeature *feature);
119 /* shortcuts to load from the registry pool */
120 gboolean gst_plugin_load (const gchar *name);
121 gboolean gst_library_load (const gchar *name);
125 #endif /* __GST_PLUGIN_H__ */