summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-09-04 00:23:39 +0200
committerwm4 <wm4@nowhere>2015-09-04 00:23:39 +0200
commitd04d2380e35ba016e3816ab5d7c282997df74168 (patch)
treeed64cfb94406785cc7fc18c5a650c0f196f6d0fd
parent091bfa3abf2f28b37fa12cca6b4c248c31d27965 (diff)
downloadmpv-d04d2380e35ba016e3816ab5d7c282997df74168.tar.bz2
mpv-d04d2380e35ba016e3816ab5d7c282997df74168.tar.xz
audio/filter: remove af_bs2b too
Some users still use this filter, so the filter was going to be kept. But I overlooked that libavfilter provides this filter. Remove the redundant wrapper from mpv. Something like --af=lavfi=bs2b should work and give exactly the same results.
-rw-r--r--DOCS/man/af.rst22
-rwxr-xr-xTOOLS/old-configure3
-rw-r--r--TOOLS/old-makefile1
-rw-r--r--audio/filter/af.c3
-rw-r--r--audio/filter/af_bs2b.c168
-rw-r--r--wscript4
-rw-r--r--wscript_build.py1
7 files changed, 0 insertions, 202 deletions
diff --git a/DOCS/man/af.rst b/DOCS/man/af.rst
index e632820811..9baaca664b 100644
--- a/DOCS/man/af.rst
+++ b/DOCS/man/af.rst
@@ -96,28 +96,6 @@ Available filters are:
If the input channel number is less than ``<minch>``, the filter will
detach itself (default: 3).
-``bs2b[=option1:option2:...]``
- Bauer stereophonic to binaural transformation using libbs2b. Improves the
- headphone listening experience by making the sound similar to that from
- loudspeakers, allowing each ear to hear both channels and taking into
- account the distance difference and the head shadowing effect. It is
- applicable only to 2-channel audio.
-
- ``fcut=<300-1000>``
- Set cut frequency in Hz.
- ``feed=<10-150>``
- Set feed level for low frequencies in 0.1*dB.
- ``profile=<value>``
- Several profiles are available for convenience:
-
- :default: will be used if nothing else was specified (fcut=700,
- feed=45)
- :cmoy: Chu Moy circuit implementation (fcut=700, feed=60)
- :jmeier: Jan Meier circuit implementation (fcut=650, feed=95)
-
- If ``fcut`` or ``feed`` options are specified together with a profile, they
- will be applied on top of the selected profile.
-
``equalizer=g1:g2:g3:...:g10``
10 octave band graphic equalizer, implemented using 10 IIR band-pass
filters. This means that it works regardless of what type of audio is
diff --git a/TOOLS/old-configure b/TOOLS/old-configure
index e967a657eb..5f4e8e7061 100755
--- a/TOOLS/old-configure
+++ b/TOOLS/old-configure
@@ -191,7 +191,6 @@ options_state_machine() {
opt_yes_no _libcdio "libcdio support"
opt_yes_no _librubberband "librubberband support"
opt_yes_no _ffmpeg "skip FFmpeg/Libav autodetection"
- opt_yes_no _libbs2b "libbs2b audio filter support"
opt_yes_no _libavresample "libavresample (preferred over libswresample)"
opt_yes_no _libswresample "libswresample"
opt_yes_no _caca "CACA video output"
@@ -748,8 +747,6 @@ check_pkg_config "uchardet" $_uchardet UCHARDET 'uchardet'
check_pkg_config "zlib" auto ZLIB 'zlib'
test $(defretval) = no && die "Unable to find development files for zlib."
-check_pkg_config "libbs2b audio filter support" $_libbs2b LIBBS2B 'libbs2b'
-
check_pkg_config "LCMS2 support" $_lcms2 LCMS2 'lcms2 >= 2.6'
check_pkg_config "FFmpeg/Libav" $_ffmpeg FFMPEG \
diff --git a/TOOLS/old-makefile b/TOOLS/old-makefile
index f3e4d7ea86..2807290e15 100644
--- a/TOOLS/old-makefile
+++ b/TOOLS/old-makefile
@@ -40,7 +40,6 @@ SOURCES-$(LIBASS) += sub/ass_mp.c sub/sd_ass.c \
demux/demux_libass.c
SOURCES-$(LIBBLURAY) += stream/stream_bluray.c
-SOURCES-$(LIBBS2B) += audio/filter/af_bs2b.c
SOURCES-$(LIBSMBCLIENT) += stream/stream_smb.c
diff --git a/audio/filter/af.c b/audio/filter/af.c
index b877ba7661..ba08c1ed9b 100644
--- a/audio/filter/af.c
+++ b/audio/filter/af.c
@@ -59,9 +59,6 @@ static const struct af_info *const filter_list[] = {
&af_info_rubberband,
#endif
&af_info_scaletempo,
-#if HAVE_LIBBS2B
- &af_info_bs2b,
-#endif
#if HAVE_LIBAVFILTER
&af_info_lavfi,
#endif
diff --git a/audio/filter/af_bs2b.c b/audio/filter/af_bs2b.c
deleted file mode 100644
index beb4dc9b96..0000000000
--- a/audio/filter/af_bs2b.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * The Bauer stereophonic-to-binaural DSP using bs2b library:
- * http://bs2b.sourceforge.net/
- *
- * Copyright (c) 2009 Andrew Savchenko
- *
- * This file is part of mpv.
- *
- * mpv is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpv 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with mpv. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <bs2b.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "af.h"
-#include "options/m_option.h"
-
-/// Internal specific data of the filter
-struct af_bs2b {
- int fcut; ///< cut frequency in Hz
- int feed; ///< feed level for low frequencies in 0.1*dB
- int profile ; ///< profile (available crossfeed presets)
- t_bs2bdp filter; ///< instance of a library filter
-};
-
-#define DEF_FILTER(fmt, name) \
-static int filter_##name(struct af_instance *af, struct mp_audio *data) \
-{ \
- if (!data) \
- return 0; \
- if (af_make_writeable(af, data) < 0) { \
- talloc_free(data); \
- return -1; \
- } \
- bs2b_cross_feed_##name(((struct af_bs2b*)(af->priv))->filter, \
- (data->planes[0]), data->samples); \
- af_add_output_frame(af, data); \
- return 0; \
-}
-
-#define GET_FILTER(fmt, name) \
- case AF_FORMAT_##fmt: return filter_##name;
-
-#define FILTERS \
- FILTER(FLOAT, f) \
- FILTER(S32, s32) \
- FILTER(S24, s24) \
- FILTER(S16, s16) \
- FILTER(U8, u8)
-
-#define FILTER DEF_FILTER
-FILTERS
-#undef FILTER
-
-typedef int (*filter)(struct af_instance *af, struct mp_audio *d);
-static filter get_filter(int fmt)
-{
- switch (fmt) {
-#define FILTER GET_FILTER
-FILTERS
-#undef FILTER
- default: return NULL;
- }
-}
-
-/// Initialization and runtime control
-static int control(struct af_instance *af, int cmd, void *arg)
-{
- struct af_bs2b *s = af->priv;
-
- switch (cmd) {
- case AF_CONTROL_REINIT: {
- int format;
- // Sanity check
- if (!arg) return AF_ERROR;
-
- format = ((struct mp_audio*)arg)->format;
- af->data->rate = ((struct mp_audio*)arg)->rate;
- mp_audio_set_num_channels(af->data, 2); // bs2b is useful only for 2ch audio
- mp_audio_set_format(af->data, format);
-
- /* check for formats supported by libbs2b
- and assign corresponding handlers */
- af->filter_frame = get_filter(format);
- if (!af->filter_frame) {
- af->filter_frame = filter_f;
- mp_audio_set_format(af->data, AF_FORMAT_FLOAT);
- }
-
- // bs2b have srate limits, try to resample if needed
- if (af->data->rate > BS2B_MAXSRATE || af->data->rate < BS2B_MINSRATE) {
- af->data->rate = BS2B_DEFAULT_SRATE;
- MP_WARN(af, "Requested sample rate %d Hz is out of bounds [%d..%d] Hz.\n"
- "Trying to resample to %d Hz.\n",
- af->data->rate, BS2B_MINSRATE, BS2B_MAXSRATE, BS2B_DEFAULT_SRATE);
- }
- bs2b_set_srate(s->filter, (long)af->data->rate);
- MP_VERBOSE(af, "using format %s\n",
- af_fmt_to_str(af->data->format));
-
- return af_test_output(af,(struct mp_audio*)arg);
- }
- }
- return AF_UNKNOWN;
-}
-
-/// Deallocate memory and close library
-static void uninit(struct af_instance *af)
-{
- struct af_bs2b *s = af->priv;
- if (s->filter)
- bs2b_close(s->filter);
-}
-
-/// Allocate memory, set function pointers and init library
-static int af_open(struct af_instance *af)
-{
- struct af_bs2b *s = af->priv;
- af->control = control;
- af->uninit = uninit;
-
- // NULL means failed initialization
- if (!(s->filter = bs2b_open())) {
- return AF_ERROR;
- }
-
- if (s->profile)
- bs2b_set_level(s->filter, s->profile);
- // set fcut and feed only if specified, otherwise defaults will be used
- if (s->fcut)
- bs2b_set_level_fcut(s->filter, s->fcut);
- if (s->feed)
- bs2b_set_level_feed(s->filter, s->feed);
- return AF_OK;
-}
-
-#define OPT_BASE_STRUCT struct af_bs2b
-
-/// Description of this filter
-const struct af_info af_info_bs2b = {
- .info = "Bauer stereophonic-to-binaural audio filter",
- .name = "bs2b",
- .open = af_open,
- .priv_size = sizeof(struct af_bs2b),
- .options = (const struct m_option[]) {
- OPT_INTRANGE("fcut", fcut, 0, BS2B_MINFCUT, BS2B_MAXFCUT),
- OPT_INTRANGE("feed", feed, 0, BS2B_MINFEED, BS2B_MAXFEED),
- OPT_CHOICE("profile", profile, 0,
- ({"unset", 0},
- {"default", BS2B_DEFAULT_CLEVEL},
- {"cmoy", BS2B_CMOY_CLEVEL},
- {"jmeier", BS2B_JMEIER_CLEVEL})),
- {0}
- },
-};
diff --git a/wscript b/wscript
index 2fecdebb59..e6b89494e9 100644
--- a/wscript
+++ b/wscript
@@ -352,10 +352,6 @@ iconv support use --disable-iconv.",
'desc': 'librubberband support',
'func': check_pkg_config('rubberband', '>= 1.8.0'),
}, {
- 'name': '--libbs2b',
- 'desc': 'libbs2b audio filter support',
- 'func': check_pkg_config('libbs2b'),
- }, {
'name': '--lcms2',
'desc': 'LCMS2 support',
'func': check_pkg_config('lcms2', '>= 2.6'),
diff --git a/wscript_build.py b/wscript_build.py
index a7ddc26e31..87226107f7 100644
--- a/wscript_build.py
+++ b/wscript_build.py
@@ -100,7 +100,6 @@ def build(ctx):
( "audio/decode/ad_spdif.c" ),
( "audio/decode/dec_audio.c" ),
( "audio/filter/af.c" ),
- ( "audio/filter/af_bs2b.c", "libbs2b" ),
( "audio/filter/af_channels.c" ),
( "audio/filter/af_delay.c" ),
( "audio/filter/af_drc.c" ),