From beeba9161a091d4d352e6fe5224c86c383f1aaa7 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Sun, 19 Aug 2012 19:26:58 +0200 Subject: lavfi: add a closed field to AVFilerLink. It will help forward errors and maintain consistency. --- libavfilter/avfilter.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libavfilter/avfilter.c') diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index b1df5373b3..861a57d400 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -159,6 +159,11 @@ void avfilter_link_free(AVFilterLink **link) av_freep(link); } +void avfilter_link_set_closed(AVFilterLink *link, int closed) +{ + link->closed = closed; +} + int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, unsigned filt_srcpad_idx, unsigned filt_dstpad_idx) { @@ -325,6 +330,8 @@ int ff_request_frame(AVFilterLink *link) int ret = -1; FF_TPRINTF_START(NULL, request_frame); ff_tlog_link(NULL, link, 1); + if (link->closed) + return AVERROR_EOF; if (link->srcpad->request_frame) ret = link->srcpad->request_frame(link); else if (link->src->inputs[0]) @@ -335,6 +342,8 @@ int ff_request_frame(AVFilterLink *link) ff_filter_samples_framed(link, pbuf); return 0; } + if (ret == AVERROR_EOF) + link->closed = 1; return ret; } -- cgit v1.2.1