1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 00:42:57 +00:00

vf: auto-label video filters if no label is specified

Signed-off-by: wm4 <wm4@nowhere>
This commit is contained in:
Kevin Mitchell 2014-04-13 07:52:58 -07:00 committed by wm4
parent 7ae2eb8e2c
commit 7305140a8a

View File

@ -307,8 +307,19 @@ int vf_append_filter_list(struct vf_chain *c, struct m_obj_settings *list)
struct vf_instance *vf =
vf_append_filter(c, list[n].name, list[n].attribs);
if (vf) {
if (list[n].label)
if (list[n].label) {
vf->label = talloc_strdup(vf, list[n].label);
} else {
for (int i = 0; i < 100; i++) {
char* label = talloc_asprintf(vf, "%s.%02d", list[n].name, i);
if (vf_find_by_label(c, label)) {
talloc_free(label);
} else {
vf->label = label;
break;
}
}
}
}
}
return 0;