summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-06-30 01:10:44 +0200
committerwm4 <wm4@nowhere>2019-09-19 20:37:05 +0200
commitc8b8fe9981c654c0539ca77056ed6451a3da7367 (patch)
treeeeb90f352ead8588e0756be1e97a25595baca495
parentc6773692adba9d65fd43313f07a8aab9af2aa80d (diff)
downloadmpv-c8b8fe9981c654c0539ca77056ed6451a3da7367.tar.bz2
mpv-c8b8fe9981c654c0539ca77056ed6451a3da7367.tar.xz
audio: remove unreferenced af_lavrresample
This filter wasn't referenced anywhere and thus was dead code. It should have been in the audio filter list in user_filters.c. This was intended as compatibility wrapper (to avoid breaking old command lines and config files), and has no real use. Apparently I forgot to add it to the filter list (did I even test this shit?), and so it was rotting around for 1.5 years doing nothing (just like myself). Note that users can just use the libavfilter provided filter to force resampling, just that it has a different name and different options. There's also af_format to force inserting auto conversion through the internal f_swsresample filter.
-rw-r--r--DOCS/man/af.rst38
-rw-r--r--audio/filter/af_lavrresample.c112
-rw-r--r--wscript_build.py1
3 files changed, 0 insertions, 151 deletions
diff --git a/DOCS/man/af.rst b/DOCS/man/af.rst
index 4e806d482e..aebf76431a 100644
--- a/DOCS/man/af.rst
+++ b/DOCS/man/af.rst
@@ -24,44 +24,6 @@ See ``--vf`` group of options for info on how ``--af-defaults``, ``--af-add``,
Available filters are:
-``lavrresample[=option1:option2:...]``
- This filter uses libavresample (or libswresample, depending on the build)
- to change sample rate, sample format, or channel layout of the audio stream.
- This filter is automatically enabled if the audio output does not support
- the audio configuration of the file being played.
-
- .. warning::
-
- Deprecated. Either use the ``--audio-resample-...`` options to customize
- resampling, or the libavfilter ``--af=aresample`` filter, which has its
- own options.
-
- It supports only the following sample formats: u8, s16, s32, float.
-
- ``filter-size=<length>``
- Length of the filter with respect to the lower sampling rate. (default:
- 16)
- ``phase-shift=<count>``
- Log2 of the number of polyphase entries. (..., 10->1024, 11->2048,
- 12->4096, ...) (default: 10->1024)
- ``cutoff=<cutoff>``
- Cutoff frequency (0.0-1.0), default set depending upon filter length.
- ``linear``
- If set then filters will be linearly interpolated between polyphase
- entries. (default: no)
- ``no-detach``
- Do not detach if input and output audio format/rate/channels match.
- (If you just want to set defaults for this filter that will be used
- even by automatically inserted lavrresample instances, you should
- prefer setting them with the ``--audio-resample-...`` options.) This
- does not do anything anymore and the filter will never detach.
- ``normalize=<yes|no|auto>``
- Whether to normalize when remixing channel layouts (default: auto).
- ``auto`` uses the value set by ``--audio-normalize-downmix``.
- ``o=<string>``
- Set AVOptions on the SwrContext or AVAudioResampleContext. These should
- be documented by FFmpeg or Libav.
-
``lavcac3enc[=options]``
Encode multi-channel audio to AC-3 at runtime using libavcodec. Supports
16-bit native-endian input format, maximum 6 channels. The output is
diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c
deleted file mode 100644
index baa78acb6e..0000000000
--- a/audio/filter/af_lavrresample.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
- * Copyright (c) 2013 Stefano Pigozzi <stefano.pigozzi@gmail.com>
- *
- * Based on Michael Niedermayer's lavcresample.
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <math.h>
-#include <assert.h>
-
-#include "common/common.h"
-#include "config.h"
-
-#include "common/av_common.h"
-#include "common/msg.h"
-#include "filters/f_swresample.h"
-#include "filters/filter_internal.h"
-#include "filters/user_filters.h"
-#include "options/m_config.h"
-#include "options/m_option.h"
-#include "options/options.h"
-
-struct af_resample {
- int allow_detach;
- struct mp_resample_opts opts;
- int global_normalize;
-};
-
-static void set_defaults(struct mpv_global *global, void *p)
-{
- struct af_resample *s = p;
-
- struct mp_resample_opts *opts = &s->opts;
-
- struct mp_resample_opts *src_opts =
- mp_get_config_group(s, global, &resample_conf);
-
- s->global_normalize = src_opts->normalize;
-
- assert(!opts->avopts); // we don't set a default value, so it must be NULL
-
- *opts = *src_opts;
-
- opts->avopts = NULL;
- struct m_option dummy = {.type = &m_option_type_keyvalue_list};
- m_option_copy(&dummy, &opts->avopts, &src_opts->avopts);
-}
-
-#define OPT_BASE_STRUCT struct af_resample
-
-static struct mp_filter *af_lavrresample_create(struct mp_filter *parent,
- void *options)
-{
- struct af_resample *s = options;
-
- if (s->opts.normalize < 0)
- s->opts.normalize = s->global_normalize;
-
- struct mp_swresample *swr = mp_swresample_create(parent, &s->opts);
- if (!swr)
- abort();
-
- MP_WARN(swr->f, "This filter is deprecated! Use the --audio-resample- options"
- " to customize resampling, or the --af=aresample filter.\n");
-
- talloc_free(s);
- return swr->f;
-}
-
-const struct mp_user_filter_entry af_lavrresample = {
- .desc = {
- .description = "Sample frequency conversion using libavresample",
- .name = "lavrresample",
- .priv_size = sizeof(struct af_resample),
- .priv_defaults = &(const struct af_resample) {
- .opts = MP_RESAMPLE_OPTS_DEF,
- .allow_detach = 1,
- },
- .options = (const struct m_option[]) {
- OPT_INTRANGE("filter-size", opts.filter_size, 0, 0, 32),
- OPT_INTRANGE("phase-shift", opts.phase_shift, 0, 0, 30),
- OPT_FLAG("linear", opts.linear, 0),
- OPT_DOUBLE("cutoff", opts.cutoff, M_OPT_RANGE, .min = 0, .max = 1),
- OPT_FLAG("detach", allow_detach, 0), // does nothing
- OPT_CHOICE("normalize", opts.normalize, 0,
- ({"no", 0}, {"yes", 1}, {"auto", -1})),
- OPT_KEYVALUELIST("o", opts.avopts, 0),
- {0}
- },
- .set_defaults = set_defaults,
- },
- .create = af_lavrresample_create,
-};
diff --git a/wscript_build.py b/wscript_build.py
index 2c60a8dcf6..8f2f804a39 100644
--- a/wscript_build.py
+++ b/wscript_build.py
@@ -228,7 +228,6 @@ def build(ctx):
( "audio/decode/ad_spdif.c" ),
( "audio/filter/af_format.c" ),
( "audio/filter/af_lavcac3enc.c" ),
- ( "audio/filter/af_lavrresample.c" ),
( "audio/filter/af_rubberband.c", "rubberband" ),
( "audio/filter/af_scaletempo.c" ),
( "audio/fmt-conversion.c" ),