diff options
author | llyyr <llyyr.public@gmail.com> | 2023-08-14 21:11:11 +0530 |
---|---|---|
committer | Niklas Haas <github-daiK1o@haasn.dev> | 2023-08-28 00:29:43 +0200 |
commit | 8bf3fe7e2a05809103527fa3d2a0fd8eeed3ef2a (patch) | |
tree | 5decb65a963af6d70cf7fb48e03635920ea43603 /filters/f_lavfi.c | |
parent | a19aefac372c7fbfed08209eef55862c2e715b5c (diff) | |
download | mpv-8bf3fe7e2a05809103527fa3d2a0fd8eeed3ef2a.tar.bz2 mpv-8bf3fe7e2a05809103527fa3d2a0fd8eeed3ef2a.tar.xz |
f_lavfi: don't reject dynamic lavfi ins/outs
Ideally, users should be using lavfi-complex instead of lavfi-bridge
for such a use case, however currently lavfi-complex doesn't support
hwdec. So we can allow filters with dynamic inputs to work with
lavfi-bridge, at the cost of them only being able to take in
only one input. This should probably be reverted when/if lavfi-complex
has hwdec, but for now this allows us to use libplacebo
as a video filter with hwdec in mpv again.
Diffstat (limited to 'filters/f_lavfi.c')
-rw-r--r-- | filters/f_lavfi.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/filters/f_lavfi.c b/filters/f_lavfi.c index 597cf91fc0..ec50dd5946 100644 --- a/filters/f_lavfi.c +++ b/filters/f_lavfi.c @@ -981,9 +981,13 @@ static bool is_usable(const AVFilter *filter, int media_type) 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 input_ok = filter->flags & AVFILTER_FLAG_DYNAMIC_INPUTS; + bool output_ok = filter->flags & AVFILTER_FLAG_DYNAMIC_OUTPUTS; + if (nb_inputs == 1) + input_ok = avfilter_pad_get_type(filter->inputs, 0) == media_type; + if (nb_outputs == 1) + output_ok = avfilter_pad_get_type(filter->outputs, 0) == media_type; + return input_ok && output_ok; } bool mp_lavfi_is_usable(const char *name, int media_type) |