From: Ziqing Hui <zhui(a)codeweavers.com> --- dlls/winegstreamer/unix_private.h | 1 + dlls/winegstreamer/unixlib.c | 28 ++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index 8574042a23c..4feb18a0c67 100644 --- a/dlls/winegstreamer/unix_private.h +++ b/dlls/winegstreamer/unix_private.h @@ -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 *create_element_by_factory(GstElementFactory *factory) DECLSPEC_HIDDEN; extern GList *find_element_factory(GstElementFactoryListType type, GstRank min_rank, GstCaps *element_sink_caps, GstCaps *element_src_caps) DECLSPEC_HIDDEN; extern GstElement *find_element(GstElementFactoryListType type, GstRank min_rank, diff --git a/dlls/winegstreamer/unixlib.c b/dlls/winegstreamer/unixlib.c index 7cd7cfb394a..82eaa4ec73e 100644 --- a/dlls/winegstreamer/unixlib.c +++ b/dlls/winegstreamer/unixlib.c @@ -78,6 +78,25 @@ GstElement *create_element(const char *name, const char *plugin_set) return element; } +GstElement *create_element_by_factory(GstElementFactory *factory) +{ + gchar *plugin_name = gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(factory)); + GstElement *element; + + if ((element = gst_element_factory_create(factory, NULL))) + { + gchar *element_name = gst_element_get_name(element); + GST_INFO("Created element %s %p by factory %s.", element_name, element, plugin_name); + g_free(element_name); + } + else + { + GST_WARNING("Failed to create element by factory %s.", plugin_name); + } + + return element; +} + GList *find_element_factory(GstElementFactoryListType type, GstRank min_rank, GstCaps *element_sink_caps, GstCaps *element_src_caps) { @@ -137,16 +156,13 @@ GstElement *find_element(GstElementFactoryListType type, GstRank min_rank, continue; } - if (!(element = gst_element_factory_create(GST_ELEMENT_FACTORY(tmp->data), NULL))) - GST_WARNING("Failed to create %s element.", name); + element = create_element_by_factory(GST_ELEMENT_FACTORY(tmp->data)); } gst_plugin_feature_list_free(transforms); - if (element) - GST_DEBUG("Created %s element %p.", name, element); - else - GST_WARNING("Failed to create the element matching caps %"GST_PTR_FORMAT" / %"GST_PTR_FORMAT".", + if (!element) + GST_WARNING("Failed to create element matching caps %"GST_PTR_FORMAT" / %"GST_PTR_FORMAT".", element_sink_caps, element_src_caps); return element; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3810