const gchar * description, const gchar * author)
{
g_return_if_fail (GST_IS_ELEMENT_CLASS (klass));
+ g_return_if_fail (longname != NULL && *longname != '\0');
+ g_return_if_fail (classification != NULL && *classification != '\0');
+ g_return_if_fail (description != NULL && *description != '\0');
+ g_return_if_fail (author != NULL && *author != '\0');
gst_structure_id_set ((GstStructure *) klass->metadata,
GST_QUARK (ELEMENT_METADATA_LONGNAME), G_TYPE_STRING, longname,
GValue val = G_VALUE_INIT;
g_return_if_fail (GST_IS_ELEMENT_CLASS (klass));
+ g_return_if_fail (longname != NULL && *longname != '\0');
+ g_return_if_fail (classification != NULL && *classification != '\0');
+ g_return_if_fail (description != NULL && *description != '\0');
+ g_return_if_fail (author != NULL && *author != '\0');
g_value_init (&val, G_TYPE_STRING);
factory->interfaces = NULL;
}
+#define CHECK_METADATA_FIELD(klass, name, key) \
+ G_STMT_START { \
+ const gchar *metafield = gst_element_class_get_metadata (klass, key); \
+ if (G_UNLIKELY (metafield == NULL || *metafield == '\0')) { \
+ g_warning ("Element factory metadata for '%s' has no valid %s field", name, key); \
+ goto detailserror; \
+ } \
+ } G_STMT_END;
+
/**
* gst_element_register:
* @plugin: (allow-none): #GstPlugin to register the element with, or NULL for
/* provide info needed during class structure setup */
g_type_set_qdata (type, __gst_elementclass_factory, factory);
klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
-#if 0
- /* FIXME */
- if ((klass->details.longname == NULL) ||
- (klass->details.klass == NULL) || (klass->details.author == NULL))
- goto detailserror;
-#endif
+
+ CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_LONGNAME);
+ CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_KLASS);
+ CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_DESCRIPTION);
+ CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_AUTHOR);
factory->type = type;
factory->metadata = gst_structure_copy ((GstStructure *) klass->metadata);
return FALSE;
}
-#if 0
detailserror:
{
- GST_WARNING_OBJECT (factory,
- "The GstElementDetails don't seem to have been set properly");
gst_element_factory_cleanup (factory);
return FALSE;
}
-#endif
}
/**