summaryrefslogtreecommitdiffstats
path: root/core/m_config.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-21 19:33:08 +0200
committerwm4 <wm4@nowhere>2013-07-21 23:27:31 +0200
commit6629a95b928499a46c9686f0800b65aec7fcbb22 (patch)
tree67e158d3678b54fc521b4fedb19a7dd20b823512 /core/m_config.h
parent111a455ec621103b714a199217471af5f3efe35a (diff)
downloadmpv-6629a95b928499a46c9686f0800b65aec7fcbb22.tar.bz2
mpv-6629a95b928499a46c9686f0800b65aec7fcbb22.tar.xz
options: use m_config for options instead of m_struct
For some reason, both m_config and m_struct are somewhat similar, except that m_config is much more powerful. m_config is used for VOs and some other things, so to unify them. We plan to kick out m_struct and use m_config for everything. (Unfortunately, m_config is also a bit more bloated, so this commit isn't all that great, but it will allow to reduce the option parser mess somewhat.) This commit also switches all video filters to use the option macros. One reason is that m_struct and m_config, even though they both use m_option, store the offsets of the option fields differently (sigh...), meaning the options defined for either are incompatible. It's easier to switch everything in one go. This commit will allow using the -vf option parser for other things, like VOs and AOs.
Diffstat (limited to 'core/m_config.h')
-rw-r--r--core/m_config.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/m_config.h b/core/m_config.h
index 98b21c9bf9..28983944df 100644
--- a/core/m_config.h
+++ b/core/m_config.h
@@ -31,10 +31,13 @@ typedef struct m_profile m_profile_t;
struct m_option;
struct m_option_type;
struct m_sub_options;
+struct m_obj_desc;
// Config option
struct m_config_option {
struct m_config_option *next;
+ // For positional parameters
+ int pos;
// Full name (ie option-subopt).
char *name;
// Option description.
@@ -71,6 +74,7 @@ typedef struct m_config {
/** This contains all options and suboptions.
*/
struct m_config_option *opts;
+ int num_pos_opts;
// When options are set (via m_config_set_option or m_config_set_profile),
// back up the old value (unless it's already backed up). Used for restoring
// global options when per-file options are set.
@@ -92,6 +96,16 @@ m_config_new(void *optstruct,
struct m_config *m_config_simple(void *optstruct);
+struct m_config *m_config_from_obj_desc(void *talloc_parent,
+ struct m_obj_desc *desc);
+
+int m_config_set_obj_params(struct m_config *conf, char **args);
+
+// Initialize an object (VO/VF/...) in one go, including legacy handling.
+// This is pretty specialized, and is just for convenience.
+int m_config_initialize_obj(struct m_config *config, struct m_obj_desc *desc,
+ void **ppriv, char ***pargs);
+
// Free a config object.
void m_config_free(struct m_config *config);
@@ -149,6 +163,10 @@ const struct m_option *m_config_get_option(const struct m_config *config,
struct m_config_option *m_config_get_co(const struct m_config *config,
struct bstr name);
+// Return the n-th option by position. n==0 is the first option. If there are
+// less than (n + 1) options, return NULL.
+const char *m_config_get_positional_option(const struct m_config *config, int n);
+
// Return a hint to the option parser whether a parameter is/may be required.
// The option may still accept empty/non-empty parameters independent from
// this, and this function is useful only for handling ambiguous options like