Module: wine Branch: master Commit: 1173a2e0126ebc4dc53dad6fc48bd5a28c1bf0eb URL: https://gitlab.winehq.org/wine/wine/-/commit/1173a2e0126ebc4dc53dad6fc48bd5a...
Author: Ziqing Hui zhui@codeweavers.com Date: Wed Oct 25 10:11:03 2023 +0800
winegstreamer: Introduce factory_create_element.
---
dlls/winegstreamer/unix_private.h | 1 + dlls/winegstreamer/unixlib.c | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index ea9803e6003..823fab908be 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 *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, diff --git a/dlls/winegstreamer/unixlib.c b/dlls/winegstreamer/unixlib.c index ad92ff230f8..db9d1eb114f 100644 --- a/dlls/winegstreamer/unixlib.c +++ b/dlls/winegstreamer/unixlib.c @@ -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);