diff --git a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer-types.c b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer-types.c index dc76657a98..55172388eb 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer-types.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer-types.c @@ -365,7 +365,12 @@ G_DEFINE_TYPE (GstDiscovererInfo, gst_discoverer_info, G_TYPE_OBJECT); static void gst_discoverer_info_init (GstDiscovererInfo * info) { +#if GLIB_CHECK_VERSION(2,74,0) + info->missing_elements_details = + g_ptr_array_new_null_terminated (16, g_free, TRUE); +#else info->missing_elements_details = g_ptr_array_new_with_free_func (g_free); +#endif } static void @@ -1179,7 +1184,6 @@ const gchar ** gst_discoverer_info_get_missing_elements_installer_details (const GstDiscovererInfo * info) { - if (info->result != GST_DISCOVERER_MISSING_PLUGINS) { GST_WARNING_OBJECT (info, "Trying to get missing element installed details " "but result is not 'MISSING_PLUGINS'"); @@ -1187,11 +1191,5 @@ gst_discoverer_info_get_missing_elements_installer_details (const return NULL; } - if (info->missing_elements_details->pdata[info->missing_elements_details-> - len]) { - GST_DEBUG ("Adding NULL pointer to the end of missing_elements_details"); - g_ptr_array_add (info->missing_elements_details, NULL); - } - return (const gchar **) info->missing_elements_details->pdata; } diff --git a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer.c b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer.c index d12f73225e..d3e1c01994 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstdiscoverer.c @@ -1519,6 +1519,10 @@ discoverer_collect (GstDiscoverer * dc) } _ensure_info_tags (dc); +#if !GLIB_CHECK_VERSION(2,74,0) + /* Make sure the missing element details are NULL-terminated */ + g_ptr_array_add (info->missing_elements_details, NULL); +#endif serialize_info_if_required (dc, dc->priv->current_info); if (dc->priv->async) emit_discovered (dc);