mirror of https://github.com/mpv-player/mpv
Fix most of the mistakes pointed out by Diego.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18284 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
b04bd62cee
commit
2b54afbabb
12
m_config.h
12
m_config.h
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
/// \defgroup Config Config manager
|
/// \defgroup Config Config manager
|
||||||
///
|
///
|
||||||
/// m_config provide an API to manipulate the config variables in MPlayer.
|
/// m_config provides an API to manipulate the config variables in MPlayer.
|
||||||
/// It make use of the \ref Options API to provide a context stack that
|
/// It make uses of the \ref Options API to provide a context stack that
|
||||||
/// allow saving and later restoring the state of all variables.
|
/// allow saving and later restoring the state of all variables.
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ struct m_config_option {
|
||||||
/// \defgroup ConfigProfiles Config profiles
|
/// \defgroup ConfigProfiles Config profiles
|
||||||
/// \ingroup Config
|
/// \ingroup Config
|
||||||
///
|
///
|
||||||
/// Profiles allow to predefine some set of options that can then
|
/// Profiles allow to predefine some sets of options that can then
|
||||||
/// be applied later on with the internal -profile option.
|
/// be applied later on with the internal -profile option.
|
||||||
///
|
///
|
||||||
///@{
|
///@{
|
||||||
|
@ -65,14 +65,14 @@ struct m_profile {
|
||||||
/** \ingroup Config */
|
/** \ingroup Config */
|
||||||
typedef struct m_config {
|
typedef struct m_config {
|
||||||
/// Registered options.
|
/// Registered options.
|
||||||
/** This contain all options and suboptions.
|
/** This contains all options and suboptions.
|
||||||
*/
|
*/
|
||||||
m_config_option_t* opts;
|
m_config_option_t* opts;
|
||||||
/// Current stack level.
|
/// Current stack level.
|
||||||
int lvl;
|
int lvl;
|
||||||
/// \ref OptionParserModes
|
/// \ref OptionParserModes
|
||||||
int mode;
|
int mode;
|
||||||
/// List of the defined profiles.
|
/// List of defined profiles.
|
||||||
m_profile_t* profiles;
|
m_profile_t* profiles;
|
||||||
/// Depth when recursively including profiles.
|
/// Depth when recursively including profiles.
|
||||||
int profile_depth;
|
int profile_depth;
|
||||||
|
@ -87,7 +87,7 @@ typedef struct m_config {
|
||||||
/// Set if an option have been set at the current level.
|
/// Set if an option have been set at the current level.
|
||||||
#define M_CFG_OPT_SET (1<<0)
|
#define M_CFG_OPT_SET (1<<0)
|
||||||
|
|
||||||
/// Set if another option already use the same variable.
|
/// Set if another option already uses the same variable.
|
||||||
#define M_CFG_OPT_ALIAS (1<<1)
|
#define M_CFG_OPT_ALIAS (1<<1)
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
62
m_option.h
62
m_option.h
|
@ -2,7 +2,7 @@
|
||||||
#define _M_OPTION_H
|
#define _M_OPTION_H
|
||||||
|
|
||||||
/// \defgroup Options
|
/// \defgroup Options
|
||||||
/// m_option allow to parse, print and copy data of various types.
|
/// m_option allows to parse, print and copy data of various types.
|
||||||
/// It is the base of the \ref OptionsStruct, \ref Config and
|
/// It is the base of the \ref OptionsStruct, \ref Config and
|
||||||
/// \ref Properties APIs.
|
/// \ref Properties APIs.
|
||||||
///@{
|
///@{
|
||||||
|
@ -81,7 +81,7 @@ typedef struct m_obj_settings {
|
||||||
} m_obj_settings_t;
|
} m_obj_settings_t;
|
||||||
|
|
||||||
/// A parser to setup a list of objects.
|
/// A parser to setup a list of objects.
|
||||||
/** It create a NULL terminated array \ref m_obj_settings. The option priv
|
/** It creates a NULL terminated array \ref m_obj_settings. The option priv
|
||||||
* field (\ref m_option::priv) must point to a \ref m_obj_list_t describing
|
* field (\ref m_option::priv) must point to a \ref m_obj_list_t describing
|
||||||
* the available object types.
|
* the available object types.
|
||||||
*/
|
*/
|
||||||
|
@ -100,7 +100,7 @@ typedef struct {
|
||||||
} m_obj_presets_t;
|
} m_obj_presets_t;
|
||||||
|
|
||||||
/// Set several fields in a struct at once.
|
/// Set several fields in a struct at once.
|
||||||
/** For this two struct description are used. One for the struct holding the
|
/** For this two struct descriptions are used. One for the struct holding the
|
||||||
* preset and one for the struct beeing set. Every field present in both
|
* preset and one for the struct beeing set. Every field present in both
|
||||||
* struct will be copied from the preset struct to the destination one.
|
* struct will be copied from the preset struct to the destination one.
|
||||||
* The option priv field (\ref m_option::priv) must point to a correctly
|
* The option priv field (\ref m_option::priv) must point to a correctly
|
||||||
|
@ -116,7 +116,7 @@ extern m_option_type_t m_option_type_custom_url;
|
||||||
|
|
||||||
/// Extra definition needed for \ref m_option_type_obj_params options.
|
/// Extra definition needed for \ref m_option_type_obj_params options.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/// Fields description.
|
/// Field descriptions.
|
||||||
struct m_struct_st* desc;
|
struct m_struct_st* desc;
|
||||||
/// Field separator to use.
|
/// Field separator to use.
|
||||||
char separator;
|
char separator;
|
||||||
|
@ -124,7 +124,7 @@ typedef struct {
|
||||||
|
|
||||||
/// Parse a set of parameters.
|
/// Parse a set of parameters.
|
||||||
/** Parameters are separated by the given separator and each one
|
/** Parameters are separated by the given separator and each one
|
||||||
* successively set a field from the struct. The option priv field
|
* successively sets a field from the struct. The option priv field
|
||||||
* (\ref m_option::priv) must point to a \ref m_obj_params_t.
|
* (\ref m_option::priv) must point to a \ref m_obj_params_t.
|
||||||
*/
|
*/
|
||||||
extern m_option_type_t m_option_type_obj_params;
|
extern m_option_type_t m_option_type_obj_params;
|
||||||
|
@ -178,10 +178,10 @@ struct m_option_type {
|
||||||
* \param opt The option that is parsed.
|
* \param opt The option that is parsed.
|
||||||
* \param name The full option name.
|
* \param name The full option name.
|
||||||
* \param param The parameter to parse.
|
* \param param The parameter to parse.
|
||||||
* \param dst Pointer to the memory where the data should be writen.
|
* \param dst Pointer to the memory where the data should be written.
|
||||||
* If NULL the parameter validity should still be checked.
|
* If NULL the parameter validity should still be checked.
|
||||||
* \param src Source of the option, see \ref OptionParserModes.
|
* \param src Source of the option, see \ref OptionParserModes.
|
||||||
* \return On error a negative value is returned, on success the number of argument
|
* \return On error a negative value is returned, on success the number of arguments
|
||||||
* consumed. For details see \ref OptionParserReturn.
|
* consumed. For details see \ref OptionParserReturn.
|
||||||
*/
|
*/
|
||||||
int (*parse)(m_option_t* opt,char *name, char *param, void* dst, int src);
|
int (*parse)(m_option_t* opt,char *name, char *param, void* dst, int src);
|
||||||
|
@ -196,7 +196,7 @@ struct m_option_type {
|
||||||
|
|
||||||
/** \name
|
/** \name
|
||||||
* These functions are called to save/set/restore the status of the
|
* These functions are called to save/set/restore the status of the
|
||||||
* variables. The difference between the 3 only matter for types like
|
* variables. The difference between the 3 only matters for types like
|
||||||
* \ref m_option_type_func where 'setting' need to do more than just
|
* \ref m_option_type_func where 'setting' need to do more than just
|
||||||
* copying some data.
|
* copying some data.
|
||||||
*/
|
*/
|
||||||
|
@ -243,7 +243,7 @@ struct m_option {
|
||||||
|
|
||||||
/// Reserved for higher level APIs, it shouldn't be used by parsers.
|
/// Reserved for higher level APIs, it shouldn't be used by parsers.
|
||||||
/** The suboption parser and func types do use it. They should instead
|
/** The suboption parser and func types do use it. They should instead
|
||||||
* use the priv field but this was herited from older versions of the
|
* use the priv field but this was inherited from older versions of the
|
||||||
* config code.
|
* config code.
|
||||||
*/
|
*/
|
||||||
void *p;
|
void *p;
|
||||||
|
@ -254,15 +254,15 @@ struct m_option {
|
||||||
/// See \ref OptionFlags.
|
/// See \ref OptionFlags.
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
|
|
||||||
/// \brief Mostly usefull for numeric types, the \ref M_OPT_MIN flags must
|
/// \brief Mostly useful for numeric types, the \ref M_OPT_MIN flags must
|
||||||
/// also be set.
|
/// also be set.
|
||||||
double min;
|
double min;
|
||||||
|
|
||||||
/// \brief Mostly usefull for numeric types, the \ref M_OPT_MAX flags must
|
/// \brief Mostly useful for numeric types, the \ref M_OPT_MAX flags must
|
||||||
/// also be set.
|
/// also be set.
|
||||||
double max;
|
double max;
|
||||||
|
|
||||||
/// Type dependent data (for all kind of extended setting).
|
/// Type dependent data (for all kind of extended settings).
|
||||||
/** This used to be function pointer to hold a 'reverse to defaults' func.
|
/** This used to be function pointer to hold a 'reverse to defaults' func.
|
||||||
* Now it can be used to pass any type of extra args needed by the parser.
|
* Now it can be used to pass any type of extra args needed by the parser.
|
||||||
* Passing a 'default func' is still valid for all func based option types
|
* Passing a 'default func' is still valid for all func based option types
|
||||||
|
@ -274,19 +274,19 @@ struct m_option {
|
||||||
/// \defgroup OptionFlags Option flags
|
/// \defgroup OptionFlags Option flags
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
/// The option have a minimum set in \ref m_option::min.
|
/// The option has a minimum set in \ref m_option::min.
|
||||||
#define M_OPT_MIN (1<<0)
|
#define M_OPT_MIN (1<<0)
|
||||||
|
|
||||||
/// The option have a maximum set in \ref m_option::max.
|
/// The option has a maximum set in \ref m_option::max.
|
||||||
#define M_OPT_MAX (1<<1)
|
#define M_OPT_MAX (1<<1)
|
||||||
|
|
||||||
/// The option have a minimum and maximum in \ref m_option::min and \ref m_option::max.
|
/// The option has a minimum and maximum in \ref m_option::min and \ref m_option::max.
|
||||||
#define M_OPT_RANGE (M_OPT_MIN|M_OPT_MAX)
|
#define M_OPT_RANGE (M_OPT_MIN|M_OPT_MAX)
|
||||||
|
|
||||||
/// The option is forbidden in config files.
|
/// The option is forbidden in config files.
|
||||||
#define M_OPT_NOCFG (1<<2)
|
#define M_OPT_NOCFG (1<<2)
|
||||||
|
|
||||||
/// The option is forbiden on the command line.
|
/// The option is forbidden on the command line.
|
||||||
#define M_OPT_NOCMD (1<<3)
|
#define M_OPT_NOCMD (1<<3)
|
||||||
|
|
||||||
/// The option is global in the \ref Config.
|
/// The option is global in the \ref Config.
|
||||||
|
@ -297,8 +297,8 @@ struct m_option {
|
||||||
#define M_OPT_GLOBAL (1<<4)
|
#define M_OPT_GLOBAL (1<<4)
|
||||||
|
|
||||||
/// The \ref Config won't save this option on push.
|
/// The \ref Config won't save this option on push.
|
||||||
/** It won't be saved on push but the command line parser will put it with
|
/** It won't be saved on push but the command line parser will add it with
|
||||||
* it's entry (ie : it may be set later)
|
* its entry (ie : it may be set later)
|
||||||
* e.g options : -include
|
* e.g options : -include
|
||||||
*/
|
*/
|
||||||
#define M_OPT_NOSAVE (1<<5)
|
#define M_OPT_NOSAVE (1<<5)
|
||||||
|
@ -335,22 +335,22 @@ struct m_option {
|
||||||
* array. Only the parse function will be called. If dst is set, it should
|
* array. Only the parse function will be called. If dst is set, it should
|
||||||
* create/update an array of char* containg opt/val pairs. The options in
|
* create/update an array of char* containg opt/val pairs. The options in
|
||||||
* the child array will then be set automatically by the \ref Config.
|
* the child array will then be set automatically by the \ref Config.
|
||||||
* Also note that sub options may be directly accessed by using
|
* Also note that suboptions may be directly accessed by using
|
||||||
* -option:subopt blah.
|
* -option:subopt blah.
|
||||||
*/
|
*/
|
||||||
#define M_OPT_TYPE_HAS_CHILD (1<<0)
|
#define M_OPT_TYPE_HAS_CHILD (1<<0)
|
||||||
|
|
||||||
/// Wildcard matching flag.
|
/// Wildcard matching flag.
|
||||||
/** If set the option type have a use for option name ending with a *
|
/** If set the option type has a use for option name ending with a *
|
||||||
* (used for -aa*), this only affect the option name matching.
|
* (used for -aa*), this only affects the option name matching.
|
||||||
*/
|
*/
|
||||||
#define M_OPT_TYPE_ALLOW_WILDCARD (1<<1)
|
#define M_OPT_TYPE_ALLOW_WILDCARD (1<<1)
|
||||||
|
|
||||||
/// Dynamic data type.
|
/// Dynamic data type.
|
||||||
/** This flag indicate that the data is dynamicly allocated (m_option::p point
|
/** This flag indicate that the data is dynamically allocated (m_option::p point
|
||||||
* to a pointer). It enable a little hack in the \ref Config wich replace
|
* to a pointer). It enables a little hack in the \ref Config wich replace
|
||||||
* the initial value of such variables with a dynamic copy in case the
|
* the initial value of such variables with a dynamic copy in case the
|
||||||
* initial value is staticaly allocated (pretty common with strings).
|
* initial value is statically allocated (pretty common with strings).
|
||||||
*/
|
*/
|
||||||
#define M_OPT_TYPE_DYNAMIC (1<<2)
|
#define M_OPT_TYPE_DYNAMIC (1<<2)
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ struct m_option {
|
||||||
/// \defgroup OptionParserModes Option parser modes
|
/// \defgroup OptionParserModes Option parser modes
|
||||||
/// \ingroup Options
|
/// \ingroup Options
|
||||||
///
|
///
|
||||||
/// Some parser behave differently depending on the mode passed in the src
|
/// Some parsers behaves differently depending on the mode passed in the src
|
||||||
/// parameter of m_option_type::parse. For example the flag type doesn't take
|
/// parameter of m_option_type::parse. For example the flag type doesn't take
|
||||||
/// an argument when parsing from the command line.
|
/// an argument when parsing from the command line.
|
||||||
///@{
|
///@{
|
||||||
|
@ -387,16 +387,16 @@ struct m_option {
|
||||||
/// \defgroup OptionParserReturn Option parser return code
|
/// \defgroup OptionParserReturn Option parser return code
|
||||||
/// \ingroup Options
|
/// \ingroup Options
|
||||||
///
|
///
|
||||||
/// On sucess parsers return the number of arguments consumed: 0 or 1.
|
/// On success parsers return the number of arguments consumed: 0 or 1.
|
||||||
///
|
///
|
||||||
/// To indicate that mplayer should exit without playing anything,
|
/// To indicate that MPlayer should exit without playing anything,
|
||||||
/// parsers return M_OPT_EXIT minus the number of parameters they
|
/// parsers return M_OPT_EXIT minus the number of parameters they
|
||||||
/// consumed: \ref M_OPT_EXIT or \ref M_OPT_EXIT-1.
|
/// consumed: \ref M_OPT_EXIT or \ref M_OPT_EXIT-1.
|
||||||
///
|
///
|
||||||
/// On error one of the following (negative) error code is returned:
|
/// On error one of the following (negative) error codes is returned:
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
/// For use by higer level APIs when the option name is invalid.
|
/// For use by higher level APIs when the option name is invalid.
|
||||||
#define M_OPT_UNKNOWN -1
|
#define M_OPT_UNKNOWN -1
|
||||||
|
|
||||||
/// Returned when a parameter is needed but wasn't provided.
|
/// Returned when a parameter is needed but wasn't provided.
|
||||||
|
@ -419,7 +419,7 @@ struct m_option {
|
||||||
|
|
||||||
/// \defgroup OldOptionParserReturn Backward compatibility
|
/// \defgroup OldOptionParserReturn Backward compatibility
|
||||||
///
|
///
|
||||||
/// Those are kept for compatibility with older code.
|
/// These are kept for compatibility with older code.
|
||||||
///
|
///
|
||||||
///@{
|
///@{
|
||||||
#define ERR_NOT_AN_OPTION M_OPT_UNKNOWN
|
#define ERR_NOT_AN_OPTION M_OPT_UNKNOWN
|
||||||
|
@ -432,7 +432,7 @@ struct m_option {
|
||||||
|
|
||||||
/// Find the option matching the given name in the list.
|
/// Find the option matching the given name in the list.
|
||||||
/** \ingroup Options
|
/** \ingroup Options
|
||||||
* This function take the possible wildcards in account (see
|
* This function takes the possible wildcards into account (see
|
||||||
* \ref M_OPT_TYPE_ALLOW_WILDCARD).
|
* \ref M_OPT_TYPE_ALLOW_WILDCARD).
|
||||||
*
|
*
|
||||||
* \param list Pointer to an array of \ref m_option.
|
* \param list Pointer to an array of \ref m_option.
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
/// Returned on error.
|
/// Returned on error.
|
||||||
#define M_PROPERTY_ERROR 0
|
#define M_PROPERTY_ERROR 0
|
||||||
|
|
||||||
/// \brief Returned when the property can't be used, for ex something about
|
/// \brief Returned when the property can't be used, for example something about
|
||||||
/// the subs while playing audio only
|
/// the subs while playing audio only
|
||||||
#define M_PROPERTY_UNAVAILABLE -1
|
#define M_PROPERTY_UNAVAILABLE -1
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ int m_property_do(m_option_t* prop, int action, void* arg);
|
||||||
|
|
||||||
/// Print the current value of a property.
|
/// Print the current value of a property.
|
||||||
/** \param prop The property.
|
/** \param prop The property.
|
||||||
* \return A newly allocated string with current value or NULL on error.
|
* \return A newly allocated string with the current value or NULL on error.
|
||||||
*/
|
*/
|
||||||
char* m_property_print(m_option_t* prop);
|
char* m_property_print(m_option_t* prop);
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ int m_property_parse(m_option_t* prop, char* txt);
|
||||||
void m_properties_print_help_list(m_option_t* list);
|
void m_properties_print_help_list(m_option_t* list);
|
||||||
|
|
||||||
/// Expand a property string.
|
/// Expand a property string.
|
||||||
/** This function allow to print strings containing property values.
|
/** This function allows to print strings containing property values.
|
||||||
* ${NAME} is expanded to the value of property NAME or an empty
|
* ${NAME} is expanded to the value of property NAME or an empty
|
||||||
* string in case of error. $(NAME:STR) expand STR only if the property
|
* string in case of error. $(NAME:STR) expand STR only if the property
|
||||||
* NAME is available.
|
* NAME is available.
|
||||||
|
|
|
@ -12,7 +12,7 @@ struct m_option;
|
||||||
|
|
||||||
/// Struct definition
|
/// Struct definition
|
||||||
typedef struct m_struct_st {
|
typedef struct m_struct_st {
|
||||||
/// For error msg and debuging
|
/// For error messages and debugging
|
||||||
char* name;
|
char* name;
|
||||||
/// size of the whole struct
|
/// size of the whole struct
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
|
|
Loading…
Reference in New Issue