summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2011-12-25 23:04:44 +0100
committerStefano Sabatini <stefasab@gmail.com>2011-12-27 15:21:08 +0100
commit440e984b712ff02ee0fc5deb7db8d4ae57eed4fc (patch)
tree367c1f643d0a82be8bb577226151f4d972ee4e48
parentae21776207e8a2bbe268e7c9e203f7599dd87ddb (diff)
lavfi: add asplit filter
-rw-r--r--Changelog1
-rw-r--r--doc/filters.texi13
-rw-r--r--libavfilter/Makefile1
-rw-r--r--libavfilter/af_asplit.c55
-rw-r--r--libavfilter/allfilters.c1
-rw-r--r--libavfilter/avfilter.h2
6 files changed, 72 insertions, 1 deletions
diff --git a/Changelog b/Changelog
index 4a0cc3041c..75d9471c6d 100644
--- a/Changelog
+++ b/Changelog
@@ -10,6 +10,7 @@ version next:
- dv: add timecode to metadata
- thumbnail video filter
- XML output in ffprobe
+- asplit audio filter
version 0.9:
diff --git a/doc/filters.texi b/doc/filters.texi
index 37fd9cdb0a..da36e8b1b8 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -224,6 +224,19 @@ expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3} @var{c4} @var{c5}
@var{c6} @var{c7}]"
@end table
+@section asplit
+
+Pass on the input audio to two outputs. Both outputs are identical to
+the input audio.
+
+For example:
+@example
+[in] asplit[out0], showaudio[out1]
+@end example
+
+will create two separate outputs from the same input, one cropped and
+one padded.
+
@section earwax
Make audio easier to listen to on headphones.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index b60b88fd0c..c8ce1d6405 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -29,6 +29,7 @@ OBJS-$(CONFIG_AFORMAT_FILTER) += af_aformat.o
OBJS-$(CONFIG_ANULL_FILTER) += af_anull.o
OBJS-$(CONFIG_ARESAMPLE_FILTER) += af_aresample.o
OBJS-$(CONFIG_ASHOWINFO_FILTER) += af_ashowinfo.o
+OBJS-$(CONFIG_ASPLIT_FILTER) += af_asplit.o
OBJS-$(CONFIG_EARWAX_FILTER) += af_earwax.o
OBJS-$(CONFIG_PAN_FILTER) += af_pan.o
OBJS-$(CONFIG_VOLUME_FILTER) += af_volume.o
diff --git a/libavfilter/af_asplit.c b/libavfilter/af_asplit.c
new file mode 100644
index 0000000000..ec5032bd6c
--- /dev/null
+++ b/libavfilter/af_asplit.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2011 Stefano Sabatini
+ *
+ * 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
+ * audio splitter
+ */
+
+#include "avfilter.h"
+
+static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
+{
+ avfilter_filter_samples(inlink->dst->outputs[0],
+ avfilter_ref_buffer(insamples, ~AV_PERM_WRITE));
+ avfilter_filter_samples(inlink->dst->outputs[1],
+ avfilter_ref_buffer(insamples, ~AV_PERM_WRITE));
+ avfilter_unref_buffer(insamples);
+}
+
+AVFilter avfilter_af_asplit = {
+ .name = "asplit",
+ .description = NULL_IF_CONFIG_SMALL("Pass on the audio input to two outputs."),
+
+ .inputs = (const AVFilterPad[]) {
+ { .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .get_audio_buffer = avfilter_null_get_audio_buffer,
+ .filter_samples = filter_samples, },
+ { .name = NULL}
+ },
+ .outputs = (const AVFilterPad[]) {
+ { .name = "output1",
+ .type = AVMEDIA_TYPE_AUDIO, },
+ { .name = "output2",
+ .type = AVMEDIA_TYPE_AUDIO, },
+ { .name = NULL}
+ },
+};
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 01ebd0df28..adc78b197b 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -39,6 +39,7 @@ void avfilter_register_all(void)
REGISTER_FILTER (ANULL, anull, af);
REGISTER_FILTER (ARESAMPLE, aresample, af);
REGISTER_FILTER (ASHOWINFO, ashowinfo, af);
+ REGISTER_FILTER (ASPLIT, asplit, af);
REGISTER_FILTER (EARWAX, earwax, af);
REGISTER_FILTER (PAN, pan, af);
REGISTER_FILTER (VOLUME, volume, af);
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 77d10cdd55..ba8b9dcd48 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -30,7 +30,7 @@
#include "libavcodec/avcodec.h"
#define LIBAVFILTER_VERSION_MAJOR 2
-#define LIBAVFILTER_VERSION_MINOR 54
+#define LIBAVFILTER_VERSION_MINOR 55
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \