From patchwork Thu Dec 29 14:33:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 1971 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp2439098vsb; Thu, 29 Dec 2016 06:34:16 -0800 (PST) X-Received: by 10.194.179.135 with SMTP id dg7mr36423537wjc.219.1483022056158; Thu, 29 Dec 2016 06:34:16 -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 eq5si29971509wjc.18.2016.12.29.06.34.15; Thu, 29 Dec 2016 06:34:16 -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 1B2DF689AEF; Thu, 29 Dec 2016 16:34: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 7356868925E for ; Thu, 29 Dec 2016 16:34:02 +0200 (EET) Received: from phare.normalesup.org (archicubes.ens.fr [129.199.129.80]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id uBTEY5pp080405 for ; Thu, 29 Dec 2016 15:34:05 +0100 (CET) Received: by phare.normalesup.org (Postfix, from userid 1001) id 65FB4E00F9; Thu, 29 Dec 2016 15:34:05 +0100 (CET) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Thu, 29 Dec 2016 15:33:47 +0100 Message-Id: <20161229143403.2851-1-george@nsup.org> X-Mailer: git-send-email 2.11.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef2.ens.fr [129.199.96.32]); Thu, 29 Dec 2016 15:34:05 +0100 (CET) Subject: [FFmpeg-devel] [PATCH 01/17] lavfi: add ff_inlink_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" Also introduce libavfilter/filters.h for all functions needed to implement filters. Signed-off-by: Nicolas George --- libavfilter/avfilter.c | 14 ++++++++++++++ libavfilter/filters.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 libavfilter/filters.h The series is still based on the series about AVFilterLink, although it does not actually depends on it, it is just a matter of tiny conflicts in the headers. Still passes FATE at each step. Changes in this commit: rename ff_link -> ff_inlink and move to filters.h, and always return the status (avoids accessing the link directly). diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 8d106c1ab3..47a48998e0 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -38,6 +38,7 @@ #include "audio.h" #include "avfilter.h" #include "avfilterlink.h" +#include "filters.h" #include "formats.h" #include "internal.h" @@ -1542,6 +1543,19 @@ int ff_filter_activate(AVFilterContext *filter) return ret; } +int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus) +{ + if (ff_framequeue_queued_frames(&link->fifo)) + return *rstatus = 0; + if (link->status_out) + return *rstatus = link->status_out; + if (!link->status_in) + return *rstatus = 0; + *rstatus = 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/filters.h b/libavfilter/filters.h new file mode 100644 index 0000000000..f4a46a023c --- /dev/null +++ b/libavfilter/filters.h @@ -0,0 +1,37 @@ +/* + * Filters implementation helper functions + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with FFmpeg; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_FILTERS_H +#define AVFILTER_FILTERS_H + +/** + * Filters implementation helper functions + */ + +#include "avfilter.h" + +/** + * Test and acknowledge the change of status on the link. + * @param[out] new or current status + * @return >0 if status changed, <0 if status already acked, 0 otherwise + */ +int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus); + +#endif /* AVFILTER_FILTERS_H */