gst/gstelementfactory.*: API: gst_element_factory_has_interface()
authorWim Taymans <wim.taymans@gmail.com>
Wed, 25 Jul 2007 18:37:12 +0000 (18:37 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Wed, 25 Jul 2007 18:37:12 +0000 (18:37 +0000)
Original commit message from CVS:
* 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.

ChangeLog
gst/gstelementfactory.c
gst/gstelementfactory.h

index 22ffc93..28a4cf7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-07-25  Wim Taymans  <wim.taymans@gmail.com>
+
+       * 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  <ensonic@users.sf.net>
 
        * configure.ac:
index bbc9bc1..bf0025d 100644 (file)
@@ -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;
+}
index 9783b4a..ddd5cf9 100644 (file)
@@ -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);