You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avfilter: factorize requesting an input frame from multi output filters
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
@ -214,6 +214,7 @@ Frame scheduling
|
||||
FF_FILTER_FORWARD_STATUS(inlink, outlink);
|
||||
FF_FILTER_FORWARD_STATUS_ALL(inlink, filter);
|
||||
FF_FILTER_FORWARD_WANTED(outlink, inlink);
|
||||
FF_FILTER_FORWARD_WANTED_ANY(filter, inlink);
|
||||
|
||||
filter_frame
|
||||
------------
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user