[PATCH 2/2] Add asink_anullsink - null audio sink.

Stefano Sabatini stefano.sabatini-lala
Fri Sep 24 21:46:31 CEST 2010


Patch by "S.N. Hemanth Meenakshisundaram" /smeenaks/ucsd/edu.
---
 doc/filters.texi              |   13 +++++++++++++
 libavfilter/Makefile          |    2 ++
 libavfilter/allfilters.c      |    2 ++
 libavfilter/asink_anullsink.c |   38 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 55 insertions(+), 0 deletions(-)
 create mode 100644 libavfilter/asink_anullsink.c

diff --git a/doc/filters.texi b/doc/filters.texi
index 8674b5b..30028f0 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -40,6 +40,19 @@ will set the sample rate to 48000 Hz and the channel layout to CH_LAYOUT_MONO.
 
 @c man end AUDIO SOURCES
 
+ at chapter Audio Sinks
+ at c man begin AUDIO SINKS
+
+Below is a description of the currently available audio sinks.
+
+ at section anullsink
+
+Null audio sink, do absolutely nothing with the input audio. It is
+mainly useful as a template and to be employed in analysis / debugging
+tools.
+
+ at c man end AUDIO SINKS
+
 @chapter Video Filters
 @c man begin VIDEO FILTERS
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 29fbb62..39c4b3b 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -18,6 +18,8 @@ OBJS-$(CONFIG_ANULL_FILTER)                  += af_anull.o
 
 OBJS-$(CONFIG_ANULLSRC_FILTER)               += asrc_anullsrc.o
 
+OBJS-$(CONFIG_ANULLSINK_FILTER)              += asink_anullsink.o
+
 OBJS-$(CONFIG_ASPECT_FILTER)                 += vf_aspect.o
 OBJS-$(CONFIG_CROP_FILTER)                   += vf_crop.o
 OBJS-$(CONFIG_FIFO_FILTER)                   += vf_fifo.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index a29a274..ac54bd0 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -38,6 +38,8 @@ void avfilter_register_all(void)
 
     REGISTER_FILTER (ANULLSRC,    anullsrc,    asrc);
 
+    REGISTER_FILTER (ANULLSINK,   anullsink,   asink);
+
     REGISTER_FILTER (ASPECT,      aspect,      vf);
     REGISTER_FILTER (CROP,        crop,        vf);
     REGISTER_FILTER (FIFO,        fifo,        vf);
diff --git a/libavfilter/asink_anullsink.c b/libavfilter/asink_anullsink.c
new file mode 100644
index 0000000..5a89c27
--- /dev/null
+++ b/libavfilter/asink_anullsink.c
@@ -0,0 +1,38 @@
+/*
+ * 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 null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) { }
+
+AVFilter avfilter_asink_anullsink = {
+    .name        = "anullsink",
+    .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  = null_filter_samples,
+        },
+        { .name = NULL},
+    },
+    .outputs   = (AVFilterPad[]) {{ .name = NULL }},
+};
-- 
1.7.1


--dTy3Mrz/UPE2dbVg--



More information about the ffmpeg-devel mailing list