summaryrefslogtreecommitdiffstats
path: root/video/filter
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2014-04-13 07:52:58 -0700
committerwm4 <wm4@nowhere>2014-04-13 18:03:01 +0200
commit7305140a8ade58847d9e44cf4ebf5fd202b30892 (patch)
treeff77893e4535c19fe3a5a1d6046f1065793fb63e /video/filter
parent7ae2eb8e2cbb041d22017632e95de6ac773db56a (diff)
downloadmpv-7305140a8ade58847d9e44cf4ebf5fd202b30892.tar.bz2
mpv-7305140a8ade58847d9e44cf4ebf5fd202b30892.tar.xz
vf: auto-label video filters if no label is specified
Signed-off-by: wm4 <wm4@nowhere>
Diffstat (limited to 'video/filter')
-rw-r--r--video/filter/vf.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/video/filter/vf.c b/video/filter/vf.c
index 2e26ed0fbe..a37afde68b 100644
--- a/video/filter/vf.c
+++ b/video/filter/vf.c
@@ -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;