diff options
Diffstat (limited to 'libavfilter/vf_idet.c')
-rw-r--r-- | libavfilter/vf_idet.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c index 339f4a6507..b9c4070d48 100644 --- a/libavfilter/vf_idet.c +++ b/libavfilter/vf_idet.c @@ -191,6 +191,35 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref) return ff_filter_frame(ctx->outputs[0], av_frame_clone(idet->cur)); } +static int request_frame(AVFilterLink *link) +{ + AVFilterContext *ctx = link->src; + IDETContext *idet = ctx->priv; + + do { + int ret; + + if (idet->eof) + return AVERROR_EOF; + + ret = ff_request_frame(link->src->inputs[0]); + + if (ret == AVERROR_EOF && idet->cur) { + AVFrame *next = av_frame_clone(idet->next); + + if (!next) + return AVERROR(ENOMEM); + + filter_frame(link->src->inputs[0], next); + idet->eof = 1; + } else if (ret < 0) { + return ret; + } + } while (!idet->cur); + + return 0; +} + static av_cold void uninit(AVFilterContext *ctx) { IDETContext *idet = ctx->priv; @@ -253,6 +282,7 @@ static av_cold int init(AVFilterContext *ctx) { IDETContext *idet = ctx->priv; + idet->eof = 0; idet->last_type = UNDETERMINED; memset(idet->history, UNDETERMINED, HIST_SIZE); @@ -279,6 +309,7 @@ static const AVFilterPad idet_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, + .request_frame = request_frame }, { NULL } }; |