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