summaryrefslogtreecommitdiffstats
path: root/options/m_option.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-21 19:45:42 +0100
committerwm4 <wm4@nowhere>2013-12-21 21:05:02 +0100
commitd8d42b44fc717c695af59c14213d54885088ea37 (patch)
tree9dbfd597e3352249cb5d1fda996d2c0ce1602fe9 /options/m_option.h
parenta2d144fc8f146f96e4fe97b1b2c15828e24f8494 (diff)
downloadmpv-d8d42b44fc717c695af59c14213d54885088ea37.tar.bz2
mpv-d8d42b44fc717c695af59c14213d54885088ea37.tar.xz
m_option, m_config: mp_msg conversions
Always pass around mp_log contexts in the option parser code. This of course affects all users of this API as well. In stream.c, pass a mp_null_log, because we can't do it properly yet. This will be fixed later.
Diffstat (limited to 'options/m_option.h')
-rw-r--r--options/m_option.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/options/m_option.h b/options/m_option.h
index bea7a4376a..5abe605e95 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -31,6 +31,7 @@
typedef struct m_option_type m_option_type_t;
typedef struct m_option m_option_t;
struct m_config;
+struct mp_log;
///////////////////////////// Options types declarations ////////////////////
@@ -63,7 +64,8 @@ extern const m_option_type_t m_option_type_size_box;
extern const m_option_type_t m_option_type_chmap;
// Callback used by m_option_type_print_func options.
-typedef int (*m_opt_func_full_t)(const m_option_t *, const char *, const char *);
+typedef int (*m_opt_func_full_t)(struct mp_log *log, const m_option_t *,
+ const char *, const char *);
enum m_rel_time_type {
REL_TIME_NONE,
@@ -113,6 +115,9 @@ struct m_obj_desc {
bool hidden;
// Callback to print custom help if "help" is passed
void (*print_help)(void);
+ // Set by m_obj_list_find(). If the requested name is an old alias, this
+ // is set to the old name (while the name field uses the new name).
+ const char *replaced_name;
};
// Extra definition needed for \ref m_option_type_obj_settings_list options.
@@ -224,6 +229,7 @@ struct m_option_type {
// Parse the data from a string.
/** It is the only required function, all others can be NULL.
*
+ * \param log for outputting parser error or help messages
* \param opt The option that is parsed.
* \param name The full option name.
* \param param The parameter to parse.
@@ -233,8 +239,8 @@ struct m_option_type {
* \return On error a negative value is returned, on success the number
* of arguments consumed. For details see \ref OptionParserReturn.
*/
- int (*parse)(const m_option_t *opt, struct bstr name, struct bstr param,
- void *dst);
+ int (*parse)(struct mp_log *log, const m_option_t *opt,
+ struct bstr name, struct bstr param, void *dst);
// Print back a value in string form.
/** \param opt The option to print.
@@ -439,10 +445,10 @@ char *m_option_strerror(int code);
const m_option_t *m_option_list_find(const m_option_t *list, const char *name);
// Helper to parse options, see \ref m_option_type::parse.
-static inline int m_option_parse(const m_option_t *opt, struct bstr name,
- struct bstr param, void *dst)
+static inline int m_option_parse(struct mp_log *log, const m_option_t *opt,
+ struct bstr name, struct bstr param, void *dst)
{
- return opt->type->parse(opt, name, param, dst);
+ return opt->type->parse(log, opt, name, param, dst);
}
// Helper to print options, see \ref m_option_type::print.