From patchwork Sat May 2 22:35:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 19446 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 8C998449EE4 for ; Sun, 3 May 2020 01:35:59 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 63EB568C20C; Sun, 3 May 2020 01:35:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CB23B68C08C for ; Sun, 3 May 2020 01:35:52 +0300 (EEST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 55A405C033B for ; Sat, 2 May 2020 18:35:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sat, 02 May 2020 18:35:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jailuthra.in; h= from:to:subject:date:message-id:mime-version :content-transfer-encoding; s=fm1; bh=u/wuz0QYgeJGt6Aopx8NA7i/6X ocePLZcuh03YpenAg=; b=LB5tMhilmSdB2llMsUbgn10FtfW4QMQJgSyfFpXoM4 bxHZ1j9zxpg0MlQmewiupyt/UyT9ZM7UaiRXVk57Q7S8JwjNuK5D2ulz2OmOsnRp xhfpkHJ+REhtVg5Eonpqb3rA8JfL/TYafgbkisrWajxQZ02Ps2WTCDC98baXwKtF Bru23d39wUsvi1RfSDF4mKqcvFC59PKKM1gyJlndjkc0YJHF4WuUfAfbrccsFtKq 3fUzY5a/D5G58AaydqgFnvhfDMoEM2A0sFV/5vWg6hjdefzgsFQT6WBPv6/e+2hu ce2CtEm7w5clfU1ye9kfcDeTCbfmWB+yIueF1ztwJz5g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=u/wuz0QYgeJGt6Aop x8NA7i/6XocePLZcuh03YpenAg=; b=b1bMoTWDqyXRD1qWYj7Nik0d27AII1Fpn j5Edk+5OStHYyG8Z67Seq9FXRYP8z8p/GPD0kiebB+tm+qu006qtLEjzEAkTe1Yg XDdvwoUEGjI1BFIqsaxvN0vcqe70ik6XxJnyufdMr+YHzNE1AVp9IjaSZmcdZ33v QMcVXk4AAPHgaIce+9XNQx4hq9Z+ZC4gqY6ep1aRKsGUToN556Q8tzvTa2r8I4gy shfnwchZiMa0rnr8YScDzVx0WsQGE78cRTHx2B680CoIJe0VOaY1eRWt05BGg7RN oUgV7UDBNcbjdv59citthpQdqs3eHvlh2rKzYXxTzN2fiJojS++bw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrjedtgddtlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffoggfgsedtkeertdertd dtnecuhfhrohhmpeflrghiucfnuhhthhhrrgcuoehmvgesjhgrihhluhhthhhrrgdrihhn qeenucggtffrrghtthgvrhhnpeevffefteegfffhteeijedugfeiheeftdelkeetvdettd eijeehffehudefveegheenucfkphepuddvgedruddvfedrvdeghedruddvfeenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmvgesjhgrihhluh hthhhrrgdrihhn X-ME-Proxy: Received: from localhost.localdomain (unknown [124.123.245.123]) by mail.messagingengine.com (Postfix) with ESMTPA id 607E83065FA7 for ; Sat, 2 May 2020 18:35:50 -0400 (EDT) From: Jai Luthra To: ffmpeg-devel@ffmpeg.org Date: Sun, 3 May 2020 04:05:47 +0530 Message-Id: <20200502223547.335955-1-me@jailuthra.in> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavf/fps: add cmd to force write buf 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Enables writing buffered frames to the outsink using send command api. This is useful when a lavf user wants to fetch buffered frames without closing/reopening the filtergraph again and again. Signed-off-by: Jai Luthra --- libavfilter/vf_fps.c | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c index cf1e36726a..fa856a8f45 100644 --- a/libavfilter/vf_fps.c +++ b/libavfilter/vf_fps.c @@ -326,6 +326,23 @@ static int activate(AVFilterContext *ctx) return FFERROR_NOT_READY; } +static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, + char *res, int res_len, int flags) +{ + FPSContext *s = ctx->priv; + int ret, again = 0; + + if (!strcmp(cmd, "force_write")) { + AVFilterLink *outlink = ctx->outputs[0]; + ret = write_frame(ctx, s, outlink, &again); + if (again) + ff_filter_set_ready(ctx, 100); + } else + ret = AVERROR(ENOSYS); + + return ret; +} + static const AVFilterPad avfilter_vf_fps_inputs[] = { { .name = "default", @@ -344,13 +361,14 @@ static const AVFilterPad avfilter_vf_fps_outputs[] = { }; AVFilter ff_vf_fps = { - .name = "fps", - .description = NULL_IF_CONFIG_SMALL("Force constant framerate."), - .init = init, - .uninit = uninit, - .priv_size = sizeof(FPSContext), - .priv_class = &fps_class, - .activate = activate, - .inputs = avfilter_vf_fps_inputs, - .outputs = avfilter_vf_fps_outputs, + .name = "fps", + .description = NULL_IF_CONFIG_SMALL("Force constant framerate."), + .init = init, + .uninit = uninit, + .priv_size = sizeof(FPSContext), + .priv_class = &fps_class, + .activate = activate, + .inputs = avfilter_vf_fps_inputs, + .outputs = avfilter_vf_fps_outputs, + .process_command = process_command, };