Gjsify LogoGjsify Logo

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

record

Hierarchy

  • Uri

Index

Constructors

  • new Uri(scheme: string, userinfo: string, host: string, port: number, path: string, query: string, fragment: string): Gst.Uri
  • Creates a new #GstUri object with the given URI parts. The path and query strings will be broken down into their elements. All strings should not be escaped except where indicated.

    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.

    • path: string

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

    • query: string

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

    • fragment: string

      The fragment name for the new URI.

    Returns Gst.Uri

Properties

name: string

Methods

  • append_path(relative_path: string): boolean
  • 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

    • relative_path: string

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

    Returns boolean

  • append_path_segment(path_segment: string): boolean
  • Append a single path segment onto the end of the URI path.

    Parameters

    • path_segment: string

      The path segment string to append to the URI path.

    Returns boolean

  • equal(second: Gst.Uri): boolean
  • Compares two #GstUri objects to see if they represent the same normalized URI.

    Parameters

    • second: Gst.Uri

      Second #GstUri to compare.

    Returns boolean

  • from_string_with_base(uri: string): Gst.Uri
  • get_fragment(): string
  • Get the fragment name from the URI or %NULL if it doesn't exist. If uri is %NULL then returns %NULL.

    Returns string

  • get_host(): string
  • Get the host name from the URI or %NULL if it doesn't exist. If uri is %NULL then returns %NULL.

    Returns string

  • get_media_fragment_table(): HashTable<string | number | symbol, string | number | boolean>
  • 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 #GHashTable 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 HashTable<string | number | symbol, string | number | boolean>

  • get_path(): string
  • get_path_segments(): string[]
  • get_path_string(): string
  • get_port(): number
  • 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

  • get_query_keys(): string[]
  • get_query_string(): string
  • get_query_table(): HashTable<string | number | symbol, string | number | boolean>
  • 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 #GHashTable with #g_hash_table_unref() when it is no longer required. Modifying this hash table will modify the query in the URI.

    Returns HashTable<string | number | symbol, string | number | boolean>

  • get_query_value(query_key: string): string
  • 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

  • get_scheme(): string
  • Get the scheme name from the URI or %NULL if it doesn't exist. If uri is %NULL then returns %NULL.

    Returns string

  • get_userinfo(): string
  • 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

  • is_normalized(): boolean
  • is_writable(): boolean
  • Check if it is safe to write to this #GstUri.

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

    Modification of a #GstUri should only be done after verifying that it is writable.

    Returns boolean

  • 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

    • ref_uri: Gst.Uri

      The reference URI to join onto the base URI.

    Returns Gst.Uri

  • Make the #GstUri 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 #GstUri. If uri is %NULL then %NULL is returned.

    Returns Gst.Uri

  • new_with_base(scheme: string, userinfo: string, host: string, port: number, path: string, query: string, fragment: string): Gst.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.

    • path: string

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

    • query: string

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

    • fragment: string

      The fragment name for the new URI.

    Returns Gst.Uri

  • normalize(): boolean
  • 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 #GstUri object must be writable. Check with gst_uri_is_writable() or use gst_uri_make_writable() first.

    Returns boolean

  • query_has_key(query_key: string): boolean
  • Check if there is a query table entry for the query_key key.

    Parameters

    • query_key: string

      The key to lookup.

    Returns boolean

  • remove_query_key(query_key: string): boolean
  • Remove an entry from the query table by key.

    Parameters

    • query_key: string

      The key to remove.

    Returns boolean

  • set_fragment(fragment: string): boolean
  • Sets the fragment string in the URI. Use a value of %NULL in fragment to unset the fragment string.

    Parameters

    • fragment: string

      The fragment string to set.

    Returns boolean

  • set_host(host: string): boolean
  • Set or unset the host for the URI.

    Parameters

    • host: string

      The new host string to set or %NULL to unset.

    Returns boolean

  • set_path(path: string): boolean
  • Sets or unsets the path in the URI.

    Parameters

    • path: string

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

    Returns boolean

  • set_path_segments(path_segments: string[]): boolean
  • Replace the path segments list in the URI.

    Parameters

    • path_segments: string[]

      The new path list to set.

    Returns boolean

  • set_path_string(path: string): boolean
  • 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

  • set_port(port: number): boolean
  • 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

  • set_query_string(query: string): boolean
  • Sets or unsets the query table in the URI.

    Parameters

    • query: string

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

    Returns boolean

  • set_query_table(query_table: HashTable<string | number | symbol, string | number | boolean>): boolean
  • 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

    • query_table: HashTable<string | number | symbol, string | number | boolean>

      The new query table to use.

    Returns boolean

  • set_query_value(query_key: string, query_value: string): boolean
  • 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.

    • query_value: string

      The value for the key.

    Returns boolean

  • set_scheme(scheme: string): boolean
  • Set or unset the scheme for the URI.

    Parameters

    • scheme: string

      The new scheme to set or %NULL to unset the scheme.

    Returns boolean

  • set_userinfo(userinfo: string): boolean
  • 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

  • to_string(): string
  • 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

  • unref(): void
  • Decrement the reference count to this #GstUri object.

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

    See gst_mini_object_unref() for further info.

    Returns void

  • construct(protocol: string, location: string): string
  • 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

  • from_string(uri: string): Gst.Uri
  • Parses a URI string into a new #GstUri object. Will return NULL if the URI cannot be parsed.

    Parameters

    • uri: string

      The URI string to parse.

    Returns Gst.Uri

  • from_string_escaped(uri: string): Gst.Uri
  • Parses a URI string into a new #GstUri 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

  • get_location(uri: string): string
  • 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

  • get_protocol(uri: string): 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

  • has_protocol(uri: string, protocol: string): boolean
  • 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

  • is_valid(uri: string): 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

  • join_strings(base_uri: string, ref_uri: string): string
  • 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

  • new(scheme: string, userinfo: string, host: string, port: number, path: string, query: string, fragment: string): Gst.Uri
  • Creates a new #GstUri object with the given URI parts. The path and query strings will be broken down into their elements. All strings should not be escaped except where indicated.

    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.

    • path: string

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

    • query: string

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

    • fragment: string

      The fragment name for the new URI.

    Returns Gst.Uri

  • protocol_is_supported(type: Gst.URIType, protocol: string): boolean
  • 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

  • protocol_is_valid(protocol: string): 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

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method