Class (GI Struct)

Gst-1.0GstUri

A Gst.Uri object can be used to parse and split a URI string into its constituent parts. Two Gst.Uri objects can be joined to make a new Gst.Uri using the algorithm described in RFC3986.

Index

Constructors

  • Parameters

    • scheme: string
    • userinfo: string
    • host: string
    • port: number
    • Optionalpath: string
    • Optionalquery: string
    • Optionalfragment: string

    Returns Gst.Uri

Properties

$gtype: GType<Gst.Uri>

Methods

  • Append a path onto the end of the path in the URI. The path is not normalized, call gst_uri_normalize() to normalize the path.

    Parameters

    • Optionalrelative_path: string

      Relative path to append to the end of the current path.

    Returns boolean

    true if the path was appended successfully.

  • Append a single path segment onto the end of the URI path.

    Parameters

    • Optionalpath_segment: string

      The path segment string to append to the URI path.

    Returns boolean

    true if the path was appended successfully.

  • Compares two Gst.Uri objects to see if they represent the same normalized URI.

    Parameters

    Returns boolean

    true if the normalized versions of the two URI's would be equal.

  • Get the fragment name from the URI or null if it doesn't exist. If uri is null then returns null.

    Returns string

    The host name from the Gst.Uri object or null.

  • Get the host name from the URI or null if it doesn't exist. If uri is null then returns null.

    Returns string

    The host name from the Gst.Uri object or null.

  • Get the media fragment table from the URI, as defined by "Media Fragments URI 1.0". Hash table returned by this API is a list of "key-value" pairs, and the each pair is generated by splitting "URI fragment" per "&" sub-delims, then "key" and "value" are split by "=" sub-delims. The "key" returned by this API may be undefined keyword by standard. A value may be null to indicate that the key should appear in the fragment string in the URI, but does not have a value. Free the returned GLib.HashTable with g_hash_table_unref() when it is no longer required. Modifying this hash table does not affect the fragment in the URI.

    See more about Media Fragments URI 1.0 (W3C) at https://www.w3.org/TR/media-frags/

    Returns GLib.HashTable<string, string>

    The fragment hash table from the URI.

  • Extract the path string from the URI object.

    Returns string

    The path from the URI. Once finished with the string should be g_free()'d.

  • Get a list of path segments from the URI.

    Returns string[]

    A GLib.List of path segment strings or null if no path segments are available. Free the list when no longer needed with g_list_free_full(list, g_free).

  • Extract the path string from the URI object as a percent encoded URI path.

    Returns string

    The path from the URI. Once finished with the string should be g_free()'d.

  • Get the port number from the URI or GST_URI_NO_PORT if it doesn't exist. If uri is null then returns GST_URI_NO_PORT.

    Returns number

    The port number from the Gst.Uri object or GST_URI_NO_PORT.

  • Get a list of the query keys from the URI.

    Returns string[]

    A list of keys from the URI query. Free the list with g_list_free().

  • Get a percent encoded URI query string from the uri.

    Returns string

    A percent encoded query string. Use g_free() when no longer needed.

  • Get a percent encoded URI query string from the uri, with query parameters in the order provided by the keys list. Only parameter keys in the list will be added to the resulting URI string. This method can be used by retrieving the keys with gst_uri_get_query_keys() and then sorting the list, for example.

    Parameters

    • Optionalkeys: string[]

      A GList containing the query argument key strings.

    Returns string

    A percent encoded query string. Use g_free() when no longer needed.

  • Get the query table from the URI. Keys and values in the table are freed with g_free when they are deleted. A value may be null to indicate that the key should appear in the query string in the URI, but does not have a value. Free the returned GLib.HashTable with g_hash_table_unref() when it is no longer required. Modifying this hash table will modify the query in the URI.

    Returns GLib.HashTable<string, string>

    The query hash table from the URI.

  • Get the value associated with the query_key key. Will return null if the key has no value or if the key does not exist in the URI query table. Because null is returned for both missing keys and keys with no value, you should use gst_uri_query_has_key() to determine if a key is present in the URI query.

    Parameters

    • query_key: string

      The key to lookup.

    Returns string

    The value for the given key, or null if not found.

  • Get the scheme name from the URI or null if it doesn't exist. If uri is null then returns null.

    Returns string

    The scheme from the Gst.Uri object or null.

  • Get the userinfo (usually in the form "username:password") from the URI or null if it doesn't exist. If uri is null then returns null.

    Returns string

    The userinfo from the Gst.Uri object or null.

  • Tests the uri to see if it is normalized. A null uri is considered to be normalized.

    Returns boolean

    TRUE if the URI is normalized or is null.

  • Check if it is safe to write to this Gst.Uri.

    Check if the refcount of uri is exactly 1, meaning that no other reference exists to the Gst.Uri and that the Gst.Uri is therefore writable.

    Modification of a Gst.Uri should only be done after verifying that it is writable.

    Returns boolean

    true if it is safe to write to the object.

  • Join a reference URI onto a base URI using the method from RFC 3986. If either URI is null then the other URI will be returned with the ref count increased.

    Parameters

    • Optionalref_uri: Gst.Uri

      The reference URI to join onto the base URI.

    Returns Gst.Uri

    A Gst.Uri which represents the base with the reference URI joined on.

  • Make the Gst.Uri writable.

    Checks if uri is writable, and if so the original object is returned. If not, then a writable copy is made and returned. This gives away the reference to uri and returns a reference to the new Gst.Uri. If uri is null then null is returned.

    Returns Gst.Uri

    A writable version of uri.

  • Like gst_uri_new(), but joins the new URI onto a base URI.

    Parameters

    • scheme: string

      The scheme for the new URI.

    • userinfo: string

      The user-info for the new URI.

    • host: string

      The host name for the new URI.

    • port: number

      The port number for the new URI or GST_URI_NO_PORT.

    • Optionalpath: string

      The path for the new URI with '/' separating path elements.

    • Optionalquery: string

      The query string for the new URI with '&' separating query elements. Elements containing '&' characters should encode them as "%26".

    • Optionalfragment: string

      The fragment name for the new URI.

    Returns Gst.Uri

    The new URI joined onto base.

  • Normalization will remove extra path segments ("." and "..") from the URI. It will also convert the scheme and host name to lower case and any percent-encoded values to uppercase.

    The Gst.Uri object must be writable. Check with gst_uri_is_writable() or use gst_uri_make_writable() first.

    Returns boolean

    TRUE if the URI was modified.

  • Check if there is a query table entry for the query_key key.

    Parameters

    • query_key: string

      The key to lookup.

    Returns boolean

    true if query_key exists in the URI query table.

  • Remove an entry from the query table by key.

    Parameters

    • query_key: string

      The key to remove.

    Returns boolean

    true if the key existed in the table and was removed.

  • Sets the fragment string in the URI. Use a value of null in fragment to unset the fragment string.

    Parameters

    • Optionalfragment: string

      The fragment string to set.

    Returns boolean

    true if the fragment was set/unset successfully.

  • Set or unset the host for the URI.

    Parameters

    • host: string

      The new host string to set or null to unset.

    Returns boolean

    true if the host was set/unset successfully.

  • Sets or unsets the path in the URI.

    Parameters

    • Optionalpath: string

      The new path to set with path segments separated by '/', or use null to unset the path.

    Returns boolean

    true if the path was set successfully.

  • Replace the path segments list in the URI.

    Parameters

    • Optionalpath_segments: string[]

      The new path list to set.

    Returns boolean

    true if the path segments were set successfully.

  • Sets or unsets the path in the URI.

    Parameters

    • path: string

      The new percent encoded path to set with path segments separated by '/', or use null to unset the path.

    Returns boolean

    true if the path was set successfully.

  • Set or unset the port number for the URI.

    Parameters

    • port: number

      The new port number to set or GST_URI_NO_PORT to unset.

    Returns boolean

    true if the port number was set/unset successfully.

  • Sets or unsets the query table in the URI.

    Parameters

    • Optionalquery: string

      The new percent encoded query string to use to populate the query table, or use null to unset the query table.

    Returns boolean

    true if the query table was set successfully.

  • Set the query table to use in the URI. The old table is unreferenced and a reference to the new one is used instead. A value if null for query_table will remove the query string from the URI.

    Parameters

    • Optionalquery_table: GLib.HashTable<string, string>

      The new query table to use.

    Returns boolean

    true if the new table was successfully used for the query table.

  • This inserts or replaces a key in the query table. A query_value of null indicates that the key has no associated value, but will still be present in the query string.

    Parameters

    • query_key: string

      The key for the query entry.

    • Optionalquery_value: string

      The value for the key.

    Returns boolean

    true if the query table was successfully updated.

  • Set or unset the scheme for the URI.

    Parameters

    • scheme: string

      The new scheme to set or null to unset the scheme.

    Returns boolean

    true if the scheme was set/unset successfully.

  • Set or unset the user information for the URI.

    Parameters

    • userinfo: string

      The new user-information string to set or null to unset.

    Returns boolean

    true if the user information was set/unset successfully.

  • Convert the URI to a string.

    Returns the URI as held in this object as a gchar* nul-terminated string. The caller should g_free() the string once they are finished with it. The string is put together as described in RFC 3986.

    Returns string

    The string version of the URI.

  • Convert the URI to a string, with the query arguments in a specific order. Only the keys in the keys list will be added to the resulting string.

    Returns the URI as held in this object as a gchar* nul-terminated string. The caller should g_free() the string once they are finished with it. The string is put together as described in RFC 3986.

    Parameters

    • Optionalkeys: string[]

      A GList containing the query argument key strings.

    Returns string

    The string version of the URI.

  • Decrement the reference count to this Gst.Uri object.

    If the reference count drops to 0 then finalize this object.

    See gst_mini_object_unref() for further info.

    Returns void

  • Constructs a URI for a given valid protocol and location.

    Free-function: g_free

    Parameters

    • protocol: string

      Protocol for URI

    • location: string

      Location for URI

    Returns string

  • Parses a URI string into a new Gst.Uri object. Will return NULL if the URI cannot be parsed. This is identical to gst_uri_from_string() except that the userinfo and fragment components of the URI will not be unescaped while parsing.

    Use this when you need to extract a username and password from the userinfo such as https://user:password@example.com since either may contain a URI-escaped ':' character. gst_uri_from_string() will unescape the entire userinfo component, which will make it impossible to know which ':' delineates the username and password.

    The same applies to the fragment component of the URI, such as https://example.com/path#fragment which may contain a URI-escaped '#'.

    Parameters

    • uri: string

      The URI string to parse.

    Returns Gst.Uri

  • 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().

    Free-function: g_free

    Parameters

    • uri: string

      A URI string

    Returns string

  • Extracts the protocol out of a given valid URI. The returned string must be freed using g_free().

    Parameters

    • uri: string

      A URI string

    Returns string

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

    Parameters

    • uri: string

      a URI string

    • protocol: string

      a protocol string (e.g. "http")

    Returns boolean

  • 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: string

      A URI string

    Returns boolean

  • This is a convenience function to join two URI strings and return the result. The returned string should be g_free()'d after use.

    Parameters

    • base_uri: string

      The percent-encoded base URI.

    • ref_uri: string

      The percent-encoded reference URI to join to the base_uri.

    Returns string

  • Parameters

    • scheme: string
    • userinfo: string
    • host: string
    • port: number
    • Optionalpath: string
    • Optionalquery: string
    • Optionalfragment: string

    Returns Gst.Uri

  • 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: Gst.URIType

      Whether to check for a source or a sink

    • protocol: string

      Protocol that should be checked for (e.g. "http" or "smb")

    Returns boolean

  • 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: string

      A string

    Returns boolean