diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index 18431d0b36..cc0713d7c4 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -273,8 +273,12 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank, factory->uri_type = iface->get_type (factory->type); if (!GST_URI_TYPE_IS_VALID (factory->uri_type)) goto urierror; - if (iface->get_protocols) - factory->uri_protocols = iface->get_protocols (factory->type); + if (iface->get_protocols) { + const gchar *const *protocols; + + protocols = iface->get_protocols (factory->type); + factory->uri_protocols = g_strdupv ((gchar **) protocols); + } if (!factory->uri_protocols) goto urierror; } @@ -577,12 +581,12 @@ gst_element_factory_get_uri_type (GstElementFactory * factory) * Returns: (transfer none) (array zero-terminated=1): the supported protocols * or NULL */ -gchar ** +const gchar *const * gst_element_factory_get_uri_protocols (GstElementFactory * factory) { g_return_val_if_fail (GST_IS_ELEMENT_FACTORY (factory), NULL); - return factory->uri_protocols; + return (const gchar * const *) factory->uri_protocols; } /** diff --git a/gst/gstelementfactory.h b/gst/gstelementfactory.h index a7ecec58e7..62a80ac15f 100644 --- a/gst/gstelementfactory.h +++ b/gst/gstelementfactory.h @@ -90,7 +90,7 @@ guint gst_element_factory_get_num_pad_templates (GstElementFac const GList * gst_element_factory_get_static_pad_templates (GstElementFactory *factory); GstURIType gst_element_factory_get_uri_type (GstElementFactory *factory); -gchar ** gst_element_factory_get_uri_protocols (GstElementFactory *factory); +const gchar * const * gst_element_factory_get_uri_protocols (GstElementFactory *factory); gboolean gst_element_factory_has_interface (GstElementFactory *factory, const gchar *interfacename); diff --git a/gst/gsturi.c b/gst/gsturi.c index 359fba8572..6d49a39ed0 100644 --- a/gst/gsturi.c +++ b/gst/gsturi.c @@ -478,7 +478,7 @@ SearchEntry; static gboolean search_by_entry (GstPluginFeature * feature, gpointer search_entry) { - gchar **protocols; + const gchar *const *protocols; GstElementFactory *factory; SearchEntry *entry = (SearchEntry *) search_entry; @@ -649,11 +649,11 @@ gst_uri_handler_get_uri_type (GstURIHandler * handler) * supported protocols. Returns NULL if the @handler isn't implemented * properly, or the @handler doesn't support any protocols. */ -gchar ** +const gchar *const * gst_uri_handler_get_protocols (GstURIHandler * handler) { GstURIHandlerInterface *iface; - gchar **ret; + const gchar *const *ret; g_return_val_if_fail (GST_IS_URI_HANDLER (handler), NULL); @@ -673,9 +673,9 @@ gst_uri_handler_get_protocols (GstURIHandler * handler) * * Gets the currently handled URI. * - * Returns: (transfer none): the URI currently handled by the @handler. + * Returns: (transfer full): the URI currently handled by the @handler. * Returns NULL if there are no URI currently handled. The - * returned string must not be modified or freed. + * returned string must be freed with g_free() when no longer needed. */ gchar * gst_uri_handler_get_uri (GstURIHandler * handler) @@ -725,7 +725,8 @@ gst_uri_handler_set_uri (GstURIHandler * handler, const gchar * uri, protocol = gst_uri_get_protocol (uri); if (iface->get_protocols) { - gchar **p, **protocols; + const gchar *const *protocols; + const gchar *const *p; gboolean found_protocol = FALSE; protocols = iface->get_protocols (G_OBJECT_TYPE (handler)); diff --git a/gst/gsturi.h b/gst/gsturi.h index 7435fc740b..ad9005cc60 100644 --- a/gst/gsturi.h +++ b/gst/gsturi.h @@ -111,7 +111,7 @@ struct _GstURIHandlerInterface { /*< public >*/ /* querying capabilities */ GstURIType (* get_type) (GType type); - gchar ** (* get_protocols) (GType type); + const gchar * const * (* get_protocols) (GType type); /* using the interface */ gchar * (* get_uri) (GstURIHandler * handler); @@ -144,7 +144,7 @@ GstElement * gst_element_make_from_uri (const GstURIType type, GType gst_uri_handler_get_type (void); GstURIType gst_uri_handler_get_uri_type (GstURIHandler * handler); -gchar ** gst_uri_handler_get_protocols (GstURIHandler * handler); +const gchar * const * gst_uri_handler_get_protocols (GstURIHandler * handler); gchar * gst_uri_handler_get_uri (GstURIHandler * handler); gboolean gst_uri_handler_set_uri (GstURIHandler * handler, const gchar * uri,