mirror of https://github.com/mpv-player/mpv
vf: add function to remove a filter from the chain
This commit is contained in:
parent
7791b5cf7c
commit
f69312e329
|
@ -119,6 +119,8 @@ static const vf_info_t *const filter_list[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void vf_uninit_filter(vf_instance_t *vf);
|
||||||
|
|
||||||
static bool get_desc(struct m_obj_desc *dst, int index)
|
static bool get_desc(struct m_obj_desc *dst, int index)
|
||||||
{
|
{
|
||||||
if (index >= MP_ARRAY_SIZE(filter_list) - 1)
|
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);
|
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,
|
struct vf_instance *vf_append_filter(struct vf_chain *c, const char *name,
|
||||||
char **args)
|
char **args)
|
||||||
{
|
{
|
||||||
|
|
|
@ -136,6 +136,7 @@ struct mp_image *vf_output_queued_frame(struct vf_chain *c);
|
||||||
void vf_seek_reset(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,
|
struct vf_instance *vf_append_filter(struct vf_chain *c, const char *name,
|
||||||
char **args);
|
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);
|
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);
|
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);
|
void vf_print_filter_chain(struct vf_chain *c, int msglevel);
|
||||||
|
|
Loading…
Reference in New Issue