2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
5 * gst_private.h: Private header for within libgst
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., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
23 #ifndef __GST_PRIVATE_H__
24 #define __GST_PRIVATE_H__
27 # ifndef GST_LICENSE /* don't include config.h twice, it has no guards */
32 /* This needs to be before glib.h, since it might be used in inline
34 extern const char g_log_domain_gstreamer[];
41 /* Needed for GstRegistry * */
42 #include "gstregistry.h"
43 #include "gststructure.h"
45 /* we need this in pretty much all files */
48 /* for the flags in the GstPluginDep structure below */
49 #include "gstplugin.h"
51 /* for the pad cache */
55 #include "gstelement.h"
57 /* for GstDeviceMonitor */
58 #include "gstdevicemonitor.h"
63 #include "gstdatetime.h"
67 /* used by gstparse.c and grammar.y */
68 struct _GstParseContext {
69 GList * missing_elements;
72 /* used by gstplugin.c and gstregistrybinary.c */
74 /* details registered via gst_plugin_add_dependency() */
75 GstPluginDependencyFlags flags;
80 /* information saved from the last time the plugin was loaded (-1 = unset) */
81 guint env_hash; /* hash of content of environment variables in env_vars */
82 guint stat_hash; /* hash of stat() on all relevant files and directories */
85 struct _GstPluginPrivate {
86 GList *deps; /* list of GstPluginDep structures */
87 GstStructure *cache_data;
90 /* FIXME: could rename all priv_gst_* functions to __gst_* now */
91 G_GNUC_INTERNAL gboolean priv_gst_plugin_loading_have_whitelist (void);
93 G_GNUC_INTERNAL guint32 priv_gst_plugin_loading_get_whitelist_hash (void);
95 G_GNUC_INTERNAL gboolean priv_gst_plugin_desc_is_whitelisted (GstPluginDesc * desc,
96 const gchar * filename);
98 G_GNUC_INTERNAL gboolean _priv_plugin_deps_env_vars_changed (GstPlugin * plugin);
100 G_GNUC_INTERNAL gboolean _priv_plugin_deps_files_changed (GstPlugin * plugin);
102 G_GNUC_INTERNAL gboolean _priv_gst_in_valgrind (void);
104 /* init functions called from gst_init(). */
105 G_GNUC_INTERNAL void _priv_gst_quarks_initialize (void);
106 G_GNUC_INTERNAL void _priv_gst_mini_object_initialize (void);
107 G_GNUC_INTERNAL void _priv_gst_memory_initialize (void);
108 G_GNUC_INTERNAL void _priv_gst_allocator_initialize (void);
109 G_GNUC_INTERNAL void _priv_gst_buffer_initialize (void);
110 G_GNUC_INTERNAL void _priv_gst_buffer_list_initialize (void);
111 G_GNUC_INTERNAL void _priv_gst_structure_initialize (void);
112 G_GNUC_INTERNAL void _priv_gst_caps_initialize (void);
113 G_GNUC_INTERNAL void _priv_gst_caps_features_initialize (void);
114 G_GNUC_INTERNAL void _priv_gst_event_initialize (void);
115 G_GNUC_INTERNAL void _priv_gst_format_initialize (void);
116 G_GNUC_INTERNAL void _priv_gst_message_initialize (void);
117 G_GNUC_INTERNAL void _priv_gst_memory_initialize (void);
118 G_GNUC_INTERNAL void _priv_gst_meta_initialize (void);
119 G_GNUC_INTERNAL void _priv_gst_plugin_initialize (void);
120 G_GNUC_INTERNAL void _priv_gst_query_initialize (void);
121 G_GNUC_INTERNAL void _priv_gst_sample_initialize (void);
122 G_GNUC_INTERNAL void _priv_gst_tag_initialize (void);
123 G_GNUC_INTERNAL void _priv_gst_value_initialize (void);
124 G_GNUC_INTERNAL void _priv_gst_debug_init (void);
125 G_GNUC_INTERNAL void _priv_gst_context_initialize (void);
126 G_GNUC_INTERNAL void _priv_gst_toc_initialize (void);
127 G_GNUC_INTERNAL void _priv_gst_date_time_initialize (void);
129 /* Private registry functions */
131 gboolean _priv_gst_registry_remove_cache_plugins (GstRegistry *registry);
133 G_GNUC_INTERNAL void _priv_gst_registry_cleanup (void);
135 gboolean _gst_plugin_loader_client_run (void);
137 /* Used in GstBin for manual state handling */
138 G_GNUC_INTERNAL void _priv_gst_element_state_changed (GstElement *element,
139 GstState oldstate, GstState newstate, GstState pending);
141 /* used in both gststructure.c and gstcaps.c; numbers are completely made up */
142 #define STRUCTURE_ESTIMATED_STRING_LEN(s) (16 + gst_structure_n_fields(s) * 22)
143 #define FEATURES_ESTIMATED_STRING_LEN(s) (16 + gst_caps_features_get_size(s) * 14)
146 gboolean priv_gst_structure_append_to_gstring (const GstStructure * structure,
149 void priv_gst_caps_features_append_to_gstring (const GstCapsFeatures * features, GString *s);
152 gboolean priv_gst_structure_parse_name (gchar * str, gchar **start, gchar ** end, gchar ** next);
154 gboolean priv_gst_structure_parse_fields (gchar *str, gchar ** end, GstStructure *structure);
156 /* registry cache backends */
158 gboolean priv_gst_registry_binary_read_cache (GstRegistry * registry, const char *location);
161 gboolean priv_gst_registry_binary_write_cache (GstRegistry * registry, GList * plugins, const char *location);
165 void __gst_element_factory_add_static_pad_template (GstElementFactory * elementfactory,
166 GstStaticPadTemplate * templ);
169 void __gst_element_factory_add_interface (GstElementFactory * elementfactory,
170 const gchar * interfacename);
172 /* used in gstvalue.c and gststructure.c */
173 #define GST_ASCII_IS_STRING(c) (g_ascii_isalnum((c)) || ((c) == '_') || \
174 ((c) == '-') || ((c) == '+') || ((c) == '/') || ((c) == ':') || \
177 /* This is only meant for internal uses */
179 gint __gst_date_time_compare (const GstDateTime * dt1, const GstDateTime * dt2);
182 gchar * __gst_date_time_serialize (GstDateTime * datetime, gboolean with_usecs);
184 #ifndef GST_DISABLE_REGISTRY
185 /* Secret variable to initialise gst without registry cache */
186 GST_EXPORT gboolean _gst_disable_registry_cache;
189 /* provide inline gst_g_value_get_foo_unchecked(), used in gststructure.c */
190 #define DEFINE_INLINE_G_VALUE_GET_UNCHECKED(ret_type,name_type,v_field) \
191 static inline ret_type \
192 gst_g_value_get_##name_type##_unchecked (const GValue *value) \
194 return value->data[0].v_field; \
197 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(gboolean,boolean,v_int)
198 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(gint,int,v_int)
199 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(guint,uint,v_uint)
200 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(gint64,int64,v_int64)
201 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(guint64,uint64,v_uint64)
202 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(gfloat,float,v_float)
203 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(gdouble,double,v_double)
204 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(const gchar *,string,v_pointer)
207 /*** debugging categories *****************************************************/
209 #ifndef GST_REMOVE_GST_DEBUG
211 GST_EXPORT GstDebugCategory *GST_CAT_GST_INIT;
212 GST_EXPORT GstDebugCategory *GST_CAT_MEMORY;
213 GST_EXPORT GstDebugCategory *GST_CAT_PARENTAGE;
214 GST_EXPORT GstDebugCategory *GST_CAT_STATES;
215 GST_EXPORT GstDebugCategory *GST_CAT_SCHEDULING;
216 GST_EXPORT GstDebugCategory *GST_CAT_BUFFER;
217 GST_EXPORT GstDebugCategory *GST_CAT_BUFFER_LIST;
218 GST_EXPORT GstDebugCategory *GST_CAT_BUS;
219 GST_EXPORT GstDebugCategory *GST_CAT_CAPS;
220 GST_EXPORT GstDebugCategory *GST_CAT_CLOCK;
221 GST_EXPORT GstDebugCategory *GST_CAT_ELEMENT_PADS;
222 GST_EXPORT GstDebugCategory *GST_CAT_PADS;
223 GST_EXPORT GstDebugCategory *GST_CAT_PERFORMANCE;
224 GST_EXPORT GstDebugCategory *GST_CAT_PIPELINE;
225 GST_EXPORT GstDebugCategory *GST_CAT_PLUGIN_LOADING;
226 GST_EXPORT GstDebugCategory *GST_CAT_PLUGIN_INFO;
227 GST_EXPORT GstDebugCategory *GST_CAT_PROPERTIES;
228 GST_EXPORT GstDebugCategory *GST_CAT_NEGOTIATION;
229 GST_EXPORT GstDebugCategory *GST_CAT_REFCOUNTING;
230 GST_EXPORT GstDebugCategory *GST_CAT_ERROR_SYSTEM;
231 GST_EXPORT GstDebugCategory *GST_CAT_EVENT;
232 GST_EXPORT GstDebugCategory *GST_CAT_MESSAGE;
233 GST_EXPORT GstDebugCategory *GST_CAT_PARAMS;
234 GST_EXPORT GstDebugCategory *GST_CAT_CALL_TRACE;
235 GST_EXPORT GstDebugCategory *GST_CAT_SIGNAL;
236 GST_EXPORT GstDebugCategory *GST_CAT_PROBE;
237 GST_EXPORT GstDebugCategory *GST_CAT_REGISTRY;
238 GST_EXPORT GstDebugCategory *GST_CAT_QOS;
239 GST_EXPORT GstDebugCategory *GST_CAT_META;
240 GST_EXPORT GstDebugCategory *GST_CAT_LOCKING;
241 GST_EXPORT GstDebugCategory *GST_CAT_CONTEXT;
243 /* Categories that should be completely private to
244 * libgstreamer should be done like this: */
245 #define GST_CAT_POLL _priv_GST_CAT_POLL
246 extern GstDebugCategory *_priv_GST_CAT_POLL;
250 #define GST_CAT_GST_INIT NULL
251 #define GST_CAT_AUTOPLUG NULL
252 #define GST_CAT_AUTOPLUG_ATTEMPT NULL
253 #define GST_CAT_PARENTAGE NULL
254 #define GST_CAT_STATES NULL
255 #define GST_CAT_SCHEDULING NULL
256 #define GST_CAT_DATAFLOW NULL
257 #define GST_CAT_BUFFER NULL
258 #define GST_CAT_BUFFER_LIST NULL
259 #define GST_CAT_BUS NULL
260 #define GST_CAT_CAPS NULL
261 #define GST_CAT_CLOCK NULL
262 #define GST_CAT_ELEMENT_PADS NULL
263 #define GST_CAT_PADS NULL
264 #define GST_CAT_PERFORMANCE NULL
265 #define GST_CAT_PIPELINE NULL
266 #define GST_CAT_PLUGIN_LOADING NULL
267 #define GST_CAT_PLUGIN_INFO NULL
268 #define GST_CAT_PROPERTIES NULL
269 #define GST_CAT_NEGOTIATION NULL
270 #define GST_CAT_REFCOUNTING NULL
271 #define GST_CAT_ERROR_SYSTEM NULL
272 #define GST_CAT_EVENT NULL
273 #define GST_CAT_MESSAGE NULL
274 #define GST_CAT_PARAMS NULL
275 #define GST_CAT_CALL_TRACE NULL
276 #define GST_CAT_SIGNAL NULL
277 #define GST_CAT_PROBE NULL
278 #define GST_CAT_REGISTRY NULL
279 #define GST_CAT_QOS NULL
280 #define GST_CAT_TYPES NULL
281 #define GST_CAT_POLL NULL
282 #define GST_CAT_META NULL
283 #define GST_CAT_LOCKING NULL
284 #define GST_CAT_CONTEXT NULL
288 #ifdef GST_DISABLE_GST_DEBUG
289 /* for _gst_element_error_printf */
290 #define __gst_vasprintf __gst_info_fallback_vasprintf
291 int __gst_vasprintf (char **result, char const *format, va_list args);
294 /**** objects made opaque until the private bits have been made private ****/
297 #include <time.h> /* time_t */
298 #include <sys/types.h> /* off_t */
299 #include <sys/stat.h> /* off_t */
301 typedef struct _GstPluginPrivate GstPluginPrivate;
309 GstPluginDesc *orig_desc;
312 gchar * basename; /* base name (non-dir part) of plugin path */
314 GModule * module; /* contains the module if plugin is loaded */
318 gboolean registered; /* TRUE when the registry has seen a filename
319 * that matches the plugin's basename */
321 GstPluginPrivate *priv;
323 gpointer _gst_reserved[GST_PADDING];
326 struct _GstPluginClass {
327 GstObjectClass object_class;
330 gpointer _gst_reserved[GST_PADDING];
333 struct _GstPluginFeature {
340 const gchar *plugin_name;
341 GstPlugin *plugin; /* weak ref */
344 gpointer _gst_reserved[GST_PADDING];
347 struct _GstPluginFeatureClass {
348 GstObjectClass parent_class;
351 gpointer _gst_reserved[GST_PADDING];
354 #include "gsttypefind.h"
356 struct _GstTypeFindFactory {
357 GstPluginFeature feature;
360 GstTypeFindFunction function;
365 GDestroyNotify user_data_notify;
367 gpointer _gst_reserved[GST_PADDING];
370 struct _GstTypeFindFactoryClass {
371 GstPluginFeatureClass parent;
374 gpointer _gst_reserved[GST_PADDING];
377 struct _GstElementFactory {
378 GstPluginFeature parent;
380 GType type; /* unique GType of element or 0 if not loaded */
384 GList * staticpadtemplates; /* GstStaticPadTemplate list */
385 guint numpadtemplates;
387 /* URI interface stuff */
389 gchar ** uri_protocols;
391 GList * interfaces; /* interface type names this element implements */
394 gpointer _gst_reserved[GST_PADDING];
397 struct _GstElementFactoryClass {
398 GstPluginFeatureClass parent_class;
400 gpointer _gst_reserved[GST_PADDING];
403 struct _GstDeviceMonitorFactory {
404 GstPluginFeature feature;
407 GType type; /* unique GType the device factory or 0 if not loaded */
409 volatile GstDeviceMonitor *monitor;
412 gpointer _gst_reserved[GST_PADDING];
415 struct _GstDeviceMonitorFactoryClass {
416 GstPluginFeatureClass parent;
419 gpointer _gst_reserved[GST_PADDING];
423 #endif /* __GST_PRIVATE_H__ */