Data Structures | Defines | Functions

vlc_url.h File Reference

This file defines functions for manipulating URL in vlc. More...

Include dependency graph for vlc_url.h:

Go to the source code of this file.

Data Structures

struct  vlc_url_t

Defines

#define I(i, a, b)   ( (a) <= (i) && (i) <= (b) )

Functions

VLC_API char * decode_URI_duplicate (const char *psz)
 Decode encoded URI component.
VLC_API char * decode_URI (char *psz)
 Decode an encoded URI component in place.
VLC_API char * encode_URI_component (const char *psz)
 Encodes a URI component (RFC3986 §2).
VLC_API char * make_URI (const char *path, const char *scheme)
 Convert a file path to a URI.
VLC_API char * make_path (const char *url)
 Tries to convert a URI to a local (UTF-8-encoded) file path.
static void vlc_UrlParse (vlc_url_t *url, const char *psz_url, char option)
static void vlc_UrlClean (vlc_url_t *url)
static int vlc_UrlIsNotEncoded (const char *psz_url)
 Check whether a given string is not a valid URL and must hence be encoded.

Detailed Description

This file defines functions for manipulating URL in vlc.


Define Documentation

#define I (   i,
  a,
  b 
)    ( (a) <= (i) && (i) <= (b) )

Function Documentation

VLC_API char* decode_URI ( char *  psz  ) 

Decode an encoded URI component in place.

This function does NOT decode entire URIs. It decodes components (e.g. host name, directory, file name). Decoded URIs do not exist in the real world (see RFC3986 §2.4). Complete URIs are always "encoded" (or they are syntaxically invalid).

Note that URI encoding is different from Javascript escaping. Especially, white spaces and Unicode non-ASCII code points are encoded differently.

Returns:
psz on success, NULL if it was not properly encoded

Referenced by decode_URI_duplicate(), input_item_SetURI(), make_path(), and vlc_UrlParse().

VLC_API char* decode_URI_duplicate ( const char *  psz  ) 

Decode encoded URI component.

See also decode_URI().

Returns:
decoded duplicated string

References decode_URI(), and strdup().

Referenced by test_decode().

VLC_API char* encode_URI_component ( const char *  psz_uri  ) 

Encodes a URI component (RFC3986 §2).

Parameters:
psz_uri nul-terminated UTF-8 representation of the component. Obviously, you can't pass a URI containing a nul character, but you don't want to do that, do you?
Returns:
encoded string (must be free()'d), or NULL for ENOMEM.

References encode_URI_bytes().

VLC_API char* make_path ( const char *  url  ) 

Tries to convert a URI to a local (UTF-8-encoded) file path.

Parameters:
url URI to convert
Returns:
NULL on error, a nul-terminated string otherwise (use free() to release it)

References asprintf(), decode_URI(), strdup(), strncasecmp(), strndup(), and unlikely.

Referenced by get_path(), input_item_WriteMeta(), and subtitles_Detect().

VLC_API char* make_URI ( const char *  path,
const char *  scheme 
)

Convert a file path to a URI.

If already a URI, return a copy of the string.

Parameters:
path path to convert (or URI to copy)
scheme URI scheme to use (default is auto: "file", "fd" or "smb")
Returns:
a nul-terminated URI string (use free() to release it), or NULL in case of error

References asprintf(), DIR_SEP, DIR_SEP_CHAR, encode_URI_bytes(), make_URI(), SMB_SCHEME, strdup(), and vlc_getcwd().

Referenced by Control(), GetFilenames(), libvlc_InternalInit(), LoadSlaves(), make_URI(), make_URI_def(), playlist_FindArtInCache(), playlist_Import(), playlist_MLLoad(), playlist_SaveArt(), SubtitleAdd(), vlm_ControlMediaInstanceStart(), vlm_OnMediaUpdate(), and WMCOPYWNDPROC().

static void vlc_UrlClean ( vlc_url_t url  )  [inline, static]
static int vlc_UrlIsNotEncoded ( const char *  psz_url  )  [inline, static]

Check whether a given string is not a valid URL and must hence be encoded.

static void vlc_UrlParse ( vlc_url_t url,
const char *  psz_url,
char  option 
) [inline, static]
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines