fix doc build fix autogen
[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 <gst/gstplugin.h>
28
29 #define GLOBAL_REGISTRY_DIR      GST_CACHE_DIR
30 #define GLOBAL_REGISTRY_FILE     GLOBAL_REGISTRY_DIR"/registry.xml"
31 #define GLOBAL_REGISTRY_FILE_TMP GLOBAL_REGISTRY_DIR"/.registry.xml.tmp"
32
33 #define LOCAL_REGISTRY_DIR       ".gstreamer-"GST_MAJORMINOR
34 #define LOCAL_REGISTRY_FILE      LOCAL_REGISTRY_DIR"/registry.xml"
35 #define LOCAL_REGISTRY_FILE_TMP  LOCAL_REGISTRY_DIR"/.registry.xml.tmp"
36
37 #define REGISTRY_DIR_PERMS (S_ISGID | \
38                             S_IRUSR | S_IWUSR | S_IXUSR | \
39                             S_IRGRP | S_IXGRP | \
40                             S_IROTH | S_IXOTH)
41 #define REGISTRY_TMPFILE_PERMS (S_IRUSR | S_IWUSR)
42 #define REGISTRY_FILE_PERMS (S_IRUSR | S_IWUSR | \
43                              S_IRGRP | S_IWGRP | \
44                              S_IROTH | S_IWOTH)
45
46 G_BEGIN_DECLS
47
48 typedef enum {
49   GST_REGISTRY_OK                       = (0),
50   GST_REGISTRY_LOAD_ERROR               = (1 << 1),
51   GST_REGISTRY_SAVE_ERROR               = (1 << 2),
52   GST_REGISTRY_PLUGIN_LOAD_ERROR        = (1 << 3),
53   GST_REGISTRY_PLUGIN_SIGNATURE_ERROR   = (1 << 4)
54 } GstRegistryReturn;
55
56 typedef enum {
57   GST_REGISTRY_READABLE                 = (1 << 1),
58   GST_REGISTRY_WRITABLE                 = (1 << 2),
59   GST_REGISTRY_EXISTS                   = (1 << 3),
60   GST_REGISTRY_REMOTE                   = (1 << 4),
61   GST_REGISTRY_DELAYED_LOADING          = (1 << 5)
62 } GstRegistryFlags;
63
64   
65 #define GST_TYPE_REGISTRY               (gst_registry_get_type ())
66 #define GST_REGISTRY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_REGISTRY, GstRegistry))
67 #define GST_IS_REGISTRY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_REGISTRY))
68 #define GST_REGISTRY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_REGISTRY, GstRegistryClass))
69 #define GST_IS_REGISTRY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_REGISTRY))
70 #define GST_REGISTRY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_REGISTRY, GstRegistryClass))
71
72 typedef struct _GstRegistry GstRegistry;
73 typedef struct _GstRegistryClass GstRegistryClass;
74
75 struct _GstRegistry {
76   GObject        object;
77
78   gint           priority;
79   GstRegistryFlags flags;
80
81   gchar         *name;
82   gchar         *details;
83
84   gboolean       loaded;
85   GList         *plugins;
86
87   GList         *paths;
88
89   gpointer _gst_reserved[GST_PADDING];
90 };
91
92 struct _GstRegistryClass {
93   GObjectClass          parent_class;
94
95   /* vtable */
96   gboolean              (*load)                 (GstRegistry *registry);
97   gboolean              (*save)                 (GstRegistry *registry);
98   gboolean              (*rebuild)              (GstRegistry *registry);
99   gboolean              (*unload)               (GstRegistry *registry);
100
101   GstRegistryReturn     (*load_plugin)          (GstRegistry *registry, GstPlugin *plugin);
102   GstRegistryReturn     (*unload_plugin)        (GstRegistry *registry, GstPlugin *plugin);
103   GstRegistryReturn     (*update_plugin)        (GstRegistry *registry, GstPlugin *plugin);
104
105   /* signals */
106   void                  (*plugin_added)         (GstRegistry *registry, GstPlugin *plugin);
107
108   gpointer _gst_reserved[GST_PADDING];
109 };
110
111
112 /* normal GObject stuff */
113 GType                   gst_registry_get_type           (void);
114
115 gboolean                gst_registry_load               (GstRegistry *registry);
116 gboolean                gst_registry_is_loaded          (GstRegistry *registry);
117 gboolean                gst_registry_save               (GstRegistry *registry);
118 gboolean                gst_registry_rebuild            (GstRegistry *registry);
119 gboolean                gst_registry_unload             (GstRegistry *registry);
120
121 void                    gst_registry_add_path           (GstRegistry *registry, const gchar *path);
122 GList*                  gst_registry_get_path_list      (GstRegistry *registry);
123 void                    gst_registry_clear_paths        (GstRegistry *registry);
124
125 gboolean                gst_registry_add_plugin         (GstRegistry *registry, GstPlugin *plugin);
126 void                    gst_registry_remove_plugin      (GstRegistry *registry, GstPlugin *plugin);
127
128 GList*                  gst_registry_plugin_filter      (GstRegistry *registry, 
129                                                          GstPluginFilter filter, 
130                                                          gboolean first, 
131                                                          gpointer user_data);
132 GList*                  gst_registry_feature_filter     (GstRegistry *registry, 
133                                                          GstPluginFeatureFilter filter, 
134                                                          gboolean first,
135                                                          gpointer user_data);
136
137 GstPlugin*              gst_registry_find_plugin        (GstRegistry *registry, const gchar *name);
138 GstPluginFeature*       gst_registry_find_feature       (GstRegistry *registry, const gchar *name, GType type);
139
140 GstRegistryReturn       gst_registry_load_plugin        (GstRegistry *registry, GstPlugin *plugin);
141 GstRegistryReturn       gst_registry_unload_plugin      (GstRegistry *registry, GstPlugin *plugin);
142 GstRegistryReturn       gst_registry_update_plugin      (GstRegistry *registry, GstPlugin *plugin);
143
144 G_END_DECLS
145
146 #endif /* __GST_REGISTRY_H__ */