moved docs to sgml files added first batch of docs provided by ronald
[platform/upstream/gstreamer.git] / gst / gstplugin.h
1 /* GStreamer
2  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3  *                    2000 Wim Taymans <wtay@chello.be>
4  *
5  * gstplugin.h: Header for plugin subsystem
6  *
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.
11  *
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.
16  *
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.
21  */
22
23
24 #ifndef __GST_PLUGIN_H__
25 #define __GST_PLUGIN_H__
26
27 #include <gst/gstconfig.h>
28
29 #include <gmodule.h>
30 #include <gst/gstpluginfeature.h>
31 #include <gst/gstmacros.h>
32
33 G_BEGIN_DECLS
34
35 GQuark gst_plugin_error_quark (void);
36 #define GST_PLUGIN_ERROR gst_plugin_error_quark ()
37
38 typedef enum
39 {
40   GST_PLUGIN_ERROR_MODULE,
41   GST_PLUGIN_ERROR_DEPENDENCIES,
42   GST_PLUGIN_ERROR_NAME_MISMATCH
43 } GstPluginError;
44
45 #define GST_PLUGIN(plugin)              ((GstPlugin *) (plugin))
46
47 typedef struct _GstPlugin               GstPlugin;
48 typedef struct _GstPluginDesc           GstPluginDesc;
49
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);
54
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 */
66   
67   gpointer _gst_reserved[GST_PADDING];
68 };
69
70 struct _GstPlugin {
71   GstPluginDesc desc;
72
73   gchar *       filename;
74   GList *       features;               /* list of features provided */
75   gint          numfeatures;
76
77   gpointer      manager;                /* managing registry */
78   GModule *     module;                 /* contains the module if the plugin is loaded */
79
80   gpointer _gst_reserved[GST_PADDING];
81 };
82
83 #define GST_PLUGIN_DEFINE(major,minor,name,description,init,version,license,package,origin)     \
84 GST_PLUGIN_EXPORT GstPluginDesc gst_plugin_desc = {                     \
85   major,                                                \
86   minor,                                                \
87   name,                                                 \
88   description,                                          \
89   init,                                                 \
90   NULL,                                                 \
91   version,                                              \
92   license,                                              \
93   package,                                              \
94   origin,                                               \
95   GST_PADDING_INIT                                      \
96 };
97
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)                 \
101 {                                                       \
102   static GstPluginDesc plugin_desc_ = {                 \
103     major,                                              \
104     minor,                                              \
105     name,                                               \
106     description,                                        \
107     init,                                               \
108     NULL,                                               \
109     version,                                            \
110     license,                                            \
111     package,                                            \
112     origin,                                             \
113     GST_PADDING_INIT                                    \
114   };                                                    \
115   _gst_plugin_register_static (&plugin_desc_);          \
116 }                       
117
118 #define GST_LICENSE_UNKNOWN "unknown"
119
120
121 /* function for filters */
122 typedef gboolean        (*GstPluginFilter)              (GstPlugin *plugin,
123                                                          gpointer user_data);
124
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);
129
130 G_CONST_RETURN gchar*   gst_plugin_get_name             (GstPlugin *plugin);
131 G_CONST_RETURN gchar*   gst_plugin_get_description      (GstPlugin *plugin);
132 G_CONST_RETURN gchar*   gst_plugin_get_filename         (GstPlugin *plugin);
133 G_CONST_RETURN gchar*   gst_plugin_get_license          (GstPlugin *plugin);
134 G_CONST_RETURN gchar*   gst_plugin_get_package          (GstPlugin *plugin);
135 G_CONST_RETURN gchar*   gst_plugin_get_origin           (GstPlugin *plugin);
136 GModule *               gst_plugin_get_module           (GstPlugin *plugin);
137 gboolean                gst_plugin_is_loaded            (GstPlugin *plugin);
138
139 GList*                  gst_plugin_feature_filter       (GstPlugin *plugin, 
140                                                          GstPluginFeatureFilter filter,
141                                                          gboolean first,
142                                                          gpointer user_data);
143 GList*                  gst_plugin_list_feature_filter  (GList *list, 
144                                                          GstPluginFeatureFilter filter,
145                                                          gboolean first,
146                                                          gpointer user_data);
147 gboolean                gst_plugin_name_filter          (GstPlugin *plugin, const gchar *name);
148
149 GList*                  gst_plugin_get_feature_list     (GstPlugin *plugin);
150 GstPluginFeature*       gst_plugin_find_feature         (GstPlugin *plugin, const gchar *name, GType type);
151
152 gboolean                gst_plugin_check_file           (const gchar *filename, GError** error);
153 GstPlugin *             gst_plugin_load_file            (const gchar *filename, GError** error);
154 gboolean                gst_plugin_unload_plugin        (GstPlugin *plugin);
155
156 void                    gst_plugin_add_feature          (GstPlugin *plugin, GstPluginFeature *feature);
157
158 /* shortcuts to load from the registry pool */
159 gboolean                gst_plugin_load                 (const gchar *name);
160 gboolean                gst_library_load                (const gchar *name);
161
162 G_END_DECLS
163
164 #endif /* __GST_PLUGIN_H__ */