diff options
author | wm4 <wm4@nowhere> | 2019-12-07 14:19:11 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-12-07 14:19:11 +0100 |
commit | 855a4779ae64a53d04a7d8fcdc274bd8f2155831 (patch) | |
tree | 6591561f3b7e3933227608a712ccde4227a3622d /filters/user_filters.c | |
parent | d90d5ee1a0914239ee3048fe567fed14adbe1127 (diff) | |
download | mpv-855a4779ae64a53d04a7d8fcdc274bd8f2155831.tar.bz2 mpv-855a4779ae64a53d04a7d8fcdc274bd8f2155831.tar.xz |
filters: move prefix check from f_lavfi.c to user_filters.c
It's user_filters.c which allows the "lavfi-" prefix to distinguish
libavfilter filters from mpv builtin filters. f_lavfi.c is a layer
below, and strictly passes anything it gets to libavfilter. So the
correct place for this is in user_filters.c, which also has the code for
stripping the prefix in the normal filter instantiation code.
Diffstat (limited to 'filters/user_filters.c')
-rw-r--r-- | filters/user_filters.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/filters/user_filters.c b/filters/user_filters.c index 69017b7b5a..7fb164490e 100644 --- a/filters/user_filters.c +++ b/filters/user_filters.c @@ -20,6 +20,14 @@ static bool get_desc_from(const struct mp_user_filter_entry **list, int num, return true; } +static bool check_unknown_entry(const char *name, int media_type) +{ + // Generic lavfi bridge: skip the lavfi- prefix, if present. + if (strncmp(name, "lavfi-", 6) == 0) + name += 6; + return mp_lavfi_is_usable(name, media_type); +} + // --af option const struct mp_user_filter_entry *af_list[] = { @@ -50,7 +58,7 @@ static void print_af_lavfi_help(struct mp_log *log, const char *name) static bool check_af_lavfi(const char *name) { - return mp_lavfi_is_usable(name, AVMEDIA_TYPE_AUDIO); + return check_unknown_entry(name, AVMEDIA_TYPE_AUDIO); } const struct m_obj_list af_obj_list = { @@ -107,7 +115,7 @@ static void print_vf_lavfi_help(struct mp_log *log, const char *name) static bool check_vf_lavfi(const char *name) { - return mp_lavfi_is_usable(name, AVMEDIA_TYPE_VIDEO); + return check_unknown_entry(name, AVMEDIA_TYPE_VIDEO); } const struct m_obj_list vf_obj_list = { |