summaryrefslogtreecommitdiffstats
path: root/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-multimedia/gstreamer/gstreamer-0.10.36')
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/0001-baseparse-Fix-self-comparison-always-evaluates-to-tr.patch32
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/check_fix.patch19
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/gst-inspect-check-error.patch16
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/gstregistrybinary.c487
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/gstregistrybinary.h194
5 files changed, 748 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/0001-baseparse-Fix-self-comparison-always-evaluates-to-tr.patch b/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/0001-baseparse-Fix-self-comparison-always-evaluates-to-tr.patch
new file mode 100644
index 0000000000..d07749682b
--- /dev/null
+++ b/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/0001-baseparse-Fix-self-comparison-always-evaluates-to-tr.patch
@@ -0,0 +1,32 @@
1From ed7f4802222234eef192aa3f74bc92268f338f97 Mon Sep 17 00:00:00 2001
2From: Sebastian Droege <sebastian.droege@collabora.co.uk>
3Date: Tue, 6 Mar 2012 12:28:02 +0100
4Subject: [PATCH] baseparse: Fix 'self-comparison always evaluates to true'
5
6This was really a bug.
7
8Commit is ed7f4802222234eef192aa3f74bc92268f338f97 in 0.10 branch
9
10Upstream Status: Backported
11
12Signed-off-by: Sebastian Droege <sebastian.droege@collabora.co.uk>
13---
14 libs/gst/base/gstbaseparse.c | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c
18index 851ec1d..108ee89 100644
19--- a/libs/gst/base/gstbaseparse.c
20+++ b/libs/gst/base/gstbaseparse.c
21@@ -3899,7 +3899,7 @@ gst_base_parse_handle_seek (GstBaseParse * parse, GstEvent * event)
22 seek event (in bytes) to upstream. Segment / flush handling happens
23 in corresponding src event handlers */
24 GST_DEBUG_OBJECT (parse, "seek in PUSH mode");
25- if (seekstop >= 0 && seekpos <= seekpos)
26+ if (seekstop >= 0 && seekstop <= seekpos)
27 seekstop = seekpos;
28 new_event = gst_event_new_seek (rate, GST_FORMAT_BYTES, flags,
29 GST_SEEK_TYPE_SET, seekpos, stop_type, seekstop);
30--
311.7.9.5
32
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/check_fix.patch b/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/check_fix.patch
new file mode 100644
index 0000000000..5d8bb13403
--- /dev/null
+++ b/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/check_fix.patch
@@ -0,0 +1,19 @@
1# gstreamer: Fix a problem with configure if check has already been built
2# Richard Purdie <rpurdie@linux.intel.com>
3
4Upstream-Status: Inappropriate [configuration]
5
6diff -urN gstreamer-0.10.29-orig/configure.ac gstreamer-0.10.29/configure.ac
7--- gstreamer-0.10.29-orig/configure.ac 2010-06-26 12:49:27.774930773 +0800
8+++ gstreamer-0.10.29/configure.ac 2010-06-26 12:51:12.899200233 +0800
9@@ -543,8 +543,10 @@
10 *) BUILD_CHECK=yes ;;
11 esac
12 ])
13+
14 dnl bit of a misnomer, but keep the conditional named like this so we don't
15 dnl have to change too much elsewhere
16+HAVE_CHECK=no
17 AM_CONDITIONAL(HAVE_CHECK, test "x$BUILD_CHECK" = "xyes")
18
19 dnl configure the desired buffer alignment
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/gst-inspect-check-error.patch b/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/gst-inspect-check-error.patch
new file mode 100644
index 0000000000..30be85f59d
--- /dev/null
+++ b/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/gst-inspect-check-error.patch
@@ -0,0 +1,16 @@
1# Fix crash with gst-inspect
2# Chris Lord <chris@openedhand.com>
3
4Upstream-Status: Pending
5
6--- gstreamer-0.10.9/tools/gst-inspect.c.old 2006-09-12 11:56:53.000000000 +0100
7+++ gstreamer-0.10.9/tools/gst-inspect.c 2006-09-12 11:57:27.000000000 +0100
8@@ -1123,7 +1123,7 @@
9 g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE);
10 g_option_context_add_group (ctx, gst_init_get_option_group ());
11 if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
12- g_print ("Error initializing: %s\n", err->message);
13+ g_print ("Error initializing: %s\n", err ? err->message : "(null)");
14 exit (1);
15 }
16 g_option_context_free (ctx);
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/gstregistrybinary.c b/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/gstregistrybinary.c
new file mode 100644
index 0000000000..c1f3e71af6
--- /dev/null
+++ b/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/gstregistrybinary.c
@@ -0,0 +1,487 @@
1/* GStreamer
2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
4 * 2005 David A. Schleef <ds@schleef.org>
5 *
6 * gstregistryxml.c: GstRegistry object, support routines
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it ulnder 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
24
25#include <gst/gstregistrybinary.h>
26
27/*
28** Simple handy function to write a memory location to the registry cache file
29*/
30inline static gboolean
31gst_registry_binary_write(GstRegistry *registry, const void *mem, const ssize_t size)
32{
33 if (write(registry->cache_file, mem, size) != size)
34 {
35 GST_ERROR("Failed to write binary registry element: ptr=%p size=%u error=%s\n",
36 mem, size, strerror(errno));
37 return FALSE;
38 }
39 return TRUE;
40}
41
42/*
43** Save features GstBinary style
44*/
45static gboolean
46gst_registry_binary_fill_feature(GList **list, GstPluginFeature *orig, GstBinaryPluginFeature *dest, const char *name)
47{
48 GstBinaryChunck *chk;
49
50 if ((chk = calloc(1, sizeof (GstBinaryChunck))) == NULL)
51 return FALSE;
52
53 chk->data = dest;
54 chk->size = sizeof (GstBinaryPluginFeature);
55
56 *list = g_list_append(*list, chk);
57
58 dest->rank = orig->rank;
59 if (!strncpy(dest->typename, name, GST_BINARY_REGISTRY_TYPENAME_TYPENAME_LEN) ||
60 !strncpy(dest->name, orig->name, GST_BINARY_REGISTRY_TYPENAME_NAME_LEN))
61 {
62 GST_ERROR("Failed to write binary registry feature");
63 goto fail;
64 }
65
66 if (GST_IS_ELEMENT_FACTORY(orig))
67 {
68 GstElementFactory *factory = GST_ELEMENT_FACTORY(orig);
69
70 if (!strncpy(dest->longname, factory->details.longname, GST_BINARY_REGISTRY_TYPENAME_LONGNAME_LEN) ||
71 !strncpy(dest->class, factory->details.klass, GST_BINARY_REGISTRY_TYPENAME_CLASS_LEN) ||
72 !strncpy(dest->description, factory->details.description, GST_BINARY_REGISTRY_TYPENAME_DESCRIPTION_LEN) ||
73 !strncpy(dest->author, factory->details.author, GST_BINARY_REGISTRY_TYPENAME_AUTHOR_LEN))
74 {
75 GST_ERROR("Failed to write binary registry feature");
76 goto fail;
77 }
78 }
79
80 dest->npadtemplates = dest->ninterfaces = dest->nuritypes = 0;
81 return TRUE;
82
83 fail:
84 free(chk);
85 return FALSE;
86}
87
88
89/*
90** Initialize the GstBinaryRegistryMagic, setting both our magic number and gstreamer major/minor version
91*/
92inline static gboolean
93gst_registry_binary_initialize_magic(GstBinaryRegistryMagic *m)
94{
95 if (!strncpy(m->magic, GST_MAGIC_BINARY_REGISTRY_STR, GST_MAGIC_BINARY_REGISTRY_LEN) ||
96 !strncpy(m->version, GST_MAJORMINOR, GST_BINARY_REGISTRY_VERSION_LEN))
97 {
98 GST_ERROR("Failed to write magic to the registry magic structure");
99 return FALSE;
100 }
101 return TRUE;
102}
103
104/*
105** Check GstBinaryRegistryMagic validity.
106** Return a pointer pointing right after the magic structure
107*/
108static gchar *
109gst_registry_binary_check_magic(gchar *in)
110{
111 GstBinaryRegistryMagic *m = (GstBinaryRegistryMagic *) in;
112
113 if (m == NULL || m->magic == NULL || m->version == NULL)
114 {
115 GST_ERROR("Binary registry magic structure is broken");
116 return NULL;
117 }
118 if (strncmp(m->magic, GST_MAGIC_BINARY_REGISTRY_STR, GST_MAGIC_BINARY_REGISTRY_LEN) != 0)
119 {
120 GST_ERROR("Binary registry magic is different : %02x%02x%02x%02x != %02x%02x%02x%02x",
121 GST_MAGIC_BINARY_REGISTRY_STR[0] & 0xff, GST_MAGIC_BINARY_REGISTRY_STR[1] & 0xff,
122 GST_MAGIC_BINARY_REGISTRY_STR[2] & 0xff, GST_MAGIC_BINARY_REGISTRY_STR[3] & 0xff,
123 m->magic[0] & 0xff, m->magic[1] & 0xff, m->magic[2] & 0xff, m->magic[3] & 0xff);
124 return NULL;
125 }
126 if (strncmp(m->version, GST_MAJORMINOR, GST_BINARY_REGISTRY_VERSION_LEN))
127 {
128 GST_ERROR("Binary registry magic version is different : %s != %s",
129 GST_MAJORMINOR, m->version);
130 return NULL;
131 }
132 return (in + sizeof (GstBinaryRegistryMagic));
133}
134
135/*
136** Adapt a GstPlugin to our GstBinaryPluginElement structure, and write it to the
137** registry file.
138*/
139static gboolean
140gst_registry_binary_save_plugin(GList **list, GstRegistry *registry, GstPlugin *plugin)
141{
142 GstBinaryPluginElement *e;
143 GstBinaryChunck *chk;
144 GList *walk;
145
146 if ((e = calloc(1, sizeof (GstBinaryPluginElement))) == NULL ||
147 (chk = calloc(1, sizeof (GstBinaryChunck))) == NULL)
148 return FALSE;
149
150 chk->data = e;
151 chk->size = sizeof (GstBinaryPluginElement);
152 *list = g_list_append(*list, chk);
153
154 if (!strncpy(e->name, plugin->desc.name, GST_BINARY_REGISTRY_NAME_LEN) ||
155 !strncpy(e->description, plugin->desc.description, GST_BINARY_REGISTRY_DESCRIPTION_LEN) ||
156 !strncpy(e->filename, plugin->filename, _POSIX_PATH_MAX) ||
157 !strncpy(e->version, plugin->desc.version, GST_BINARY_REGISTRY_VERSION_LEN) ||
158 !strncpy(e->license, plugin->desc.license, GST_BINARY_REGISTRY_LICENSE_LEN) ||
159 !strncpy(e->source, plugin->desc.source, GST_BINARY_REGISTRY_SOURCE_LEN) ||
160 !strncpy(e->package, plugin->desc.package, GST_BINARY_REGISTRY_PACKAGE_LEN) ||
161 !strncpy(e->origin, plugin->desc.origin, GST_BINARY_REGISTRY_ORIGIN_LEN))
162 {
163 GST_DEBUG("Can't adapt GstPlugin to GstBinaryPluginElement");
164 goto fail;
165 }
166
167 e->size = plugin->file_size;
168 e->m32p = plugin->file_mtime;
169
170 GList *ft_list = gst_registry_get_feature_list_by_plugin(registry, plugin->desc.name);
171
172 for (walk = ft_list; walk; walk = g_list_next(walk), e->nfeatures++)
173 {
174 GstPluginFeature *curfeat = GST_PLUGIN_FEATURE (walk->data);
175 GstBinaryPluginFeature *newfeat;
176 const char *feat_name = g_type_name(G_OBJECT_TYPE(curfeat));
177
178 if ((newfeat = calloc(1, sizeof (GstBinaryPluginFeature))) == NULL)
179 goto fail;
180
181 if (!feat_name || !gst_registry_binary_fill_feature(list, curfeat, newfeat, feat_name))
182 {
183 GST_ERROR("Can't fill plugin feature, aborting.");
184 goto fail;
185 }
186 }
187
188 GST_DEBUG("Found %d features in plugin \"%s\"\n", e->nfeatures, e->name);
189 return TRUE;
190
191 fail:
192 free(chk);
193 free(e);
194 return FALSE;
195}
196
197/*
198** Write the cache to file. Part of the code was taken from gstregistryxml.c
199*/
200gboolean
201gst_registry_binary_write_cache(GstRegistry *registry, const char *location)
202{
203 GList *walk;
204 char *tmp_location;
205 GstBinaryRegistryMagic *magic;
206 GstBinaryChunck *magic_chunck;
207 GList *to_write = NULL;
208
209 GST_INFO("Writing binary registry cache");
210
211 g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
212 tmp_location = g_strconcat (location, ".tmpXXXXXX", NULL);
213 registry->cache_file = g_mkstemp (tmp_location);
214 if (registry->cache_file == -1)
215 {
216 char *dir;
217
218 /* oops, I bet the directory doesn't exist */
219 dir = g_path_get_dirname (location);
220 g_mkdir_with_parents (dir, 0777);
221 g_free (dir);
222
223 registry->cache_file = g_mkstemp (tmp_location);
224 }
225
226 if (registry->cache_file == -1)
227 goto fail;
228
229 if ((magic = calloc(1, sizeof (GstBinaryRegistryMagic))) == NULL ||
230 !gst_registry_binary_initialize_magic(magic))
231 goto fail;
232
233 if ((magic_chunck = calloc(1, sizeof (GstBinaryChunck))) == NULL)
234 goto fail;
235
236 magic_chunck->data = magic;
237 magic_chunck->size = sizeof (GstBinaryRegistryMagic);
238 to_write = g_list_append(to_write, magic_chunck);
239
240 /* Iterate trough the list of plugins in the GstRegistry and adapt them to our structures */
241 for (walk = g_list_last(registry->plugins); walk; walk = g_list_previous(walk))
242 {
243 GstPlugin *plugin = GST_PLUGIN(walk->data);
244
245 if (!plugin->filename)
246 continue;
247
248 if (plugin->flags & GST_PLUGIN_FLAG_CACHED)
249 {
250 int ret;
251 struct stat statbuf;
252
253 ret = g_stat (plugin->filename, &statbuf);
254 if ((ret = g_stat (plugin->filename, &statbuf)) < 0 ||
255 plugin->file_mtime != statbuf.st_mtime ||
256 plugin->file_size != statbuf.st_size)
257 continue;
258 }
259
260 if (!gst_registry_binary_save_plugin(&to_write, registry, plugin))
261 {
262 GST_ERROR("Can't write binary plugin information for \"%s\"", plugin->filename);
263 continue; /* Try anyway */
264 }
265 }
266
267 for (walk = g_list_first(to_write); walk; walk = g_list_next(walk))
268 {
269 GstBinaryChunck *cur = walk->data;
270
271 if (!gst_registry_binary_write(registry, cur->data, cur->size))
272 {
273 free(cur->data);
274 free(cur);
275 g_list_free(to_write);
276 goto fail;
277 }
278 free(cur->data);
279 free(cur);
280 }
281 g_list_free(to_write);
282
283 if (close(registry->cache_file) < 0)
284 {
285 GST_DEBUG("Can't close registry file : %s", strerror(errno));
286 goto fail;
287 }
288
289 if (g_file_test (tmp_location, G_FILE_TEST_EXISTS)) {
290#ifdef WIN32
291 remove (location);
292#endif
293 rename (tmp_location, location);
294 }
295
296 g_free (tmp_location);
297 return TRUE;
298
299 fail:
300 g_free(tmp_location);
301 return FALSE;
302}
303
304static GstPluginFeature*
305gst_registry_binary_load_feature(GstBinaryPluginFeature *in)
306{
307 GstPluginFeature *feature;
308 GType type;
309
310 if (!in->typename || !*(in->typename))
311 return NULL;
312
313 /* GST_INFO("Plugin feature typename : %s", in->typename);*/
314
315 if (!(type = g_type_from_name(in->typename)))
316 {
317 GST_ERROR("Unknown type from typename");
318 return NULL;
319 }
320 feature = g_object_new (type, NULL);
321
322 if (!feature) {
323 GST_ERROR("Can't create feature from type");
324 return NULL;
325 }
326
327 if (!GST_IS_PLUGIN_FEATURE (feature)) {
328 /* don't really know what it is */
329 if (GST_IS_OBJECT (feature))
330 gst_object_unref (feature);
331 else
332 g_object_unref (feature);
333 return NULL;
334 }
335
336 feature->name = g_strdup(in->name);
337 feature->rank = in->rank;
338
339 if (GST_IS_ELEMENT_FACTORY(feature))
340 {
341 GstElementFactory *factory = GST_ELEMENT_FACTORY(feature);
342
343 factory->details.longname = g_strdup(in->longname);
344 factory->details.klass = g_strdup(in->class);
345 factory->details.description = g_strdup(in->description);
346 factory->details.author = g_strdup(in->author);
347
348 /* GST_INFO("Element factory : %s", factory->details.longname); */
349 }
350
351 GST_DEBUG("Added feature %p with name %s", feature, feature->name);
352 return feature;
353}
354
355/*
356** Make a new plugin from current GstBinaryPluginElement structure
357** and save it to the GstRegistry. Return an offset to the next
358** GstBinaryPluginElement structure.
359*/
360static unsigned long
361gst_registry_binary_get_binary_plugin(GstRegistry *registry, gchar *in)
362{
363 GstBinaryPluginElement *p = (GstBinaryPluginElement *) in;
364 GstPlugin *plugin = NULL;
365 GList *plugin_features = NULL;
366 GstBinaryPluginFeature *feat;
367 unsigned int i;
368 unsigned long offset;
369
370 plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
371
372 plugin->flags |= GST_PLUGIN_FLAG_CACHED;
373
374 plugin->desc.name = g_strdup(p->name);
375 plugin->desc.description= g_strdup(p->description);
376 plugin->filename = g_strdup(p->filename);
377 plugin->desc.version = g_strdup(p->version);
378 plugin->desc.license = g_strdup(p->license);
379 plugin->desc.source = g_strdup(p->source);
380 plugin->desc.package = g_strdup(p->package);
381 plugin->desc.origin = g_strdup(p->origin);
382 plugin->file_mtime = p->m32p;
383 plugin->file_size = p->size;
384 plugin->basename = g_path_get_basename (plugin->filename);
385
386 if (plugin->file_mtime < 0 || plugin->file_size < 0)
387 {
388 GST_ERROR("Plugin time or file size is not valid !");
389 g_free(plugin);
390 return -1;
391 }
392
393 if (p->nfeatures < 0)
394 {
395 GST_ERROR("The number of feature structure is not valid !");
396 gst_object_unref(plugin);
397 return -1;
398 }
399
400 for (feat = (GstBinaryPluginFeature *) (in + sizeof (GstBinaryPluginElement)), i = 0;
401 i < p->nfeatures; i++, feat++)
402 {
403 GstPluginFeature *gstfeat;
404
405 if ((gstfeat = gst_registry_binary_load_feature(feat)) == NULL)
406 {
407 g_list_free(plugin_features);
408 g_free(plugin);
409 GST_ERROR("Error while loading binary feature");
410 return -1;
411 }
412 gstfeat->plugin_name = g_strdup(plugin->desc.name);
413 plugin_features = g_list_prepend(plugin_features, gstfeat);
414 }
415
416 GST_DEBUG("Added plugin \"%s\" to global registry from binary registry", plugin->desc.name);
417 GList *g;
418
419 gst_registry_add_plugin (registry, plugin);
420 for (g = plugin_features; g; g = g_list_next (g))
421 gst_registry_add_feature (registry, GST_PLUGIN_FEATURE (g->data));
422 /* g_list_free(plugin_features); */
423
424 offset = sizeof (GstBinaryPluginElement) + p->nfeatures * sizeof (GstBinaryPluginFeature);
425 return offset;
426}
427
428
429/*
430** Read the cache and adapt it to fill GstRegistry
431*/
432gboolean
433gst_registry_binary_read_cache(GstRegistry *registry, const char *location)
434{
435 GMappedFile *mapped = NULL;
436 GTimer *timer = NULL;
437 gchar *contents = NULL;
438 gdouble seconds;
439 unsigned long offset, inc;
440 gsize size;
441
442 /* make sure these types exist */
443 GST_TYPE_ELEMENT_FACTORY;
444 GST_TYPE_TYPE_FIND_FACTORY;
445 GST_TYPE_INDEX_FACTORY;
446
447 timer = g_timer_new ();
448
449 if ((mapped = g_mapped_file_new(location, FALSE, NULL)) == NULL ||
450 (contents = g_mapped_file_get_contents(mapped)) == NULL)
451 {
452 GST_ERROR("Can't load file : %s", strerror(errno));
453 return FALSE;
454 }
455 if ((contents = gst_registry_binary_check_magic(contents)) == NULL)
456 {
457 GST_ERROR("Binary registry type not recognized (invalid magic)");
458 g_mapped_file_free(mapped);
459 return FALSE;
460 }
461
462 if ((size = g_mapped_file_get_length(mapped)) < sizeof (GstBinaryPluginElement))
463 {
464 GST_INFO("No binary plugins structure to read");
465 return TRUE; /* This is not really an error */
466 }
467
468 for (offset = inc = 0; (offset + sizeof (GstBinaryPluginElement)) < size &&
469 (inc = gst_registry_binary_get_binary_plugin(registry, contents + offset)) > 0;
470 offset += inc)
471 ; /* May want in the future to do something here */
472 if (inc < 0)
473 {
474 GST_DEBUG("Problem while reading binary registry");
475 return FALSE;
476 }
477
478 g_timer_stop (timer);
479 seconds = g_timer_elapsed (timer, NULL);
480 g_timer_destroy (timer);
481
482 GST_INFO ("loaded %s in %f seconds", location, seconds);
483
484 if (mapped)
485 g_mapped_file_free (mapped);
486 return TRUE;
487}
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/gstregistrybinary.h b/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/gstregistrybinary.h
new file mode 100644
index 0000000000..2ef24d765d
--- /dev/null
+++ b/meta/recipes-multimedia/gstreamer/gstreamer-0.10.36/gstregistrybinary.h
@@ -0,0 +1,194 @@
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/* SUGGESTIONS AND TODO :
24** ====================
25** - Use a compressed registry, but would induce performance loss
26** - Encrypt the registry, for security purpose, but would also reduce performances
27** - Also have a non-mmap based cache reading (work with file descriptors)
28*/
29
30#ifndef __GST_REGISTRYBINARY_H__
31#define __GST_REGISTRYBINARY_H__
32
33#ifdef HAVE_CONFIG_H
34# include "config.h"
35#endif
36
37#include <stdio.h>
38#include <errno.h>
39#include <sys/types.h>
40#include <sys/stat.h>
41#include <dirent.h>
42#include <fcntl.h>
43#include <sys/mman.h>
44#ifdef HAVE_UNISTD_H
45#include <unistd.h>
46#endif
47
48#include <gst/gst_private.h>
49#include <gst/gstelement.h>
50#include <gst/gsttypefind.h>
51#include <gst/gsttypefindfactory.h>
52#include <gst/gsturi.h>
53#include <gst/gstinfo.h>
54#include <gst/gstenumtypes.h>
55#include <gst/gstregistry.h>
56#include <gst/gstpadtemplate.h>
57
58#include "glib-compat-private.h"
59#include <glib/gstdio.h>
60
61/* A magic, written at the beginning of the file */
62#define GST_MAGIC_BINARY_REGISTRY_STR "\xc0\xde\xf0\x0d"
63#define GST_MAGIC_BINARY_REGISTRY_LEN (4)
64#define GST_MAGIC_BINARY_VERSION_LEN (64)
65
66typedef struct _GstBinaryRegistryMagic
67{
68 char magic[GST_MAGIC_BINARY_REGISTRY_LEN];
69 char version[GST_MAGIC_BINARY_VERSION_LEN];
70} GstBinaryRegistryMagic;
71
72
73/* Used to store pointers to write */
74typedef struct _GstBinaryChunck
75{
76 void *data;
77 unsigned int size;
78} GstBinaryChunck;
79
80
81/* A structure containing (staticely) every information needed for a plugin
82**
83** Notes :
84** "nfeatures" is used to say how many GstBinaryPluginFeature structures we will have
85** right after the structure itself.
86*/
87
88/* Various lenght defines for our GstBinaryPluginElement structure
89** Note : We could eventually use smaller size
90*/
91#define GST_BINARY_REGISTRY_NAME_LEN (256)
92#define GST_BINARY_REGISTRY_DESCRIPTION_LEN (1024)
93#define GST_BINARY_REGISTRY_VERSION_LEN (64)
94#define GST_BINARY_REGISTRY_LICENSE_LEN (256)
95#define GST_BINARY_REGISTRY_SOURCE_LEN (256)
96#define GST_BINARY_REGISTRY_PACKAGE_LEN (1024)
97#define GST_BINARY_REGISTRY_ORIGIN_LEN (1024)
98
99typedef struct _GstBinaryPluginElement
100{
101 char name[GST_BINARY_REGISTRY_NAME_LEN];
102 char description[GST_BINARY_REGISTRY_DESCRIPTION_LEN];
103 char filename[_POSIX_PATH_MAX];
104 char version[GST_BINARY_REGISTRY_VERSION_LEN];
105 char license[GST_BINARY_REGISTRY_LICENSE_LEN];
106 char source[GST_BINARY_REGISTRY_SOURCE_LEN];
107 char package[GST_BINARY_REGISTRY_PACKAGE_LEN];
108 char origin[GST_BINARY_REGISTRY_ORIGIN_LEN];
109 unsigned long size;
110 unsigned long m32p;
111 unsigned int nfeatures;
112} GstBinaryPluginElement;
113
114
115/* A structure containing the plugin features
116**
117** Note :
118** "npadtemplates" is used to store the number of GstBinaryPadTemplate structures following the structure itself.
119** "ninterfaces" is used to store the number of GstBinaryInterface structures following the structure itself.
120** "nuritypes" is used to store the number of GstBinaryUriType structures following the structure itself.
121*/
122#define GST_BINARY_REGISTRY_TYPENAME_TYPENAME_LEN (256)
123#define GST_BINARY_REGISTRY_TYPENAME_NAME_LEN (256)
124#define GST_BINARY_REGISTRY_TYPENAME_LONGNAME_LEN (1024)
125#define GST_BINARY_REGISTRY_TYPENAME_CLASS_LEN (512)
126#define GST_BINARY_REGISTRY_TYPENAME_DESCRIPTION_LEN (1024)
127#define GST_BINARY_REGISTRY_TYPENAME_AUTHOR_LEN (256)
128
129typedef struct _GstBinaryPluginFeature
130{
131 char typename[GST_BINARY_REGISTRY_TYPENAME_TYPENAME_LEN];
132 char name[GST_BINARY_REGISTRY_TYPENAME_NAME_LEN];
133 unsigned long rank;
134 char longname[GST_BINARY_REGISTRY_TYPENAME_LONGNAME_LEN];
135 char class[GST_BINARY_REGISTRY_TYPENAME_CLASS_LEN];
136 char description[GST_BINARY_REGISTRY_TYPENAME_DESCRIPTION_LEN];
137 char author[GST_BINARY_REGISTRY_TYPENAME_AUTHOR_LEN];
138 unsigned int npadtemplates;
139 unsigned int ninterfaces;
140 unsigned int nuritypes;
141} GstBinaryPluginFeature;
142
143
144/*
145** A structure containing the static pad templates of a plugin feature
146*/
147#define GST_BINARY_REGISTRY_PADTEMPLATE_NAME_LEN (256)
148#define GST_BINARY_REGISTRY_PADTEMPLATE_CAP_LEN (1024)
149
150typedef struct _GstBinaryPadTemplate
151{
152 char name[GST_BINARY_REGISTRY_PADTEMPLATE_NAME_LEN];
153 char cap[GST_BINARY_REGISTRY_PADTEMPLATE_CAP_LEN];
154 int direction; /* Either 0:"sink" or 1:"src" */
155 GstPadPresence presence;
156} GstBinaryPadTemplate;
157
158/*
159** A very simple structure defining the plugin feature interface string
160*/
161#define GST_BINARY_REGISTRY_INTERFACE_INTERFACE_LEN (512)
162typedef struct _GstBinaryInterface
163{
164 char interface[GST_BINARY_REGISTRY_INTERFACE_INTERFACE_LEN];
165 unsigned long size;
166} GstBinaryInterface;
167
168/* Uri Type */
169typedef struct _GstBinaryUriType
170{
171 GstURIType type;
172 unsigned long nuriprotocols;
173} GstBinaryUriType;
174
175/*
176** Function prototypes
177*/
178
179/* Local prototypes */
180inline static gboolean gst_registry_binary_write(GstRegistry *registry, const void *mem, const ssize_t size);
181inline static gboolean gst_registry_binary_initialize_magic(GstBinaryRegistryMagic *m);
182static gboolean gst_registry_binary_fill_feature(GList **list, GstPluginFeature *, GstBinaryPluginFeature *, const char *);
183static gboolean gst_registry_binary_save_plugin(GList **list, GstRegistry *registry, GstPlugin *plugin);
184static gchar *gst_registry_binary_check_magic(gchar *in);
185static GstPluginFeature *gst_registry_binary_load_feature(GstBinaryPluginFeature *);
186static unsigned long gst_registry_binary_get_binary_plugin(GstRegistry *registry, gchar *in);
187
188/* Exportable */
189gboolean gst_registry_binary_write_cache(GstRegistry *registry, const char *location);
190gboolean gst_registry_binary_read_cache(GstRegistry *registry, const char *location);
191
192#endif /* !__GST_REGISTRYBINARY_H__ */
193
194