[FFmpeg-devel] [PATCH] Add asink_nullasink - Null audio sink

Stefano Sabatini stefano.sabatini-lala
Mon Aug 16 00:31:12 CEST 2010


On date Friday 2010-08-13 22:58:20 -0700, S.N. Hemanth Meenakshisundaram encoded:
> Audio null sink. Also passes make test and same test below:
> 
> valgrind ./ffplay -af "[in] asplit [T1], afifo, nullasink; [T1] afifo,
> nullaud [out]" ../../test.mp3
> 
> Regards,
> 
> ---
>  libavfilter/Makefile          |    2 ++
>  libavfilter/allfilters.c      |    2 ++
>  libavfilter/asink_nullasink.c |   40 ++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 44 insertions(+), 0 deletions(-)
>  create mode 100644 libavfilter/asink_nullasink.c
> 
> 
> 

> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index c118bad..3e25e39 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -35,6 +35,8 @@ OBJS-$(CONFIG_BUFFER_FILTER)                 += vsrc_buffer.o
>  OBJS-$(CONFIG_COLOR_FILTER)                  += vf_pad.o
>  OBJS-$(CONFIG_NULLSRC_FILTER)                += vsrc_nullsrc.o
>  
> +OBJS-$(CONFIG_NULLASINK_FILTER)              += asink_nullasink.o
> +
>  OBJS-$(CONFIG_NULLSINK_FILTER)               += vsink_nullsink.o
>  
>  include $(SUBDIR)../subdir.mak
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 1e212d1..cab7d4b 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -55,5 +55,7 @@ void avfilter_register_all(void)
>      REGISTER_FILTER (COLOR,       color,       vsrc);
>      REGISTER_FILTER (NULLSRC,     nullsrc,     vsrc);
>  
> +    REGISTER_FILTER (NULLASINK,   nullasink,   asink);
> +
>      REGISTER_FILTER (NULLSINK,    nullsink,    vsink);
>  }
> diff --git a/libavfilter/asink_nullasink.c b/libavfilter/asink_nullasink.c
> new file mode 100644
> index 0000000..84904fa
> --- /dev/null
> +++ b/libavfilter/asink_nullasink.c
> @@ -0,0 +1,40 @@
> +/*
> + * 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 avfilter_asink_nullasink = {
> +    .name        = "nullasink",
> +    .description = NULL_IF_CONFIG_SMALL("Do absolutely nothing with the input audio."),
> +
> +    .priv_size = 0,
> +
> +    .inputs    = (AVFilterPad[]) {
> +        {
> +            .name            = "default",
> +            .type            = AVMEDIA_TYPE_AUDIO,
> +            .filter_samples  = filter_samples,
> +        },
> +        { .name = NULL},
> +    },
> +    .outputs   = (AVFilterPad[]) {{ .name = NULL }},
> +};

Missing filters.texi docs, should be OK otherwise.
-- 
FFmpeg = Faithful Foolish Mean Picky Elfic Goblin



More information about the ffmpeg-devel mailing list