diff options
author | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-01-21 10:45:53 +0000 |
---|---|---|
committer | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-01-21 10:45:53 +0000 |
commit | 5fafd19ee28c13e90f1af33db15480ed2a42324f (patch) | |
tree | cd3797a4a6ca271690e78b0a838f0bf33ca90c54 /cfgparser.h | |
parent | f4acdd0f5eb6feb63cff216680959364880a3641 (diff) | |
download | mpv-5fafd19ee28c13e90f1af33db15480ed2a42324f.tar.bz2 mpv-5fafd19ee28c13e90f1af33db15480ed2a42324f.tar.xz |
Bug fix for subconfig option. A -tv option containing the on parameter
is now take as an entry. New functions to set/get options and know
if an option is alredy set. A few comments.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4293 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'cfgparser.h')
-rw-r--r-- | cfgparser.h | 92 |
1 files changed, 83 insertions, 9 deletions
diff --git a/cfgparser.h b/cfgparser.h index f340141a4b..bb36a32f05 100644 --- a/cfgparser.h +++ b/cfgparser.h @@ -46,6 +46,8 @@ struct config { unsigned int type; unsigned int flags; float min,max; + /* Use this field when your need to do something before a new value is + assigned to your option */ cfg_default_func_t default_func; }; @@ -57,6 +59,7 @@ struct m_config { int cs_level; int parser_mode; /* COMMAND_LINE or CONFIG_FILE */ int flags; + char* sub_conf; // When we save a subconfig play_tree_t* pt; // play tree we use for playlist option, etc play_tree_t* last_entry; // last added entry play_tree_t* last_parent; // if last_entry is NULL we must create child of this @@ -87,29 +90,100 @@ int m_config_parse_config_file(m_config_t *config, char *conffile); /* parse_command_line returns: * -1 on error (invalid option...) - * 0 if there was no filename on command line - * 1 if there were filenames + * 1 otherwise */ int m_config_parse_command_line(m_config_t* config, int argc, char **argv, char **envp); +m_config_t* m_config_new(play_tree_t* pt); + +void m_config_free(m_config_t* config); + +void m_config_push(m_config_t* config); + +/* + * Return 0 on error 1 on success + */ +int m_config_pop(m_config_t* config); -void m_config_register_options(m_config_t *config,config_t *args); +/* + * Return 0 on error 1 on success + */ +int m_config_register_options(m_config_t *config,config_t *args); +/* + * For all the following function when it's a subconfig option + * you must give an option name like 'tv:channel' and not just + * 'channel' + */ + +/* + * Return 1 on sucess 0 on failure + */ int m_config_set_option(m_config_t *config,char *opt, char *param); +/* + * Get the config struct defining an option + * Return NULL on error + */ config_t* m_config_get_option(m_config_t *config, char* arg); +/* + * Get the p field of the struct defining an option + * Return NULL on error + */ +void* m_config_get_option_ptr(m_config_t *config, char* arg); + +/* + * Tell is an option is alredy set or not + * Return -1 one error (requested option arg exist) + * Otherwise 0 or 1 + */ +int m_config_is_option_set(m_config_t *config, char* arg); + +/* + * Return 0 on error 1 on success + */ int m_config_switch_flag(m_config_t *config, char* opt); -void m_config_set_flag(m_config_t *config, char* opt, int max); +/* + * Return 0 on error 1 on success + */ +int m_config_set_flag(m_config_t *config, char* opt, int max); -void* m_config_get_option_ptr(m_config_t *config, char* arg); +/* + * Return the value of a flag (O or 1) and -1 on error + */ +int m_config_get_flag(m_config_t *config, char* opt); -m_config_t* m_config_new(play_tree_t* pt); +/* + * Set the value of an int option + * Return 0 on error 1 on success + */ +int +m_config_set_int(m_config_t *config, char* arg,int val); -void m_config_free(m_config_t* config); +/* + * Get the value of an int option + * Return the option value or -1 on error + * If err_ret is not NULL it's set to 1 on error + */ +int +m_config_get_int (m_config_t *config, char* arg,int* err_ret); -void m_config_push(m_config_t* config); +/* + * Set the value of a float option + * Return 0 on error 1 on success + */ +int +m_config_set_float(m_config_t *config, char* arg,float val); + + +/* + * Get the value of a float option + * Return the option value or -1 on error + * If err_ret is not NULL it's set to 1 on error + */ +float +m_config_get_float (m_config_t *config, char* arg,int* err_ret); -int m_config_pop(m_config_t* config); #endif /* __CONFIG_H */ |