From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id A161A40203 for ; Sat, 19 Feb 2022 16:01:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6601A68B163; Sat, 19 Feb 2022 18:01:45 +0200 (EET) Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C0D4668AFDD for ; Sat, 19 Feb 2022 18:01:39 +0200 (EET) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 21JG1coT006055 for ; Sat, 19 Feb 2022 17:01:39 +0100 Received: by phare.normalesup.org (Postfix, from userid 1001) id D1953EB5BC; Sat, 19 Feb 2022 17:01:38 +0100 (CET) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Sat, 19 Feb 2022 17:01:36 +0100 Message-Id: <20220219160137.2806285-1-george@nsup.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Sat, 19 Feb 2022 17:01:39 +0100 (CET) Subject: [FFmpeg-devel] [PATCH 1/2] lavfi: add ff_inoutlink_check_flow() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: Nicolas George --- libavfilter/avfilter.c | 8 ++++++++ libavfilter/filters.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 7362bcdab5..1f37a70179 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -1559,6 +1559,14 @@ int ff_outlink_get_status(AVFilterLink *link) return link->status_in; } +int ff_inoutlink_check_flow(AVFilterLink *inlink, AVFilterLink *outlink) +{ + return ff_outlink_frame_wanted(outlink) || + ff_inlink_check_available_frame(inlink) || + inlink->status_out; +} + + const AVClass *avfilter_get_class(void) { return &avfilter_class; diff --git a/libavfilter/filters.h b/libavfilter/filters.h index 1157755403..86bc49d459 100644 --- a/libavfilter/filters.h +++ b/libavfilter/filters.h @@ -258,4 +258,12 @@ static inline void ff_outlink_set_status(AVFilterLink *link, int status, int64_t } \ } while (0) +/** + * Check for flow control between input and output. + * This is necessary for filters that may produce several output frames for + * a single input event, otherwise they may produce them all at once, + * causing excessive memory consumption. + */ +int ff_inoutlink_check_flow(AVFilterLink *inlink, AVFilterLink *outlink); + #endif /* AVFILTER_FILTERS_H */ -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".