registry: Add registry helper phase 1
[platform/upstream/gstreamer.git] / gst / gstregistrychunks.h
1 /* GStreamer
2  * Copyright (C) 2006 Josep Torra <josep@fluendo.com>
3  * Copyright (C) 2006 Mathieu Garcia  <matthieu@fluendo.com>
4  * Copyright (C) 2006 Stefan Kost <ensonic@sonicpulse.de>
5  *
6  * gstregistrybinary.h: Header for registry handling
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 #ifndef __GST_REGISTRYCHUNKS_H__
24 #define __GST_REGISTRYCHUNKS_H__
25
26 #include <gst/gstpad.h>
27 #include <gst/gstregistry.h>
28
29 /*
30  * we reference strings directly from the plugins and in this case set CONST to
31  * avoid freeing them
32  */
33 enum {
34   GST_REGISTRY_CHUNK_FLAG_NONE = 0,
35   GST_REGISTRY_CHUNK_FLAG_CONST = 1
36 };
37
38 /*
39  * GstRegistryChunk:
40  *
41  * Header for binary blobs
42  */
43 typedef struct _GstRegistryChunk
44 {
45   gpointer data;
46   guint size;
47   guint flags;
48   gboolean align;
49 } GstRegistryChunk;
50
51 /*
52  * GstRegistryChunkPluginElement:
53  *
54  * @n_deps: Says how many dependency structures follows.
55  *
56  * @nfeatures: says how many binary plugin feature structures we will have
57  * right after the structure itself.
58  *
59  * A structure containing (staticely) every information needed for a plugin
60  */
61
62 typedef struct _GstRegistryChunkPluginElement
63 {
64   gulong file_size;
65   gulong file_mtime;
66
67   guint n_deps;
68
69   guint nfeatures;
70 } GstRegistryChunkPluginElement;
71
72 /* GstRegistryChunkDep:
73  */
74 typedef struct _GstRegistryChunkDep
75 {
76   guint flags;
77   guint n_env_vars;
78   guint n_paths;
79   guint n_names;
80
81   guint env_hash;
82   guint stat_hash;
83 } GstRegistryChunkDep;
84
85 /*
86  * GstRegistryChunkPluginFeature:
87  * @rank: rank of the feature
88  *
89  * A structure containing the plugin features
90  */
91 typedef struct _GstRegistryChunkPluginFeature
92 {
93   gulong rank;
94 } GstRegistryChunkPluginFeature;
95
96 /*
97  * GstRegistryChunkElementFactory:
98  * @npadtemplates: stores the number of GstRegistryChunkPadTemplate structures
99  * following the structure
100  * @ninterfaces: stores the number of interface names following the structure
101  * @nuriprotocols: stores the number of protocol strings following the structure
102  *
103  * A structure containing the element factory fields
104  */
105 typedef struct _GstRegistryChunkElementFactory
106 {
107   GstRegistryChunkPluginFeature plugin_feature;
108
109   guint npadtemplates;
110   guint ninterfaces;
111   guint nuriprotocols;
112 } GstRegistryChunkElementFactory;
113
114 /*
115  * GstRegistryChunkTypeFindFactory:
116  * @nextensions: stores the number of typefind extensions
117  *
118  * A structure containing the element factory fields
119  */
120 typedef struct _GstRegistryChunkTypeFindFactory
121 {
122   GstRegistryChunkPluginFeature plugin_feature;
123
124   guint nextensions;
125 } GstRegistryChunkTypeFindFactory;
126
127 /*
128  * GstRegistryChunkPadTemplate:
129  *
130  * A structure containing the static pad templates of a plugin feature
131  */
132 typedef struct _GstRegistryChunkPadTemplate
133 {
134   guint direction;                     /* Either 0:"sink" or 1:"src" */
135   GstPadPresence presence;
136 } GstRegistryChunkPadTemplate;
137
138 G_BEGIN_DECLS
139
140 gboolean
141 _priv_gst_registry_chunks_save_plugin (GList ** list, GstRegistry * registry,
142     GstPlugin * plugin);
143
144 gboolean
145 _priv_gst_registry_chunks_load_plugin (GstRegistry * registry, gchar ** in,
146     gchar *end, GstPlugin **out_plugin);
147
148 G_END_DECLS
149
150 #endif /* __GST_REGISTRYCHUNKS_H__ */