2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wim.taymans@chello.be>
5 * gstregistry.h: Header for registry handling
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_REGISTRY_H__
25 #define __GST_REGISTRY_H__
27 #include <gst/gstplugin.h>
29 #define GLOBAL_REGISTRY_DIR GST_CONFIG_DIR
30 #define GLOBAL_REGISTRY_FILE GLOBAL_REGISTRY_DIR"/registry.xml"
31 #define GLOBAL_REGISTRY_FILE_TMP GLOBAL_REGISTRY_DIR"/.registry.xml.tmp"
33 #define LOCAL_REGISTRY_DIR ".gstreamer"
34 #define LOCAL_REGISTRY_FILE LOCAL_REGISTRY_DIR"/registry.xml"
35 #define LOCAL_REGISTRY_FILE_TMP LOCAL_REGISTRY_DIR"/.registry.xml.tmp"
37 #define REGISTRY_DIR_PERMS (S_ISGID | \
38 S_IRUSR | S_IWUSR | S_IXUSR | \
41 #define REGISTRY_TMPFILE_PERMS (S_IRUSR | S_IWUSR)
42 #define REGISTRY_FILE_PERMS (S_IRUSR | S_IWUSR | \
48 typedef struct _GstRegistryWrite GstRegistryWrite;
49 struct _GstRegistryWrite {
55 typedef struct _GstRegistryRead GstRegistryRead;
56 struct _GstRegistryRead {
61 GstRegistryWrite *gst_registry_write_get (void);
62 GstRegistryRead *gst_registry_read_get (void);
63 void gst_registry_option_set (const gchar *registry);
67 GST_REGISTRY_OK = (0),
68 GST_REGISTRY_LOAD_ERROR = (1 << 1),
69 GST_REGISTRY_SAVE_ERROR = (1 << 2),
70 GST_REGISTRY_PLUGIN_LOAD_ERROR = (1 << 3),
71 GST_REGISTRY_PLUGIN_SIGNATURE_ERROR = (1 << 4),
75 GST_REGISTRY_READABLE = (1 << 1),
76 GST_REGISTRY_WRITABLE = (1 << 2),
77 GST_REGISTRY_REMOTE = (1 << 3),
78 GST_REGISTRY_DELAYED_LOADING = (1 << 4),
82 #define GST_TYPE_REGISTRY \
83 (gst_registry_get_type())
84 #define GST_REGISTRY(obj) \
85 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_REGISTRY,GstRegistry))
86 #define GST_REGISTRY_CLASS(klass) \
87 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_REGISTRY,GstRegistryClass))
88 #define GST_IS_REGISTRY(obj) \
89 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_REGISTRY))
90 #define GST_IS_REGISTRY_CLASS(obj) \
91 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_REGISTRY))
93 typedef struct _GstRegistry GstRegistry;
94 typedef struct _GstRegistryClass GstRegistryClass;
100 GstRegistryFlags flags;
111 struct _GstRegistryClass {
112 GObjectClass parent_class;
115 gboolean (*load) (GstRegistry *registry);
116 gboolean (*save) (GstRegistry *registry);
117 gboolean (*rebuild) (GstRegistry *registry);
118 gboolean (*unload) (GstRegistry *registry);
120 GstRegistryReturn (*load_plugin) (GstRegistry *registry, GstPlugin *plugin);
121 GstRegistryReturn (*unload_plugin) (GstRegistry *registry, GstPlugin *plugin);
122 GstRegistryReturn (*update_plugin) (GstRegistry *registry, GstPlugin *plugin);
125 void (*plugin_added) (GstRegistry *registry, GstPlugin *plugin);
129 /* normal GObject stuff */
130 GType gst_registry_get_type (void);
132 gboolean gst_registry_load (GstRegistry *registry);
133 gboolean gst_registry_is_loaded (GstRegistry *registry);
134 gboolean gst_registry_save (GstRegistry *registry);
135 gboolean gst_registry_rebuild (GstRegistry *registry);
136 gboolean gst_registry_unload (GstRegistry *registry);
138 void gst_registry_add_path (GstRegistry *registry, const gchar *path);
139 GList* gst_registry_get_path_list (GstRegistry *registry);
140 void gst_registry_clear_paths (GstRegistry *registry);
142 gboolean gst_registry_add_plugin (GstRegistry *registry, GstPlugin *plugin);
143 void gst_registry_remove_plugin (GstRegistry *registry, GstPlugin *plugin);
145 GstPlugin* gst_registry_find_plugin (GstRegistry *registry, const gchar *name);
146 GstPluginFeature* gst_registry_find_feature (GstRegistry *registry, const gchar *name, GType type);
148 GstRegistryReturn gst_registry_load_plugin (GstRegistry *registry, GstPlugin *plugin);
149 GstRegistryReturn gst_registry_unload_plugin (GstRegistry *registry, GstPlugin *plugin);
150 GstRegistryReturn gst_registry_update_plugin (GstRegistry *registry, GstPlugin *plugin);
152 /* the pool of registries */
153 GList* gst_registry_pool_list (void);
154 void gst_registry_pool_add (GstRegistry *registry, guint priority);
155 void gst_registry_pool_remove (GstRegistry *registry);
157 void gst_registry_pool_add_plugin (GstPlugin *plugin);
159 void gst_registry_pool_add (GstRegistry *registry, guint priority);
160 void gst_registry_pool_load_all (void);
162 GList* gst_registry_pool_plugin_list (void);
163 GList* gst_registry_pool_feature_list (GType type);
165 GstPlugin* gst_registry_pool_find_plugin (const gchar *name);
166 GstPluginFeature* gst_registry_pool_find_feature (const gchar *name, GType type);
168 GstRegistry* gst_registry_pool_get_prefered (GstRegistryFlags flags);
172 #endif /* __GST_REGISTRY_H__ */