diff options
author | wm4 <wm4@nowhere> | 2014-09-27 17:14:23 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-09-27 17:21:29 +0200 |
commit | 0ec6df2ddfc6eb22de3c4f98c78d291997a5e93d (patch) | |
tree | 7014bcaed49a291a5c6b08f965b4be9b1d18b8a7 /video/filter/vf_gradfun.c | |
parent | cbf7180c90cba46921e9ababb74b5cc5ce45d287 (diff) | |
download | mpv-0ec6df2ddfc6eb22de3c4f98c78d291997a5e93d.tar.bz2 mpv-0ec6df2ddfc6eb22de3c4f98c78d291997a5e93d.tar.xz |
vf_lavfi: make chaining from other filters more flexible
Some filters exists only to create a specific lavfi graph. Allow these
filters to reset the graph exactly on reconfig, and allow them to modify
some image parameters too. Also make vf_lw_update_graph() behave like
vf_lw_set_graph() - they had a subtitle difference with filter==NULL.
Useful for the following commit.
Diffstat (limited to 'video/filter/vf_gradfun.c')
-rw-r--r-- | video/filter/vf_gradfun.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/video/filter/vf_gradfun.c b/video/filter/vf_gradfun.c index 6b98f38437..b352521001 100644 --- a/video/filter/vf_gradfun.c +++ b/video/filter/vf_gradfun.c @@ -43,16 +43,19 @@ struct vf_priv_s { .cfg_size = -1, }; -static void lavfi_recreate(struct vf_instance *vf) +static int lavfi_reconfig(struct vf_instance *vf, + struct mp_image_params *in, + struct mp_image_params *out) { struct vf_priv_s *p = vf_lw_old_priv(vf); - int w = vf->fmt_in.w; - int h = vf->fmt_in.h; + int w = in->w; + int h = in->h; p->radius = p->cfg_radius; if (p->cfg_size > -1) p->radius = (p->cfg_size / 100.0f) * sqrtf(w * w + h * h); p->radius = MPCLAMP((p->radius+1)&~1, 4, 32); vf_lw_update_graph(vf, "gradfun", "%f:%d", p->cfg_thresh, p->radius); + return 0; } static int vf_open(vf_instance_t *vf) @@ -72,7 +75,7 @@ static int vf_open(vf_instance_t *vf) if (vf_lw_set_graph(vf, vf->priv->lw_opts, "gradfun", "%f:4", vf->priv->cfg_thresh) >= 0) { - vf_lw_set_recreate_cb(vf, lavfi_recreate); + vf_lw_set_reconfig_cb(vf, lavfi_reconfig); return 1; } |