Commit 41800667 authored by Benjamin Otte's avatar Benjamin Otte

implement 'gst_element_factory_find_from_element' to replace gst_element_get_factory

Original commit message from CVS:
implement 'gst_element_factory_find_from_element' to replace gst_element_get_factory
parent 3ddbdba7
......@@ -359,8 +359,6 @@ void gst_element_wait_state_change (GstElement *element);
const gchar* gst_element_state_get_name (GstElementState state);
GstElementFactory* gst_element_get_factory (GstElement *element);
GstBin* gst_element_get_managing_bin (GstElement *element);
......@@ -404,7 +402,8 @@ gboolean gst_element_register (GstPlugin *plugin,
guint rank,
GType type);
GstElementFactory* gst_element_factory_find (const gchar *name);
GstElementFactory * gst_element_factory_find (const gchar *name);
GstElementFactory * gst_element_factory_find_from_element (GstElement *element);
GType gst_element_factory_get_element_type (GstElementFactory *factory);
G_CONST_RETURN gchar * gst_element_factory_get_longname (GstElementFactory *factory);
G_CONST_RETURN gchar * gst_element_factory_get_klass (GstElementFactory *factory);
......@@ -108,6 +108,43 @@ gst_element_factory_find (const gchar *name)
GST_DEBUG ("no such elementfactory \"%s\"", name);
return NULL;
typedef struct {
GType type;
} MyGTypeData;
static gboolean
find_type_filter (GstPluginFeature *feature, gpointer data)
GstElementFactory *factory;
if (!GST_IS_ELEMENT_FACTORY (feature))
return FALSE;
factory = GST_ELEMENT_FACTORY (feature);
return factory->type == ((MyGTypeData *) data)->type;
GstElementFactory *
gst_element_factory_find_from_element (GstElement *element)
GstElementFactory *factory;
GList *list;
MyGTypeData data;
g_return_val_if_fail(GST_IS_ELEMENT (element), NULL);
data.type = G_OBJECT_TYPE (element);
list = gst_registry_pool_feature_filter (find_type_filter, TRUE, &data);
if (!list)
return NULL;
g_assert (g_list_next (list) == NULL);
factory = GST_ELEMENT_FACTORY (list->data);
g_list_free (list);
return factory;
__gst_element_details_clear (GstElementDetails *dp)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment