From 9d3de77ba7c62df9c2e587483a2a237e0d16c966 Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Thu, 25 Oct 2007 16:19:05 +0000 Subject: [PATCH] gst/: Patch from Alessandro Decina adding get_type_full and get_protocols_full private vfuncs to the URIHandler inter... Original commit message from CVS: * gst/gstelementfactory.c: (gst_element_register): * gst/gsturi.h: Patch from Alessandro Decina adding get_type_full and get_protocols_full private vfuncs to the URIHandler interface to allow bindings to support creating URI handlers. Partially fixes: #339279 API: GstURIHandlerInterface::get_type_full API: GstURIHandlerInterface::get_protocols_full --- ChangeLog | 11 +++++++++++ gst/gstelementfactory.c | 13 ++++++++++--- gst/gsturi.h | 13 ++++++++++++- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 865fc4ebe8..dd66e85ef1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-10-25 Jan Schmidt + + * gst/gstelementfactory.c: (gst_element_register): + * gst/gsturi.h: + Patch from Alessandro Decina adding get_type_full and + get_protocols_full private vfuncs to the URIHandler interface + to allow bindings to support creating URI handlers. + Partially fixes: #339279 + API: GstURIHandlerInterface::get_type_full + API: GstURIHandlerInterface::get_protocols_full + 2007-10-25 Jan Schmidt * plugins/elements/gstmultiqueue.c: (gst_multi_queue_set_property), diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index cc6367ef30..aed6898460 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -309,12 +309,19 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank, GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_type_interface_peek (klass, GST_TYPE_URI_HANDLER); - if (!iface || !iface->get_type || !iface->get_protocols) + if (!iface || (!iface->get_type && !iface->get_type_full) || + (!iface->get_protocols && !iface->get_protocols_full)) goto urierror; - factory->uri_type = iface->get_type (); + if (iface->get_type) + factory->uri_type = iface->get_type (); + else if (iface->get_type_full) + factory->uri_type = iface->get_type_full (factory->type); if (!GST_URI_TYPE_IS_VALID (factory->uri_type)) goto urierror; - factory->uri_protocols = g_strdupv (iface->get_protocols ()); + if (iface->get_protocols) + factory->uri_protocols = g_strdupv (iface->get_protocols ()); + else if (iface->get_protocols_full) + factory->uri_protocols = iface->get_protocols_full (factory->type); if (!factory->uri_protocols) goto urierror; } diff --git a/gst/gsturi.h b/gst/gsturi.h index 899bdadc23..eef0cf759c 100644 --- a/gst/gsturi.h +++ b/gst/gsturi.h @@ -75,6 +75,14 @@ typedef struct _GstURIHandlerInterface GstURIHandlerInterface; * @get_protocols: Method to return the list of protocols handled by the element. * @get_uri: Method to return the URI currently handled by the element. * @set_uri: Method to set a new URI. + * @get_type_full: Variant of get_type which takes a GType argument. This is + * for use by bindings that need to pass context when creating a URI Handler. * If implemented, get_type will be used in preference to get_type_full. + * Since: 0.10.15 + * @get_protocols_full: Variant of get_type which takes a GType argument. + * This is for use by bindings that need to pass context when creating a URI + * Handler. If implemented, get_protocols will be used in preference to + * get_protocols_full. + * Since: 0.10.15 * * #GstElements using this interface should implement these methods. */ @@ -103,11 +111,14 @@ struct _GstURIHandlerInterface { gboolean (* set_uri) (GstURIHandler * handler, const gchar * uri); + GstURIType (* get_type_full) (GType type); + gchar ** (* get_protocols_full) (GType type); + /*< private >*/ /* we might want to add functions here to query features, * someone with gnome-vfs knowledge go ahead */ - gpointer _gst_reserved[GST_PADDING]; + gpointer _gst_reserved[GST_PADDING - 2]; }; /* general URI functions */