mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
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
This commit is contained in:
parent
3ddbdba789
commit
4180066759
2 changed files with 39 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
void
|
||||
__gst_element_details_clear (GstElementDetails *dp)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue