## gstrtspurl

gstrtspurl — handling RTSP urls

## Synopsis

    #include <gst/rtsp/gstrtspurl.h>

    #define             GST_RTSP_DEFAULT_PORT
    struct              GstRTSPUrl;
    GstRTSPResult       gst_rtsp_url_parse                  (const gchar *urlstr,
                                                             GstRTSPUrl **url);
    GstRTSPUrl *        gst_rtsp_url_copy                   (const GstRTSPUrl *url);
    void                gst_rtsp_url_free                   (GstRTSPUrl *url);
    gchar *             gst_rtsp_url_get_request_uri        (const GstRTSPUrl *url);
    GstRTSPResult       gst_rtsp_url_set_port               (GstRTSPUrl *url,
                                                             guint16 port);
    GstRTSPResult       gst_rtsp_url_get_port               (const GstRTSPUrl *url,
                                                             guint16 *port);
    gchar **            gst_rtsp_url_decode_path_components (const GstRTSPUrl *url);

## Description

Provides helper functions to handle RTSP urls. Last reviewed on 2007-07-25 (0.10.14)

## Details

### GST_RTSP_DEFAULT_PORT

    #define GST_RTSP_DEFAULT_PORT       554

The default RTSP port to connect to.

### struct GstRTSPUrl

    struct GstRTSPUrl {
      GstRTSPLowerTrans  transports;
      GstRTSPFamily      family;
      gchar             *user;
      gchar             *passwd;
      gchar             *host;
      guint16            port;
      gchar             *abspath;
      gchar             *query;
    };

This structure contains the result of a parsed RTSP URL

GstRTSPLowerTrans `transports`; | the transports allowed
GstRTSPFamily `family`; | the family
gchar *`user`; | the user
gchar *`passwd`; | the password
gchar *`host`; | the host
guint16 `port`; | the port
gchar *`abspath`; | the absolute path
gchar *`query`; | additional query parameters

### gst_rtsp_url_parse ()

    GstRTSPResult       gst_rtsp_url_parse                  (const gchar *urlstr,
                                                             GstRTSPUrl **url);

Parse the RTSP `urlstr` into a newly allocated GstRTSPUrl. Free after usage with `gst_rtsp_url_free()`.

`urlstr` : | the url string to parse
`url` : | location to hold the result.
Returns : | a GstRTSPResult.

### gst_rtsp_url_copy ()

    GstRTSPUrl *        gst_rtsp_url_copy                   (const GstRTSPUrl *url);

Make a copy of `url`.

`url` : | a GstRTSPUrl
Returns : | a copy of `url`. Free with `gst_rtsp_url_free()` after usage.

Since 0.10.22

### gst_rtsp_url_free ()

    void                gst_rtsp_url_free                   (GstRTSPUrl *url);

Free the memory used by `url`.

`url` : | a GstRTSPUrl

### gst_rtsp_url_get_request_uri ()

    gchar *             gst_rtsp_url_get_request_uri        (const GstRTSPUrl *url);

Get a newly allocated string describing the request URI for `url`.

`url` : | a GstRTSPUrl
Returns : | a string with the request URI. `g_free()` after usage.

### gst_rtsp_url_set_port ()

    GstRTSPResult       gst_rtsp_url_set_port               (GstRTSPUrl *url,
                                                             guint16 port);

Set the port number in `url` to `port`.

`url` : | a GstRTSPUrl
`port` : | the port
Returns : | GST_RTSP_OK.

### gst_rtsp_url_get_port ()

    GstRTSPResult       gst_rtsp_url_get_port               (const GstRTSPUrl *url,
                                                             guint16 *port);

Get the port number of `url`.

`url` : | a GstRTSPUrl
`port` : | location to hold the port
Returns : | GST_RTSP_OK.

### gst_rtsp_url_decode_path_components ()

    gchar **            gst_rtsp_url_decode_path_components (const GstRTSPUrl *url);

Splits the path of `url` on '/' boundaries, decoding the resulting components,

The decoding performed by this routine is "URI decoding", as defined in RFC 3986, commonly known as percent-decoding. For example, a string "foo%2fbar" will decode to "foo/bar" -- the %2f being replaced by the corresponding byte with hex value 0x2f. Note that there is no guarantee that the resulting byte sequence is valid in any given encoding. As a special case, %00 is not unescaped to NUL, as that would prematurely terminate the string.

Also note that since paths usually start with a slash, the first component will usually be the empty string.

`url` : | a GstRTSPUrl
Returns : | a string vector. `g_strfreev()` after usage.

Since 0.10.32