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 if (G_UNLIKELY (len == maxlen))
54 while (*str++ != '\0') {
56 if (G_UNLIKELY (len == maxlen))
63 #define unpack_element(inptr, outptr, element, endptr, error_label) G_STMT_START{ \
64 if (inptr + sizeof(element) > endptr) { \
65 GST_ERROR ("Failed reading element " G_STRINGIFY (element) \
66 ". Have %" G_GSSIZE_FORMAT " bytes need %" G_GSSIZE_FORMAT, \
67 endptr - inptr, sizeof(element)); \
70 outptr = (element *) inptr; \
71 inptr += sizeof (element); \
74 #define unpack_const_string(inptr, outptr, endptr, error_label) G_STMT_START{\
75 gint _len = _strnlen (inptr, (endptr-inptr)); \
78 outptr = g_intern_string ((const gchar *)inptr); \
82 #define unpack_string(inptr, outptr, endptr, error_label) G_STMT_START{\
83 gint _len = _strnlen (inptr, (endptr-inptr)); \
86 outptr = g_memdup ((gconstpointer)inptr, _len + 1); \
90 #define ALIGNMENT (sizeof (void *))
91 #define alignment(_address) (gsize)_address%ALIGNMENT
92 #define align(_ptr) _ptr += (( alignment(_ptr) == 0) ? 0 : ALIGNMENT-alignment(_ptr))
95 * gst_registry_chunks_save_const_string:
97 * Store a const string in a binary chunk.
99 * Returns: %TRUE for success
101 inline static gboolean
102 gst_registry_chunks_save_const_string (GList ** list, const gchar * str)
104 GstRegistryChunk *chunk;
106 if (G_UNLIKELY (str == NULL)) {
107 GST_ERROR ("unexpected NULL string in plugin or plugin feature data");
111 chunk = g_malloc (sizeof (GstRegistryChunk));
112 chunk->data = (gpointer) str;
113 chunk->size = strlen ((gchar *) chunk->data) + 1;
114 chunk->flags = GST_REGISTRY_CHUNK_FLAG_CONST;
115 chunk->align = FALSE;
116 *list = g_list_prepend (*list, chunk);
121 * gst_registry_chunks_save_string:
123 * Store a string in a binary chunk.
125 * Returns: %TRUE for success
127 inline static gboolean
128 gst_registry_chunks_save_string (GList ** list, gchar * str)
130 GstRegistryChunk *chunk;
132 chunk = g_malloc (sizeof (GstRegistryChunk));
134 chunk->size = strlen ((gchar *) chunk->data) + 1;
135 chunk->flags = GST_REGISTRY_CHUNK_FLAG_NONE;
136 chunk->align = FALSE;
137 *list = g_list_prepend (*list, chunk);
142 * gst_registry_chunks_save_data:
144 * Store some data in a binary chunk.
146 * Returns: the initialized chunk
148 inline static GstRegistryChunk *
149 gst_registry_chunks_make_data (gpointer data, gulong size)
151 GstRegistryChunk *chunk;
153 chunk = g_malloc (sizeof (GstRegistryChunk));
156 chunk->flags = GST_REGISTRY_CHUNK_FLAG_NONE;
163 * gst_registry_chunks_save_pad_template:
165 * Store pad_templates in binary chunks.
167 * Returns: %TRUE for success
170 gst_registry_chunks_save_pad_template (GList ** list,
171 GstStaticPadTemplate * template)
173 GstRegistryChunkPadTemplate *pt;
174 GstRegistryChunk *chk;
176 pt = g_malloc0 (sizeof (GstRegistryChunkPadTemplate));
178 gst_registry_chunks_make_data (pt, sizeof (GstRegistryChunkPadTemplate));
180 pt->presence = template->presence;
181 pt->direction = template->direction;
183 /* pack pad template strings */
184 gst_registry_chunks_save_const_string (list,
185 (gchar *) (template->static_caps.string));
186 gst_registry_chunks_save_const_string (list, template->name_template);
188 *list = g_list_prepend (*list, chk);
194 * gst_registry_chunks_save_feature:
196 * Store features in binary chunks.
198 * Returns: %TRUE for success
201 gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature)
203 const gchar *type_name = g_type_name (G_OBJECT_TYPE (feature));
204 GstRegistryChunkPluginFeature *pf = NULL;
205 GstRegistryChunk *chk = NULL;
209 GST_ERROR ("NULL feature type_name, aborting.");
213 if (GST_IS_ELEMENT_FACTORY (feature)) {
214 GstRegistryChunkElementFactory *ef;
215 GstElementFactory *factory = GST_ELEMENT_FACTORY (feature);
217 ef = g_malloc0 (sizeof (GstRegistryChunkElementFactory));
219 gst_registry_chunks_make_data (ef,
220 sizeof (GstRegistryChunkElementFactory));
221 ef->npadtemplates = ef->ninterfaces = ef->nuriprotocols = 0;
222 pf = (GstRegistryChunkPluginFeature *) ef;
224 /* save interfaces */
225 for (walk = factory->interfaces; walk;
226 walk = g_list_next (walk), ef->ninterfaces++) {
227 gst_registry_chunks_save_const_string (list, (gchar *) walk->data);
229 GST_DEBUG ("Saved %d Interfaces", ef->ninterfaces);
231 if (GST_URI_TYPE_IS_VALID (factory->uri_type)) {
232 if (factory->uri_protocols && *factory->uri_protocols) {
233 GstRegistryChunk *subchk;
237 gst_registry_chunks_make_data (&factory->uri_type,
238 sizeof (factory->uri_type));
239 subchk->flags = GST_REGISTRY_CHUNK_FLAG_CONST;
241 protocol = factory->uri_protocols;
243 gst_registry_chunks_save_const_string (list, *protocol++);
246 *list = g_list_prepend (*list, subchk);
247 GST_DEBUG ("Saved %d UriTypes", ef->nuriprotocols);
249 g_warning ("GStreamer feature '%s' is URI handler but does not provide"
250 " any protocols it can handle", feature->name);
254 /* save pad-templates */
255 for (walk = factory->staticpadtemplates; walk;
256 walk = g_list_next (walk), ef->npadtemplates++) {
257 GstStaticPadTemplate *template = walk->data;
259 if (!gst_registry_chunks_save_pad_template (list, template)) {
260 GST_ERROR ("Can't fill pad template, aborting.");
265 /* pack element factory strings */
266 gst_registry_chunks_save_const_string (list, factory->details.author);
267 gst_registry_chunks_save_const_string (list, factory->details.description);
268 gst_registry_chunks_save_const_string (list, factory->details.klass);
269 gst_registry_chunks_save_const_string (list, factory->details.longname);
270 } else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
271 GstRegistryChunkTypeFindFactory *tff;
272 GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (feature);
275 tff = g_malloc0 (sizeof (GstRegistryChunkTypeFindFactory));
277 gst_registry_chunks_make_data (tff,
278 sizeof (GstRegistryChunkTypeFindFactory));
279 tff->nextensions = 0;
280 pf = (GstRegistryChunkPluginFeature *) tff;
282 /* save extensions */
283 if (factory->extensions) {
284 while (factory->extensions[tff->nextensions]) {
285 gst_registry_chunks_save_const_string (list,
286 factory->extensions[tff->nextensions++]);
291 /* we copy the caps here so we can simplify them before saving. This
292 * is a lot faster when loading them later on */
293 GstCaps *copy = gst_caps_copy (factory->caps);
295 gst_caps_do_simplify (copy);
296 str = gst_caps_to_string (copy);
297 gst_caps_unref (copy);
298 gst_registry_chunks_save_string (list, str);
300 gst_registry_chunks_save_const_string (list, "");
302 } else if (GST_IS_INDEX_FACTORY (feature)) {
303 GstIndexFactory *factory = GST_INDEX_FACTORY (feature);
305 pf = g_malloc0 (sizeof (GstRegistryChunkPluginFeature));
307 gst_registry_chunks_make_data (pf,
308 sizeof (GstRegistryChunkPluginFeature));
309 pf->rank = feature->rank;
311 /* pack element factory strings */
312 gst_registry_chunks_save_const_string (list, factory->longdesc);
314 GST_WARNING ("unhandled feature type '%s'", type_name);
318 pf->rank = feature->rank;
319 *list = g_list_prepend (*list, chk);
321 /* pack plugin feature strings */
322 gst_registry_chunks_save_const_string (list, feature->name);
323 gst_registry_chunks_save_const_string (list, (gchar *) type_name);
336 gst_registry_chunks_save_plugin_dep (GList ** list, GstPluginDep * dep)
338 GstRegistryChunkDep *ed;
339 GstRegistryChunk *chk;
342 ed = g_malloc0 (sizeof (GstRegistryChunkDep));
343 chk = gst_registry_chunks_make_data (ed, sizeof (GstRegistryChunkDep));
345 ed->flags = dep->flags;
350 ed->env_hash = dep->env_hash;
351 ed->stat_hash = dep->stat_hash;
353 for (s = dep->env_vars; s != NULL && *s != NULL; ++s, ++ed->n_env_vars)
354 gst_registry_chunks_save_string (list, g_strdup (*s));
356 for (s = dep->paths; s != NULL && *s != NULL; ++s, ++ed->n_paths)
357 gst_registry_chunks_save_string (list, g_strdup (*s));
359 for (s = dep->names; s != NULL && *s != NULL; ++s, ++ed->n_names)
360 gst_registry_chunks_save_string (list, g_strdup (*s));
362 *list = g_list_prepend (*list, chk);
364 GST_LOG ("Saved external plugin dependency");
369 * _priv_gst_registry_chunks_save_plugin:
371 * Adapt a GstPlugin to our GstRegistryChunkPluginElement structure, and
372 * prepend it as a GstRegistryChunk in the provided list.
376 _priv_gst_registry_chunks_save_plugin (GList ** list, GstRegistry * registry,
379 GstRegistryChunkPluginElement *pe;
380 GstRegistryChunk *chk;
381 GList *plugin_features = NULL;
384 pe = g_malloc0 (sizeof (GstRegistryChunkPluginElement));
386 gst_registry_chunks_make_data (pe,
387 sizeof (GstRegistryChunkPluginElement));
389 pe->file_size = plugin->file_size;
390 pe->file_mtime = plugin->file_mtime;
394 /* pack external deps */
395 for (walk = plugin->priv->deps; walk != NULL; walk = walk->next) {
396 if (!gst_registry_chunks_save_plugin_dep (list, walk->data)) {
397 GST_ERROR ("Could not save external plugin dependency, aborting.");
403 /* pack plugin features */
405 gst_registry_get_feature_list_by_plugin (registry, plugin->desc.name);
406 for (walk = plugin_features; walk; walk = g_list_next (walk), pe->nfeatures++) {
407 GstPluginFeature *feature = GST_PLUGIN_FEATURE (walk->data);
409 if (!gst_registry_chunks_save_feature (list, feature)) {
410 GST_ERROR ("Can't fill plugin feature, aborting.");
415 gst_plugin_feature_list_free (plugin_features);
417 /* pack cache data */
418 if (plugin->priv->cache_data) {
419 gchar *cache_str = gst_structure_to_string (plugin->priv->cache_data);
420 gst_registry_chunks_save_string (list, cache_str);
422 gst_registry_chunks_save_const_string (list, "");
425 /* pack plugin element strings */
426 gst_registry_chunks_save_const_string (list, plugin->desc.origin);
427 gst_registry_chunks_save_const_string (list, plugin->desc.package);
428 gst_registry_chunks_save_const_string (list, plugin->desc.source);
429 gst_registry_chunks_save_const_string (list, plugin->desc.license);
430 gst_registry_chunks_save_const_string (list, plugin->desc.version);
431 gst_registry_chunks_save_const_string (list, plugin->filename);
432 gst_registry_chunks_save_const_string (list, plugin->desc.description);
433 gst_registry_chunks_save_const_string (list, plugin->desc.name);
435 *list = g_list_prepend (*list, chk);
437 GST_DEBUG ("Found %d features in plugin \"%s\"", pe->nfeatures,
443 gst_plugin_feature_list_free (plugin_features);
450 * gst_registry_chunks_load_pad_template:
452 * Make a new GstStaticPadTemplate from current GstRegistryChunkPadTemplate
455 * Returns: new GstStaticPadTemplate
458 gst_registry_chunks_load_pad_template (GstElementFactory * factory, gchar ** in,
461 GstRegistryChunkPadTemplate *pt;
462 GstStaticPadTemplate *template = NULL;
465 GST_DEBUG ("Reading/casting for GstRegistryChunkPadTemplate at address %p",
467 unpack_element (*in, pt, GstRegistryChunkPadTemplate, end, fail);
469 template = g_new0 (GstStaticPadTemplate, 1);
470 template->presence = pt->presence;
471 template->direction = pt->direction;
473 /* unpack pad template strings */
474 unpack_const_string (*in, template->name_template, end, fail);
475 unpack_string (*in, template->static_caps.string, end, fail);
477 __gst_element_factory_add_static_pad_template (factory, template);
478 GST_DEBUG ("Added pad_template %s", template->name_template);
482 GST_INFO ("Reading pad template failed");
488 * gst_registry_chunks_load_feature:
490 * Make a new GstPluginFeature from current binary plugin feature structure
492 * Returns: new GstPluginFeature
495 gst_registry_chunks_load_feature (GstRegistry * registry, gchar ** in,
496 gchar * end, const gchar * plugin_name)
498 GstRegistryChunkPluginFeature *pf = NULL;
499 GstPluginFeature *feature = NULL;
500 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 GST_DEBUG ("Plugin '%s' feature typename : '%s'", plugin_name, type_name);
514 if (G_UNLIKELY (!(type = g_type_from_name (type_name)))) {
515 GST_ERROR ("Unknown type from typename '%s' for plugin '%s'", type_name,
520 if (G_UNLIKELY ((feature = g_object_new (type, NULL)) == NULL)) {
521 GST_ERROR ("Can't create feature from type");
526 if (G_UNLIKELY (!GST_IS_PLUGIN_FEATURE (feature))) {
527 GST_ERROR ("typename : '%s' is not a plugin feature", type_name);
531 /* unpack more plugin feature strings */
532 unpack_string (*in, feature->name, end, fail);
534 if (GST_IS_ELEMENT_FACTORY (feature)) {
535 GstRegistryChunkElementFactory *ef;
537 GstElementFactory *factory = GST_ELEMENT_FACTORY_CAST (feature);
540 GST_LOG ("Reading/casting for GstRegistryChunkElementFactory at address %p",
542 unpack_element (*in, ef, GstRegistryChunkElementFactory, end, fail);
543 pf = (GstRegistryChunkPluginFeature *) ef;
545 /* unpack element factory strings */
546 unpack_string (*in, factory->details.longname, end, fail);
547 unpack_string (*in, factory->details.klass, end, fail);
548 unpack_string (*in, factory->details.description, end, fail);
549 unpack_string (*in, factory->details.author, end, fail);
550 n = ef->npadtemplates;
551 GST_DEBUG ("Element factory : '%s' with npadtemplates=%d",
552 factory->details.longname, n);
554 /* load pad templates */
555 for (i = 0; i < n; i++) {
556 if (G_UNLIKELY (!gst_registry_chunks_load_pad_template (factory, in,
558 GST_ERROR ("Error while loading binary pad template");
564 if (G_UNLIKELY ((n = ef->nuriprotocols))) {
565 GST_DEBUG ("Reading %d UriTypes at address %p", n, *in);
568 factory->uri_type = *((guint *) * in);
569 *in += sizeof (factory->uri_type);
570 /*unpack_element(*in, &factory->uri_type, factory->uri_type, end, fail); */
572 factory->uri_protocols = g_new0 (gchar *, n + 1);
573 for (i = 0; i < n; i++) {
574 unpack_string (*in, str, end, fail);
575 factory->uri_protocols[i] = str;
578 /* load interfaces */
579 if (G_UNLIKELY ((n = ef->ninterfaces))) {
580 GST_DEBUG ("Reading %d Interfaces at address %p", n, *in);
581 for (i = 0; i < n; i++) {
582 unpack_string (*in, str, end, fail);
583 __gst_element_factory_add_interface (factory, str);
587 } else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
588 GstRegistryChunkTypeFindFactory *tff;
589 GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (feature);
593 ("Reading/casting for GstRegistryChunkPluginFeature at address %p",
595 unpack_element (*in, tff, GstRegistryChunkTypeFindFactory, end, fail);
596 pf = (GstRegistryChunkPluginFeature *) tff;
599 unpack_string (*in, str, end, fail);
600 factory->caps = (str && *str) ? gst_caps_from_string (str) : NULL;
602 /* load extensions */
603 if (tff->nextensions) {
604 GST_DEBUG ("Reading %d Typefind extensions at address %p",
605 tff->nextensions, *in);
606 factory->extensions = g_new0 (gchar *, tff->nextensions + 1);
607 for (i = 0; i < tff->nextensions; i++) {
608 unpack_string (*in, str, end, fail);
609 factory->extensions[i] = str;
612 } else if (GST_IS_INDEX_FACTORY (feature)) {
613 GstIndexFactory *factory = GST_INDEX_FACTORY (feature);
617 ("Reading/casting for GstRegistryChunkPluginFeature at address %p",
619 unpack_element (*in, pf, GstRegistryChunkPluginFeature, end, fail);
621 /* unpack index factory strings */
622 unpack_string (*in, factory->longdesc, end, fail);
624 GST_WARNING ("unhandled factory type : %s", G_OBJECT_TYPE_NAME (feature));
628 feature->rank = pf->rank;
630 /* should already be the interned string, but better make sure */
631 feature->plugin_name = g_intern_string (plugin_name);
633 gst_registry_add_feature (registry, feature);
634 GST_DEBUG ("Added feature %s", feature->name);
641 GST_INFO ("Reading plugin feature failed");
644 if (GST_IS_OBJECT (feature))
645 gst_object_unref (feature);
647 g_object_unref (feature);
653 gst_registry_chunks_load_plugin_dep_strv (gchar ** in, gchar * end, guint n)
660 arr = g_new0 (gchar *, n + 1);
662 unpack_string (*in, arr[n - 1], end, fail);
667 GST_INFO ("Reading plugin dependency strings failed");
672 gst_registry_chunks_load_plugin_dep (GstPlugin * plugin, gchar ** in,
676 GstRegistryChunkDep *d;
680 GST_LOG_OBJECT (plugin, "Unpacking GstRegistryChunkDep from %p", *in);
681 unpack_element (*in, d, GstRegistryChunkDep, end, fail);
683 dep = g_malloc0 (sizeof (GstPluginDep));
685 dep->env_hash = d->env_hash;
686 dep->stat_hash = d->stat_hash;
688 dep->flags = d->flags;
690 dep->names = gst_registry_chunks_load_plugin_dep_strv (in, end, d->n_names);
691 dep->paths = gst_registry_chunks_load_plugin_dep_strv (in, end, d->n_paths);
693 gst_registry_chunks_load_plugin_dep_strv (in, end, d->n_env_vars);
695 plugin->priv->deps = g_list_append (plugin->priv->deps, dep);
697 GST_DEBUG_OBJECT (plugin, "Loaded external plugin dependency from registry: "
698 "env_hash: %08x, stat_hash: %08x", dep->env_hash, dep->stat_hash);
699 for (s = dep->env_vars; s != NULL && *s != NULL; ++s)
700 GST_LOG_OBJECT (plugin, " evar: %s", *s);
701 for (s = dep->paths; s != NULL && *s != NULL; ++s)
702 GST_LOG_OBJECT (plugin, " path: %s", *s);
703 for (s = dep->names; s != NULL && *s != NULL; ++s)
704 GST_LOG_OBJECT (plugin, " name: %s", *s);
708 GST_INFO ("Reading plugin dependency failed");
714 * _priv_gst_registry_chunks_load_plugin:
716 * Make a new GstPlugin from current GstRegistryChunkPluginElement structure
717 * and add it to the GstRegistry. Return an offset to the next
718 * GstRegistryChunkPluginElement structure.
721 _priv_gst_registry_chunks_load_plugin (GstRegistry * registry, gchar ** in,
722 gchar * end, GstPlugin ** out_plugin)
724 GstRegistryChunkPluginElement *pe;
725 GstPlugin *plugin = NULL;
726 gchar *cache_str = NULL;
730 GST_LOG ("Reading/casting for GstRegistryChunkPluginElement at address %p",
732 unpack_element (*in, pe, GstRegistryChunkPluginElement, end, fail);
734 plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
736 /* TODO: also set GST_PLUGIN_FLAG_CONST */
737 plugin->flags |= GST_PLUGIN_FLAG_CACHED;
738 plugin->file_mtime = pe->file_mtime;
739 plugin->file_size = pe->file_size;
741 /* unpack plugin element strings */
742 unpack_const_string (*in, plugin->desc.name, end, fail);
743 unpack_string (*in, plugin->desc.description, end, fail);
744 unpack_string (*in, plugin->filename, end, fail);
745 unpack_const_string (*in, plugin->desc.version, end, fail);
746 unpack_const_string (*in, plugin->desc.license, end, fail);
747 unpack_const_string (*in, plugin->desc.source, end, fail);
748 unpack_const_string (*in, plugin->desc.package, end, fail);
749 unpack_const_string (*in, plugin->desc.origin, end, fail);
750 GST_LOG ("read strings for name='%s'", plugin->desc.name);
751 GST_LOG (" desc.description='%s'", plugin->desc.description);
752 GST_LOG (" filename='%s'", plugin->filename);
753 GST_LOG (" desc.version='%s'", plugin->desc.version);
754 GST_LOG (" desc.license='%s'", plugin->desc.license);
755 GST_LOG (" desc.source='%s'", plugin->desc.source);
756 GST_LOG (" desc.package='%s'", plugin->desc.package);
757 GST_LOG (" desc.origin='%s'", plugin->desc.origin);
759 /* unpack cache data */
760 unpack_string (*in, cache_str, end, fail);
762 plugin->priv->cache_data = gst_structure_from_string (cache_str, NULL);
766 /* If the license string is 'BLACKLIST', mark this as a blacklisted
768 if (strcmp (plugin->desc.license, "BLACKLIST") == 0)
769 plugin->flags |= GST_PLUGIN_FLAG_BLACKLISTED;
771 plugin->basename = g_path_get_basename (plugin->filename);
773 /* Takes ownership of plugin */
774 gst_registry_add_plugin (registry, plugin);
776 GST_DEBUG ("Added plugin '%s' plugin with %d features from binary registry",
777 plugin->desc.name, n);
779 /* Load plugin features */
780 for (i = 0; i < n; i++) {
781 if (G_UNLIKELY (!gst_registry_chunks_load_feature (registry, in, end,
782 plugin->desc.name))) {
783 GST_ERROR ("Error while loading binary feature for plugin '%s'",
784 GST_STR_NULL (plugin->desc.name));
785 gst_registry_remove_plugin (registry, plugin);
790 /* Load external plugin dependencies */
791 for (i = 0; i < pe->n_deps; ++i) {
792 if (G_UNLIKELY (!gst_registry_chunks_load_plugin_dep (plugin, in, end))) {
793 GST_ERROR_OBJECT (plugin, "Could not read external plugin dependency "
794 "for plugin '%s'", GST_STR_NULL (plugin->desc.name));
795 gst_registry_remove_plugin (registry, plugin);
801 *out_plugin = plugin;
807 GST_INFO ("Reading plugin failed");