From patchwork Thu Jun 15 18:00:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 3990 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.22.4 with SMTP id 4csp916586vsw; Thu, 15 Jun 2017 11:00:43 -0700 (PDT) X-Received: by 10.223.153.114 with SMTP id x105mr4762506wrb.18.1497549643307; Thu, 15 Jun 2017 11:00:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497549643; cv=none; d=google.com; s=arc-20160816; b=aYst30ganzqNoHn0UQ+c59YwwlEua3Qv+nENLjpBNZKSuzGvRIS/mMv03KHi7SvR8+ Yp2A8gzPvLxAsYRGMUeRbtOw/vLm4WcykracKVQfj6X4RzzwPKYtbpzkUmkpB1rR3Qlx cze4b3ETjN0jJ/JvC+8tjoWXeTswdMsByka4DMuJP9Jy14HwC9MsLM0vWE6K4gj0mEY3 4KguqyRn064idiG0r/F05oy76m8te9hM23YkH3ePVyUExvzJmKZc1PPOh+k/8J7bdJiu SwvTN0pyhdxyM+LGAVSEd88H5nK5YpVF3CaKFi//xsEnGWiFbcZNoJvIrd83O1tZZWVE GV3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :in-reply-to:mime-version:references:message-id:to:from:date :delivered-to:arc-authentication-results; bh=GzuWf4/l90ikYJPPWypNaecwbXzjQlykbdLdkXMaZ+g=; b=k1B2JMmaqPCUW3QYrOfzvT8zGDLoxg+6YOpKo60DgygLo0qp6yDc8BqZtRwLNjtGoR gtVMC+w8eGIXnTmemuUSNuuIDguQzeKk0yPhn7CPYsbL380mXGgb9CQouvZ+AR5qhr/G txngWK+9+3P/N5HvW/5zkgZ1O3O/K6JXXLv42zeo2lk3JTR0yGcFf4kr62sD4yPH1l4/ +HzMiHAP8QGPEqmdVoERBkgAC6LsZSwlFmNIEuKJSQ4MsvAJCl2rbMqXNLk9SPIeS2kT ltYR9aFBA5BHHp+U1Rec+27oGqMDKW2G/eNT9LFId3yTMzuT8Kol5URdzq5TilTOTfnl FxvA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 71si661209wmb.134.2017.06.15.11.00.42; Thu, 15 Jun 2017 11:00:43 -0700 (PDT) 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 39E4568A37A; Thu, 15 Jun 2017 21:00:36 +0300 (EEST) 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 072AF68A32B for ; Thu, 15 Jun 2017 21:00:28 +0300 (EEST) 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 v5FI0VJm042210 for ; Thu, 15 Jun 2017 20:00:31 +0200 (CEST) Received: by phare.normalesup.org (Postfix, from userid 1001) id 63406E00D6; Thu, 15 Jun 2017 20:00:31 +0200 (CEST) Date: Thu, 15 Jun 2017 20:00:31 +0200 From: Nicolas George To: FFmpeg development discussions and patches Message-ID: <20170615180031.GA1157777@phare.normalesup.org> References: <20170402111619.GA3569160@phare.normalesup.org> <0a34f69b-ad43-b4d5-b97c-7ee442b8a18f@gmail.com> <20170613124626.GA3725048@phare.normalesup.org> <20170613130030.GA3730516@phare.normalesup.org> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef2.ens.fr [129.199.96.32]); Thu, 15 Jun 2017 20:00:31 +0200 (CEST) Subject: Re: [FFmpeg-devel] [PATCH v3] avfilter/vf_fps: fix duration 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Le quintidi 25 prairial, an CCXXV, Thomas Mundt a écrit : > Patch attached. This fixes ticket #2674. I inserted a FIXME message as a > reminder. > Please comment. I am sorry to say I do not like it. The timestamp computation code in vf_fps is already quite complex, and this patch is making it more complex, introducing frames_in_proc which should not be needed just to fix the last timestamp, and obviously the EOF handling duplicates the filter_frame() logic. Rule of thumb: if you are about to copy-paste a non-trivial block of code, stop and refactor. I think the way forward for this filter is to rewrite the core logic using the activate() design. It should be much simpler since the framework already handles a FIFO. If you are interested in it, you probably will need to rebase push this series: https://ffmpeg.org/pipermail/ffmpeg-devel/2017-April/209678.html and use the attached patch. Regards, From b7a20596861a8baeb746dbe8922c874ab48e26f5 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Sun, 23 Apr 2017 14:05:01 +0200 Subject: [PATCH 5/6] lavfi: add ff_inlink_query_fifo(). Signed-off-by: Nicolas George --- libavfilter/avfilter.c | 14 ++++++++++++++ libavfilter/filters.h | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index ecfb872ed8..ee79743928 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -1638,6 +1638,20 @@ void ff_inlink_request_frame(AVFilterLink *link) ff_filter_set_ready(link->src, 100); } +void ff_inlink_query_fifo(AVFilterLink *link, + size_t *frames, uint64_t *samples, + int *status, int64_t *status_pts) +{ + if (*frames) + *frames = ff_framequeue_queued_frames(&link->fifo); + if (*samples) + *samples = ff_framequeue_queued_samples(&link->fifo); + if (*status) + *status = link->status_in; + if (*status_pts) + *status_pts = link->status_in_pts; +} + const AVClass *avfilter_get_class(void) { return &avfilter_class; diff --git a/libavfilter/filters.h b/libavfilter/filters.h index 2c78d60e62..870fbc4708 100644 --- a/libavfilter/filters.h +++ b/libavfilter/filters.h @@ -134,4 +134,11 @@ int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts */ void ff_inlink_request_frame(AVFilterLink *link); +/** + * Query the properties of the link FIFO and surrounding properties. + */ +void ff_inlink_query_fifo(AVFilterLink *link, + size_t *frames, uint64_t *samples, + int *status, int64_t *status_pts); + #endif /* AVFILTER_FILTERS_H */ -- 2.11.0