diff options
author | sfan5 <sfan5@live.de> | 2021-10-30 17:12:29 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-11-05 23:34:20 +0100 |
commit | ec16769c2d37d74d53192d422d80c8e20a708fb7 (patch) | |
tree | 902d1d09be3f2e2d547e87fd43f2e6928862708c /filters/f_lavfi.c | |
parent | 6996588254e59cc5c2489556d6fbfc8bca54f19c (diff) | |
download | mpv-ec16769c2d37d74d53192d422d80c8e20a708fb7.tar.bz2 mpv-ec16769c2d37d74d53192d422d80c8e20a708fb7.tar.xz |
f_lavfi: replace deprecated avfilter_pad_count
Diffstat (limited to 'filters/f_lavfi.c')
-rw-r--r-- | filters/f_lavfi.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/filters/f_lavfi.c b/filters/f_lavfi.c index 1f715e6e34..e764598997 100644 --- a/filters/f_lavfi.c +++ b/filters/f_lavfi.c @@ -944,19 +944,19 @@ static struct mp_filter *lavfi_create(struct mp_filter *parent, void *options) return l ? l->f : NULL; } -static bool is_single_media_only(const AVFilterPad *pads, int media_type) -{ - int count = avfilter_pad_count(pads); - if (count != 1) - return false; - return avfilter_pad_get_type(pads, 0) == media_type; -} - // Does it have exactly one video input and one video output? static bool is_usable(const AVFilter *filter, int media_type) { - return is_single_media_only(filter->inputs, media_type) && - is_single_media_only(filter->outputs, media_type); +#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(8, 3, 0) + int nb_inputs = avfilter_filter_pad_count(filter, 0), + nb_outputs = avfilter_filter_pad_count(filter, 1); +#else + int nb_inputs = avfilter_pad_count(filter->inputs), + nb_outputs = avfilter_pad_count(filter->outputs); +#endif + return nb_inputs == 1 && nb_outputs == 1 && + avfilter_pad_get_type(filter->inputs, 0) == media_type && + avfilter_pad_get_type(filter->outputs, 0) == media_type; } bool mp_lavfi_is_usable(const char *name, int media_type) |