From patchwork Mon Jul 31 12:29:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 4547 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.85 with SMTP id 82csp2350696vsb; Mon, 31 Jul 2017 05:29:35 -0700 (PDT) X-Received: by 10.28.154.85 with SMTP id c82mr11539860wme.151.1501504175329; Mon, 31 Jul 2017 05:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501504175; cv=none; d=google.com; s=arc-20160816; b=Z7b8+taH/xErL5pe+BHcOeKO8mspFo1iy1rCbT6xiMxosqOinZr6aFzCnBmjj5cS3z n+HK2T87CahCcP+AaefBwwbE7E55yElhETfAPhmdw/+113QAy7OPDDXXNhi1ZDYyqul6 hefD798IAY4lA8w/Q/hDB/CNYqJYzUIHQfRkbG0iY6bYIbTPv7jFWv7l10BLI4GfehKv t3NJrf2dpcxwukkvA6cUpvT9/C/ZFKtUzEmmAbOYa77NctIZL+9+q1sZ4QdNN+Mtgpil 6RwhbtwLebI3X6286t2um8OpsYDsmGUEFiUG7qVj0fRcaAqMSnJWq+T/9tH29qyzsMcp rsBg== 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=WcczHBYxJXp1XI6TVvE9Kimqb7uLKKkrpFVw4/uAYRo=; b=ehC6pM4G2bhbGRLwDUG9qtNdVNTrFjY7+OlUWbFQGLDbyhkFd5PcVMQHsA59bso7+v DoatLv1JARGyrQK4gzQfiBIWieztf0+d/XYfHnW/JBk8+4TWqZzu3WCXuKQHXLnqwWmI zysznLz49/LQZhOMjs91RFKO6sCHx7lQZ7HDZzvsjymIdoXj6940PfIqL5c1Dm8Jiv14 Akhy1NCO2B1l6OvcfjV+FurIC3Vcz/PjYGJ5Kb5Hq7HxSwR5PjDSQ3OsePuAYX6oDW3i iD5pwA1FFxJK6sC+GbNBez+LJqWS+GJJ0CNWQqL0GfUvAS1aBC70Yupoxz4G168+1SNy NZnQ== 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 72si8107100wms.11.2017.07.31.05.29.34; Mon, 31 Jul 2017 05:29:35 -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 3A53268A23A; Mon, 31 Jul 2017 15:29:29 +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 3E08D68A1A2 for ; Mon, 31 Jul 2017 15:29:23 +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 v6VCTPPe081608 for ; Mon, 31 Jul 2017 14:29:25 +0200 (CEST) Received: by phare.normalesup.org (Postfix, from userid 1001) id 1C8A6E00FD; Mon, 31 Jul 2017 14:29:25 +0200 (CEST) Date: Mon, 31 Jul 2017 14:29:25 +0200 From: Nicolas George To: ffmpeg-devel@ffmpeg.org Message-ID: <20170731122925.GA1820107@phare.normalesup.org> References: <20170731120227.31047-1-george@nsup.org> MIME-Version: 1.0 In-Reply-To: <20170731120227.31047-1-george@nsup.org> 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]); Mon, 31 Jul 2017 14:29:25 +0200 (CEST) Subject: Re: [FFmpeg-devel] [PATCH 01/14] lavfi: add f_streamsync dependency. 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" Even better. From 836cbf40eb95e16d48bb5a2d356c130ce9d53de1 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Mon, 31 Jul 2017 13:47:34 +0200 Subject: [PATCH] lavfi/f_streamselect: convert to framesync2. Signed-off-by: Nicolas George --- libavfilter/Makefile | 4 ++-- libavfilter/f_streamselect.c | 33 +++++++++++++-------------------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 4d61d7835e..18d217bfe5 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 @@ -301,7 +301,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, -- 2.13.2