From 437ecc5cad9d31899a0b0bf3e9c696bc61586621 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 4 Dec 2013 00:01:38 +0100 Subject: video/filter: remove legacy option handling hacks All filters now either use the generic option parser, or don't have options. This finally finishes a transition started in 2003 (see git commit 33b62af94760186c). Why are MPlayer devs so monumentally lazy? Sorry, but this takes the cake. You had 10 years. --- video/filter/vf.c | 8 +++----- video/filter/vf.h | 2 +- video/filter/vf_crop.c | 2 +- video/filter/vf_delogo.c | 2 +- video/filter/vf_divtc.c | 2 +- video/filter/vf_dlopen.c | 2 +- video/filter/vf_dsize.c | 2 +- video/filter/vf_eq.c | 2 +- video/filter/vf_expand.c | 2 +- video/filter/vf_flip.c | 2 +- video/filter/vf_format.c | 2 +- video/filter/vf_gradfun.c | 2 +- video/filter/vf_hqdn3d.c | 2 +- video/filter/vf_ilpack.c | 2 +- video/filter/vf_lavfi.c | 4 ++-- video/filter/vf_mirror.c | 2 +- video/filter/vf_noformat.c | 2 +- video/filter/vf_noise.c | 2 +- video/filter/vf_phase.c | 2 +- video/filter/vf_pp.c | 2 +- video/filter/vf_pullup.c | 2 +- video/filter/vf_rotate.c | 2 +- video/filter/vf_scale.c | 2 +- video/filter/vf_screenshot.c | 2 +- video/filter/vf_softpulldown.c | 2 +- video/filter/vf_stereo3d.c | 2 +- video/filter/vf_sub.c | 2 +- video/filter/vf_swapuv.c | 2 +- video/filter/vf_unsharp.c | 2 +- video/filter/vf_vavpp.c | 2 +- video/filter/vf_vo.c | 2 +- video/filter/vf_yadif.c | 2 +- 32 files changed, 35 insertions(+), 37 deletions(-) diff --git a/video/filter/vf.c b/video/filter/vf.c index 7242f47514..c88621afdb 100644 --- a/video/filter/vf.c +++ b/video/filter/vf.c @@ -138,7 +138,6 @@ static bool get_desc(struct m_obj_desc *dst, int index) const struct m_obj_list vf_obj_list = { .get_desc = get_desc, .description = "video filters", - .legacy_hacks = true, // some filters have custom option parsing }; int vf_control(struct vf_instance *vf, int cmd, void *arg) @@ -251,11 +250,10 @@ static struct vf_instance *vf_open(struct MPOpts *opts, vf_instance_t *next, struct m_config *config = m_config_from_obj_desc(vf, &desc); if (m_config_apply_defaults(config, name, opts->vf_defs) < 0) goto error; - void *priv = NULL; - if (m_config_initialize_obj(config, &desc, &priv, &args) < 0) + if (m_config_set_obj_params(config, args) < 0) goto error; - vf->priv = priv; - int retcode = vf->info->open(vf, (char *)args); + vf->priv = config->optstruct; + int retcode = vf->info->open(vf); if (retcode < 1) goto error; return vf; diff --git a/video/filter/vf.h b/video/filter/vf.h index af7f0a3481..fb3c0e9565 100644 --- a/video/filter/vf.h +++ b/video/filter/vf.h @@ -33,7 +33,7 @@ struct vf_priv_s; typedef struct vf_info { const char *description; const char *name; - int (*open)(struct vf_instance *vf, char *args); + int (*open)(struct vf_instance *vf); int priv_size; const void *priv_defaults; const struct m_option *options; diff --git a/video/filter/vf_crop.c b/video/filter/vf_crop.c index b07f9c6db1..b1f41e5b18 100644 --- a/video/filter/vf_crop.c +++ b/video/filter/vf_crop.c @@ -82,7 +82,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) return 0; } -static int vf_open(vf_instance_t *vf, char *args){ +static int vf_open(vf_instance_t *vf){ vf->config=config; vf->filter=filter; vf->query_format=query_format; diff --git a/video/filter/vf_delogo.c b/video/filter/vf_delogo.c index 6bd538cba5..c8897f2a13 100644 --- a/video/filter/vf_delogo.c +++ b/video/filter/vf_delogo.c @@ -280,7 +280,7 @@ load_error: return -1; } -static int vf_open(vf_instance_t *vf, char *args){ +static int vf_open(vf_instance_t *vf){ struct vf_priv_s *p = vf->priv; vf->config=config; vf->filter=filter; diff --git a/video/filter/vf_divtc.c b/video/filter/vf_divtc.c index d8e1368441..87fcd8d049 100644 --- a/video/filter/vf_divtc.c +++ b/video/filter/vf_divtc.c @@ -604,7 +604,7 @@ static int control(vf_instance_t *vf, int request, void *data) return vf_next_control(vf, request, data); } -static int vf_open(vf_instance_t *vf, char *args) +static int vf_open(vf_instance_t *vf) { struct vf_priv_s *p = vf->priv; diff --git a/video/filter/vf_dlopen.c b/video/filter/vf_dlopen.c index e034b6eadb..5f41c427a9 100644 --- a/video/filter/vf_dlopen.c +++ b/video/filter/vf_dlopen.c @@ -289,7 +289,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) return vf_next_query_format(vf, outfmt); } -static int vf_open(vf_instance_t *vf, char *args) +static int vf_open(vf_instance_t *vf) { int i; if (!vf->priv->cfg_dllname) { diff --git a/video/filter/vf_dsize.c b/video/filter/vf_dsize.c index be8b73133d..fd65d46388 100644 --- a/video/filter/vf_dsize.c +++ b/video/filter/vf_dsize.c @@ -78,7 +78,7 @@ static int config(struct vf_instance *vf, return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt); } -static int vf_open(vf_instance_t *vf, char *args) +static int vf_open(vf_instance_t *vf) { vf->config = config; return 1; diff --git a/video/filter/vf_eq.c b/video/filter/vf_eq.c index 924fcd66a8..c61c8f249b 100644 --- a/video/filter/vf_eq.c +++ b/video/filter/vf_eq.c @@ -457,7 +457,7 @@ void uninit (vf_instance_t *vf) } static -int vf_open(vf_instance_t *vf, char *args) +int vf_open(vf_instance_t *vf) { unsigned i; vf_eq2_t *eq2; diff --git a/video/filter/vf_expand.c b/video/filter/vf_expand.c index 51f49862d7..d336cf3d91 100644 --- a/video/filter/vf_expand.c +++ b/video/filter/vf_expand.c @@ -148,7 +148,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) return 0; } -static int vf_open(vf_instance_t *vf, char *args){ +static int vf_open(vf_instance_t *vf){ vf->config=config; vf->control=control; vf->query_format=query_format; diff --git a/video/filter/vf_flip.c b/video/filter/vf_flip.c index 6500053032..121503c976 100644 --- a/video/filter/vf_flip.c +++ b/video/filter/vf_flip.c @@ -51,7 +51,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) return 0; } -static int vf_open(vf_instance_t *vf, char *args){ +static int vf_open(vf_instance_t *vf){ vf->config=config; vf->filter=filter; vf->query_format = query_format; diff --git a/video/filter/vf_format.c b/video/filter/vf_format.c index 1ddbc079bd..e673fd8f60 100644 --- a/video/filter/vf_format.c +++ b/video/filter/vf_format.c @@ -63,7 +63,7 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) return mpi; } -static int vf_open(vf_instance_t *vf, char *args){ +static int vf_open(vf_instance_t *vf){ vf->query_format=query_format; if (vf->priv->outfmt) { vf->config=config; diff --git a/video/filter/vf_gradfun.c b/video/filter/vf_gradfun.c index 28916e7871..39dd050002 100644 --- a/video/filter/vf_gradfun.c +++ b/video/filter/vf_gradfun.c @@ -368,7 +368,7 @@ static void lavfi_recreate(struct vf_instance *vf) vf_lw_update_graph(vf, "gradfun", "%f:%d", p->cfg_thresh, p->radius); } -static int vf_open(vf_instance_t *vf, char *args) +static int vf_open(vf_instance_t *vf) { vf->filter=filter; vf->query_format=query_format; diff --git a/video/filter/vf_hqdn3d.c b/video/filter/vf_hqdn3d.c index 05f182ffac..1a5736f98e 100644 --- a/video/filter/vf_hqdn3d.c +++ b/video/filter/vf_hqdn3d.c @@ -282,7 +282,7 @@ static void PrecalcCoefs(int *Ct, double Dist25) #define CHROMA_SPATIAL 2 #define CHROMA_TMP 3 -static int vf_open(vf_instance_t *vf, char *args){ +static int vf_open(vf_instance_t *vf){ struct vf_priv_s *s = vf->priv; vf->config=config; diff --git a/video/filter/vf_ilpack.c b/video/filter/vf_ilpack.c index f3bef4fa19..bd7e863dee 100644 --- a/video/filter/vf_ilpack.c +++ b/video/filter/vf_ilpack.c @@ -404,7 +404,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) return 0; } -static int vf_open(vf_instance_t *vf, char *args) +static int vf_open(vf_instance_t *vf) { vf->config=config; vf->query_format=query_format; diff --git a/video/filter/vf_lavfi.c b/video/filter/vf_lavfi.c index 9e064f49d9..c5fe973d2b 100644 --- a/video/filter/vf_lavfi.c +++ b/video/filter/vf_lavfi.c @@ -329,7 +329,7 @@ static void uninit(struct vf_instance *vf) destroy_graph(vf); } -static int vf_open(vf_instance_t *vf, char *args) +static int vf_open(vf_instance_t *vf) { vf->reconfig = NULL; vf->config = config; @@ -459,7 +459,7 @@ int vf_lw_set_graph(struct vf_instance *vf, struct vf_lw_opts *lavfi_opts, va_end(ap); p->old_priv = old_priv; // Note: we should be sure vf_open really overwrites _all_ vf callbacks. - if (vf_open(vf, NULL) < 1) + if (vf_open(vf) < 1) abort(); return 1; } diff --git a/video/filter/vf_mirror.c b/video/filter/vf_mirror.c index 88658c5436..36232f7f2b 100644 --- a/video/filter/vf_mirror.c +++ b/video/filter/vf_mirror.c @@ -95,7 +95,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) return vf_next_query_format(vf, fmt); } -static int vf_open(vf_instance_t *vf, char *args){ +static int vf_open(vf_instance_t *vf){ vf->config=config; vf->filter=filter; vf->query_format=query_format; diff --git a/video/filter/vf_noformat.c b/video/filter/vf_noformat.c index 993c805060..f3b193bc4e 100644 --- a/video/filter/vf_noformat.c +++ b/video/filter/vf_noformat.c @@ -44,7 +44,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){ return 0; } -static int vf_open(vf_instance_t *vf, char *args){ +static int vf_open(vf_instance_t *vf){ vf->query_format=query_format; return 1; } diff --git a/video/filter/vf_noise.c b/video/filter/vf_noise.c index e47bd30a32..93ab00e6cc 100644 --- a/video/filter/vf_noise.c +++ b/video/filter/vf_noise.c @@ -395,7 +395,7 @@ static const unsigned int fmt_list[]={ 0 }; -static int vf_open(vf_instance_t *vf, char *args){ +static int vf_open(vf_instance_t *vf){ vf->config=config; vf->filter=filter; vf->query_format=query_format; diff --git a/video/filter/vf_phase.c b/video/filter/vf_phase.c index 46b75b28c4..136f3cc187 100644 --- a/video/filter/vf_phase.c +++ b/video/filter/vf_phase.c @@ -266,7 +266,7 @@ static const char *get_lavfi_mode(int mode) } } -static int vf_open(vf_instance_t *vf, char *args) +static int vf_open(vf_instance_t *vf) { vf->filter = filter; vf->uninit = uninit; diff --git a/video/filter/vf_pp.c b/video/filter/vf_pp.c index 627f8b27f4..83191594cc 100644 --- a/video/filter/vf_pp.c +++ b/video/filter/vf_pp.c @@ -127,7 +127,7 @@ static const unsigned int fmt_list[]={ 0 }; -static int vf_open(vf_instance_t *vf, char *args){ +static int vf_open(vf_instance_t *vf){ int i; vf->query_format=query_format; diff --git a/video/filter/vf_pullup.c b/video/filter/vf_pullup.c index 357d08cae3..910650d690 100644 --- a/video/filter/vf_pullup.c +++ b/video/filter/vf_pullup.c @@ -275,7 +275,7 @@ static int control(vf_instance_t *vf, int request, void *data) return vf_next_control(vf, request, data); } -static int vf_open(vf_instance_t *vf, char *args) +static int vf_open(vf_instance_t *vf) {; vf->filter = filter; vf->config = config; diff --git a/video/filter/vf_rotate.c b/video/filter/vf_rotate.c index 69f5b30d96..0a23071cdc 100644 --- a/video/filter/vf_rotate.c +++ b/video/filter/vf_rotate.c @@ -116,7 +116,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) return vf_next_query_format(vf, fmt); } -static int vf_open(vf_instance_t *vf, char *args){ +static int vf_open(vf_instance_t *vf){ vf->reconfig=reconfig; vf->filter=filter; vf->query_format=query_format; diff --git a/video/filter/vf_scale.c b/video/filter/vf_scale.c index d195cf230e..d57ea07df7 100644 --- a/video/filter/vf_scale.c +++ b/video/filter/vf_scale.c @@ -396,7 +396,7 @@ static void uninit(struct vf_instance *vf) { } -static int vf_open(vf_instance_t *vf, char *args) +static int vf_open(vf_instance_t *vf) { vf->reconfig = reconfig; vf->filter = filter; diff --git a/video/filter/vf_screenshot.c b/video/filter/vf_screenshot.c index d5846e20cc..308c43c3b8 100644 --- a/video/filter/vf_screenshot.c +++ b/video/filter/vf_screenshot.c @@ -68,7 +68,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) return 0; } -static int vf_open(vf_instance_t *vf, char *args) +static int vf_open(vf_instance_t *vf) { vf->config = config; vf->control = control; diff --git a/video/filter/vf_softpulldown.c b/video/filter/vf_softpulldown.c index 9a73e39110..3f50de0991 100644 --- a/video/filter/vf_softpulldown.c +++ b/video/filter/vf_softpulldown.c @@ -149,7 +149,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) return vf_next_query_format(vf, fmt); } -static int vf_open(vf_instance_t *vf, char *args) +static int vf_open(vf_instance_t *vf) { vf->config = config; vf->filter_ext = filter; diff --git a/video/filter/vf_stereo3d.c b/video/filter/vf_stereo3d.c index 42791dca43..6bd13ada87 100644 --- a/video/filter/vf_stereo3d.c +++ b/video/filter/vf_stereo3d.c @@ -459,7 +459,7 @@ static const char *rev_map_name(int val) return NULL; } -static int vf_open(vf_instance_t *vf, char *args) +static int vf_open(vf_instance_t *vf) { vf->config = config; vf->filter = filter; diff --git a/video/filter/vf_sub.c b/video/filter/vf_sub.c index 1b344ab3f5..643339c4eb 100644 --- a/video/filter/vf_sub.c +++ b/video/filter/vf_sub.c @@ -129,7 +129,7 @@ static int control(vf_instance_t *vf, int request, void *data) return vf_next_control(vf, request, data); } -static int vf_open(vf_instance_t *vf, char *args) +static int vf_open(vf_instance_t *vf) { vf->config = config; vf->query_format = query_format; diff --git a/video/filter/vf_swapuv.c b/video/filter/vf_swapuv.c index a09ca04d5f..8233d6cab5 100644 --- a/video/filter/vf_swapuv.c +++ b/video/filter/vf_swapuv.c @@ -49,7 +49,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) return vf_next_query_format(vf, fmt); } -static int vf_open(vf_instance_t *vf, char *args){ +static int vf_open(vf_instance_t *vf){ vf->filter=filter; vf->query_format=query_format; return 1; diff --git a/video/filter/vf_unsharp.c b/video/filter/vf_unsharp.c index 5a81f8c395..abb5fb4864 100644 --- a/video/filter/vf_unsharp.c +++ b/video/filter/vf_unsharp.c @@ -221,7 +221,7 @@ static const unsigned int fmt_list[] = { 0 }; -static int vf_open( vf_instance_t *vf, char *args ) { +static int vf_open( vf_instance_t *vf) { vf->config = config; vf->filter = filter; vf->query_format = query_format; diff --git a/video/filter/vf_vavpp.c b/video/filter/vf_vavpp.c index c96d23590b..352f2a586c 100644 --- a/video/filter/vf_vavpp.c +++ b/video/filter/vf_vavpp.c @@ -363,7 +363,7 @@ static bool initialize(struct vf_priv_s *p) return true; } -static int vf_open(vf_instance_t *vf, char *args) +static int vf_open(vf_instance_t *vf) { vf->reconfig = reconfig; vf->filter_ext = filter_ext; diff --git a/video/filter/vf_vo.c b/video/filter/vf_vo.c index 8deb632085..3ba0a60fe8 100644 --- a/video/filter/vf_vo.c +++ b/video/filter/vf_vo.c @@ -110,7 +110,7 @@ static void uninit(struct vf_instance *vf) } } -static int vf_open(vf_instance_t *vf, char *args) +static int vf_open(vf_instance_t *vf) { vf->reconfig = reconfig; vf->control = control; diff --git a/video/filter/vf_yadif.c b/video/filter/vf_yadif.c index 735f1ac6c8..7cbfb1633c 100644 --- a/video/filter/vf_yadif.c +++ b/video/filter/vf_yadif.c @@ -490,7 +490,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){ return 0; } -static int vf_open(vf_instance_t *vf, char *args){ +static int vf_open(vf_instance_t *vf){ vf->config=config; vf->filter_ext=filter_image; -- cgit v1.2.3