Next: , Previous: GstTypeFind, Up: Top


41 GstUriHandler

Interface to ease URI handling in plugins.

41.1 Overview

The URIHandler is an interface that is implemented by Source and Sink <gst-element> to simplify then handling of URI.

An application can use the following functions to quickly get an element that handles the given URI for reading or writing (gst-element-make-from-uri).

Source and Sink plugins should implement this interface when possible.

Last reviewed on 2005-11-09 (0.9.4)

41.2 Usage

— Function: gst-uri-protocol-is-valid (protocol mchars)   (ret bool)

Tests if the given string is a valid protocol identifier. Protocols must consist of alphanumeric characters and not start with a number.

protocol
A string
ret
TRUE if the string is a valid protocol identifier, FALSE otherwise.
— Function: gst-uri-is-valid (uri mchars)   (ret bool)

Tests if the given string is a valid URI identifier. URIs start with a valid protocol followed by "://" and maybe a string identifying the location.

uri
A URI string
ret
TRUE if the string is a valid URI
— Function: gst-uri-has-protocol (uri mchars) (protocol mchars)   (ret bool)

Checks if the protocol of a given valid URI matches protocol.

uri
an URI string
protocol
a protocol string (e.g. "http")
ret
#t’ if the protocol matches.

Since 0.10.4

— Function: gst-uri-get-protocol (uri mchars)   (ret mchars)

Extracts the protocol out of a given valid URI. The returned string must be freed using g-free.

uri
A URI string
ret
The protocol for this URI.
— Function: gst-uri-get-location (uri mchars)   (ret mchars)

Extracts the location out of a given valid URI, ie. the protocol and "://" are stripped from the URI, which means that the location returned includes the hostname if one is specified. The returned string must be freed using g-free.

uri
A URI string
ret
The location for this URI. Returns NULL if the URI isn't valid. If the URI does not contain a location, an empty string is returned.
— Function: gst-uri-construct (protocol mchars) (location mchars)   (ret mchars)

Constructs a URI for a given valid protocol and location.

protocol
Protocol for URI
location
Location for URI
ret
a new string for this URI. Returns NULL if the given URI protocol is not valid, or the given location is NULL.
— Function: gst-element-make-from-uri (type <gst-uri-type>) (uri mchars) (elementname mchars)   (ret <gst-element>)

Creates an element for handling the given URI.

type
Whether to create a source or a sink
uri
URI to create an element for
elementname
Name of created element, can be NULL.
ret
a new element or NULL if none could be created
— Function: gst-uri-handler-get-uri-type (self <gst-uri-handler*>)   (ret unsigned-int)

Gets the type of the given URI handler

Returns: the <gst-uri-type> of the URI handler.

handler
A <gst-uri-handler>.
ret
<gst-uri-unknown> if the handler isn't implemented correctly.
— Function: gst-uri-handler-get-protocols (self <gst-uri-handler*>)   (ret <gchar**>)

Gets the list of protocols supported by handler. This list may not be modified.

Returns: the supported protocols.

handler
A <gst-uri-handler>.
ret
NULL if the handler isn't implemented properly, or the handler doesn't support any protocols.
— Function: gst-uri-handler-get-uri (self <gst-uri-handler*>)   (ret mchars)

Gets the currently handled URI.

Returns: the URI currently handled by the handler.

handler
A <gst-uri-handler>
ret
NULL if there are no URI currently handled. The returned string must not be modified or freed.
— Function: gst-uri-handler-set-uri (self <gst-uri-handler*>) (uri mchars)   (ret bool)

Tries to set the URI of the given handler.

handler
A <gst-uri-handler>
uri
URI to set
ret
TRUE if the URI was set successfully, else FALSE.
— Function: gst-uri-handler-new-uri (self <gst-uri-handler*>) (uri mchars)

Emits the new-uri signal for a given handler, when that handler has a new URI. This function should only be called by URI handlers themselves.

handler
A <gst-uri-handler>
uri
new URI or NULL if it was unset