Commit 1173a2e0 authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

winegstreamer: Introduce factory_create_element.

parent eb7571c8
......@@ -35,6 +35,7 @@ extern NTSTATUS wg_init_gstreamer(void *args) DECLSPEC_HIDDEN;
extern GstStreamType stream_type_from_caps(GstCaps *caps) DECLSPEC_HIDDEN;
extern GstElement *create_element(const char *name, const char *plugin_set) DECLSPEC_HIDDEN;
GstElement *factory_create_element(GstElementFactory *factory) DECLSPEC_HIDDEN;
extern GList *find_element_factories(GstElementFactoryListType type, GstRank min_rank,
GstCaps *element_sink_caps, GstCaps *element_src_caps) DECLSPEC_HIDDEN;
extern GstElement *find_element(GstElementFactoryListType type,
......
......@@ -78,6 +78,19 @@ GstElement *create_element(const char *name, const char *plugin_set)
return element;
}
GstElement *factory_create_element(GstElementFactory *factory)
{
GstElement *element;
if ((element = gst_element_factory_create(factory, NULL)))
GST_INFO("Created element %"GST_PTR_FORMAT" from factory %"GST_PTR_FORMAT".",
element, factory);
else
GST_WARNING("Failed to create element from factory %"GST_PTR_FORMAT".", factory);
return element;
}
GList *find_element_factories(GstElementFactoryListType type, GstRank min_rank,
GstCaps *element_sink_caps, GstCaps *element_src_caps)
{
......@@ -135,15 +148,12 @@ GstElement *find_element(GstElementFactoryListType type, GstCaps *element_sink_c
continue;
}
if (!(element = gst_element_factory_create(GST_ELEMENT_FACTORY(tmp->data), NULL)))
GST_WARNING("Failed to create %s element.", name);
element = factory_create_element(GST_ELEMENT_FACTORY(tmp->data));
}
gst_plugin_feature_list_free(transforms);
if (element)
GST_DEBUG("Created %s element %p.", name, element);
else
if (!element)
GST_WARNING("Failed to create element matching caps %"GST_PTR_FORMAT" / %"GST_PTR_FORMAT".",
element_sink_caps, element_src_caps);
......
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