Defines | Functions

chain.c File Reference

Include dependency graph for chain.c:

Defines

#define SKIPSPACE(p)   p += strspn( p, " \t" )
#define SKIPTRAILINGSPACE(p, e)   do { while( e > p && IsSpace( *(e-1) ) ) e--; } while(0)

Functions

static bool IsEscapeNeeded (char c)
static bool IsEscape (const char *psz)
static bool IsSpace (char c)
static const char * ChainGetEnd (const char *psz_string)
 This function will return a pointer after the end of a string element.
static char * ChainGetValue (const char **ppsz_string)
 It will extract an option value (=...
const char * config_ChainParseOptions (config_chain_t **pp_cfg, const char *psz_opts)
 This function will parse a configuration string (psz_opts) and

  • set all options for this module in a chained list (*pp_cfg)
  • returns a pointer on the next module if any.

char * config_ChainCreate (char **ppsz_name, config_chain_t **pp_cfg, const char *psz_chain)
 This function will parse a configuration string (psz_string) and

  • set the module name (*ppsz_name)
  • set all options for this module in a chained list (*pp_cfg)
  • returns a pointer on the next module if any.

void config_ChainDestroy (config_chain_t *p_cfg)
 This function will release a linked list of config_chain_t (Including the head).
void config_ChainParse (vlc_object_t *p_this, const char *psz_prefix, const char *const *ppsz_options, config_chain_t *cfg)
 This function will

  • create all options in the array ppsz_options (var_Create).

config_chain_tconfig_ChainDuplicate (const config_chain_t *p_src)
 This function will duplicate a linked list of config_chain_t.
char * config_StringUnescape (char *psz_string)
 This function will unescape a string in place and will return a pointer on the given string.
char * config_StringEscape (const char *str)
 This function will escape a string that can be unescaped by config_StringUnescape.

Define Documentation

#define SKIPSPACE (   p  )     p += strspn( p, " \t" )
#define SKIPTRAILINGSPACE (   p,
  e 
)    do { while( e > p && IsSpace( *(e-1) ) ) e--; } while(0)

Referenced by ChainGetValue().


Function Documentation

static const char* ChainGetEnd ( const char *  psz_string  )  [static]

This function will return a pointer after the end of a string element.

It will search the closing element which is } for { (it will handle nested { ... }) " for " ' for '

References IsEscape(), and SKIPSPACE.

Referenced by ChainGetValue().

static char* ChainGetValue ( const char **  ppsz_string  )  [static]

It will extract an option value (=...

or {...}). It will remove the initial = if present but keep the {}

References ChainGetEnd(), config_StringUnescape(), psz_value, SKIPSPACE, SKIPTRAILINGSPACE, and strndup().

Referenced by config_ChainParseOptions().

char* config_ChainCreate ( char **  ppsz_name,
config_chain_t **  pp_cfg,
const char *  psz_string 
)

This function will parse a configuration string (psz_string) and

  • set the module name (*ppsz_name)
  • set all options for this module in a chained list (*pp_cfg)
  • returns a pointer on the next module if any.

The string format is module{option=*,option=*}[:modulenext{option=*,...}]

The options values are unescaped using config_StringUnescape.

References config_ChainParseOptions(), SKIPSPACE, strdup(), and strndup().

Referenced by filter_chain_AppendFromStringInternal(), intf_Create(), sout_AccessOutNew(), sout_MuxNew(), sout_StreamChainNew(), ThreadChangeFilters(), and vlc_sd_Create().

void config_ChainDestroy ( config_chain_t p_cfg  ) 
config_chain_t* config_ChainDuplicate ( const config_chain_t p_src  ) 

This function will duplicate a linked list of config_chain_t.

References config_chain_t::p_next, config_chain_t::psz_name, config_chain_t::psz_value, and strdup().

void config_ChainParse ( vlc_object_t ,
const char *  psz_prefix,
const char *const *  ppsz_options,
config_chain_t  
)

This function will

  • create all options in the array ppsz_options (var_Create).

  • parse the given linked list of config_chain_t and set the value (var_Set).

The option names will be created by adding the psz_prefix prefix.

References vlc_value_t::b_bool, module_config_t::b_removed, config_FindConfig(), config_GetType, vlc_value_t::f_float, vlc_value_t::i_int, i_type, msg_Dbg, msg_Err, msg_Warn, name, config_chain_t::p_next, psz_name, config_chain_t::psz_name, vlc_value_t::psz_string, config_chain_t::psz_value, us_atof(), var_Create, var_Get, var_Set, VLC_VAR_BOOL, VLC_VAR_DOINHERIT, VLC_VAR_FLOAT, VLC_VAR_INTEGER, and VLC_VAR_STRING.

const char* config_ChainParseOptions ( config_chain_t **  pp_cfg,
const char *  ppsz_opts 
)

This function will parse a configuration string (psz_opts) and

  • set all options for this module in a chained list (*pp_cfg)
  • returns a pointer on the next module if any.

The string format is module{option=*,option=*}

The options values are unescaped using config_StringUnescape.

References ChainGetValue(), config_chain_t::p_next, config_chain_t::psz_name, config_chain_t::psz_value, SKIPSPACE, and strndup().

Referenced by config_ChainCreate().

char* config_StringEscape ( const char *  psz_string  ) 

This function will escape a string that can be unescaped by config_StringUnescape.

The returned value is allocated by it. You have to free it once you do not need it anymore (unlike config_StringUnescape). If NULL is given as parameter nothing will be done (NULL will be returned).

The escaped characters are ' " and \

References IsEscapeNeeded(), and xmalloc().

char* config_StringUnescape ( char *  psz_string  ) 

This function will unescape a string in place and will return a pointer on the given string.

No memory is allocated by it (unlike config_StringEscape). If NULL is given as parameter nothing will be done (NULL will be returned).

The following sequences will be unescaped (only one time): \ \' and "

References IsEscape().

Referenced by ChainGetValue().

static bool IsEscape ( const char *  psz  )  [static]

References IsEscapeNeeded().

Referenced by ChainGetEnd(), and config_StringUnescape().

static bool IsEscapeNeeded ( char  c  )  [static]

Referenced by config_StringEscape(), and IsEscape().

static bool IsSpace ( char  c  )  [static]
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines