diff options
author | wm4 <wm4@nowhere> | 2014-04-20 23:53:59 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-04-21 02:57:16 +0200 |
commit | f69312e329b3c5060f85898f8e88312eb963d91a (patch) | |
tree | faf75b27f53c0ac44138410674881920ef6b77be /video/filter/vf.c | |
parent | 7791b5cf7c8ee6300ce1b6994ea6b91c7d3f4577 (diff) | |
download | mpv-f69312e329b3c5060f85898f8e88312eb963d91a.tar.bz2 mpv-f69312e329b3c5060f85898f8e88312eb963d91a.tar.xz |
vf: add function to remove a filter from the chain
Diffstat (limited to 'video/filter/vf.c')
-rw-r--r-- | video/filter/vf.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/video/filter/vf.c b/video/filter/vf.c index 9928b8a37e..ef34b8242d 100644 --- a/video/filter/vf.c +++ b/video/filter/vf.c @@ -119,6 +119,8 @@ static const vf_info_t *const filter_list[] = { NULL }; +static void vf_uninit_filter(vf_instance_t *vf); + static bool get_desc(struct m_obj_desc *dst, int index) { if (index >= MP_ARRAY_SIZE(filter_list) - 1) @@ -282,6 +284,17 @@ static vf_instance_t *vf_open_filter(struct vf_chain *c, const char *name, return vf_open(c, name, args); } +void vf_remove_filter(struct vf_chain *c, struct vf_instance *vf) +{ + assert(vf != c->first && vf != c->last); // these are sentinels + struct vf_instance *prev = c->first; + while (prev && prev->next != vf) + prev = prev->next; + assert(prev); // not inserted + prev->next = vf->next; + vf_uninit_filter(vf); +} + struct vf_instance *vf_append_filter(struct vf_chain *c, const char *name, char **args) { |