From patchwork Sat Dec 24 17:41:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 1911 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp383380vsb; Sat, 24 Dec 2016 09:42:20 -0800 (PST) X-Received: by 10.28.36.87 with SMTP id k84mr20793669wmk.64.1482601340153; Sat, 24 Dec 2016 09:42:20 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b1si39997903wjz.272.2016.12.24.09.42.19; Sat, 24 Dec 2016 09:42:20 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 16CB9689B4A; Sat, 24 Dec 2016 19:42:09 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef2.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C3DAB68975F for ; Sat, 24 Dec 2016 19:42:00 +0200 (EET) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id uBOHg1M4095769 for ; Sat, 24 Dec 2016 18:42:02 +0100 (CET) Received: by phare.normalesup.org (Postfix, from userid 1001) id B72E8E0087; Sat, 24 Dec 2016 18:42:01 +0100 (CET) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Sat, 24 Dec 2016 18:41:33 +0100 Message-Id: <20161224174149.8995-2-george@nsup.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161224174149.8995-1-george@nsup.org> References: <20161224174149.8995-1-george@nsup.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef2.ens.fr [129.199.96.32]); Sat, 24 Dec 2016 18:42:02 +0100 (CET) Subject: [FFmpeg-devel] [PATCH 01/17] lavfi: add ff_link_acknowledge_status(). X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Nicolas George --- libavfilter/avfilter.c | 13 +++++++++++++ libavfilter/internal.h | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 0020ee163a..c1858fb6a0 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -1543,6 +1543,19 @@ int ff_filter_activate(AVFilterContext *filter) return ret; } +int ff_link_acknowledge_status(AVFilterLink *link) +{ + if (ff_framequeue_queued_frames(&link->fifo)) + return 0; + if (link->status_out) + return link->status_out; + if (!link->status_in) + return 0; + link->status_out = link->status_in; + ff_update_link_current_pts(link, link->status_in_pts); + return 1; +} + const AVClass *avfilter_get_class(void) { return &avfilter_class; diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 599be24a85..13666bc330 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -613,4 +613,10 @@ static inline int ff_norm_qscale(int qscale, int type) */ int ff_filter_get_nb_threads(AVFilterContext *ctx); +/** + * Test and acknowledge the change of status on the link. + * @return >0 if status changed, 0 otherwise, <0 if status already acked + */ +int ff_link_acknowledge_status(AVFilterLink *link); + #endif /* AVFILTER_INTERNAL_H */