From patchwork Thu Aug 10 11:46:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 4670 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.46.211 with SMTP id u202csp2306955vsu; Thu, 10 Aug 2017 04:46:58 -0700 (PDT) X-Received: by 10.223.160.229 with SMTP id n34mr9393985wrn.117.1502365618870; Thu, 10 Aug 2017 04:46:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502365618; cv=none; d=google.com; s=arc-20160816; b=UhCGD+HvCfmDfVf9Egi0ePXj4Hnmr7SbH57ZCzMJzYk9M938Wp7rR18G34wEUD1L6N 51T2U6J9KZSjkVHm+DZusu5+Dmblg9sUG1VbaFn8Ua1Qr1h3SqkzyZX9UaHIYawXU+q8 lXuswILOo5KXB78qdYi5vvrOuEPbegwzRBqBgtIjBwmC3vKs1RqwIOGG/GoMGeGxiiIh s6qZrYMm1ZjqgZrc3VZBgkyRoyLvC1KtrZZmjs/agj1FCK/OWwyvDo6+6piaOBRfY646 laQryMAQ4K2sqYCcPHmz5F8OZwo827O4qcdUTsNvNnDfb1gmTMm8zqWpGQHX5V9T54wO 4W6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=t8AlNzhgiJUUuqypGKwx++RT0brHM0HGosbqKSvLBMM=; b=o/6bDZoPwoSwxLzYULJ/9+zlRoT5P+XmDvdaSZvtz5UJsmqVDXPr17hWOkeBB1IBz8 B+wWTWS8Y7P9+stsSJCrdnkrLTUKqkpE0HWdYLVgzA4HlKirJS8YLfskuStqerQ2eQI8 xjX47z1zxYxud2wKaTCBxZuEeK1r+v2JnWY8pD6pAyCSPPbk/bN6oFyNzN1WSXnHQR8p z4goMn544ETPmKUQjehx10c0gsmLknDWvR+2vSbli0qVgUkbNFacAMW03kfFFyzNdgq4 WcWgz6HgC1aJcgIPEkmbFOTvwtG87CZQXvmrChOz2tnTqDKXMzdYjHdRuXWSevlH7DU6 gnGg== 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 e4si4742877wmc.100.2017.08.10.04.46.58; Thu, 10 Aug 2017 04:46:58 -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 1D7AB689BE5; Thu, 10 Aug 2017 14:46:45 +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 C9577689C09 for ; Thu, 10 Aug 2017 14:46:43 +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 v7ABkkqN043656 for ; Thu, 10 Aug 2017 13:46:46 +0200 (CEST) Received: by phare.normalesup.org (Postfix, from userid 1001) id 0F3B0E00F5; Thu, 10 Aug 2017 13:46:46 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Thu, 10 Aug 2017 13:46:28 +0200 Message-Id: <20170810114642.26779-2-george@nsup.org> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170810114642.26779-1-george@nsup.org> References: <20170810114642.26779-1-george@nsup.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef2.ens.fr [129.199.96.32]); Thu, 10 Aug 2017 13:46:46 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 02/16] lavfi/f_streamselect: convert to framesync2. 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/Makefile | 4 ++-- libavfilter/f_streamselect.c | 33 +++++++++++++-------------------- 2 files changed, 15 insertions(+), 22 deletions(-) Unchanged. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 06b915fc91..2079ccb557 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -67,7 +67,7 @@ OBJS-$(CONFIG_ASHOWINFO_FILTER) += af_ashowinfo.o OBJS-$(CONFIG_ASIDEDATA_FILTER) += f_sidedata.o OBJS-$(CONFIG_ASPLIT_FILTER) += split.o OBJS-$(CONFIG_ASTATS_FILTER) += af_astats.o -OBJS-$(CONFIG_ASTREAMSELECT_FILTER) += f_streamselect.o +OBJS-$(CONFIG_ASTREAMSELECT_FILTER) += f_streamselect.o framesync2.o OBJS-$(CONFIG_ATEMPO_FILTER) += af_atempo.o OBJS-$(CONFIG_ATRIM_FILTER) += trim.o OBJS-$(CONFIG_AZMQ_FILTER) += f_zmq.o @@ -302,7 +302,7 @@ OBJS-$(CONFIG_SPLIT_FILTER) += split.o OBJS-$(CONFIG_SPP_FILTER) += vf_spp.o OBJS-$(CONFIG_SSIM_FILTER) += vf_ssim.o dualinput.o framesync.o OBJS-$(CONFIG_STEREO3D_FILTER) += vf_stereo3d.o -OBJS-$(CONFIG_STREAMSELECT_FILTER) += f_streamselect.o +OBJS-$(CONFIG_STREAMSELECT_FILTER) += f_streamselect.o framesync2.o OBJS-$(CONFIG_SUBTITLES_FILTER) += vf_subtitles.o OBJS-$(CONFIG_SUPER2XSAI_FILTER) += vf_super2xsai.o OBJS-$(CONFIG_SWAPRECT_FILTER) += vf_swaprect.o diff --git a/libavfilter/f_streamselect.c b/libavfilter/f_streamselect.c index 1a517bfc95..10607de9b8 100644 --- a/libavfilter/f_streamselect.c +++ b/libavfilter/f_streamselect.c @@ -22,7 +22,7 @@ #include "avfilter.h" #include "audio.h" #include "formats.h" -#include "framesync.h" +#include "framesync2.h" #include "internal.h" #include "video.h" @@ -48,12 +48,6 @@ static const AVOption streamselect_options[] = { AVFILTER_DEFINE_CLASS(streamselect); -static int filter_frame(AVFilterLink *inlink, AVFrame *in) -{ - StreamSelectContext *s = inlink->dst->priv; - return ff_framesync_filter_frame(&s->fs, inlink, in); -} - static int process_frame(FFFrameSync *fs) { AVFilterContext *ctx = fs->parent; @@ -62,7 +56,7 @@ static int process_frame(FFFrameSync *fs) int i, j, ret = 0; for (i = 0; i < ctx->nb_inputs; i++) { - if ((ret = ff_framesync_get_frame(&s->fs, i, &in[i], 0)) < 0) + if ((ret = ff_framesync2_get_frame(&s->fs, i, &in[i], 0)) < 0) return ret; } @@ -90,10 +84,10 @@ static int process_frame(FFFrameSync *fs) return ret; } -static int request_frame(AVFilterLink *outlink) +static int activate(AVFilterContext *ctx) { - StreamSelectContext *s = outlink->src->priv; - return ff_framesync_request_frame(&s->fs, outlink); + StreamSelectContext *s = ctx->priv; + return ff_framesync2_activate(&s->fs); } static int config_output(AVFilterLink *outlink) @@ -130,7 +124,7 @@ static int config_output(AVFilterLink *outlink) if (s->fs.opaque == s) return 0; - if ((ret = ff_framesync_init(&s->fs, ctx, ctx->nb_inputs)) < 0) + if ((ret = ff_framesync2_init(&s->fs, ctx, ctx->nb_inputs)) < 0) return ret; in = s->fs.in; @@ -148,12 +142,11 @@ static int config_output(AVFilterLink *outlink) if (!s->frames) return AVERROR(ENOMEM); - return ff_framesync_configure(&s->fs); + return ff_framesync2_configure(&s->fs); } -static int parse_definition(AVFilterContext *ctx, int nb_pads, void *filter_frame, int is_audio) +static int parse_definition(AVFilterContext *ctx, int nb_pads, int is_input, int is_audio) { - const int is_input = !!filter_frame; const char *padtype = is_input ? "in" : "out"; int i = 0, ret = 0; @@ -169,11 +162,9 @@ static int parse_definition(AVFilterContext *ctx, int nb_pads, void *filter_fram av_log(ctx, AV_LOG_DEBUG, "Add %s pad %s\n", padtype, pad.name); if (is_input) { - pad.filter_frame = filter_frame; ret = ff_insert_inpad(ctx, i, &pad); } else { pad.config_props = config_output; - pad.request_frame = request_frame; ret = ff_insert_outpad(ctx, i, &pad); } @@ -281,8 +272,8 @@ static av_cold int init(AVFilterContext *ctx) if (!s->last_pts) return AVERROR(ENOMEM); - if ((ret = parse_definition(ctx, s->nb_inputs, filter_frame, s->is_audio)) < 0 || - (ret = parse_definition(ctx, nb_outputs, NULL, s->is_audio)) < 0) + if ((ret = parse_definition(ctx, s->nb_inputs, 1, s->is_audio)) < 0 || + (ret = parse_definition(ctx, nb_outputs, 0, s->is_audio)) < 0) return ret; av_log(ctx, AV_LOG_DEBUG, "Configured with %d inpad and %d outpad\n", @@ -298,7 +289,7 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&s->last_pts); av_freep(&s->map); av_freep(&s->frames); - ff_framesync_uninit(&s->fs); + ff_framesync2_uninit(&s->fs); } static int query_formats(AVFilterContext *ctx) @@ -332,6 +323,7 @@ AVFilter ff_vf_streamselect = { .query_formats = query_formats, .process_command = process_command, .uninit = uninit, + .activate = activate, .priv_size = sizeof(StreamSelectContext), .priv_class = &streamselect_class, .flags = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_DYNAMIC_OUTPUTS, @@ -347,6 +339,7 @@ AVFilter ff_af_astreamselect = { .query_formats = query_formats, .process_command = process_command, .uninit = uninit, + .activate = activate, .priv_size = sizeof(StreamSelectContext), .priv_class = &astreamselect_class, .flags = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_DYNAMIC_OUTPUTS,