VLC  2.1.0-git
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | 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

Functions

char * vlc_path2uri (const char *path, const char *scheme)
 Builds a URL representation from a local file path.
char * decode_URI_duplicate (const char *psz)
 Decodes an encoded URI component.
char * decode_URI (char *psz)
 Decodes an encoded URI component in place.
char * encode_URI_component (const char *psz)
 Encodes a URI component (RFC3986 §2).
char * make_path (const char *url)
 Tries to convert a URI to a local (UTF-8-encoded) file path.
void vlc_UrlParse (vlc_url_t *, const char *, unsigned char)
void vlc_UrlClean (vlc_url_t *)

Detailed Description

This file defines functions for manipulating URL in vlc.

Function Documentation

char* decode_URI ( char *  str)

Decodes an encoded URI component in place.

This function does NOT decode entire URIs. Instead, it decodes one component at a time (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.

Parameters
strnul-terminated URI component to decode
Returns
str on success, NULL if it was not properly encoded

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

char* decode_URI_duplicate ( const char *  str)

Decodes an encoded URI component.

See also decode_URI().

Returns
decoded string allocated on the heap, or NULL on error.

References decode_URI(), and strdup().

Referenced by test_decode().

char* encode_URI_component ( const char *  str)

Encodes a URI component (RFC3986 §2).

Parameters
strnul-terminated UTF-8 representation of the component.
Note
Obviously, a URI containing nul bytes cannot be passed.
Returns
encoded string (must be free()'d), or NULL for ENOMEM.

References encode_URI_bytes(), and likely.

char* make_path ( const char *  url)

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

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

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

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

char* vlc_path2uri ( const char *  path,
const char *  scheme 
)

Builds a URL representation from a local file path.

Parameters
pathpath to convert (or URI to copy)
schemeURI 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(), SMB_SCHEME, strdup(), unlikely, vlc_getcwd(), and vlc_path2uri().

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

void vlc_UrlClean ( vlc_url_t )
void vlc_UrlParse ( vlc_url_t ,
const char *  ,
unsigned  char 
)