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>
31 #include <gst/gstmacros.h>
35 GQuark gst_plugin_error_quark (void);
36 #define GST_PLUGIN_ERROR gst_plugin_error_quark ()
40 GST_PLUGIN_ERROR_MODULE,
41 GST_PLUGIN_ERROR_DEPENDENCIES,
42 GST_PLUGIN_ERROR_NAME_MISMATCH
45 #define GST_PLUGIN(plugin) ((GstPlugin *) (plugin))
47 typedef struct _GstPlugin GstPlugin;
48 typedef struct _GstPluginDesc GstPluginDesc;
50 /* Initialiser function: returns TRUE if plugin initialised successfully */
51 typedef gboolean (*GstPluginInitFunc) (GstPlugin *plugin);
52 /* exiting function when plugin is unloaded */
53 typedef void (*GstPluginExitFunc) (GstPlugin *plugin);
55 struct _GstPluginDesc {
56 gint major_version; /* major version of core that plugin was compiled for */
57 gint minor_version; /* minor version of core that plugin was compiled for */
58 gchar *name; /* unique name of plugin */
59 gchar *description; /* description of plugin */
60 GstPluginInitFunc plugin_init; /* pointer to plugin_init function */
61 GstPluginExitFunc plugin_exit; /* pointer to exiting function */
62 gchar *version; /* version of the plugin */
63 gchar *license; /* effective license of plugin */
64 gchar *package; /* package plugin belongs to */
65 gchar *origin; /* URL to provider of plugin */
67 gpointer _gst_reserved[GST_PADDING];
74 GList * features; /* list of features provided */
77 gpointer manager; /* managing registry */
78 GModule * module; /* contains the module if the plugin is loaded */
80 gpointer _gst_reserved[GST_PADDING];
83 #define GST_PLUGIN_DEFINE(major,minor,name,description,init,version,license,package,origin) \
84 GstPluginDesc gst_plugin_desc = { \
98 #define GST_PLUGIN_DEFINE_STATIC(major,minor,name,description,init,version,license,package,origin) \
99 static void GST_GNUC_CONSTRUCTOR \
100 _gst_plugin_static_init__ ##init (void) \
102 static GstPluginDesc plugin_desc_ = { \
115 _gst_plugin_register_static (&plugin_desc_); \
118 #define GST_LICENSE_UNKNOWN "unknown"
121 /* function for filters */
122 typedef gboolean (*GstPluginFilter) (GstPlugin *plugin,
125 #define GST_TYPE_PLUGIN (gst_plugin_get_type())
126 GType gst_plugin_get_type (void);
127 void _gst_plugin_initialize (void);
128 void _gst_plugin_register_static (GstPluginDesc *desc);
130 G_CONST_RETURN gchar* gst_plugin_get_name (GstPlugin *plugin);
131 void gst_plugin_set_name (GstPlugin *plugin, const gchar *name);
132 G_CONST_RETURN gchar* gst_plugin_get_longname (GstPlugin *plugin);
133 G_CONST_RETURN gchar* gst_plugin_get_filename (GstPlugin *plugin);
134 G_CONST_RETURN gchar* gst_plugin_get_license (GstPlugin *plugin);
135 G_CONST_RETURN gchar* gst_plugin_get_package (GstPlugin *plugin);
136 G_CONST_RETURN gchar* gst_plugin_get_origin (GstPlugin *plugin);
137 GModule * gst_plugin_get_module (GstPlugin *plugin);
138 gboolean gst_plugin_is_loaded (GstPlugin *plugin);
140 GList* gst_plugin_feature_filter (GstPlugin *plugin,
141 GstPluginFeatureFilter filter,
144 GList* gst_plugin_list_feature_filter (GList *list,
145 GstPluginFeatureFilter filter,
148 gboolean gst_plugin_name_filter (GstPlugin *plugin, const gchar *name);
150 GList* gst_plugin_get_feature_list (GstPlugin *plugin);
151 GstPluginFeature* gst_plugin_find_feature (GstPlugin *plugin, const gchar *name, GType type);
153 GstPlugin * gst_plugin_load_file (const gchar *filename, GError** error);
154 gboolean gst_plugin_unload_plugin (GstPlugin *plugin);
156 void gst_plugin_add_feature (GstPlugin *plugin, GstPluginFeature *feature);
158 /* shortcuts to load from the registry pool */
159 gboolean gst_plugin_load (const gchar *name);
160 gboolean gst_library_load (const gchar *name);
164 #endif /* __GST_PLUGIN_H__ */