return TRUE;
}
+#define VALIDATE_UTF8(__details, __entry) \
+G_STMT_START { \
+ if (!g_utf8_validate (__details->__entry, -1, NULL)) { \
+ g_warning ("Invalid UTF-8 in " G_STRINGIFY (__entry) ": %s", \
+ __details->__entry); \
+ g_free (__details->__entry); \
+ __details->__entry = g_strdup ("[ERROR: invalid UTF-8]"); \
+ } \
+} G_STMT_END
+
/*
* gst_registry_chunks_save_feature:
*
gst_registry_chunks_save_const_string (list, (gchar *) walk->data);
}
GST_DEBUG ("Feature %s: saved %d interfaces %d pad templates",
- feature->name, ef->ninterfaces, ef->npadtemplates);
+ GST_OBJECT_NAME (feature), ef->ninterfaces, ef->npadtemplates);
/* save uritypes */
if (GST_URI_TYPE_IS_VALID (factory->uri_type)) {
GST_DEBUG ("Saved %d UriTypes", ef->nuriprotocols);
} else {
g_warning ("GStreamer feature '%s' is URI handler but does not provide"
- " any protocols it can handle", feature->name);
+ " any protocols it can handle", GST_OBJECT_NAME (feature));
}
}
} else {
gst_registry_chunks_save_const_string (list, "");
}
- } else if (GST_IS_INDEX_FACTORY (feature)) {
- GstIndexFactory *factory = GST_INDEX_FACTORY (feature);
-
- pf = g_slice_new (GstRegistryChunkPluginFeature);
- chk =
- gst_registry_chunks_make_data (pf,
- sizeof (GstRegistryChunkPluginFeature));
-
- /* pack element factory strings */
- gst_registry_chunks_save_const_string (list, factory->longdesc);
} else {
GST_WARNING ("unhandled feature type '%s'", type_name);
}
*list = g_list_prepend (*list, chk);
/* pack plugin feature strings */
- gst_registry_chunks_save_const_string (list, feature->name);
+ gst_registry_chunks_save_const_string (list, GST_OBJECT_NAME (feature));
gst_registry_chunks_save_const_string (list, (gchar *) type_name);
return TRUE;
template = g_slice_new (GstStaticPadTemplate);
template->presence = pt->presence;
- template->direction = pt->direction;
+ template->direction = (GstPadDirection) pt->direction;
template->static_caps.caps.mini_object.refcount = 0;
/* unpack pad template strings */
*/
static gboolean
gst_registry_chunks_load_feature (GstRegistry * registry, gchar ** in,
- gchar * end, const gchar * plugin_name)
+ gchar * end, GstPlugin * plugin)
{
GstRegistryChunkPluginFeature *pf = NULL;
GstPluginFeature *feature = NULL;
const gchar *const_str, *type_name;
- gchar *str, *feature_name;
+ const gchar *feature_name;
+ const gchar *plugin_name;
+ gchar *str;
GType type;
guint i;
+ plugin_name = plugin->desc.name;
+
/* unpack plugin feature strings */
unpack_string_nocopy (*in, type_name, end, fail);
}
/* unpack more plugin feature strings */
- unpack_string (*in, feature_name, end, fail);
+ unpack_string_nocopy (*in, feature_name, end, fail);
GST_DEBUG ("Plugin '%s' feature '%s' typename : '%s'", plugin_name,
feature_name, type_name);
if (G_UNLIKELY (!(type = g_type_from_name (type_name)))) {
GST_ERROR ("Unknown type from typename '%s' for plugin '%s'", type_name,
plugin_name);
- g_free (feature_name);
return FALSE;
}
if (G_UNLIKELY ((feature = g_object_newv (type, 0, NULL)) == NULL)) {
GST_ERROR ("Can't create feature from type");
- g_free (feature_name);
return FALSE;
}
-
- feature->name = feature_name;
+ gst_plugin_feature_set_name (feature, feature_name);
if (G_UNLIKELY (!GST_IS_PLUGIN_FEATURE (feature))) {
GST_ERROR ("typename : '%s' is not a plugin feature", type_name);
factory->extensions[i - 1] = str;
}
}
- } else if (GST_IS_INDEX_FACTORY (feature)) {
- GstIndexFactory *factory = GST_INDEX_FACTORY (feature);
-
- align (*in);
- GST_DEBUG
- ("Reading/casting for GstRegistryChunkPluginFeature at address %p",
- *in);
- unpack_element (*in, pf, GstRegistryChunkPluginFeature, end, fail);
-
- /* unpack index factory strings */
- unpack_string (*in, factory->longdesc, end, fail);
} else {
GST_WARNING ("unhandled factory type : %s", G_OBJECT_TYPE_NAME (feature));
goto fail;
feature->rank = pf->rank;
feature->plugin_name = plugin_name;
+ feature->plugin = plugin;
+ g_object_add_weak_pointer ((GObject *) plugin,
+ (gpointer *) & feature->plugin);
gst_registry_add_feature (registry, feature);
- GST_DEBUG ("Added feature %s", feature->name);
+ GST_DEBUG ("Added feature %s, plugin %p %s", GST_OBJECT_NAME (feature),
+ plugin, plugin_name);
return TRUE;
dep->env_hash = d->env_hash;
dep->stat_hash = d->stat_hash;
- dep->flags = d->flags;
+ dep->flags = (GstPluginDependencyFlags) d->flags;
dep->names = gst_registry_chunks_load_plugin_dep_strv (in, end, d->n_names);
dep->paths = gst_registry_chunks_load_plugin_dep_strv (in, end, d->n_paths);
/* Load plugin features */
for (i = 0; i < n; i++) {
if (G_UNLIKELY (!gst_registry_chunks_load_feature (registry, in, end,
- plugin->desc.name))) {
+ plugin))) {
GST_ERROR ("Error while loading binary feature for plugin '%s'",
GST_STR_NULL (plugin->desc.name));
gst_registry_remove_plugin (registry, plugin);