avfilter: factorize requesting an input frame from multi output filters
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
parent
01ffe103e5
commit
f3b7aa6c22
6 changed files with 20 additions and 36 deletions
|
|
@ -588,15 +588,7 @@ static int activate(AVFilterContext *ctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ctx->nb_outputs; i++) {
|
||||
if (ff_outlink_get_status(ctx->outputs[i]))
|
||||
continue;
|
||||
|
||||
if (ff_outlink_frame_wanted(ctx->outputs[i])) {
|
||||
ff_inlink_request_frame(inlink);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
FF_FILTER_FORWARD_WANTED_ANY(ctx, inlink);
|
||||
|
||||
return FFERROR_NOT_READY;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,15 +228,7 @@ static int activate(AVFilterContext *ctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ctx->nb_outputs; i++) {
|
||||
if (ff_outlink_get_status(ctx->outputs[i]))
|
||||
continue;
|
||||
|
||||
if (ff_outlink_frame_wanted(ctx->outputs[i])) {
|
||||
ff_inlink_request_frame(inlink);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
FF_FILTER_FORWARD_WANTED_ANY(ctx, inlink);
|
||||
|
||||
return FFERROR_NOT_READY;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -110,15 +110,7 @@ static int activate(AVFilterContext *ctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ctx->nb_outputs; i++) {
|
||||
if (ff_outlink_get_status(ctx->outputs[i]))
|
||||
continue;
|
||||
|
||||
if (ff_outlink_frame_wanted(ctx->outputs[i])) {
|
||||
ff_inlink_request_frame(inlink);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
FF_FILTER_FORWARD_WANTED_ANY(ctx, inlink);
|
||||
|
||||
return FFERROR_NOT_READY;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -367,15 +367,7 @@ static int activate(AVFilterContext *ctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ctx->nb_outputs; i++) {
|
||||
if (ff_outlink_get_status(ctx->outputs[i]))
|
||||
continue;
|
||||
|
||||
if (ff_outlink_frame_wanted(ctx->outputs[i])) {
|
||||
ff_inlink_request_frame(inlink);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
FF_FILTER_FORWARD_WANTED_ANY(ctx, inlink);
|
||||
|
||||
return FFERROR_NOT_READY;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue