[FFmpeg-devel] [PATCH] Add af_asplit - add audio split filter
Stefano Sabatini
stefano.sabatini-lala
Mon Aug 16 00:29:35 CEST 2010
On date Friday 2010-08-13 22:44:36 -0700, S.N. Hemanth Meenakshisundaram encoded:
> Audio split filter. Passes make test and tested with
>
> valgrind ./ffplay -af "[in] asplit [T1], afifo, nullasink; [T1] afifo,
> nullaud [out]" ../../test.mp3
>
> The patches for the other filters above (anullsink and afifo) follow.
>
> Again weird name to avoid clash with vf_split filter.
>
> ---
> libavfilter/Makefile | 1 +
> libavfilter/af_asplit.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++
> libavfilter/allfilters.c | 1 +
> 3 files changed, 51 insertions(+), 0 deletions(-)
> create mode 100644 libavfilter/af_asplit.c
Missing filters.texi description.
Check also this:
http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/115016
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 3e25e39..03ef5ae 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -15,6 +15,7 @@ OBJS = allfilters.o \
> parseutils.o \
>
> OBJS-$(CONFIG_NULLAUD_FILTER) += af_nullaud.o
> +OBJS-$(CONFIG_ASPLIT_FILTER) += af_asplit.o
>
> OBJS-$(CONFIG_ASPECT_FILTER) += vf_aspect.o
> OBJS-$(CONFIG_CROP_FILTER) += vf_crop.o
> diff --git a/libavfilter/af_asplit.c b/libavfilter/af_asplit.c
> new file mode 100644
> index 0000000..0061ece
> --- /dev/null
> +++ b/libavfilter/af_asplit.c
> @@ -0,0 +1,49 @@
> +/*
> + * Audio splitter
> + * copyright (c) 2010 S.N. Hemanth Meenakshisundaram
> + *
> + * 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 "avfilter.h"
> +
> +static void filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
> +{
> + avfilter_filter_samples(link->dst->outputs[0],
> + avfilter_ref_buffer(samplesref, ~AV_PERM_WRITE));
> + avfilter_filter_samples(link->dst->outputs[1],
> + avfilter_ref_buffer(samplesref, ~AV_PERM_WRITE));
> + avfilter_unref_buffer(samplesref);
> +}
> +
> +AVFilter avfilter_af_asplit =
> +{
> + .name = "asplit",
> + .description = NULL_IF_CONFIG_SMALL("Split audio stream into two and feed filters at outputs."),
> +
> + .inputs = (AVFilterPad[]) {{ .name = "default",
> + .type = AVMEDIA_TYPE_AUDIO,
> + .get_audio_buffer = avfilter_null_get_audio_buffer,
> + .filter_samples = filter_samples, },
> + { .name = NULL}},
> + .outputs = (AVFilterPad[]) {{ .name = "default",
> + .type = AVMEDIA_TYPE_AUDIO, },
> + { .name = "default2",
> + .type = AVMEDIA_TYPE_AUDIO, },
use more meaningful names, e.g. output1 and output2.
Regards.
--
FFmpeg = Furious and Frenzy Multimedia Powerful Eretic Geek
More information about the ffmpeg-devel
mailing list