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_dlopen.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_dlopen.c')
-rw-r--r-- | video/filter/vf_dlopen.c | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/video/filter/vf_dlopen.c b/video/filter/vf_dlopen.c index 72e747c2a7..f40762beab 100644 --- a/video/filter/vf_dlopen.c +++ b/video/filter/vf_dlopen.c @@ -29,7 +29,6 @@ #include "vf.h" #include "core/m_option.h" -#include "core/m_struct.h" #include "vf_dlopen.h" @@ -46,9 +45,9 @@ #endif static struct vf_priv_s { - const char *cfg_dllname; + char *cfg_dllname; int cfg_argc; - const char *cfg_argv[16]; + char *cfg_argv[16]; void *dll; struct vf_dlopen_context filter; @@ -329,7 +328,9 @@ static int vf_open(vf_instance_t *vf, char *args) if (vf->priv->cfg_argv[i] == NULL) vf->priv->cfg_argv[i] = talloc_strdup (vf->priv, ""); - if (func(&vf->priv->filter, vf->priv->cfg_argc, vf->priv->cfg_argv) < 0) { + if (func(&vf->priv->filter, vf->priv->cfg_argc, + (const char **)vf->priv->cfg_argv) < 0) + { mp_msg(MSGT_VFILTER, MSGL_ERR, "function did not create a filter: %s\n", vf->priv->cfg_dllname); @@ -351,33 +352,26 @@ static int vf_open(vf_instance_t *vf, char *args) return 1; } -#define ST_OFF(f) M_ST_OFF(struct vf_priv_s, f) -static m_option_t vf_opts_fields[] = { - {"dll", ST_OFF(cfg_dllname), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a0", ST_OFF(cfg_argv[0]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a1", ST_OFF(cfg_argv[1]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a2", ST_OFF(cfg_argv[2]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a3", ST_OFF(cfg_argv[3]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a4", ST_OFF(cfg_argv[4]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a5", ST_OFF(cfg_argv[5]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a6", ST_OFF(cfg_argv[6]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a7", ST_OFF(cfg_argv[7]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a8", ST_OFF(cfg_argv[8]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a9", ST_OFF(cfg_argv[9]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a10", ST_OFF(cfg_argv[10]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a11", ST_OFF(cfg_argv[11]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a12", ST_OFF(cfg_argv[12]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a13", ST_OFF(cfg_argv[13]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a14", ST_OFF(cfg_argv[14]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"a15", ST_OFF(cfg_argv[15]), CONF_TYPE_STRING, 0, 0, 0, NULL}, - { NULL, NULL, 0, 0, 0, 0, NULL } -}; - -static const m_struct_t vf_opts = { - "dlopen", - sizeof(struct vf_priv_s), - &vf_priv_dflt, - vf_opts_fields +#define OPT_BASE_STRUCT struct vf_priv_s +static const m_option_t vf_opts_fields[] = { + OPT_STRING("dll", cfg_dllname, 0), + OPT_STRING("a0", cfg_argv[0], 0), + OPT_STRING("a1", cfg_argv[1], 0), + OPT_STRING("a2", cfg_argv[2], 0), + OPT_STRING("a3", cfg_argv[3], 0), + OPT_STRING("a4", cfg_argv[4], 0), + OPT_STRING("a5", cfg_argv[5], 0), + OPT_STRING("a6", cfg_argv[6], 0), + OPT_STRING("a7", cfg_argv[7], 0), + OPT_STRING("a8", cfg_argv[8], 0), + OPT_STRING("a9", cfg_argv[9], 0), + OPT_STRING("a10", cfg_argv[10], 0), + OPT_STRING("a11", cfg_argv[11], 0), + OPT_STRING("a12", cfg_argv[12], 0), + OPT_STRING("a13", cfg_argv[13], 0), + OPT_STRING("a14", cfg_argv[14], 0), + OPT_STRING("a15", cfg_argv[15], 0), + {0} }; const vf_info_t vf_info_dlopen = { @@ -386,7 +380,9 @@ const vf_info_t vf_info_dlopen = { "Rudolf Polzer", "", vf_open, - &vf_opts + .priv_size = sizeof(struct vf_priv_s), + .priv_defaults = &vf_priv_dflt, + .options = vf_opts_fields, }; //===========================================================================// |