diff --git a/ChangeLog b/ChangeLog index 22ffc93928..28a4cf7277 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-07-25 Wim Taymans + + * gst/gstelementfactory.c: (gst_element_factory_has_interface): + * gst/gstelementfactory.h: + API: gst_element_factory_has_interface() + Added method to check if an element factory implements a named + interface. + 2007-07-25 Stefan Kost * configure.ac: diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index bbc9bc1cc5..bf0025d992 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -649,3 +649,31 @@ gst_element_factory_get_uri_protocols (GstElementFactory * factory) return factory->uri_protocols; } + +/** + * gst_element_factory_has_interface: + * @factory: a #GstElementFactory + * @interfacename: an interface name + * + * Check if @factory implements the interface with name @interfacename. + * + * Returns: #TRUE when @factory implement the interface. + * + * Since: 0.10.14 + */ +gboolean +gst_element_factory_has_interface (GstElementFactory * factory, + const gchar * interfacename) +{ + GList *walk; + + g_return_val_if_fail (GST_IS_ELEMENT_FACTORY (factory), FALSE); + + for (walk = factory->interfaces; walk; walk = g_list_next (walk)) { + gchar *iname = (gchar *) walk->data; + + if (!strcmp (iname, interfacename)) + return TRUE; + } + return FALSE; +} diff --git a/gst/gstelementfactory.h b/gst/gstelementfactory.h index 9783b4ac3b..ddd5cf9b5c 100644 --- a/gst/gstelementfactory.h +++ b/gst/gstelementfactory.h @@ -146,6 +146,8 @@ guint gst_element_factory_get_num_pad_templates (GstElementFactory *factory); G_CONST_RETURN GList * gst_element_factory_get_static_pad_templates (GstElementFactory *factory); gint gst_element_factory_get_uri_type (GstElementFactory *factory); gchar ** gst_element_factory_get_uri_protocols (GstElementFactory *factory); +gboolean gst_element_factory_has_interface (GstElementFactory *factory, + const gchar *interfacename); GstElement* gst_element_factory_create (GstElementFactory *factory, const gchar *name);