[FFmpeg-devel] Fwd: [PATCH] Add af_nullaud - Null audio filter

Stefano Sabatini stefano.sabatini-lala
Mon Aug 16 00:26:01 CEST 2010


On date Friday 2010-08-13 22:41:40 -0700, S.N. Hemanth Meenakshisundaram encoded:
> Null audio filter for debugging. Passes make test and tested with
> 
> valgrind ./ffplay -af nullaud in.mp3
> 
> The weird name (nullaud) is to avoid name clash with the video null filter.

I'd prefer "anull", more consistent with the namings we adopted for
the other audio filters.

> 
> ---
>  libavfilter/Makefile     |    2 ++
>  libavfilter/af_nullaud.c |   41 +++++++++++++++++++++++++++++++++++++++++
>  libavfilter/allfilters.c |    2 ++
>  3 files changed, 45 insertions(+), 0 deletions(-)
>  create mode 100644 libavfilter/af_nullaud.c
> 
> 
> 

> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 722a5ac..c118bad 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -14,6 +14,8 @@ OBJS = allfilters.o                                                     \
>         graphparser.o                                                    \
>         parseutils.o                                                     \
>  
> +OBJS-$(CONFIG_NULLAUD_FILTER)                += af_nullaud.o
> +
>  OBJS-$(CONFIG_ASPECT_FILTER)                 += vf_aspect.o
>  OBJS-$(CONFIG_CROP_FILTER)                   += vf_crop.o
>  OBJS-$(CONFIG_FORMAT_FILTER)                 += vf_format.o
> diff --git a/libavfilter/af_nullaud.c b/libavfilter/af_nullaud.c
> new file mode 100644
> index 0000000..bb9fbd7
> --- /dev/null
> +++ b/libavfilter/af_nullaud.c
> @@ -0,0 +1,41 @@
> +/*
> + * 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
> + */
> +
> +/**
> + * @file
> + * null audio filter
> + */
> +
> +#include "avfilter.h"
> +
> +AVFilter avfilter_af_nullaud = {
> +    .name      = "nullaud",
> +    .description = NULL_IF_CONFIG_SMALL("Pass the source unchanged to the output."),
> +
> +    .priv_size = 0,
> +
> +    .inputs    = (AVFilterPad[]) {{ .name             = "default",
> +                                    .type             = AVMEDIA_TYPE_AUDIO,
> +                                    .get_audio_buffer = avfilter_null_get_audio_buffer,
> +                                    .filter_samples   = avfilter_null_filter_samples },
> +                                  { .name = NULL}},
> +
> +    .outputs   = (AVFilterPad[]) {{ .name             = "default",
> +                                    .type             = AVMEDIA_TYPE_AUDIO, },
> +                                  { .name = NULL}},
> +};
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index fe8a011..1e212d1 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -34,6 +34,8 @@ void avfilter_register_all(void)
>          return;
>      initialized = 1;
>  
> +    REGISTER_FILTER (NULLAUD,     nullaud,     af);
> +
>      REGISTER_FILTER (ASPECT,      aspect,      vf);
>      REGISTER_FILTER (CROP,        crop,        vf);
>      REGISTER_FILTER (FORMAT,      format,      vf);

Missing filters.texi description, fine otherwise.

Regards.
-- 
FFmpeg = Fascinating Fascinating MultiPurpose Embarassing Gargoyle



More information about the ffmpeg-devel mailing list