mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
Add new API: gst_uri_has_protocol() (#333779).
Original commit message from CVS: * docs/gst/gstreamer-sections.txt: * gst/gsturi.c: (gst_uri_has_protocol): * gst/gsturi.h: Add new API: gst_uri_has_protocol() (#333779).
This commit is contained in:
parent
99a61247bc
commit
09bc0d93af
4 changed files with 36 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
2006-03-09 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* docs/gst/gstreamer-sections.txt:
|
||||
* gst/gsturi.c: (gst_uri_has_protocol):
|
||||
* gst/gsturi.h:
|
||||
Add new API: gst_uri_has_protocol() (#333779).
|
||||
|
||||
2006-03-09 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/gstclock.c: (gst_clock_entry_new),
|
||||
|
|
|
@ -1973,6 +1973,7 @@ GstURIType
|
|||
GST_URI_TYPE_IS_VALID
|
||||
gst_uri_protocol_is_valid
|
||||
gst_uri_is_valid
|
||||
gst_uri_has_protocol
|
||||
gst_uri_get_protocol
|
||||
gst_uri_get_location
|
||||
gst_uri_construct
|
||||
|
|
26
gst/gsturi.c
26
gst/gsturi.c
|
@ -372,6 +372,32 @@ gst_uri_get_protocol (const gchar * uri)
|
|||
return g_strndup (uri, colon - uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_uri_has_protocol:
|
||||
* @uri: an URI string
|
||||
* @protocol: a protocol string (e.g. "http")
|
||||
*
|
||||
* Returns TRUE if the protocol of a given valid URI matches @protocol.
|
||||
*
|
||||
* Since: 0.10.4
|
||||
*/
|
||||
gboolean
|
||||
gst_uri_has_protocol (const gchar * uri, const gchar * protocol)
|
||||
{
|
||||
gchar *colon;
|
||||
|
||||
g_return_val_if_fail (uri != NULL, FALSE);
|
||||
g_return_val_if_fail (protocol != NULL, FALSE);
|
||||
g_return_val_if_fail (gst_uri_is_valid (uri), FALSE);
|
||||
|
||||
colon = strstr (uri, "://");
|
||||
|
||||
if (colon == NULL)
|
||||
return FALSE;
|
||||
|
||||
return (strncmp (uri, protocol, (size_t) (colon - uri)) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_uri_get_location:
|
||||
* @uri: A URI string
|
||||
|
|
|
@ -115,6 +115,8 @@ struct _GstURIHandlerInterface {
|
|||
gboolean gst_uri_protocol_is_valid (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,
|
||||
const gchar * protocol);
|
||||
gchar * gst_uri_get_location (const gchar * uri);
|
||||
gchar * gst_uri_construct (const gchar * protocol,
|
||||
const gchar * location);
|
||||
|
|
Loading…
Reference in a new issue