![]() |
![]() |
![]() |
GStreamer 0.10 Core Reference Manual | ![]() |
---|---|---|---|---|
#include <gst/gst.h> GstURIHandler; GstURIHandlerInterface; enum GstURIType; #define GST_URI_TYPE_IS_VALID (type) gboolean gst_uri_protocol_is_valid (const gchar *protocol); gboolean gst_uri_is_valid (const gchar *uri); gboolean gst_uri_has_protocol (const gchar *uri, const gchar *protocol); gchar* gst_uri_get_protocol (const gchar *uri); gchar* gst_uri_get_location (const gchar *uri); gchar* gst_uri_construct (const gchar *protocol, const gchar *location); GstElement* gst_element_make_from_uri (const GstURIType type, const gchar *uri, const gchar *elementname); guint gst_uri_handler_get_uri_type (GstURIHandler *handler); gchar** 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); void gst_uri_handler_new_uri (GstURIHandler *handler, const gchar *uri);
The URIHandler is an interface that is implemented by Source and Sink GstElement 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)
typedef struct { GTypeInterface parent; /* querying capabilities */ GstURIType (* get_type) (void); gchar ** (* get_protocols) (void); /* using the interface */ G_CONST_RETURN gchar *(* get_uri) (GstURIHandler * handler); gboolean (* set_uri) (GstURIHandler * handler, const gchar * uri); } GstURIHandlerInterface;
GstElements using this interface should implement these methods.
parent
;GTypeInterfaceparent
The parent interface type
The parent interface type
get_type
()get_type
Method to tell wether the element handles source or sink URI.
Method to tell wether the element handles source or sink URI.
get_protocols
()get_protocols
Method to return the list of protocols handled by the element.
Method to return the list of protocols handled by the element.
get_uri
()get_uri
Method to return the URI currently handled by the element.
Method to return the URI currently handled by the element.
set_uri
()set_uri
Method to set a new URI.
Method to set a new URI.
GTypeInterface parent ; |
The parent interface type |
get_type () |
Method to tell wether the element handles source or sink URI. |
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. |
typedef enum { GST_URI_UNKNOWN, GST_URI_SINK, GST_URI_SRC } GstURIType;
The different types of URI direction.
GST_URI_UNKNOWN
GST_URI_UNKNOWN
The URI direction is unknown
The URI direction is unknown
GST_URI_SINK
GST_URI_SINK
The URI is a consumer.
The URI is a consumer.
GST_URI_SRC
GST_URI_SRC
The URI is a producer.
The URI is a producer.
GST_URI_UNKNOWN |
The URI direction is unknown |
GST_URI_SINK |
The URI is a consumer. |
GST_URI_SRC |
The URI is a producer. |
#define GST_URI_TYPE_IS_VALID(type) ((type) == GST_URI_SRC || (type) == GST_URI_SINK)
Tests if the type direction is valid.
gboolean gst_uri_protocol_is_valid (const gchar *protocol);
Tests if the given string is a valid protocol identifier. Protocols must consist of alphanumeric characters and not start with a number.
protocol
:protocol
A string
A string
Returns :Returns TRUE if the string is a valid protocol identifier, FALSE otherwise.
TRUE if the string is a valid protocol identifier, FALSE otherwise.
protocol : |
A string |
Returns : | TRUE if the string is a valid protocol identifier, FALSE otherwise. |
gboolean gst_uri_is_valid (const gchar *uri);
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
:uri
A URI string
A URI string
Returns :Returns TRUE if the string is a valid URI
TRUE if the string is a valid URI
uri : |
A URI string |
Returns : | TRUE if the string is a valid URI |
gboolean gst_uri_has_protocol (const gchar *uri, const gchar *protocol);
Checks if the protocol of a given valid URI matches protocol
.
uri
:uri
an URI string
an URI string
protocol
:protocol
a protocol string (e.g. "http")
a protocol string (e.g. "http")
Returns :Returns TRUE
if the protocol matches.
TRUE
if the protocol matches.
TRUE
TRUE
uri : |
an URI string |
protocol : |
a protocol string (e.g. "http") |
Returns : | TRUE if the protocol matches.
|
Since 0.10.4
gchar* gst_uri_get_protocol (const gchar *uri);
Extracts the protocol out of a given valid URI. The returned string must be
freed using g_free()
.
uri
:uri
A URI string
A URI string
Returns :Returns The protocol for this URI.
The protocol for this URI.
uri : |
A URI string |
Returns : | The protocol for this URI. |
gchar* gst_uri_get_location (const gchar *uri);
Extracts the location out of a given valid URI. So the protocol and "://"
are stripped from the URI. The returned string must be freed using
g_free()
.
uri
:uri
A URI string
A URI string
Returns :Returns The location for this URI. Returns NULL if the URI isn't valid.
The location for this URI. Returns NULL if the URI isn't valid.
uri : |
A URI string |
Returns : | The location for this URI. Returns NULL if the URI isn't valid. |
gchar* gst_uri_construct (const gchar *protocol, const gchar *location);
Constructs a URI for a given valid protocol and location.
protocol
:protocol
Protocol for URI
Protocol for URI
location
:location
Location for URI
Location for URI
Returns :Returns a new string for this URI. Returns NULL if the given URI protocol
is not valid, or the given location is NULL.
a new string for this URI. Returns NULL if the given URI protocol
is not valid, or the given location is NULL.
protocol : |
Protocol for URI |
location : |
Location for URI |
Returns : | a new string for this URI. Returns NULL if the given URI protocol is not valid, or the given location is NULL. |
GstElement* gst_element_make_from_uri (const GstURIType type, const gchar *uri, const gchar *elementname);
Creates an element for handling the given URI.
type
:type
Wether to create a source or a sink
Wether to create a source or a sink
uri
:uri
URI to create an element for
URI to create an element for
elementname
:elementname
Name of created element, can be NULL.
Name of created element, can be NULL.
Returns :Returns a new element or NULL if none could be created
a new element or NULL if none could be created
type : |
Wether to create a source or a sink |
uri : |
URI to create an element for |
elementname : |
Name of created element, can be NULL. |
Returns : | a new element or NULL if none could be created |
guint gst_uri_handler_get_uri_type (GstURIHandler *handler);
Gets the type of the given URI handler
Returns: the GstURIType of the URI handler.
handler
:handler
A GstURIHandler.
A GstURIHandler.
GstURIHandlerGstURIHandlerReturns :ReturnsGST_URI_UNKNOWN if the handler
isn't implemented correctly.
GST_URI_UNKNOWN if the handler
isn't implemented correctly.
GST_URI_UNKNOWNGST_URI_UNKNOWNhandler
handler : |
A GstURIHandler. |
Returns : |
GST_URI_UNKNOWN if the handler isn't implemented correctly.
|
gchar** gst_uri_handler_get_protocols (GstURIHandler *handler);
Gets the list of protocols supported by handler
. This list may not be
modified.
Returns: the supported protocols.
handler
:handler
A GstURIHandler.
A GstURIHandler.
GstURIHandlerGstURIHandlerReturns :ReturnsNULL if the handler
isn't implemented properly, or the handler
doesn't support any protocols.
NULL if the handler
isn't implemented properly, or the handler
doesn't support any protocols.
handler
handler
handler : |
A GstURIHandler. |
Returns : | NULL if the handler isn't implemented properly, or the handler
doesn't support any protocols.
|
gchar* gst_uri_handler_get_uri (GstURIHandler *handler);
Gets the currently handled URI.
Returns: the URI currently handled by the handler
.
handler
:handler
A GstURIHandler
A GstURIHandler
GstURIHandlerGstURIHandlerReturns :ReturnsNULL if there are no URI currently handled. The returned
string must not be modified or freed.
NULL if there are no URI currently handled. The returned
string must not be modified or freed.
handler : |
A GstURIHandler |
Returns : | NULL if there are no URI currently handled. The returned string must not be modified or freed. |
gboolean gst_uri_handler_set_uri (GstURIHandler *handler, const gchar *uri);
Tries to set the URI of the given handler.
handler
:handler
A GstURIHandler
A GstURIHandler
GstURIHandlerGstURIHandleruri
:uri
URI to set
URI to set
Returns :Returns TRUE if the URI was set successfully, else FALSE.
TRUE if the URI was set successfully, else FALSE.
handler : |
A GstURIHandler |
uri : |
URI to set |
Returns : | TRUE if the URI was set successfully, else FALSE. |
void gst_uri_handler_new_uri (GstURIHandler *handler, const gchar *uri);
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
:handler
A GstURIHandler
A GstURIHandler
GstURIHandlerGstURIHandleruri
:uri
new URI or NULL if it was unset
new URI or NULL if it was unset
handler : |
A GstURIHandler |
uri : |
new URI or NULL if it was unset |