2 * Copyright (C) 2006 Josep Torra <josep@fluendo.com>
3 * 2006 Mathieu Garcia <matthieu@fluendo.com>
4 * 2006,2007 Stefan Kost <ensonic@users.sf.net>
5 * 2008 Sebastian Dröge <slomo@circular-chaos.org>
6 * 2008 Jan Schmidt <jan.schmidt@sun.com>
8 * gstregistrychunks.c: GstRegistryChunk helper for serialising/deserialising
9 * plugin entries and features.
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the
23 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 * Boston, MA 02111-1307, USA.
31 #include <gst/gst_private.h>
32 #include <gst/gstconfig.h>
33 #include <gst/gstelement.h>
34 #include <gst/gsttypefind.h>
35 #include <gst/gsttypefindfactory.h>
36 #include <gst/gsturi.h>
37 #include <gst/gstinfo.h>
38 #include <gst/gstenumtypes.h>
39 #include <gst/gstpadtemplate.h>
41 #include <gst/gstregistrychunks.h>
43 #define GST_CAT_DEFAULT GST_CAT_REGISTRY
45 /* count string length, but return -1 if we hit the eof */
47 _strnlen (const gchar * str, gint maxlen)
51 while (G_LIKELY (len < maxlen)) {
52 if (G_UNLIKELY (str[len] == '\0'))
60 #define unpack_element(inptr, outptr, element, endptr, error_label) G_STMT_START{ \
61 if (inptr + sizeof(element) > endptr) { \
62 GST_ERROR ("Failed reading element " G_STRINGIFY (element) \
63 ". Have %d bytes need %" G_GSSIZE_FORMAT, \
64 (int) (endptr - inptr), sizeof(element)); \
67 outptr = (element *) inptr; \
68 inptr += sizeof (element); \
71 #define unpack_const_string(inptr, outptr, endptr, error_label) G_STMT_START{\
72 gint _len = _strnlen (inptr, (endptr-inptr)); \
75 outptr = g_intern_string ((const gchar *)inptr); \
79 #define unpack_string(inptr, outptr, endptr, error_label) G_STMT_START{\
80 gint _len = _strnlen (inptr, (endptr-inptr)); \
83 outptr = g_memdup ((gconstpointer)inptr, _len + 1); \
87 #define ALIGNMENT (sizeof (void *))
88 #define alignment(_address) (gsize)_address%ALIGNMENT
89 #define align(_ptr) _ptr += (( alignment(_ptr) == 0) ? 0 : ALIGNMENT-alignment(_ptr))
92 * gst_registry_chunks_save_const_string:
94 * Store a const string in a binary chunk.
96 * Returns: %TRUE for success
98 inline static gboolean
99 gst_registry_chunks_save_const_string (GList ** list, const gchar * str)
101 GstRegistryChunk *chunk;
103 if (G_UNLIKELY (str == NULL)) {
104 GST_ERROR ("unexpected NULL string in plugin or plugin feature data");
108 chunk = g_malloc (sizeof (GstRegistryChunk));
109 chunk->data = (gpointer) str;
110 chunk->size = strlen ((gchar *) chunk->data) + 1;
111 chunk->flags = GST_REGISTRY_CHUNK_FLAG_CONST;
112 chunk->align = FALSE;
113 *list = g_list_prepend (*list, chunk);
118 * gst_registry_chunks_save_string:
120 * Store a string in a binary chunk.
122 * Returns: %TRUE for success
124 inline static gboolean
125 gst_registry_chunks_save_string (GList ** list, gchar * str)
127 GstRegistryChunk *chunk;
129 chunk = g_malloc (sizeof (GstRegistryChunk));
131 chunk->size = strlen ((gchar *) chunk->data) + 1;
132 chunk->flags = GST_REGISTRY_CHUNK_FLAG_NONE;
133 chunk->align = FALSE;
134 *list = g_list_prepend (*list, chunk);
139 * gst_registry_chunks_save_data:
141 * Store some data in a binary chunk.
143 * Returns: the initialized chunk
145 inline static GstRegistryChunk *
146 gst_registry_chunks_make_data (gpointer data, gulong size)
148 GstRegistryChunk *chunk;
150 chunk = g_malloc (sizeof (GstRegistryChunk));
153 chunk->flags = GST_REGISTRY_CHUNK_FLAG_NONE;
160 * gst_registry_chunks_save_pad_template:
162 * Store pad_templates in binary chunks.
164 * Returns: %TRUE for success
167 gst_registry_chunks_save_pad_template (GList ** list,
168 GstStaticPadTemplate * template)
170 GstRegistryChunkPadTemplate *pt;
171 GstRegistryChunk *chk;
173 pt = g_malloc0 (sizeof (GstRegistryChunkPadTemplate));
175 gst_registry_chunks_make_data (pt, sizeof (GstRegistryChunkPadTemplate));
177 pt->presence = template->presence;
178 pt->direction = template->direction;
180 /* pack pad template strings */
181 gst_registry_chunks_save_const_string (list,
182 (gchar *) (template->static_caps.string));
183 gst_registry_chunks_save_const_string (list, template->name_template);
185 *list = g_list_prepend (*list, chk);
191 * gst_registry_chunks_save_feature:
193 * Store features in binary chunks.
195 * Returns: %TRUE for success
198 gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature)
200 const gchar *type_name = g_type_name (G_OBJECT_TYPE (feature));
201 GstRegistryChunkPluginFeature *pf = NULL;
202 GstRegistryChunk *chk = NULL;
206 GST_ERROR ("NULL feature type_name, aborting.");
210 if (GST_IS_ELEMENT_FACTORY (feature)) {
211 GstRegistryChunkElementFactory *ef;
212 GstElementFactory *factory = GST_ELEMENT_FACTORY (feature);
214 ef = g_malloc0 (sizeof (GstRegistryChunkElementFactory));
216 gst_registry_chunks_make_data (ef,
217 sizeof (GstRegistryChunkElementFactory));
218 ef->npadtemplates = ef->ninterfaces = ef->nuriprotocols = 0;
219 pf = (GstRegistryChunkPluginFeature *) ef;
221 /* save interfaces */
222 for (walk = factory->interfaces; walk;
223 walk = g_list_next (walk), ef->ninterfaces++) {
224 gst_registry_chunks_save_const_string (list, (gchar *) walk->data);
226 GST_DEBUG ("Feature %s: saved %d interfaces %d pad templates",
227 feature->name, ef->ninterfaces, ef->npadtemplates);
230 if (GST_URI_TYPE_IS_VALID (factory->uri_type)) {
231 if (factory->uri_protocols && *factory->uri_protocols) {
232 GstRegistryChunk *subchk;
236 gst_registry_chunks_make_data (&factory->uri_type,
237 sizeof (factory->uri_type));
238 subchk->flags = GST_REGISTRY_CHUNK_FLAG_CONST;
240 protocol = factory->uri_protocols;
242 gst_registry_chunks_save_const_string (list, *protocol++);
245 *list = g_list_prepend (*list, subchk);
246 GST_DEBUG ("Saved %d UriTypes", ef->nuriprotocols);
248 g_warning ("GStreamer feature '%s' is URI handler but does not provide"
249 " any protocols it can handle", feature->name);
253 /* save pad-templates */
254 for (walk = factory->staticpadtemplates; walk;
255 walk = g_list_next (walk), ef->npadtemplates++) {
256 GstStaticPadTemplate *template = walk->data;
258 if (!gst_registry_chunks_save_pad_template (list, template)) {
259 GST_ERROR ("Can't fill pad template, aborting.");
264 /* pack element factory strings */
265 gst_registry_chunks_save_const_string (list, factory->details.author);
266 gst_registry_chunks_save_const_string (list, factory->details.description);
267 gst_registry_chunks_save_const_string (list, factory->details.klass);
268 gst_registry_chunks_save_const_string (list, factory->details.longname);
269 } else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
270 GstRegistryChunkTypeFindFactory *tff;
271 GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (feature);
274 tff = g_malloc0 (sizeof (GstRegistryChunkTypeFindFactory));
276 gst_registry_chunks_make_data (tff,
277 sizeof (GstRegistryChunkTypeFindFactory));
278 tff->nextensions = 0;
279 pf = (GstRegistryChunkPluginFeature *) tff;
281 /* save extensions */
282 if (factory->extensions) {
283 while (factory->extensions[tff->nextensions]) {
284 gst_registry_chunks_save_const_string (list,
285 factory->extensions[tff->nextensions++]);
290 /* we copy the caps here so we can simplify them before saving. This
291 * is a lot faster when loading them later on */
292 GstCaps *copy = gst_caps_copy (factory->caps);
294 gst_caps_do_simplify (copy);
295 str = gst_caps_to_string (copy);
296 gst_caps_unref (copy);
297 gst_registry_chunks_save_string (list, str);
299 gst_registry_chunks_save_const_string (list, "");
301 } else if (GST_IS_INDEX_FACTORY (feature)) {
302 GstIndexFactory *factory = GST_INDEX_FACTORY (feature);
304 pf = g_malloc0 (sizeof (GstRegistryChunkPluginFeature));
306 gst_registry_chunks_make_data (pf,
307 sizeof (GstRegistryChunkPluginFeature));
308 pf->rank = feature->rank;
310 /* pack element factory strings */
311 gst_registry_chunks_save_const_string (list, factory->longdesc);
313 GST_WARNING ("unhandled feature type '%s'", type_name);
317 pf->rank = feature->rank;
318 *list = g_list_prepend (*list, chk);
320 /* pack plugin feature strings */
321 gst_registry_chunks_save_const_string (list, feature->name);
322 gst_registry_chunks_save_const_string (list, (gchar *) type_name);
335 gst_registry_chunks_save_plugin_dep (GList ** list, GstPluginDep * dep)
337 GstRegistryChunkDep *ed;
338 GstRegistryChunk *chk;
341 ed = g_malloc0 (sizeof (GstRegistryChunkDep));
342 chk = gst_registry_chunks_make_data (ed, sizeof (GstRegistryChunkDep));
344 ed->flags = dep->flags;
349 ed->env_hash = dep->env_hash;
350 ed->stat_hash = dep->stat_hash;
352 for (s = dep->env_vars; s != NULL && *s != NULL; ++s, ++ed->n_env_vars)
353 gst_registry_chunks_save_string (list, g_strdup (*s));
355 for (s = dep->paths; s != NULL && *s != NULL; ++s, ++ed->n_paths)
356 gst_registry_chunks_save_string (list, g_strdup (*s));
358 for (s = dep->names; s != NULL && *s != NULL; ++s, ++ed->n_names)
359 gst_registry_chunks_save_string (list, g_strdup (*s));
361 *list = g_list_prepend (*list, chk);
363 GST_LOG ("Saved external plugin dependency");
368 * _priv_gst_registry_chunks_save_plugin:
370 * Adapt a GstPlugin to our GstRegistryChunkPluginElement structure, and
371 * prepend it as a GstRegistryChunk in the provided list.
375 _priv_gst_registry_chunks_save_plugin (GList ** list, GstRegistry * registry,
378 GstRegistryChunkPluginElement *pe;
379 GstRegistryChunk *chk;
380 GList *plugin_features = NULL;
383 pe = g_malloc0 (sizeof (GstRegistryChunkPluginElement));
385 gst_registry_chunks_make_data (pe,
386 sizeof (GstRegistryChunkPluginElement));
388 pe->file_size = plugin->file_size;
389 pe->file_mtime = plugin->file_mtime;
393 /* pack external deps */
394 for (walk = plugin->priv->deps; walk != NULL; walk = walk->next) {
395 if (!gst_registry_chunks_save_plugin_dep (list, walk->data)) {
396 GST_ERROR ("Could not save external plugin dependency, aborting.");
402 /* pack plugin features */
404 gst_registry_get_feature_list_by_plugin (registry, plugin->desc.name);
405 for (walk = plugin_features; walk; walk = g_list_next (walk), pe->nfeatures++) {
406 GstPluginFeature *feature = GST_PLUGIN_FEATURE (walk->data);
408 if (!gst_registry_chunks_save_feature (list, feature)) {
409 GST_ERROR ("Can't fill plugin feature, aborting.");
414 gst_plugin_feature_list_free (plugin_features);
416 /* pack cache data */
417 if (plugin->priv->cache_data) {
418 gchar *cache_str = gst_structure_to_string (plugin->priv->cache_data);
419 gst_registry_chunks_save_string (list, cache_str);
421 gst_registry_chunks_save_const_string (list, "");
424 /* pack plugin element strings */
425 gst_registry_chunks_save_const_string (list, plugin->desc.origin);
426 gst_registry_chunks_save_const_string (list, plugin->desc.package);
427 gst_registry_chunks_save_const_string (list, plugin->desc.source);
428 gst_registry_chunks_save_const_string (list, plugin->desc.license);
429 gst_registry_chunks_save_const_string (list, plugin->desc.version);
430 gst_registry_chunks_save_const_string (list, plugin->filename);
431 gst_registry_chunks_save_const_string (list, plugin->desc.description);
432 gst_registry_chunks_save_const_string (list, plugin->desc.name);
434 *list = g_list_prepend (*list, chk);
436 GST_DEBUG ("Found %d features in plugin \"%s\"", pe->nfeatures,
442 gst_plugin_feature_list_free (plugin_features);
449 * gst_registry_chunks_load_pad_template:
451 * Make a new GstStaticPadTemplate from current GstRegistryChunkPadTemplate
454 * Returns: new GstStaticPadTemplate
457 gst_registry_chunks_load_pad_template (GstElementFactory * factory, gchar ** in,
460 GstRegistryChunkPadTemplate *pt;
461 GstStaticPadTemplate *template = NULL;
464 GST_DEBUG ("Reading/casting for GstRegistryChunkPadTemplate at address %p",
466 unpack_element (*in, pt, GstRegistryChunkPadTemplate, end, fail);
468 template = g_new0 (GstStaticPadTemplate, 1);
469 template->presence = pt->presence;
470 template->direction = pt->direction;
472 /* unpack pad template strings */
473 unpack_const_string (*in, template->name_template, end, fail);
474 unpack_string (*in, template->static_caps.string, end, fail);
476 __gst_element_factory_add_static_pad_template (factory, template);
477 GST_DEBUG ("Added pad_template %s", template->name_template);
481 GST_INFO ("Reading pad template failed");
487 * gst_registry_chunks_load_feature:
489 * Make a new GstPluginFeature from current binary plugin feature structure
491 * Returns: new GstPluginFeature
494 gst_registry_chunks_load_feature (GstRegistry * registry, gchar ** in,
495 gchar * end, const gchar * plugin_name)
497 GstRegistryChunkPluginFeature *pf = NULL;
498 GstPluginFeature *feature = NULL;
499 gchar *type_name = NULL, *str;
504 /* unpack plugin feature strings */
505 unpack_string (*in, type_name, end, fail);
507 if (G_UNLIKELY (!type_name)) {
508 GST_ERROR ("No feature type name");
512 /* unpack more plugin feature strings */
513 unpack_string (*in, feature_name, end, fail);
515 GST_DEBUG ("Plugin '%s' feature '%s' typename : '%s'", plugin_name,
516 feature_name, type_name);
518 if (G_UNLIKELY (!(type = g_type_from_name (type_name)))) {
519 GST_ERROR ("Unknown type from typename '%s' for plugin '%s'", type_name,
522 g_free (feature_name);
525 if (G_UNLIKELY ((feature = g_object_newv (type, 0, NULL)) == NULL)) {
526 GST_ERROR ("Can't create feature from type");
528 g_free (feature_name);
532 feature->name = feature_name;
534 if (G_UNLIKELY (!GST_IS_PLUGIN_FEATURE (feature))) {
535 GST_ERROR ("typename : '%s' is not a plugin feature", type_name);
539 if (GST_IS_ELEMENT_FACTORY (feature)) {
540 GstRegistryChunkElementFactory *ef;
542 GstElementFactory *factory = GST_ELEMENT_FACTORY_CAST (feature);
545 GST_LOG ("Reading/casting for GstRegistryChunkElementFactory at address %p",
547 unpack_element (*in, ef, GstRegistryChunkElementFactory, end, fail);
548 pf = (GstRegistryChunkPluginFeature *) ef;
550 /* unpack element factory strings */
551 unpack_string (*in, factory->details.longname, end, fail);
552 unpack_string (*in, factory->details.klass, end, fail);
553 unpack_string (*in, factory->details.description, end, fail);
554 unpack_string (*in, factory->details.author, end, fail);
555 n = ef->npadtemplates;
556 GST_DEBUG ("Element factory : '%s' with npadtemplates=%d",
557 factory->details.longname, n);
559 /* load pad templates */
560 for (i = 0; i < n; i++) {
561 if (G_UNLIKELY (!gst_registry_chunks_load_pad_template (factory, in,
563 GST_ERROR ("Error while loading binary pad template");
569 if (G_UNLIKELY ((n = ef->nuriprotocols))) {
570 GST_DEBUG ("Reading %d UriTypes at address %p", n, *in);
573 factory->uri_type = *((guint *) * in);
574 *in += sizeof (factory->uri_type);
575 /*unpack_element(*in, &factory->uri_type, factory->uri_type, end, fail); */
577 factory->uri_protocols = g_new0 (gchar *, n + 1);
578 for (i = 0; i < n; i++) {
579 unpack_string (*in, str, end, fail);
580 factory->uri_protocols[i] = str;
583 /* load interfaces */
584 if (G_UNLIKELY ((n = ef->ninterfaces))) {
585 GST_DEBUG ("Reading %d Interfaces at address %p", n, *in);
586 for (i = 0; i < n; i++) {
587 unpack_string (*in, str, end, fail);
588 __gst_element_factory_add_interface (factory, str);
592 } else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
593 GstRegistryChunkTypeFindFactory *tff;
594 GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (feature);
598 ("Reading/casting for GstRegistryChunkPluginFeature at address %p",
600 unpack_element (*in, tff, GstRegistryChunkTypeFindFactory, end, fail);
601 pf = (GstRegistryChunkPluginFeature *) tff;
604 unpack_string (*in, str, end, fail);
605 factory->caps = (str && *str) ? gst_caps_from_string (str) : NULL;
607 /* load extensions */
608 if (tff->nextensions) {
609 GST_DEBUG ("Reading %d Typefind extensions at address %p",
610 tff->nextensions, *in);
611 factory->extensions = g_new0 (gchar *, tff->nextensions + 1);
612 for (i = 0; i < tff->nextensions; i++) {
613 unpack_string (*in, str, end, fail);
614 factory->extensions[i] = str;
617 } else if (GST_IS_INDEX_FACTORY (feature)) {
618 GstIndexFactory *factory = GST_INDEX_FACTORY (feature);
622 ("Reading/casting for GstRegistryChunkPluginFeature at address %p",
624 unpack_element (*in, pf, GstRegistryChunkPluginFeature, end, fail);
626 /* unpack index factory strings */
627 unpack_string (*in, factory->longdesc, end, fail);
629 GST_WARNING ("unhandled factory type : %s", G_OBJECT_TYPE_NAME (feature));
633 feature->rank = pf->rank;
635 feature->plugin_name = plugin_name;
637 gst_registry_add_feature (registry, feature);
638 GST_DEBUG ("Added feature %s", feature->name);
645 GST_INFO ("Reading plugin feature failed");
648 if (GST_IS_OBJECT (feature))
649 gst_object_unref (feature);
651 g_object_unref (feature);
657 gst_registry_chunks_load_plugin_dep_strv (gchar ** in, gchar * end, guint n)
664 arr = g_new0 (gchar *, n + 1);
666 unpack_string (*in, arr[n - 1], end, fail);
671 GST_INFO ("Reading plugin dependency strings failed");
676 gst_registry_chunks_load_plugin_dep (GstPlugin * plugin, gchar ** in,
680 GstRegistryChunkDep *d;
684 GST_LOG_OBJECT (plugin, "Unpacking GstRegistryChunkDep from %p", *in);
685 unpack_element (*in, d, GstRegistryChunkDep, end, fail);
687 dep = g_malloc0 (sizeof (GstPluginDep));
689 dep->env_hash = d->env_hash;
690 dep->stat_hash = d->stat_hash;
692 dep->flags = d->flags;
694 dep->names = gst_registry_chunks_load_plugin_dep_strv (in, end, d->n_names);
695 dep->paths = gst_registry_chunks_load_plugin_dep_strv (in, end, d->n_paths);
697 gst_registry_chunks_load_plugin_dep_strv (in, end, d->n_env_vars);
699 plugin->priv->deps = g_list_append (plugin->priv->deps, dep);
701 GST_DEBUG_OBJECT (plugin, "Loaded external plugin dependency from registry: "
702 "env_hash: %08x, stat_hash: %08x", dep->env_hash, dep->stat_hash);
703 for (s = dep->env_vars; s != NULL && *s != NULL; ++s)
704 GST_LOG_OBJECT (plugin, " evar: %s", *s);
705 for (s = dep->paths; s != NULL && *s != NULL; ++s)
706 GST_LOG_OBJECT (plugin, " path: %s", *s);
707 for (s = dep->names; s != NULL && *s != NULL; ++s)
708 GST_LOG_OBJECT (plugin, " name: %s", *s);
712 GST_INFO ("Reading plugin dependency failed");
718 * _priv_gst_registry_chunks_load_plugin:
720 * Make a new GstPlugin from current GstRegistryChunkPluginElement structure
721 * and add it to the GstRegistry. Return an offset to the next
722 * GstRegistryChunkPluginElement structure.
725 _priv_gst_registry_chunks_load_plugin (GstRegistry * registry, gchar ** in,
726 gchar * end, GstPlugin ** out_plugin)
728 #ifndef GST_DISABLE_GST_DEBUG
731 GstRegistryChunkPluginElement *pe;
732 GstPlugin *plugin = NULL;
733 gchar *cache_str = NULL;
737 GST_LOG ("Reading/casting for GstRegistryChunkPluginElement at address %p",
739 unpack_element (*in, pe, GstRegistryChunkPluginElement, end, fail);
741 plugin = g_object_newv (GST_TYPE_PLUGIN, 0, NULL);
743 /* TODO: also set GST_PLUGIN_FLAG_CONST */
744 plugin->flags |= GST_PLUGIN_FLAG_CACHED;
745 plugin->file_mtime = pe->file_mtime;
746 plugin->file_size = pe->file_size;
748 /* unpack plugin element strings */
749 unpack_const_string (*in, plugin->desc.name, end, fail);
750 unpack_string (*in, plugin->desc.description, end, fail);
751 unpack_string (*in, plugin->filename, end, fail);
752 unpack_const_string (*in, plugin->desc.version, end, fail);
753 unpack_const_string (*in, plugin->desc.license, end, fail);
754 unpack_const_string (*in, plugin->desc.source, end, fail);
755 unpack_const_string (*in, plugin->desc.package, end, fail);
756 unpack_const_string (*in, plugin->desc.origin, end, fail);
757 GST_LOG ("read strings for name='%s'", plugin->desc.name);
758 GST_LOG (" desc.description='%s'", plugin->desc.description);
759 GST_LOG (" filename='%s'", plugin->filename);
760 GST_LOG (" desc.version='%s'", plugin->desc.version);
761 GST_LOG (" desc.license='%s'", plugin->desc.license);
762 GST_LOG (" desc.source='%s'", plugin->desc.source);
763 GST_LOG (" desc.package='%s'", plugin->desc.package);
764 GST_LOG (" desc.origin='%s'", plugin->desc.origin);
766 /* unpack cache data */
767 unpack_string (*in, cache_str, end, fail);
769 plugin->priv->cache_data = gst_structure_from_string (cache_str, NULL);
773 /* If the license string is 'BLACKLIST', mark this as a blacklisted
775 if (strcmp (plugin->desc.license, "BLACKLIST") == 0)
776 plugin->flags |= GST_PLUGIN_FLAG_BLACKLISTED;
778 plugin->basename = g_path_get_basename (plugin->filename);
780 /* Takes ownership of plugin */
781 gst_registry_add_plugin (registry, plugin);
783 GST_DEBUG ("Added plugin '%s' plugin with %d features from binary registry",
784 plugin->desc.name, n);
786 /* Load plugin features */
787 for (i = 0; i < n; i++) {
788 if (G_UNLIKELY (!gst_registry_chunks_load_feature (registry, in, end,
789 plugin->desc.name))) {
790 GST_ERROR ("Error while loading binary feature for plugin '%s'",
791 GST_STR_NULL (plugin->desc.name));
792 gst_registry_remove_plugin (registry, plugin);
797 /* Load external plugin dependencies */
798 for (i = 0; i < pe->n_deps; ++i) {
799 if (G_UNLIKELY (!gst_registry_chunks_load_plugin_dep (plugin, in, end))) {
800 GST_ERROR_OBJECT (plugin, "Could not read external plugin dependency "
801 "for plugin '%s'", GST_STR_NULL (plugin->desc.name));
802 gst_registry_remove_plugin (registry, plugin);
808 *out_plugin = plugin;
814 GST_INFO ("Reading plugin failed after %u bytes", (guint) (end - start));