From patchwork Sat Dec 24 17:41:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 1910 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp383591vsb; Sat, 24 Dec 2016 09:43:03 -0800 (PST) X-Received: by 10.194.108.10 with SMTP id hg10mr21121082wjb.58.1482601383079; Sat, 24 Dec 2016 09:43:03 -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 s3si39983880wjr.258.2016.12.24.09.43.02; Sat, 24 Dec 2016 09:43:03 -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 48E036899BE; Sat, 24 Dec 2016 19:42:11 +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 6F9316899BE for ; Sat, 24 Dec 2016 19:42:03 +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 uBOHg4E9095785 for ; Sat, 24 Dec 2016 18:42:04 +0100 (CET) Received: by phare.normalesup.org (Postfix, from userid 1001) id 6214BE0087; Sat, 24 Dec 2016 18:42:04 +0100 (CET) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Sat, 24 Dec 2016 18:41:37 +0100 Message-Id: <20161224174149.8995-6-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:04 +0100 (CET) Subject: [FFmpeg-devel] [PATCH 05/17] lavfi: add ff_link_process_commands(). 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 | 24 +++++++++++++++--------- libavfilter/internal.h | 6 ++++++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 83daef4609..b05a75182a 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -1099,7 +1099,6 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) AVFilterContext *dstctx = link->dst; AVFilterPad *dst = link->dstpad; int ret; - AVFilterCommand *cmd= link->dst->command_queue; int64_t pts; if (!(filter_frame = dst->filter_frame)) @@ -1111,14 +1110,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) goto fail; } - while(cmd && cmd->time <= frame->pts * av_q2d(link->time_base)){ - av_log(link->dst, AV_LOG_DEBUG, - "Processing command time:%f command:%s arg:%s\n", - cmd->time, cmd->command, cmd->arg); - avfilter_process_command(link->dst, cmd->command, cmd->arg, 0, 0, cmd->flags); - ff_command_queue_pop(link->dst); - cmd= link->dst->command_queue; - } + ff_link_process_commands(link, frame); pts = frame->pts; if (dstctx->enable_str) { @@ -1565,6 +1557,20 @@ int ff_link_make_frame_writable(AVFilterLink *link, AVFrame **rframe) return 0; } +void ff_link_process_commands(AVFilterLink *link, const AVFrame *frame) +{ + AVFilterCommand *cmd = link->dst->command_queue; + + while(cmd && cmd->time <= frame->pts * av_q2d(link->time_base)){ + av_log(link->dst, AV_LOG_DEBUG, + "Processing command time:%f command:%s arg:%s\n", + cmd->time, cmd->command, cmd->arg); + avfilter_process_command(link->dst, cmd->command, cmd->arg, 0, 0, cmd->flags); + ff_command_queue_pop(link->dst); + cmd= link->dst->command_queue; + } +} + const AVClass *avfilter_get_class(void) { return &avfilter_class; diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 422363477b..1a78dc2785 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -631,4 +631,10 @@ int ff_link_acknowledge_status(AVFilterLink *link); */ int ff_link_make_frame_writable(AVFilterLink *link, AVFrame **rframe); +/** + * Process the commands queued in the link up to the time of the frame. + * Commands will trigger the process_command() callback. + */ +void ff_link_process_commands(AVFilterLink *link, const AVFrame *frame); + #endif /* AVFILTER_INTERNAL_H */