summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2024-03-01 09:20:15 -0600
committerDudemanguy <random342@airmail.cc>2024-03-01 09:20:15 -0600
commit4560d93bf0f2494f4f1344ac1840801911be7319 (patch)
treef577a83a21356ea4e034d0f5d80fb2fbad48fda5
parent8ba6d8f7a9aa3b049b4706e3f26bb614e95f965a (diff)
downloadmpv-4560d93bf0f2494f4f1344ac1840801911be7319.tar.bz2
mpv-4560d93bf0f2494f4f1344ac1840801911be7319.tar.xz
Revert "player: add ao-volume option, to set the system volume at startup"
Ended up being a bad idea. As a property, this inherently has more functionality and the tradeoff of being able to do --ao-volume wasn't worth it. This reverts commit 58ed620c064971535e60778612777750aa5e2f4d.
-rw-r--r--DOCS/interface-changes.rst2
-rw-r--r--DOCS/man/input.rst11
-rw-r--r--DOCS/man/options.rst7
-rw-r--r--options/options.c2
-rw-r--r--options/options.h1
-rw-r--r--player/audio.c18
-rw-r--r--player/command.c15
-rw-r--r--player/core.h1
8 files changed, 16 insertions, 41 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index 4558ab8f3a..61a60d516a 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -27,8 +27,6 @@ Interface changes
::
--- mpv 0.38.0 ---
- - add `--ao-volume` option
- - change `ao-volume` property to read only property `current-ao-volume`
- add `--volume-gain`, `--volume-gain-min`, and `--volume-gain-max` options
- add `current-gpu-context` property
- add `--secondary-sub-ass-override` option
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index f277b52f02..84f64cf5c7 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -2368,15 +2368,16 @@ Property list
This option is relatively useless. Before mpv 0.18.1, it could be used to
infer behavior of the ``volume`` property.
-``current-ao-volume``
+``ao-volume`` (RW)
System volume. This property is available only if mpv audio output is
currently active, and only if the underlying implementation supports volume
- control. What this option shows depends on the API. For example, on ALSA
- this usually shows system-wide audio, while on PulseAudio per-application volume.
+ control. What this option does depends on the API. For example, on ALSA
+ this usually changes system-wide audio, while with PulseAudio this controls
+ per-application volume.
``ao-mute`` (RW)
- Similar to ``current-ao-volume``, but controls the mute state. May be unimplemented
- even if ``current-ao-volume`` works.
+ Similar to ``ao-volume``, but controls the mute state. May be unimplemented
+ even if ``ao-volume`` works.
``audio-codec``
Audio codec selected for decoding.
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 3697313f9a..0e207e38b4 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -1997,13 +1997,6 @@ Audio
Since mpv 0.18.1, this always controls the internal mixer (aka software
volume).
-``--ao-volume=<value>``
- Set the startup system volume. This option works only if mpv audio
- output is currently active, and the underlying implementation supports
- volume control. What this option does depends on the API. For example, on
- ALSA this usually changes system-wide audio, while with PulseAudio this
- controls per-application volume. Negative values will be ignored.
-
``--volume-max=<100.0-1000.0>``
Set the maximum amplification level in percent (default: 130). A value of
130 will allow you to adjust the volume up to about double the normal level.
diff --git a/options/options.c b/options/options.c
index ec3663898a..3675d5734d 100644
--- a/options/options.c
+++ b/options/options.c
@@ -709,7 +709,6 @@ static const m_option_t mp_opts[] = {
// values <0 for volume and mute are legacy and ignored
{"volume", OPT_FLOAT(softvol_volume), .flags = UPDATE_VOL,
M_RANGE(-1, 1000)},
- {"ao-volume", OPT_FLOAT(ao_volume), M_RANGE(-1, 100)},
{"volume-gain-max", OPT_FLOAT(softvol_gain_max), M_RANGE(0, 150)},
{"volume-gain-min", OPT_FLOAT(softvol_gain_min), M_RANGE(-150, 0)},
{"volume-gain", OPT_FLOAT(softvol_gain), .flags = UPDATE_VOL,
@@ -937,7 +936,6 @@ static const struct MPOpts mp_default_opts = {
.msg_color = true,
.softvol_max = 130,
.softvol_volume = 100,
- .ao_volume = -1,
.softvol_gain_max = 12,
.softvol_gain_min = -96,
.softvol_gain = 0,
diff --git a/options/options.h b/options/options.h
index d9f1f99d1b..9dce3f609c 100644
--- a/options/options.h
+++ b/options/options.h
@@ -181,7 +181,6 @@ typedef struct MPOpts {
float audio_wait_open;
int force_vo;
float softvol_volume;
- float ao_volume;
int rgain_mode;
float rgain_preamp; // Set replaygain pre-amplification
bool rgain_clip; // Enable/disable clipping prevention
diff --git a/player/audio.c b/player/audio.c
index f5379ca59b..7a37c0d2f2 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -182,19 +182,6 @@ void audio_update_volume(struct MPContext *mpctx)
ao_set_gain(ao_c->ao, gain);
}
-// Called when opts->ao_volume were changed.
-void audio_update_ao_volume(struct MPContext *mpctx)
-{
- struct MPOpts *opts = mpctx->opts;
- struct ao *ao = mpctx->ao;
- float vol = opts->ao_volume;
- if (!ao || vol < 0)
- return;
-
- ao_control(ao, AOCONTROL_SET_VOLUME, &vol);
-}
-
-
// Call this if opts->playback_speed or mpctx->speed_factor_* change.
void update_playback_speed(struct MPContext *mpctx)
{
@@ -348,7 +335,6 @@ static void ao_chain_set_ao(struct ao_chain *ao_c, struct ao *ao)
// Make sure filtering never stops with frames stuck in access filter.
mp_filter_set_high_priority(ao_c->queue_filter, true);
audio_update_volume(ao_c->mpctx);
- audio_update_ao_volume(ao_c->mpctx);
}
if (ao_c->filter->ao_needs_update)
@@ -607,10 +593,8 @@ void reinit_audio_chain_src(struct MPContext *mpctx, struct track *track)
if (recreate_audio_filters(mpctx) < 0)
goto init_error;
- if (mpctx->ao) {
+ if (mpctx->ao)
audio_update_volume(mpctx);
- audio_update_ao_volume(mpctx);
- }
mp_wakeup_core(mpctx);
return;
diff --git a/player/command.c b/player/command.c
index f8fac69ef7..2690fd4a27 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1681,6 +1681,12 @@ static int mp_property_ao_volume(void *ctx, struct m_property *prop,
return M_PROPERTY_NOT_IMPLEMENTED;
switch (action) {
+ case M_PROPERTY_SET: {
+ float vol = *(float *)arg;
+ if (ao_control(ao, AOCONTROL_SET_VOLUME, &vol) != CONTROL_OK)
+ return M_PROPERTY_UNAVAILABLE;
+ return M_PROPERTY_OK;
+ }
case M_PROPERTY_GET: {
if (ao_control(ao, AOCONTROL_GET_VOLUME, arg) != CONTROL_OK)
return M_PROPERTY_UNAVAILABLE;
@@ -3941,7 +3947,7 @@ static const struct m_property mp_properties_base[] = {
{"mixer-active", mp_property_mixer_active},
{"volume", mp_property_volume},
{"volume-gain", mp_property_volume_gain},
- {"current-ao-volume", mp_property_ao_volume},
+ {"ao-volume", mp_property_ao_volume},
{"ao-mute", mp_property_ao_mute},
{"audio-delay", mp_property_audio_delay},
{"audio-codec-name", mp_property_audio_codec_name},
@@ -4292,8 +4298,8 @@ static const struct property_osd_display {
{"volume-gain", "Volume gain",
.msg = "Volume gain: ${?volume-gain:${volume-gain} dB ${?mute==yes:(Muted)}}${!volume-gain:${volume-gain}}",
.osd_progbar = OSD_VOLUME, .marker = 0},
- {"current-ao-volume", "AO Volume",
- .msg = "AO Volume: ${?current-ao-volume:${current-ao-volume}% ${?ao-mute==yes:(Muted)}}${!current-ao-volume:${currene-ao-volume}}",
+ {"ao-volume", "AO Volume",
+ .msg = "AO Volume: ${?ao-volume:${ao-volume}% ${?ao-mute==yes:(Muted)}}${!ao-volume:${ao-volume}}",
.osd_progbar = OSD_VOLUME, .marker = 100},
{"mute", "Mute"},
{"ao-mute", "AO Mute"},
@@ -7269,9 +7275,6 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags,
mp_wakeup_core(mpctx);
}
- if (opt_ptr == &opts->ao_volume)
- audio_update_ao_volume(mpctx);
-
if (flags & UPDATE_HWDEC) {
struct track *track = mpctx->current_track[0][STREAM_VIDEO];
struct mp_decoder_wrapper *dec = track ? track->dec : NULL;
diff --git a/player/core.h b/player/core.h
index 9dc6b8bf90..dcb3c27e12 100644
--- a/player/core.h
+++ b/player/core.h
@@ -487,7 +487,6 @@ void uninit_audio_out(struct MPContext *mpctx);
void uninit_audio_chain(struct MPContext *mpctx);
void reinit_audio_chain_src(struct MPContext *mpctx, struct track *track);
void audio_update_volume(struct MPContext *mpctx);
-void audio_update_ao_volume(struct MPContext *mpctx);
void reload_audio_output(struct MPContext *mpctx);
void audio_start_ao(struct MPContext *mpctx);