From 8cbfb1beddcdede7c50a0879ac21654cba02f6b5 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Fri, 27 Oct 2023 14:26:50 +0200 Subject: [PATCH 1/2] avfilter/buffersrc: switch to activate Signed-off-by: Paul B Mahol --- libavfilter/buffersrc.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index 453fc0fd5c..1216904721 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -36,6 +36,7 @@ #include "audio.h" #include "avfilter.h" #include "buffersrc.h" +#include "filters.h" #include "formats.h" #include "internal.h" #include "video.h" @@ -484,21 +485,28 @@ static int config_props(AVFilterLink *link) return 0; } -static int request_frame(AVFilterLink *link) +static int activate(AVFilterContext *ctx) { - BufferSourceContext *c = link->src->priv; + AVFilterLink *outlink = ctx->outputs[0]; + BufferSourceContext *c = ctx->priv; + + if (!c->eof && ff_outlink_get_status(outlink)) { + c->eof = 1; + return 0; + } - if (c->eof) - return AVERROR_EOF; + if (c->eof) { + ff_outlink_set_status(outlink, AVERROR_EOF, c->last_pts); + return 0; + } c->nb_failed_requests++; - return AVERROR(EAGAIN); + return FFERROR_NOT_READY; } static const AVFilterPad avfilter_vsrc_buffer_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .request_frame = request_frame, .config_props = config_props, }, }; @@ -507,7 +515,7 @@ const AVFilter ff_vsrc_buffer = { .name = "buffer", .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them accessible to the filterchain."), .priv_size = sizeof(BufferSourceContext), - + .activate = activate, .init = init_video, .uninit = uninit, @@ -521,7 +529,6 @@ static const AVFilterPad avfilter_asrc_abuffer_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_AUDIO, - .request_frame = request_frame, .config_props = config_props, }, }; @@ -530,7 +537,7 @@ const AVFilter ff_asrc_abuffer = { .name = "abuffer", .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them accessible to the filterchain."), .priv_size = sizeof(BufferSourceContext), - + .activate = activate, .init = init_audio, .uninit = uninit, -- 2.42.0