gst/: Revert previous change until I figure out why it breaks distcheck.
[platform/upstream/gstreamer.git] / gst / gstregistry.h
1 /* GStreamer
2  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3  *                    2000 Wim Taymans <wim.taymans@chello.be>
4  *
5  * gstregistry.h: Header for registry handling
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_REGISTRY_H__
25 #define __GST_REGISTRY_H__
26
27 #include <stdio.h> /* FIXME: because of cache_file below */
28 #include <gst/gstconfig.h>
29 #include <gst/gstplugin.h>
30 #include <gst/gstpluginfeature.h>
31
32 G_BEGIN_DECLS
33
34 #define GST_TYPE_REGISTRY               (gst_registry_get_type ())
35 #define GST_REGISTRY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_REGISTRY, GstRegistry))
36 #define GST_IS_REGISTRY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_REGISTRY))
37 #define GST_REGISTRY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_REGISTRY, GstRegistryClass))
38 #define GST_IS_REGISTRY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_REGISTRY))
39 #define GST_REGISTRY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_REGISTRY, GstRegistryClass))
40
41 typedef struct _GstRegistry GstRegistry;
42 typedef struct _GstRegistryClass GstRegistryClass;
43
44 /**
45  * GstRegistry:
46  *
47  * Opaque #GstRegistry structure.
48  */
49 struct _GstRegistry {
50   GstObject      object;
51
52   /*< private >*/
53   GList         *plugins;
54   GList *features;
55
56   GList         *paths;
57
58   /* FIXME move these elsewhere */
59   int            cache_file;
60
61   /*< private >*/
62   gpointer _gst_reserved[GST_PADDING];
63 };
64
65 struct _GstRegistryClass {
66   GstObjectClass        parent_class;
67
68   /* signals */
69   void                  (*plugin_added)         (GstRegistry *registry, GstPlugin *plugin);
70   void                  (*feature_added)        (GstRegistry *registry, GstPluginFeature *feature);
71
72   /*< private >*/
73   gpointer _gst_reserved[GST_PADDING];
74 };
75
76
77 /* normal GObject stuff */
78 GType                   gst_registry_get_type           (void);
79
80 GstRegistry *           gst_registry_get_default        (void);
81
82 gboolean                        gst_registry_scan_path          (GstRegistry *registry, const gchar *path);
83 GList*                  gst_registry_get_path_list      (GstRegistry *registry);
84
85 gboolean                gst_registry_add_plugin         (GstRegistry *registry, GstPlugin *plugin);
86 void                    gst_registry_remove_plugin      (GstRegistry *registry, GstPlugin *plugin);
87 gboolean                gst_registry_add_feature        (GstRegistry * registry, GstPluginFeature * feature);
88 void                    gst_registry_remove_feature     (GstRegistry * registry, GstPluginFeature * feature);
89
90 GList*                  gst_registry_get_plugin_list    (GstRegistry *registry);
91 GList*                  gst_registry_plugin_filter      (GstRegistry *registry,
92                                                          GstPluginFilter filter,
93                                                          gboolean first,
94                                                          gpointer user_data);
95 GList*                  gst_registry_feature_filter     (GstRegistry *registry,
96                                                          GstPluginFeatureFilter filter,
97                                                          gboolean first,
98                                                          gpointer user_data);
99 GList *                 gst_registry_get_feature_list   (GstRegistry *registry,
100                                                          GType type);
101 GList *                 gst_registry_get_feature_list_by_plugin (GstRegistry *registry, const gchar *name);
102
103 GstPlugin*              gst_registry_find_plugin        (GstRegistry *registry, const gchar *name);
104 GstPluginFeature*       gst_registry_find_feature       (GstRegistry *registry, const gchar *name, GType type);
105
106 GstPlugin *             gst_registry_lookup             (GstRegistry *registry, const char *filename);
107 GstPluginFeature *      gst_registry_lookup_feature     (GstRegistry *registry, const char *name);
108
109 gboolean                gst_registry_xml_read_cache     (GstRegistry * registry, const char *location);
110 gboolean                gst_registry_xml_write_cache    (GstRegistry * registry, const char *location);
111
112 void                    _gst_registry_remove_cache_plugins (GstRegistry *registry);
113
114 void                    _gst_registry_cleanup           (void);
115
116 /* convinience defines for the default registry */
117
118 /**
119  * gst_default_registry_add_plugin:
120  * @plugin: the plugin to add
121  *
122  * Add the plugin to the default registry.
123  * The plugin-added signal will be emitted.
124  *
125  * Returns: TRUE on success.
126  */
127 #define gst_default_registry_add_plugin(plugin) \
128   gst_registry_add_plugin (gst_registry_get_default(), plugin)
129
130 /**
131  * gst_default_registry_add_path:
132  * @path: the path to add to the registry
133  *
134  * Add the given path to the default registry. The syntax of the
135  * path is specific to the registry. If the path has already been
136  * added, do nothing.
137  */
138 #define gst_default_registry_add_path(path) \
139   gst_registry_add_path (gst_registry_get_default(), path)
140
141 /**
142  * gst_default_registry_get_path_list:
143  *
144  * Get the list of paths for the default registry.
145  *
146  * Returns: A Glist of paths as strings. g_list_free after use.
147  */
148 #define gst_default_registry_get_path_list() \
149   gst_registry_get_path_list (gst_registry_get_default())
150   
151 /**
152  * gst_default_registry_get_plugin_list:
153  *
154  * Get a copy of all plugins registered in the default registry.
155  *
156  * Returns: a copy of the list. Free after use.
157  */
158 #define gst_default_registry_get_plugin_list() \
159   gst_registry_get_plugin_list (gst_registry_get_default())
160
161 /**
162  * gst_default_registry_find_feature:
163  * @name: the pluginfeature name to find
164  * @type: the pluginfeature type to find
165  *
166  * Find the pluginfeature with the given name and type in the default registry.
167  *
168  * Returns: The pluginfeature with the given name and type or NULL
169  * if the plugin was not found.
170  */
171 #define gst_default_registry_find_feature(name,type) \
172   gst_registry_find_feature (gst_registry_get_default(),name,type)
173
174 /**
175  * gst_default_registry_find_plugin:
176  * @name: the plugin name to find
177  *
178  * Find the plugin with the given name in the default registry.
179  * The plugin will be reffed; caller is responsible for unreffing.
180  *
181  * Returns: The plugin with the given name or NULL if the plugin was not found.
182  */
183 #define gst_default_registry_find_plugin(name) \
184   gst_registry_find_plugin (gst_registry_get_default(),name)
185
186 /**
187  * gst_default_registry_feature_filter:
188  * @filter: the filter to use
189  * @first: only return first match
190  * @user_data: user data passed to the filter function
191  *
192  * Runs a filter against all features of the plugins in the default registry
193  * and returns a GList with the results.
194  * If the first flag is set, only the first match is
195  * returned (as a list with a single object).
196  *
197  * Returns: a GList of plugin features, gst_plugin_feature_list_free after use.
198  */
199 #define gst_default_registry_feature_filter(filter,first,user_data) \
200   gst_registry_feature_filter (gst_registry_get_default(),filter,first,user_data)
201
202 gboolean                gst_default_registry_check_feature_version (const gchar *feature_name,
203                                                                     guint        min_major,
204                                                                     guint        min_minor,
205                                                                     guint        min_micro);
206
207 G_END_DECLS
208
209 #endif /* __GST_REGISTRY_H__ */
210