avfilter: factorize requesting an input frame from multi output filters

Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Marton Balint
2025-06-22 12:07:26 +02:00
parent 01ffe103e5
commit f3b7aa6c22
6 changed files with 20 additions and 36 deletions

View File

@@ -696,6 +696,21 @@ static inline void ff_outlink_set_status(AVFilterLink *link, int status, int64_t
} \
} while (0)
/**
* Forward the frame_wanted_out flag from any of the output links to an input link.
* If the flag is set on any of the outputs, this macro will return immediately.
*/
#define FF_FILTER_FORWARD_WANTED_ANY(filter, inlink) do { \
for (int i = 0; i < filter->nb_outputs; i++) { \
if (ff_outlink_get_status(filter->outputs[i])) \
continue; \
if (ff_outlink_frame_wanted(filter->outputs[i])) { \
ff_inlink_request_frame(inlink); \
return 0; \
} \
} \
} while (0)
/**
* Check for flow control between input and output.
* This is necessary for filters that may produce several output frames for