diff options
author | wm4 <wm4@nowhere> | 2013-07-21 19:33:08 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-21 23:27:31 +0200 |
commit | 6629a95b928499a46c9686f0800b65aec7fcbb22 (patch) | |
tree | 67e158d3678b54fc521b4fedb19a7dd20b823512 /video/filter/vf_sub.c | |
parent | 111a455ec621103b714a199217471af5f3efe35a (diff) | |
download | mpv-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 'video/filter/vf_sub.c')
-rw-r--r-- | video/filter/vf_sub.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/video/filter/vf_sub.c b/video/filter/vf_sub.c index e85a58afb7..519f3c3eb7 100644 --- a/video/filter/vf_sub.c +++ b/video/filter/vf_sub.c @@ -41,7 +41,6 @@ #include "video/memcpy_pic.h" #include "core/m_option.h" -#include "core/m_struct.h" static const struct vf_priv_s { int opt_top_margin, opt_bottom_margin; @@ -140,20 +139,11 @@ static int vf_open(vf_instance_t *vf, char *args) return 1; } -#define ST_OFF(f) M_ST_OFF(struct vf_priv_s, f) +#define OPT_BASE_STRUCT struct vf_priv_s static const m_option_t vf_opts_fields[] = { - {"bottom-margin", ST_OFF(opt_bottom_margin), - CONF_TYPE_INT, M_OPT_RANGE, 0, 2000}, - {"top-margin", ST_OFF(opt_top_margin), - CONF_TYPE_INT, M_OPT_RANGE, 0, 2000}, - {0}, -}; - -static const m_struct_t vf_opts = { - "sub", - sizeof(struct vf_priv_s), - &vf_priv_dflt, - vf_opts_fields + OPT_INTRANGE("bottom-margin", opt_bottom_margin, 0, 0, 2000), + OPT_INTRANGE("top-margin", opt_top_margin, 0, 0, 2000), + {0} }; const vf_info_t vf_info_sub = { @@ -162,5 +152,7 @@ const vf_info_t vf_info_sub = { "Evgeniy Stepanov", "", vf_open, - &vf_opts + .priv_size = sizeof(struct vf_priv_s), + .priv_defaults = &vf_priv_dflt, + .options = vf_opts_fields, }; |