From patchwork Tue May 9 21:28:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 3635 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.3.129 with SMTP id 123csp1536841vsd; Tue, 9 May 2017 14:28:37 -0700 (PDT) X-Received: by 10.28.20.84 with SMTP id 81mr1378821wmu.51.1494365317333; Tue, 09 May 2017 14:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494365317; cv=none; d=google.com; s=arc-20160816; b=AthfXJ0ACj7iD8bfgNF7Z3ZnBfJkBgLJA3x88Tf846KDLgkYog1eIGsEzPzI6KPL7T hNm2c601EEigEc6+In5fpGiRqbslf8ikTSZz+bxtXFHcw5sXI0SJG+c4hFAdl+MlXzAQ ZjBdNTRNkPqPZNQmzUksP5k/LisrqwHVx8ubDMvwqcZulVeCbU8xLHGIWqxSJsEYTh4a 4fJudwlrQJ5wWz8Wd3O6u6s754KbxEbT9p6hrBHsxChy9q2KtJwgA9zOw+qGhtPl26wK oehSl37jPs6cqklyvGjIKHG5JilSab2oBnBhCfthCq9nDvoLpWLwqNzqKgyLaPs/RLN2 UhZw== 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:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=D3Gyf/d4JNoHOBQCQWDhMZGvrdjNkPORjCNpR7gRQHo=; b=ejEvXvUhOrv4JBeZqAY8NISLOJl02rDd6L8gxO/SZbhFT/hTEHG5Sw2se3FMCyov5l heAh86tqXzu/K2MxAsJU6WoHs0YopRRSoS6Til3UjSbPFJH5oxjJK75rUOnKXS6nyVCv MpAwmz1nbyH+GEpus2YUnDv2F9tRDGGKykQx4KZ4IXq5bbf1jMjzDxzHJ7xY/2nopOgu KpN293ubF7G5GbXvR675dNGSO2e9MrRdYUtNF1mD0pYqXKDqgWfwmuywvRRywo1jjO59 wwbL2Wc+KVl7kSWn9pqraNYx41PKdHO3UU0kNZs7hEK7S+qseGk3M9OUYuQ6qsstDOCD ahNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z10si1277743wmz.41.2017.05.09.14.28.36; Tue, 09 May 2017 14:28:37 -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; dkim=neutral (body hash did not verify) header.i=@gmail.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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 81519680D08; Wed, 10 May 2017 00:28:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr0-f182.google.com (mail-wr0-f182.google.com [209.85.128.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 48DBE68096F for ; Wed, 10 May 2017 00:28:21 +0300 (EEST) Received: by mail-wr0-f182.google.com with SMTP id l9so17398913wre.1 for ; Tue, 09 May 2017 14:28:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=SpKTOj5l7i5pooDNFBdvOGuVaXwQlWk0bevqeSvZFOQ=; b=AuCy1j4pGEoHKBVrhyMevxAf3LU7XoX/zNdAm1Utt+ETc/fRgCeoJ3GJtmPRMKWYIy IIkKSNHl4gidgQg3SVReQznwEZaGFsxeGTnnz1hHhfZLbzMQizXWrAR1fFNiV1E9RlJg J9nKdGcV4PmSgpdtGKhEQpugAdquuNMH25XrTDTjBT7bmxeAoypd7YXU9+925EF/QPoc au+wTylxQVMY7oem7fRextOfLkn6rQLpt0K6B7hwLLKO0yqAjORYHHexNJpv3qSDBjFK BvA7xCfh6uFO01PcYTj7uYQAj6DdSUCoqRhLWw2xOdx+zWk6zNYfteFWxQViv/bByYgJ dR9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=SpKTOj5l7i5pooDNFBdvOGuVaXwQlWk0bevqeSvZFOQ=; b=h/6kEx/3WQueWbBUgARYrR+F5pPlcrovkYSqlSxTPoBqNyIHhMzjASAL0Y7aRjz+3r v4k9BzKz7mSkLpCT0lnv6HvcMNuCj8hkOmnR0nSI5Se+0oB2gtfLfkhrpIFQNR7LJV9y JiVSIGE6sL9RHlBhoId9HoAdnk38FCDd3om57UmuqrkuQ0clym/DF75mluby140Q5f8S LapjHraW7MLZp5rGcTIjgZ/wv4twyU+NmoW0b4qrX9lqmMToGr7zKjP94iCumkctgpG9 v44IJFYyFvoz6G2Fh8ikMF45O30u9EG5kWi32GkZ/YAQQ5Xyp59C3qWcp8MdD6y2UcZy UIPg== X-Gm-Message-State: AODbwcDyrf/XEJDPontFOlToKPGf/DHwAHhfno9WfB1oaFzqwjlSkhfH NH+OEkyxvg8JnvzM X-Received: by 10.28.170.11 with SMTP id t11mr1402013wme.44.1494365307356; Tue, 09 May 2017 14:28:27 -0700 (PDT) Received: from localhost.localdomain ([94.250.174.60]) by smtp.gmail.com with ESMTPSA id p187sm2285943wmd.24.2017.05.09.14.28.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 May 2017 14:28:26 -0700 (PDT) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Tue, 9 May 2017 23:28:13 +0200 Message-Id: <20170509212813.17089-1-onemda@gmail.com> X-Mailer: git-send-email 2.9.3 Subject: [FFmpeg-devel] [PATCH] avfilter: add acopy filter 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: Paul B Mahol --- doc/filters.texi | 7 +++++- libavfilter/Makefile | 1 + libavfilter/af_acopy.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ libavfilter/allfilters.c | 1 + 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 libavfilter/af_acopy.c diff --git a/doc/filters.texi b/doc/filters.texi index c54f5f2..e1208d0 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -395,6 +395,11 @@ How much to use compressed signal in output. Default is 1. Range is between 0 and 1. @end table +@section acopy + +Copy the input audio source unchanged to the output. This is mainly useful for +testing purposes. + @section acrossfade Apply cross fade from one input audio stream to another input audio stream. @@ -5665,7 +5670,7 @@ convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 - @section copy -Copy the input source unchanged to the output. This is mainly useful for +Copy the input video source unchanged to the output. This is mainly useful for testing purposes. @anchor{coreimage} diff --git a/libavfilter/Makefile b/libavfilter/Makefile index de5f992..f7dfe8a 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -29,6 +29,7 @@ OBJS-$(HAVE_THREADS) += pthread.o # audio filters OBJS-$(CONFIG_ABENCH_FILTER) += f_bench.o OBJS-$(CONFIG_ACOMPRESSOR_FILTER) += af_sidechaincompress.o +OBJS-$(CONFIG_ACOPY_FILTER) += af_acopy.o OBJS-$(CONFIG_ACROSSFADE_FILTER) += af_afade.o OBJS-$(CONFIG_ACRUSHER_FILTER) += af_acrusher.o OBJS-$(CONFIG_ADELAY_FILTER) += af_adelay.o diff --git a/libavfilter/af_acopy.c b/libavfilter/af_acopy.c new file mode 100644 index 0000000..d849060 --- /dev/null +++ b/libavfilter/af_acopy.c @@ -0,0 +1,60 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "audio.h" +#include "avfilter.h" +#include "internal.h" + +static int filter_frame(AVFilterLink *inlink, AVFrame *in) +{ + AVFilterLink *outlink = inlink->dst->outputs[0]; + AVFrame *out = ff_get_audio_buffer(outlink, in->nb_samples); + + if (!out) { + av_frame_free(&in); + return AVERROR(ENOMEM); + } + av_frame_copy_props(out, in); + av_frame_copy(out, in); + av_frame_free(&in); + return ff_filter_frame(outlink, out); +} + +static const AVFilterPad acopy_inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_AUDIO, + .filter_frame = filter_frame, + }, + { NULL } +}; + +static const AVFilterPad acopy_outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_AUDIO, + }, + { NULL } +}; + +AVFilter ff_af_acopy = { + .name = "acopy", + .description = NULL_IF_CONFIG_SMALL("Copy the input audio unchanged to the output."), + .inputs = acopy_inputs, + .outputs = acopy_outputs, +}; diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 555c442..cd35ae4 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -42,6 +42,7 @@ static void register_all(void) { REGISTER_FILTER(ABENCH, abench, af); REGISTER_FILTER(ACOMPRESSOR, acompressor, af); + REGISTER_FILTER(ACOPY, acopy, af); REGISTER_FILTER(ACROSSFADE, acrossfade, af); REGISTER_FILTER(ACRUSHER, acrusher, af); REGISTER_FILTER(ADELAY, adelay, af);