Merge branch 'master' into 0.11
[platform/upstream/gstreamer.git] / gst / gst_private.h
1 /* GStreamer
2  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3  *                    2000 Wim Taymans <wtay@chello.be>
4  *
5  * gst_private.h: Private header for within libgst
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 #ifndef __GST_PRIVATE_H__
24 #define __GST_PRIVATE_H__
25
26 #ifdef HAVE_CONFIG_H
27 # ifndef GST_LICENSE   /* don't include config.h twice, it has no guards */
28 #  include "config.h"
29 # endif
30 #endif
31
32 /* This needs to be before glib.h, since it might be used in inline
33  * functions */
34 extern const char             g_log_domain_gstreamer[];
35
36 #include <glib.h>
37
38 #include <stdlib.h>
39 #include <string.h>
40
41 /* Needed for GstRegistry * */
42 #include "gstregistry.h"
43 #include "gststructure.h"
44
45 /* we need this in pretty much all files */
46 #include "gstinfo.h"
47
48 /* for the flags in the GstPluginDep structure below */
49 #include "gstplugin.h"
50
51 /* for the pad cache */
52 #include "gstpad.h"
53
54 G_BEGIN_DECLS
55
56 /* used by gstparse.c and grammar.y */
57 struct _GstParseContext {
58   GList * missing_elements;
59 };
60
61 /* used by gstplugin.c and gstregistrybinary.c */
62 typedef struct {
63   /* details registered via gst_plugin_add_dependency() */
64   GstPluginDependencyFlags  flags;
65   gchar **env_vars;
66   gchar **paths;
67   gchar **names;
68
69   /* information saved from the last time the plugin was loaded (-1 = unset) */
70   guint   env_hash;  /* hash of content of environment variables in env_vars */
71   guint   stat_hash; /* hash of stat() on all relevant files and directories */
72 } GstPluginDep;
73
74 struct _GstPluginPrivate {
75   GList *deps;    /* list of GstPluginDep structures */
76   GstStructure *cache_data;
77 };
78
79 gboolean priv_gst_plugin_loading_have_whitelist (void);
80
81 guint32  priv_gst_plugin_loading_get_whitelist_hash (void);
82
83 gboolean priv_gst_plugin_desc_is_whitelisted (GstPluginDesc * desc,
84                                               const gchar   * filename);
85
86 gboolean _priv_plugin_deps_env_vars_changed (GstPlugin * plugin);
87 gboolean _priv_plugin_deps_files_changed (GstPlugin * plugin);
88
89 gboolean _priv_gst_in_valgrind (void);
90
91 /* Initialize GStreamer private quark storage */
92 void _priv_gst_quarks_initialize (void);
93
94 /* Other init functions called from gst_init().
95  * FIXME 0.11: rename to _priv_gst_foo_init() so they don't get exported
96  * (can't do this now because these functions used to be in our public
97  * headers, so at least the symbols need to continue to be available unless
98  * we want enterprise edition packagers dancing on our heads) */
99 void  _gst_buffer_initialize (void);
100 void  _gst_buffer_list_initialize (void);
101 void  _gst_caps_initialize (void);
102 void  _gst_event_initialize (void);
103 void  _gst_format_initialize (void);
104 void  _gst_message_initialize (void);
105 void  _gst_plugin_initialize (void);
106 void  _gst_query_initialize (void);
107 void  _gst_tag_initialize (void);
108 void  _gst_value_initialize (void);
109
110 /* Private registry functions */
111 gboolean _priv_gst_registry_remove_cache_plugins (GstRegistry *registry);
112 void _priv_gst_registry_cleanup (void);
113 gboolean _gst_plugin_loader_client_run (void);
114
115 void _priv_gst_pad_invalidate_cache (GstPad *pad);
116
117 /* used in both gststructure.c and gstcaps.c; numbers are completely made up */
118 #define STRUCTURE_ESTIMATED_STRING_LEN(s) (16 + (s)->fields->len * 22)
119
120 gboolean  priv_gst_structure_append_to_gstring (const GstStructure * structure,
121                                                 GString            * s);
122 /* registry cache backends */
123 /* FIXME 0.11: use priv_ prefix */
124 gboolean                gst_registry_binary_read_cache  (GstRegistry * registry, const char *location);
125 gboolean                gst_registry_binary_write_cache (GstRegistry * registry, const char *location);
126
127
128 /* used in gstvalue.c and gststructure.c */
129 #define GST_ASCII_IS_STRING(c) (g_ascii_isalnum((c)) || ((c) == '_') || \
130     ((c) == '-') || ((c) == '+') || ((c) == '/') || ((c) == ':') || \
131     ((c) == '.'))
132
133 /* This is only meant for internal uses */
134 gint priv_gst_date_time_compare (gconstpointer dt1, gconstpointer dt2);
135
136 #ifndef GST_DISABLE_REGISTRY
137 /* Secret variable to initialise gst without registry cache */
138 extern gboolean _gst_disable_registry_cache;
139 #endif
140
141 /* provide inline gst_g_value_get_foo_unchecked(), used in gststructure.c */
142 #define DEFINE_INLINE_G_VALUE_GET_UNCHECKED(ret_type,name_type,v_field) \
143 static inline ret_type                                                  \
144 gst_g_value_get_##name_type##_unchecked (const GValue *value)           \
145 {                                                                       \
146   return value->data[0].v_field;                                        \
147 }
148
149 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(gboolean,boolean,v_int)
150 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(gint,int,v_int)
151 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(guint,uint,v_uint)
152 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(gint64,int64,v_int64)
153 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(guint64,uint64,v_uint64)
154 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(gfloat,float,v_float)
155 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(gdouble,double,v_double)
156 DEFINE_INLINE_G_VALUE_GET_UNCHECKED(const gchar *,string,v_pointer)
157
158
159 /*** debugging categories *****************************************************/
160
161 #ifndef GST_REMOVE_GST_DEBUG
162
163 GST_EXPORT GstDebugCategory *GST_CAT_GST_INIT;
164 GST_EXPORT GstDebugCategory *GST_CAT_AUTOPLUG; /* FIXME 0.11: remove? */
165 GST_EXPORT GstDebugCategory *GST_CAT_AUTOPLUG_ATTEMPT; /* FIXME 0.11: remove? */
166 GST_EXPORT GstDebugCategory *GST_CAT_PARENTAGE;
167 GST_EXPORT GstDebugCategory *GST_CAT_STATES;
168 GST_EXPORT GstDebugCategory *GST_CAT_SCHEDULING;
169 GST_EXPORT GstDebugCategory *GST_CAT_BUFFER;
170 GST_EXPORT GstDebugCategory *GST_CAT_BUFFER_LIST;
171 GST_EXPORT GstDebugCategory *GST_CAT_BUS;
172 GST_EXPORT GstDebugCategory *GST_CAT_CAPS;
173 GST_EXPORT GstDebugCategory *GST_CAT_CLOCK;
174 GST_EXPORT GstDebugCategory *GST_CAT_ELEMENT_PADS;
175 GST_EXPORT GstDebugCategory *GST_CAT_PADS;
176 GST_EXPORT GstDebugCategory *GST_CAT_PERFORMANCE;
177 GST_EXPORT GstDebugCategory *GST_CAT_PIPELINE;
178 GST_EXPORT GstDebugCategory *GST_CAT_PLUGIN_LOADING;
179 GST_EXPORT GstDebugCategory *GST_CAT_PLUGIN_INFO;
180 GST_EXPORT GstDebugCategory *GST_CAT_PROPERTIES;
181 GST_EXPORT GstDebugCategory *GST_CAT_XML;
182 GST_EXPORT GstDebugCategory *GST_CAT_NEGOTIATION;
183 GST_EXPORT GstDebugCategory *GST_CAT_REFCOUNTING;
184 GST_EXPORT GstDebugCategory *GST_CAT_ERROR_SYSTEM;
185 GST_EXPORT GstDebugCategory *GST_CAT_EVENT;
186 GST_EXPORT GstDebugCategory *GST_CAT_MESSAGE;
187 GST_EXPORT GstDebugCategory *GST_CAT_PARAMS;
188 GST_EXPORT GstDebugCategory *GST_CAT_CALL_TRACE;
189 GST_EXPORT GstDebugCategory *GST_CAT_SIGNAL;
190 GST_EXPORT GstDebugCategory *GST_CAT_PROBE;
191 GST_EXPORT GstDebugCategory *GST_CAT_REGISTRY;
192 GST_EXPORT GstDebugCategory *GST_CAT_QOS;
193 GST_EXPORT GstDebugCategory *GST_CAT_TYPES; /* FIXME 0.11: remove? */
194
195 /* Categories that should be completely private to
196  * libgstreamer should be done like this: */
197 #define GST_CAT_POLL _priv_GST_CAT_POLL
198 extern GstDebugCategory *_priv_GST_CAT_POLL;
199
200 #else
201
202 #define GST_CAT_GST_INIT         NULL
203 #define GST_CAT_AUTOPLUG         NULL
204 #define GST_CAT_AUTOPLUG_ATTEMPT NULL
205 #define GST_CAT_PARENTAGE        NULL
206 #define GST_CAT_STATES           NULL
207 #define GST_CAT_SCHEDULING       NULL
208 #define GST_CAT_DATAFLOW         NULL
209 #define GST_CAT_BUFFER           NULL
210 #define GST_CAT_BUFFER_LIST      NULL
211 #define GST_CAT_BUS              NULL
212 #define GST_CAT_CAPS             NULL
213 #define GST_CAT_CLOCK            NULL
214 #define GST_CAT_ELEMENT_PADS     NULL
215 #define GST_CAT_PADS             NULL
216 #define GST_CAT_PERFORMANCE      NULL
217 #define GST_CAT_PIPELINE         NULL
218 #define GST_CAT_PLUGIN_LOADING   NULL
219 #define GST_CAT_PLUGIN_INFO      NULL
220 #define GST_CAT_PROPERTIES       NULL
221 #define GST_CAT_XML              NULL
222 #define GST_CAT_NEGOTIATION      NULL
223 #define GST_CAT_REFCOUNTING      NULL
224 #define GST_CAT_ERROR_SYSTEM     NULL
225 #define GST_CAT_EVENT            NULL
226 #define GST_CAT_MESSAGE          NULL
227 #define GST_CAT_PARAMS           NULL
228 #define GST_CAT_CALL_TRACE       NULL
229 #define GST_CAT_SIGNAL           NULL
230 #define GST_CAT_PROBE            NULL
231 #define GST_CAT_REGISTRY         NULL
232 #define GST_CAT_QOS              NULL
233 #define GST_CAT_TYPES            NULL
234 #define GST_CAT_POLL             NULL
235
236 #endif
237
238 G_END_DECLS
239 #endif /* __GST_PRIVATE_H__ */