diff --git a/filters/f_lavfi.c b/filters/f_lavfi.c index f4f68ba0af..23af326c9b 100644 --- a/filters/f_lavfi.c +++ b/filters/f_lavfi.c @@ -943,10 +943,6 @@ static bool is_usable(const AVFilter *filter, int media_type) bool mp_lavfi_is_usable(const char *name, int media_type) { - // Skip the lavfi- prefix, if present. - if (strncmp(name, "lavfi-", 6) == 0) - name += 6; - const AVFilter *f = avfilter_get_by_name(name); return f && is_usable(f, media_type); } 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 = {