From: <sl...@ke...> - 2007-04-27 08:31:17
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: slomo Date: Fri Apr 27 2007 08:31:11 UTC Log message: * docs/gst/gstreamer-sections.txt: * gst/gsturi.c: (get_element_factories_from_uri_protocol), (gst_uri_protocol_is_supported), (gst_element_make_from_uri): * gst/gsturi.h: API: Add gst_uri_protocol_is_supported(), which checks if an sink or src that supports a given URI protocol exists. Modified files: . : ChangeLog docs/gst : gstreamer-sections.txt gst : gsturi.c gsturi.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.3181&r2=1.3182 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/docs/gst/gstreamer-sections.txt.diff?r1=1.298&r2=1.299 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gsturi.c.diff?r1=1.36&r2=1.37 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gsturi.h.diff?r1=1.16&r2=1.17 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.3181 retrieving revision 1.3182 diff -u -d -r1.3181 -r1.3182 --- ChangeLog 27 Apr 2007 07:34:10 -0000 1.3181 +++ ChangeLog 27 Apr 2007 08:30:59 -0000 1.3182 @@ -1,5 +1,14 @@ 2007-04-27 Sebastian Dröge <sl...@ci...> + * docs/gst/gstreamer-sections.txt: + * gst/gsturi.c: (get_element_factories_from_uri_protocol), + (gst_uri_protocol_is_supported), (gst_element_make_from_uri): + * gst/gsturi.h: + API: Add gst_uri_protocol_is_supported(), which checks if an sink + or src that supports a given URI protocol exists. + +2007-04-27 Sebastian Dröge <sl...@ci...> * plugins/elements/gstfilesink.c: (gst_file_sink_uri_set_uri): * plugins/elements/gstfilesrc.c: (gst_file_src_uri_set_uri): Set the location to NULL if "file://" is set as URI. Otherwise Index: gstreamer-sections.txt RCS file: /cvs/gstreamer/gstreamer/docs/gst/gstreamer-sections.txt,v retrieving revision 1.298 retrieving revision 1.299 diff -u -d -r1.298 -r1.299 --- gstreamer-sections.txt 26 Apr 2007 10:00:48 -0000 1.298 +++ gstreamer-sections.txt 27 Apr 2007 08:30:59 -0000 1.299 @@ -2070,6 +2070,7 @@ GstURIType GST_URI_TYPE_IS_VALID gst_uri_protocol_is_valid +gst_uri_protocol_is_supported gst_uri_is_valid gst_uri_has_protocol gst_uri_get_protocol Index: gsturi.c RCS file: /cvs/gstreamer/gstreamer/gst/gsturi.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- gsturi.c 6 Nov 2006 15:18:57 -0000 1.36 +++ gsturi.c 27 Apr 2007 08:30:59 -0000 1.37 @@ -458,7 +458,7 @@ typedef struct { GstURIType type; - gchar *protocol; + const gchar *protocol; } SearchEntry; @@ -502,6 +502,50 @@ gst_plugin_feature_get_rank (first); +static GList * +get_element_factories_from_uri_protocol (const GstURIType type, + const gchar * protocol) +{ + GList *possibilities; + SearchEntry entry; + g_return_val_if_fail (protocol, NULL); + entry.type = type; + entry.protocol = protocol; + possibilities = gst_registry_feature_filter (gst_registry_get_default (), + search_by_entry, FALSE, &entry); + return possibilities; +} +/** + * gst_uri_protocol_is_supported: + * @type: Wether to check for a source or a sink + * @protocol: Protocol that should be checkd for. + * + * Checks if an element exists that supports the given URI protocol. + * Returns: TRUE + * Since: 0.10.13 +*/ +gboolean +gst_uri_protocol_is_supported (const GstURIType type, const gchar * protocol) + g_return_val_if_fail (protocol, FALSE); + possibilities = get_element_factories_from_uri_protocol (type, protocol); + if (possibilities) { + g_list_free (possibilities); + return TRUE; + } else + return FALSE; /** * gst_element_make_from_uri: * @type: Wether to create a source or a sink @@ -517,17 +561,15 @@ const gchar * elementname) GList *possibilities, *walk; - SearchEntry entry; + gchar *protocol; GstElement *ret = NULL; g_return_val_if_fail (GST_URI_TYPE_IS_VALID (type), NULL); g_return_val_if_fail (gst_uri_is_valid (uri), NULL); - entry.type = type; - entry.protocol = gst_uri_get_protocol (uri); - possibilities = gst_registry_feature_filter (gst_registry_get_default (), - search_by_entry, FALSE, &entry); - g_free (entry.protocol); + protocol = gst_uri_get_protocol (uri); + g_free (protocol); if (!possibilities) { GST_DEBUG ("No %s for URI '%s'", type == GST_URI_SINK ? "sink" : "source", Index: gsturi.h RCS file: /cvs/gstreamer/gstreamer/gst/gsturi.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- gsturi.h 9 Mar 2006 12:08:54 -0000 1.16 +++ gsturi.h 27 Apr 2007 08:30:59 -0000 1.17 @@ -113,6 +113,8 @@ /* general URI functions */ gboolean gst_uri_protocol_is_valid (const gchar * protocol); +gboolean gst_uri_protocol_is_supported (const GstURIType type, + const gchar *protocol); gboolean gst_uri_is_valid (const gchar * uri); gchar * gst_uri_get_protocol (const gchar * uri); gboolean gst_uri_has_protocol (const gchar * uri, |