summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-20 23:53:59 +0200
committerwm4 <wm4@nowhere>2014-04-30 11:45:31 +0200
commit57f32f7ca8c3996929fee071159d17bfac656c6c (patch)
tree925b72780e34b7c9d55f8c70ef070dd30ca7d874
parent3d85137495f96a714ab02a50d80b63c1c0126547 (diff)
downloadmpv-57f32f7ca8c3996929fee071159d17bfac656c6c.tar.bz2
mpv-57f32f7ca8c3996929fee071159d17bfac656c6c.tar.xz
vf: add function to remove a filter from the chain
-rw-r--r--video/filter/vf.c13
-rw-r--r--video/filter/vf.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/video/filter/vf.c b/video/filter/vf.c
index 001363b5fb..ecfccedbcd 100644
--- a/video/filter/vf.c
+++ b/video/filter/vf.c
@@ -115,6 +115,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)
@@ -270,6 +272,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)
{
diff --git a/video/filter/vf.h b/video/filter/vf.h
index 4e7832a6e8..a65492134e 100644
--- a/video/filter/vf.h
+++ b/video/filter/vf.h
@@ -134,6 +134,7 @@ struct mp_image *vf_output_queued_frame(struct vf_chain *c);
void vf_seek_reset(struct vf_chain *c);
struct vf_instance *vf_append_filter(struct vf_chain *c, const char *name,
char **args);
+void vf_remove_filter(struct vf_chain *c, struct vf_instance *vf);
int vf_append_filter_list(struct vf_chain *c, struct m_obj_settings *list);
struct vf_instance *vf_find_by_label(struct vf_chain *c, const char *label);
void vf_print_filter_chain(struct vf_chain *c, int msglevel);