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 | /* compatibility for pre-POSIX defines */ |
---|
38 | #ifdef S_IRUSR |
---|
39 | #if defined(_WIN32) && defined(__MINGW32__) |
---|
40 | #define REGISTRY_DIR_PERMS (S_ISGID | \ |
---|
41 | S_IRUSR | S_IWUSR | S_IXUSR) |
---|
42 | #else |
---|
43 | #define REGISTRY_DIR_PERMS (S_ISGID | \ |
---|
44 | S_IRUSR | S_IWUSR | S_IXUSR | \ |
---|
45 | S_IRGRP | S_IXGRP | \ |
---|
46 | S_IROTH | S_IXOTH) |
---|
47 | #endif |
---|
48 | #define REGISTRY_TMPFILE_PERMS (S_IRUSR | S_IWUSR) |
---|
49 | #if defined(_WIN32) && defined(__MINGW32__) |
---|
50 | #define REGISTRY_FILE_PERMS (S_IRUSR | S_IWUSR |
---|
51 | #else |
---|
52 | #define REGISTRY_FILE_PERMS (S_IRUSR | S_IWUSR | \ |
---|
53 | S_IRGRP | S_IWGRP | \ |
---|
54 | S_IROTH | S_IWOTH) |
---|
55 | #endif |
---|
56 | #else |
---|
57 | #define REGISTRY_DIR_PERMS (S_ISGID | \ |
---|
58 | S_IREAD | S_IWRITE | S_IEXEC) |
---|
59 | #define REGISTRY_TMPFILE_PERMS (S_IREAD | S_IWRITE) |
---|
60 | #define REGISTRY_FILE_PERMS (S_IREAD | S_IWRITE) |
---|
61 | #endif |
---|
62 | |
---|
63 | G_BEGIN_DECLS |
---|
64 | |
---|
65 | typedef enum { |
---|
66 | GST_REGISTRY_OK = (0), |
---|
67 | GST_REGISTRY_LOAD_ERROR = (1 << 1), |
---|
68 | GST_REGISTRY_SAVE_ERROR = (1 << 2), |
---|
69 | GST_REGISTRY_PLUGIN_LOAD_ERROR = (1 << 3), |
---|
70 | GST_REGISTRY_PLUGIN_SIGNATURE_ERROR = (1 << 4) |
---|
71 | } GstRegistryReturn; |
---|
72 | |
---|
73 | typedef enum { |
---|
74 | GST_REGISTRY_READABLE = (1 << 1), |
---|
75 | GST_REGISTRY_WRITABLE = (1 << 2), |
---|
76 | GST_REGISTRY_EXISTS = (1 << 3), |
---|
77 | GST_REGISTRY_REMOTE = (1 << 4), |
---|
78 | GST_REGISTRY_DELAYED_LOADING = (1 << 5) |
---|
79 | } GstRegistryFlags; |
---|
80 | |
---|
81 | |
---|
82 | #define GST_TYPE_REGISTRY (gst_registry_get_type ()) |
---|
83 | #define GST_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_REGISTRY, GstRegistry)) |
---|
84 | #define GST_IS_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_REGISTRY)) |
---|
85 | #define GST_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_REGISTRY, GstRegistryClass)) |
---|
86 | #define GST_IS_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_REGISTRY)) |
---|
87 | #define GST_REGISTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_REGISTRY, GstRegistryClass)) |
---|
88 | |
---|
89 | typedef struct _GstRegistry GstRegistry; |
---|
90 | typedef struct _GstRegistryClass GstRegistryClass; |
---|
91 | |
---|
92 | struct _GstRegistry { |
---|
93 | GObject object; |
---|
94 | |
---|
95 | gint priority; |
---|
96 | GstRegistryFlags flags; |
---|
97 | |
---|
98 | gchar *name; |
---|
99 | gchar *details; |
---|
100 | |
---|
101 | gboolean loaded; |
---|
102 | GList *plugins; |
---|
103 | |
---|
104 | GList *paths; |
---|
105 | |
---|
106 | gpointer _gst_reserved[GST_PADDING]; |
---|
107 | }; |
---|
108 | |
---|
109 | struct _GstRegistryClass { |
---|
110 | GObjectClass parent_class; |
---|
111 | |
---|
112 | /* vtable */ |
---|
113 | gboolean (*load) (GstRegistry *registry); |
---|
114 | gboolean (*save) (GstRegistry *registry); |
---|
115 | gboolean (*rebuild) (GstRegistry *registry); |
---|
116 | gboolean (*unload) (GstRegistry *registry); |
---|
117 | |
---|
118 | GstRegistryReturn (*load_plugin) (GstRegistry *registry, GstPlugin *plugin); |
---|
119 | GstRegistryReturn (*unload_plugin) (GstRegistry *registry, GstPlugin *plugin); |
---|
120 | GstRegistryReturn (*update_plugin) (GstRegistry *registry, GstPlugin *plugin); |
---|
121 | |
---|
122 | /* signals */ |
---|
123 | void (*plugin_added) (GstRegistry *registry, GstPlugin *plugin); |
---|
124 | |
---|
125 | gpointer _gst_reserved[GST_PADDING]; |
---|
126 | }; |
---|
127 | |
---|
128 | |
---|
129 | /* normal GObject stuff */ |
---|
130 | GType gst_registry_get_type (void); |
---|
131 | |
---|
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); |
---|
137 | |
---|
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); |
---|
141 | |
---|
142 | gboolean gst_registry_add_plugin (GstRegistry *registry, GstPlugin *plugin); |
---|
143 | void gst_registry_remove_plugin (GstRegistry *registry, GstPlugin *plugin); |
---|
144 | |
---|
145 | GList* gst_registry_plugin_filter (GstRegistry *registry, |
---|
146 | GstPluginFilter filter, |
---|
147 | gboolean first, |
---|
148 | gpointer user_data); |
---|
149 | GList* gst_registry_feature_filter (GstRegistry *registry, |
---|
150 | GstPluginFeatureFilter filter, |
---|
151 | gboolean first, |
---|
152 | gpointer user_data); |
---|
153 | |
---|
154 | GstPlugin* gst_registry_find_plugin (GstRegistry *registry, const gchar *name); |
---|
155 | GstPluginFeature* gst_registry_find_feature (GstRegistry *registry, const gchar *name, GType type); |
---|
156 | |
---|
157 | GstRegistryReturn gst_registry_load_plugin (GstRegistry *registry, GstPlugin *plugin); |
---|
158 | GstRegistryReturn gst_registry_unload_plugin (GstRegistry *registry, GstPlugin *plugin); |
---|
159 | GstRegistryReturn gst_registry_update_plugin (GstRegistry *registry, GstPlugin *plugin); |
---|
160 | |
---|
161 | G_END_DECLS |
---|
162 | |
---|
163 | #endif /* __GST_REGISTRY_H__ */ |
---|