GstURIHandler

GstURIHandler — Plugin feature that describes URI types and the element that handles it

Synopsis




enum        GstURIType;
#define     GST_TYPE_URI_HANDLER
#define     GST_URI_HANDLER                 (obj)
#define     GST_IS_URI_HANDLER              (obj)
#define     GST_URI_HANDLER_GET_INTERFACE   (obj)
#define     GST_URI_HANDLER_CLASS           (obj)
struct      GstURIHandler;
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);
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);
G_CONST_RETURN 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);

Object Hierarchy


  GInterface
   +----GstURIHandler

Implementations

GstURIHandler is implemented by GstFileSrc and GstFileSink.

Description

The URIHandler is a pluginfeature that can be used to locate element and the element property that can handle a given URI.

Details

enum GstURIType

typedef enum {
  GST_URI_UNKNOWN,
  GST_URI_SINK,
  GST_URI_SRC
} GstURIType;


GST_TYPE_URI_HANDLER

#define GST_TYPE_URI_HANDLER		(gst_uri_handler_get_type ())


GST_URI_HANDLER()

#define GST_URI_HANDLER(obj) 		(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_URI_HANDLER, GstURIHandler))

obj :

GST_IS_URI_HANDLER()

#define GST_IS_URI_HANDLER(obj) 	(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_URI_HANDLER))

obj :

GST_URI_HANDLER_GET_INTERFACE()

#define GST_URI_HANDLER_GET_INTERFACE(obj) 	(G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_URI_HANDLER, GstURIHandlerInterface))

obj :

GST_URI_HANDLER_CLASS()

#define GST_URI_HANDLER_CLASS(obj)	(G_TYPE_CHECK_CLASS_CAST ((obj), GST_TYPE_URI_HANDLER, GstURIHandler))

obj :

struct GstURIHandler

struct GstURIHandler;


struct GstURIHandlerInterface

struct GstURIHandlerInterface {

  GTypeInterface	parent;

  /* signals */
  void			(* new_uri)				(GstURIHandler *	handler,
								 const gchar *		uri);
  /* idea for the future ?
  gboolean		(* require_password)			(GstURIHandler *	handler,
								 gchar **		username,
								 gchar **		password);
   */

  /* vtable */

  /* 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);
  
  /* we might want to add functions here to query features, someone with gnome-vfs knowledge go ahead */

  gpointer _gst_reserved[GST_PADDING];
};


gst_uri_protocol_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 : string to check
Returns : TRUE if the string is a valid protocol identifier

gst_uri_is_valid ()

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 a string identifying the location.

uri : string to check
Returns : TRUE if the string is a valid URI

gst_uri_get_protocol ()

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 to get protocol from
Returns : The protocol for this URI.

gst_uri_get_location ()

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 to get the location from
Returns : The location for this URI.

gst_uri_construct ()

gchar*      gst_uri_construct               (const gchar *protocol,
                                             const gchar *location);

Constructs a URI for a given valid protocol and location.

protocol : protocol for URI
location : location for URI
Returns : a new string for this URI

gst_element_make_from_uri ()

GstElement* gst_element_make_from_uri       (const GstURIType type,
                                             const gchar *uri,
                                             const gchar *elementname);

Creates an element for handling the given URI.

type : wether to create a source or a sink
uri : URI to create element for
elementname : optional name of created element
Returns : a new element or NULL if none could be created

gst_uri_handler_get_uri_type ()

guint       gst_uri_handler_get_uri_type    (GstURIHandler *handler);

Gets the type of a URI handler

handler : Handler to query type of
Returns : the type of the URI handler

gst_uri_handler_get_protocols ()

gchar**     gst_uri_handler_get_protocols   (GstURIHandler *handler);

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

handler : Handler to get protocols for
Returns : the supported protocols

gst_uri_handler_get_uri ()

G_CONST_RETURN gchar* gst_uri_handler_get_uri
                                            (GstURIHandler *handler);

Gets the currently handled URI of the handler or NULL, if none is set.

handler : handler to query URI of
Returns : the URI

gst_uri_handler_set_uri ()

gboolean    gst_uri_handler_set_uri         (GstURIHandler *handler,
                                             const gchar *uri);

Tries to set the URI of the given handler and returns TRUE if it succeeded.

handler : handler to set URI of
uri : URI to set
Returns : TRUE, if the URI was set successfully

gst_uri_handler_new_uri ()

void        gst_uri_handler_new_uri         (GstURIHandler *handler,
                                             const gchar *uri);

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

handler : handler with a new URI
uri : new URI or NULL if it was unset