# Gst::URIHandler Class Reference
[gstreamermm Interfaces]

Gst::URIHandler - An interface to ease URI handling in plugins. More...

`#include <urihandler.h>`

Inheritance diagram for Gst::URIHandler:

List of all members.

## Public Member Functions
virtual | ~URIHandler ()
GstURIHandler* | gobj ()
| Provides access to the underlying C GObject.
const GstURIHandler* | gobj () const
| Provides access to the underlying C GObject.
guint | get_uri_type () const
| Gets the type of the given URI handler.
Glib::StringArrayHandle | get_protocols () const
| Gets the list of protocols supported by handler.
Glib::ustring | get_uri () const
| Gets the currently handled URI.
bool | set_uri (const Glib::ustring& uri)
| Tries to set the URI of the given handler.
void | new_uri (const Glib::ustring& uri)
| Emits the new-uri signal for a given handler, when that handler has a new URI.
Glib::SignalProxy1< void, const Glib::ustring& > | signal_new_uri ()
| This signal is emitted when the URI of the uri handler has changed.
virtual Glib::ustring | get_uri_vfunc () const
| Virtual method which should be implemented to return the URI currently handled by the element.
virtual bool | set_uri_vfunc (const Glib::ustring& uri)
| Virtual method which should be implemented to set a new URI.
## Static Public Member Functions
static void | add_interface (GType gtype_implementer)
static bool | protocol_is_valid (const Glib::ustring& protocol)
| Tests if the given string is a valid protocol identifier.
static bool | protocol_is_supported (const URIType type, const Glib::ustring& protocol)
| Checks if an element exists that supports the given URI protocol.
static bool | uri_is_valid (const Glib::ustring& uri)
| Tests if the given string is a valid URI identifier.
static bool | uri_has_protocol (const Glib::ustring& uri, const Glib::ustring& protocol)
| Checks if the protocol of a given valid URI matches protocol.
static Glib::ustring | get_protocol (const Glib::ustring& uri)
| Extracts the protocol out of a given valid URI.
static Glib::ustring | get_location (const Glib::ustring& uri)
| Extracts the location out of a given valid URI, ie.
static Glib::ustring | construct_uri (const Glib::ustring& protocol, const Glib::ustring& location)
| Constructs a URI for a given valid protocol and location.
static Glib::RefPtr<Gst::Element> | make_element_from_uri (const URIType type, const Glib::ustring& uri, const Glib::ustring& name)
| Creates an element for handling the given URI.
## Protected Member Functions
virtual void | on_new_uri (const Glib::ustring& uri)
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr<Gst::URIHandler> | wrap (GstURIHandler* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Gst::URIHandler - An interface to ease URI handling in plugins.

The Gst::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 (make_element_from_uri()).

Source and Sink plugins should implement this interface when possible.

Last reviewed on 2005-11-09 (0.9.4)

## Constructor & Destructor Documentation

virtual Gst::URIHandler::~URIHandler | ( |  | ) | `[virtual]`

## Member Function Documentation

static void Gst::URIHandler::add_interface | ( | GType | gtype_implementer | ) | `[static]`

static Glib::ustring Gst::URIHandler::construct_uri | ( | const Glib::ustring & | protocol,
|  | const Glib::ustring & | location |
| ) |  |  | `[static]`

Constructs a URI for a given valid protocol and location.

Parameters:

  | protocol | Protocol for URI.
  | location | Location for URI.

Returns:
  A new string for this URI. Returns `0` if the given URI protocol is not valid, or the given location is `0`.

static Glib::ustring Gst::URIHandler::get_location | ( | const Glib::ustring & | uri | ) | `[static]`

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 Glib::free().

Parameters:

  | uri | A URI string.

Returns:
  The location for this URI. Returns `0` if the URI isn't valid. If the URI does not contain a location, an empty string is returned.

static Glib::ustring Gst::URIHandler::get_protocol | ( | const Glib::ustring & | uri | ) | `[static]`

Extracts the protocol out of a given valid URI.

The returned string must be freed using Glib::free().

Parameters:

  | uri | A URI string.

Returns:
  The protocol for this URI.

Glib::StringArrayHandle Gst::URIHandler::get_protocols | ( |  | ) | const

Gets the list of protocols supported by handler.

This list may not be modified.

Returns `0` if the handler isn't implemented properly, or the handler

Returns:
  `0` if the handler isn't implemented properly, or the handler doesn't support any protocols.

Glib::ustring Gst::URIHandler::get_uri | ( |  | ) | const

Gets the currently handled URI.

Returns `0` if there are no URI currently handled. The returned

Returns:
  `0` if there are no URI currently handled. The returned string must not be modified or freed.

guint Gst::URIHandler::get_uri_type | ( |  | ) | const

Gets the type of the given URI handler.

Returns Gst::URI_UNKNOWN if the handler isn't implemented correctly.

Returns:
  Gst::URI_UNKNOWN if the handler isn't implemented correctly.

virtual Glib::ustring Gst::URIHandler::get_uri_vfunc | ( |  | ) | const`[virtual]`

Virtual method which should be implemented to return the URI currently handled by the element.

const GstURIHandler* Gst::URIHandler::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented in Gst::FdSink, Gst::FdSrc, Gst::FileSink, Gst::FileSrc, Gst::GioSink, and Gst::GioSrc.

GstURIHandler* Gst::URIHandler::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented in Gst::FdSink, Gst::FdSrc, Gst::FileSink, Gst::FileSrc, Gst::GioSink, and Gst::GioSrc.

static Glib::RefPtr<Gst::Element> Gst::URIHandler::make_element_from_uri | ( | const URIType | type,
|  | const Glib::ustring & | uri,
|  | const Glib::ustring & | name |
| ) |  |  | `[static]`

Creates an element for handling the given URI.

Parameters:

  | type | Whether to create a source or a sink.
  | uri | URI to create an element for.
  | elementname | Name of created element, can be `0`.

Returns:
  A new element or `0` if none could be created.

void Gst::URIHandler::new_uri | ( | const Glib::ustring & | 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.

Parameters:

  | uri | New URI or `0` if it was unset.

virtual void Gst::URIHandler::on_new_uri | ( | const Glib::ustring & | uri | ) | `[protected, virtual]`

static bool Gst::URIHandler::protocol_is_supported | ( | const URIType | type,
|  | const Glib::ustring & | protocol |
| ) |  |  | `[static]`

Checks if an element exists that supports the given URI protocol.

Note that a positive return value does not imply that a subsequent call to Gst::Element::make_from_uri() is guaranteed to work.

Parameters:

  | type | Whether to check for a source or a sink.
  | protocol | Protocol that should be checked for (e.g. "http" or "smb").

Returns:
  `true`

Since: 0.10.13.

static bool Gst::URIHandler::protocol_is_valid | ( | const Glib::ustring & | protocol | ) | `[static]`

Tests if the given string is a valid protocol identifier.

Protocols must consist of alphanumeric characters, '+', '-' and '.' and must start with a alphabetic character. See RFC 3986 Section 3.1.

Parameters:

  | protocol | A string.

Returns:
  `true` if the string is a valid protocol identifier, `false` otherwise.

bool Gst::URIHandler::set_uri | ( | const Glib::ustring & | uri | ) |

Tries to set the URI of the given handler.

Parameters:

  | uri | URI to set.

Returns:
  `true` if the URI was set successfully, else `false`.

virtual bool Gst::URIHandler::set_uri_vfunc | ( | const Glib::ustring & | uri | ) | `[virtual]`

Virtual method which should be implemented to set a new URI.

Glib::SignalProxy1< void,const Glib::ustring& > Gst::URIHandler::signal_new_uri | ( |  | ) |

This signal is emitted when the URI of the uri handler has changed.

Prototype:
  `void on_my_new_uri(const Glib::ustring& uri)`

static bool Gst::URIHandler::uri_has_protocol | ( | const Glib::ustring & | uri,
|  | const Glib::ustring & | protocol |
| ) |  |  | `[static]`

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

Parameters:

  | uri | An URI string.
  | protocol | A protocol string (e.g. "http").

Returns:
  `true` if the protocol matches.

Since: 0.10.4.

static bool Gst::URIHandler::uri_is_valid | ( | const Glib::ustring & | uri | ) | `[static]`

Tests if the given string is a valid URI identifier.

URIs start with a valid scheme followed by ":" and maybe a string identifying the location.

Parameters:

  | uri | A URI string.

Returns:
  `true` if the string is a valid URI.

## Friends And Related Function Documentation

Glib::RefPtr<Gst::URIHandler> wrap | ( | GstURIHandler * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- urihandler.h