summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-11-29 20:13:28 +0100
committerwm4 <wm4@nowhere>2017-11-29 21:30:51 +0100
commit3d27a0792b603b749ac546b62ed58cb76ffc5ee9 (patch)
treefeb4769093cd18275ab275f7d8f94437eb6f112e /player
parent23d9dc5457c52408533c498c685ad9dd6fd2cee0 (diff)
downloadmpv-3d27a0792b603b749ac546b62ed58cb76ffc5ee9.tar.bz2
mpv-3d27a0792b603b749ac546b62ed58cb76ffc5ee9.tar.xz
af: remove deprecated audio filters
These couldn't be relicensed, and won't survive the LGPL transition. The other existing filters are mostly LGPL (except libaf glue code). This remove the deprecated pan option. I guess it could be restored by inserting a libavfilter filter (if there's one), but for now let it be gone. This temporarily breaks volume control (and things related to it, like replaygain).
Diffstat (limited to 'player')
-rw-r--r--player/audio.c53
-rw-r--r--player/command.c33
2 files changed, 1 insertions, 85 deletions
diff --git a/player/audio.c b/player/audio.c
index 3b63f92d7e..e08259b1b5 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -185,57 +185,6 @@ void audio_update_volume(struct MPContext *mpctx)
gain *= compute_replaygain(mpctx);
if (opts->softvol_mute == 1)
gain = 0.0;
-
- if (!af_control_any_rev(ao_c->af, AF_CONTROL_SET_VOLUME, &gain)) {
- if (gain == 1.0)
- return;
- MP_VERBOSE(mpctx, "Inserting volume filter.\n");
- char *args[] = {"warn", "no", NULL};
- if (!(af_add(ao_c->af, "volume", "softvol", args)
- && af_control_any_rev(ao_c->af, AF_CONTROL_SET_VOLUME, &gain)))
- MP_ERR(mpctx, "No volume control available.\n");
- }
-}
-
-/* NOTE: Currently the balance code is seriously buggy: it always changes
- * the af_pan mapping between the first two input channels and first two
- * output channels to particular values. These values make sense for an
- * af_pan instance that was automatically inserted for balance control
- * only and is otherwise an identity transform, but if the filter was
- * there for another reason, then ignoring and overriding the original
- * values is completely wrong.
- */
-void audio_update_balance(struct MPContext *mpctx)
-{
- struct MPOpts *opts = mpctx->opts;
- struct ao_chain *ao_c = mpctx->ao_chain;
- if (!ao_c || ao_c->af->initialized < 1)
- return;
-
- float val = opts->balance;
-
- if (af_control_any_rev(ao_c->af, AF_CONTROL_SET_PAN_BALANCE, &val))
- return;
-
- if (val == 0)
- return;
-
- struct af_instance *af_pan_balance;
- if (!(af_pan_balance = af_add(ao_c->af, "pan", "autopan", NULL))) {
- MP_ERR(mpctx, "No balance control available.\n");
- return;
- }
-
- /* make all other channels pass through since by default pan blocks all */
- for (int i = 2; i < AF_NCH; i++) {
- float level[AF_NCH] = {0};
- level[i] = 1.f;
- af_control_ext_t arg_ext = { .ch = i, .arg = level };
- af_pan_balance->control(af_pan_balance, AF_CONTROL_SET_PAN_LEVEL,
- &arg_ext);
- }
-
- af_pan_balance->control(af_pan_balance, AF_CONTROL_SET_PAN_BALANCE, &val);
}
static int recreate_audio_filters(struct MPContext *mpctx)
@@ -254,7 +203,6 @@ static int recreate_audio_filters(struct MPContext *mpctx)
MP_ERR(mpctx, "--softvol=no is not supported anymore.\n");
audio_update_volume(mpctx);
- audio_update_balance(mpctx);
mp_notify(mpctx, MPV_EVENT_AUDIO_RECONFIG, NULL);
@@ -289,7 +237,6 @@ int reinit_audio_filters(struct MPContext *mpctx)
#else /* HAVE_LIBAV */
void audio_update_volume(struct MPContext *mpctx) {}
-void audio_update_balance(struct MPContext *mpctx) {}
int reinit_audio_filters(struct MPContext *mpctx) { return 0; }
#endif /* else HAVE_LIBAF */
diff --git a/player/command.c b/player/command.c
index c89f6a7f6f..569272c680 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2100,35 +2100,6 @@ static int mp_property_audio_out_params(void *ctx, struct m_property *prop,
return r;
}
-/// Balance (RW)
-static int mp_property_balance(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
-
- if (action == M_PROPERTY_PRINT) {
- char **str = arg;
- float bal = mpctx->opts->balance;
- if (bal == 0.f)
- *str = talloc_strdup(NULL, "center");
- else if (bal == -1.f)
- *str = talloc_strdup(NULL, "left only");
- else if (bal == 1.f)
- *str = talloc_strdup(NULL, "right only");
- else {
- unsigned right = (bal + 1.f) / 2.f * 100.f;
- *str = talloc_asprintf(NULL, "left %d%%, right %d%%",
- 100 - right, right);
- }
- return M_PROPERTY_OK;
- }
-
- int r = mp_property_generic_option(mpctx, prop, action, arg);
- if (action == M_PROPERTY_SET)
- audio_update_balance(mpctx);
- return r;
-}
-
static struct track* track_next(struct MPContext *mpctx, enum stream_type type,
int direction, struct track *track)
{
@@ -4011,7 +3982,6 @@ static const struct m_property mp_properties_base[] = {
{"audio-params", mp_property_audio_params},
{"audio-out-params", mp_property_audio_out_params},
{"aid", mp_property_audio},
- {"balance", mp_property_balance},
{"audio-device", mp_property_audio_device},
{"audio-device-list", mp_property_audio_devices},
{"current-ao", mp_property_ao},
@@ -4167,7 +4137,7 @@ static const char *const *const mp_event_property_change[] = {
"colormatrix-primaries", "video-aspect", "video-dec-params",
"hwdec", "hwdec-current", "hwdec-interop"),
E(MPV_EVENT_AUDIO_RECONFIG, "audio-format", "audio-codec", "audio-bitrate",
- "samplerate", "channels", "audio", "volume", "mute", "balance",
+ "samplerate", "channels", "audio", "volume", "mute",
"current-ao", "audio-codec-name", "audio-params",
"audio-out-params", "volume-max", "mixer-active"),
E(MPV_EVENT_SEEK, "seeking", "core-idle", "eof-reached"),
@@ -4361,7 +4331,6 @@ static const struct property_osd_display {
{ "ao-mute", "AO Mute" },
{ "audio-delay", "A-V delay" },
{ "audio", "Audio" },
- { "balance", "Balance", .osd_progbar = OSD_BALANCE },
// video
{ "panscan", "Panscan", .osd_progbar = OSD_PANSCAN },
{ "taskbar-progress", "Progress in taskbar" },