From patchwork Sat Apr 8 12:49:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 3341 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.44.195 with SMTP id s186csp669668vss; Sat, 8 Apr 2017 05:49:21 -0700 (PDT) X-Received: by 10.28.136.204 with SMTP id k195mr2941293wmd.99.1491655761765; Sat, 08 Apr 2017 05:49:21 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w8si3486205wmw.68.2017.04.08.05.49.20; Sat, 08 Apr 2017 05:49:21 -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 29F9F6883CB; Sat, 8 Apr 2017 15:49:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C52B3688303 for ; Sat, 8 Apr 2017 15:49:07 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 45E70100C47; Sat, 8 Apr 2017 14:49:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sVh1EWhAqYS7; Sat, 8 Apr 2017 14:49:10 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id E2415100B26; Sat, 8 Apr 2017 14:49:09 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sat, 8 Apr 2017 14:49:05 +0200 Message-Id: <20170408124905.2867-1-cus@passwd.hu> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170407082047.GA2393601@phare.normalesup.org> References: <20170407082047.GA2393601@phare.normalesup.org> Subject: [FFmpeg-devel] [PATCHv3] avfilter/vf_framerate: always request input if no output is provided in request_frame 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 Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes ticket #6285. Signed-off-by: Marton Balint --- libavfilter/vf_framerate.c | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/libavfilter/vf_framerate.c b/libavfilter/vf_framerate.c index b4a74f7..dc8b05f 100644 --- a/libavfilter/vf_framerate.c +++ b/libavfilter/vf_framerate.c @@ -440,7 +440,7 @@ copy_done: s->pending_end_frame = 0; s->last_dest_frame_pts = s->work->pts; - return ff_filter_frame(ctx->outputs[0], s->work); + return 1; } static void set_srce_frame_dest_pts(AVFilterContext *ctx) @@ -586,6 +586,7 @@ static int config_input(AVFilterLink *inlink) static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) { + int ret; AVFilterContext *ctx = inlink->dst; FrameRateContext *s = ctx->priv; @@ -606,7 +607,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) set_srce_frame_dest_pts(ctx); } - return process_work_frame(ctx, 1); + ret = process_work_frame(ctx, 1); + if (ret < 0) + return ret; + return ret ? ff_filter_frame(ctx->outputs[0], s->work) : 0; } static int config_output(AVFilterLink *outlink) @@ -658,23 +662,13 @@ static int request_frame(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; FrameRateContext *s = ctx->priv; - int val, i; + int ret, i; ff_dlog(ctx, "request_frame()\n"); // if there is no "next" frame AND we are not in flush then get one from our input filter - if (!s->srce[s->frst] && !s->flush) { - ff_dlog(ctx, "request_frame() call source's request_frame()\n"); - val = ff_request_frame(outlink->src->inputs[0]); - if (val < 0 && (val != AVERROR_EOF)) { - ff_dlog(ctx, "request_frame() source's request_frame() returned error:%d\n", val); - return val; - } else if (val == AVERROR_EOF) { - s->flush = 1; - } - ff_dlog(ctx, "request_frame() source's request_frame() returned:%d\n", val); - return 0; - } + if (!s->srce[s->frst] && !s->flush) + goto request; ff_dlog(ctx, "request_frame() REPEAT or FLUSH\n"); @@ -695,7 +689,23 @@ static int request_frame(AVFilterLink *outlink) } set_work_frame_pts(ctx); - return process_work_frame(ctx, 0); + ret = process_work_frame(ctx, 0); + if (ret < 0) + return ret; + if (ret) + return ff_filter_frame(ctx->outputs[0], s->work); + +request: + ff_dlog(ctx, "request_frame() call source's request_frame()\n"); + ret = ff_request_frame(ctx->inputs[0]); + if (ret < 0 && (ret != AVERROR_EOF)) { + ff_dlog(ctx, "request_frame() source's request_frame() returned error:%d\n", ret); + return ret; + } else if (ret == AVERROR_EOF) { + s->flush = 1; + } + ff_dlog(ctx, "request_frame() source's request_frame() returned:%d\n", ret); + return 0; } static const AVFilterPad framerate_inputs[] = {