diff options
author | wm4 <wm4@nowhere> | 2019-11-25 19:07:55 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-11-25 20:29:42 +0100 |
commit | 37ac43847eddc42f51e348a81c73bb1b42481ad0 (patch) | |
tree | 292c59e0b816bf3a18e4ab0530a7c5b536b7fb25 /filters/f_lavfi.c | |
parent | 13afc2150beeb1117e9c1724b2910e41ee4cc28b (diff) | |
download | mpv-37ac43847eddc42f51e348a81c73bb1b42481ad0.tar.bz2 mpv-37ac43847eddc42f51e348a81c73bb1b42481ad0.tar.xz |
options: pre-check filter names when using vf/af libavfilter bridge
Until now, using a filter not in mpv's builtin filter list would assume
it's a libavfilter filter. If it wasn't, the option value was still
accepted, but creating the filter simply failed. But since this happens
after option parsing, so the result is confusing.
Improve this slightly by checking filter names. This will reject truly
unknown filters at option parsing time. Unfortunately, this still does
not check filter arguments. This would be much more complex, because
you'd have to create a dummy filter graph and allocate the filter. Maybe
another time.
Diffstat (limited to 'filters/f_lavfi.c')
-rw-r--r-- | filters/f_lavfi.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/filters/f_lavfi.c b/filters/f_lavfi.c index 66e045eb2c..23af326c9b 100644 --- a/filters/f_lavfi.c +++ b/filters/f_lavfi.c @@ -941,6 +941,12 @@ static bool is_usable(const AVFilter *filter, int media_type) is_single_media_only(filter->outputs, media_type); } +bool mp_lavfi_is_usable(const char *name, int media_type) +{ + const AVFilter *f = avfilter_get_by_name(name); + return f && is_usable(f, media_type); +} + static void dump_list(struct mp_log *log, int media_type) { mp_info(log, "Available libavfilter filters:\n"); |