summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-07-24 12:50:02 +0200
committerwm4 <wm4@nowhere>2016-07-24 12:50:02 +0200
commit7621a028bf555c9ed0430501bc6eac2fa204114c (patch)
treeb99abf447215d5e802561109c9a1ac3bad72b2a1
parent99d9921f39706b90b00d5b97d07ed12c60ea5786 (diff)
downloadmpv-shitmess.tar.bz2
mpv-shitmess.tar.xz
shitmessshitmess
-rw-r--r--DOCS/interface-changes.rst9
-rw-r--r--DOCS/man/input.rst12
-rw-r--r--DOCS/man/options.rst45
-rw-r--r--etc/input.conf20
-rw-r--r--options/options.c3
-rw-r--r--player/audio.c3
-rw-r--r--player/command.c31
7 files changed, 80 insertions, 43 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index 8789cd943c..ac6e6d0eed 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -20,10 +20,17 @@ Interface changes
::
--- mpv 0.18.2 ---
+ - partially re-add --softvol=auto capability:
+ - rename --softvol to --user-volume-mode and undeprecate it
+ - implement selecting the "correct" volume control with the newly added
+ user-volume property
+ - change default key bindings to control user-volume instead of volume
+ (you will have to do the same with custom bindings)
+ - all of the above should restore most of PulseAudio behavior
- deprecate "balance" option/property (no replacement)
--- mpv 0.18.1 ---
- deprecate --heartbeat-cmd
- - remove --softvol=no capability:
+ - remove --softvol=no/--softvol=auto capability:
- deprecate --softvol, it now does nothing
- --volume, --mute, and the corresponding properties now always control
softvol, and behave as expected without surprises (e.g. you can set
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 46dcb36e7d..8a65ab0e6d 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -1242,6 +1242,9 @@ Property list
``volume`` (RW)
Current volume (see ``--volume`` for details).
+ See also ``user-volume``, in particular if you are interested in pre-
+ mpv 0.18.1 behavior.
+
``volume-max`` (RW)
Current maximum value the volume property can be set to. (Equivalent to the
``--volume-max`` option.)
@@ -1260,6 +1263,15 @@ Property list
Similar to ``ao-volume``, but controls the mute state. May be unimplemented
even if ``ao-volume`` works.
+``user-volume`` (RW)
+ This switches between the ``ao-volume`` or ``volume`` properties, depending
+ on the ``--user-volume-mode`` option.
+
+ In particular, this property is unavailable if the audio chain is not active
+ (such as when playing a file without audio, or in idle mode).
+
+ There is no such property for the mute control.
+
``audio-delay`` (RW)
See ``--audio-delay``.
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index d78588ae78..c3d43b3b67 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -1091,23 +1091,32 @@ Audio
``--no-audio``
Do not play sound.
-``--mute=<auto|yes|no>``
- Set startup audio mute status. ``auto`` (default) will not change the mute
- status.
+``--mute=<yes|no|auto>``
+ Set startup audio mute status (default: no).
+
+ ``auto`` is a deprecated alias for ``no`` (before mpv 0.18.1 the situation
+ was different).
See also: ``--volume``.
-``--softvol=<no|yes|auto>``
- Deprecated/unfunctional. Before mpv 0.18.1, this used to control whether
- to use the volume controls of the audio output driver or the internal mpv
- volume filter.
+``--user-volume-mode=<no|yes|auto>``, ``--softvol=<...>``
+ Decides what the ``user-volume`` property controls (default: auto).
- The current behavior is as if this option was set to ``yes``. The other
- behaviors are not available anymore, although ``auto`` almost matches
- current behavior in most cases.
+ :no: ``user-volume`` redirects to ``ao-volume`` (i.e. always changes
+ the audio API's volume control)
+ :yes: ``user-volume`` redirects to ``volume`` (i.e. always changes the
+ internal mixer)
+ :auto: control ``ao-volume`` if the audio API does per-application
+ audio control (like wasapi and PulseAudio), otherwise ``volume``
- The ``no`` behavior is still partially available through the ``ao-volume``
- and ``ao-mute`` properties. But there are no options to reset these.
+ ``--softvol`` is a deprecated alias - it some situation it will appear to do
+ roughly the same as before mpv 0.18.1, while in others the different
+ implementation becomes apparent.
+
+ This is the behavior since mpv 0.18.2. In mpv 0.18.1, this option was
+ deprecated and did nothing. Before mpv 0.18.1, this used to control whether
+ to use the volume controls of the audio output driver or the internal mpv
+ volume filter.
``--audio-demuxer=<[+]name>``
Use this audio demuxer type when using ``--audio-file``. Use a '+' before
@@ -1289,18 +1298,6 @@ Audio
if you want to force a different audio profile (e.g. with PulseAudio),
or to set your own application name when using libmpv.
-``--volume-restore-data=<string>``
- Used internally for use by playback resume (e.g. with ``quit-watch-later``).
- Restoring value has to be done carefully, because different AOs as well as
- softvol can have different value ranges, and we don't want to restore
- volume if setting the volume changes it system wide. The normal options
- (like ``--volume``) would always set the volume. This option was added for
- restoring volume in a safer way (by storing the method used to set the
- volume), and is not generally useful. Its semantics are considered private
- to mpv.
-
- Do not use.
-
``--audio-buffer=<seconds>``
Set the audio output minimum buffer. The audio device might actually create
a larger buffer if it pleases. If the device creates a smaller buffer,
diff --git a/etc/input.conf b/etc/input.conf
index 59ee2886f0..884d91bc39 100644
--- a/etc/input.conf
+++ b/etc/input.conf
@@ -33,8 +33,8 @@
#MOUSE_BTN2 cycle pause # toggle pause on/off
#MOUSE_BTN3 seek 10
#MOUSE_BTN4 seek -10
-#MOUSE_BTN5 add volume -2
-#MOUSE_BTN6 add volume 2
+#MOUSE_BTN5 add user-volume -2
+#MOUSE_BTN6 add user-volume 2
# Mouse wheels, touchpad or other input devices that have axes
# if the input devices supports precise scrolling it will also scale the
@@ -87,10 +87,10 @@
#x add sub-delay +0.1 # add
#ctrl++ add audio-delay 0.100 # this changes audio/video sync
#ctrl+- add audio-delay -0.100
-#9 add volume -2
-#/ add volume -2
-#0 add volume 2
-#* add volume 2
+#9 add user-volume -2
+#/ add user-volume -2
+#0 add user-volume 2
+#* add user-volume 2
#m cycle mute
#1 add contrast -1
#2 add contrast 1
@@ -136,8 +136,8 @@
#REWIND seek -60
#NEXT playlist-next
#PREV playlist-prev
-#VOLUME_UP add volume 2
-#VOLUME_DOWN add volume -2
+#VOLUME_UP add user-volume 2
+#VOLUME_DOWN add user-volume -2
#MUTE cycle mute
#CLOSE_WIN quit
#CLOSE_WIN {encode} quit 4
@@ -157,9 +157,9 @@
#AR_PREV_HOLD seek -120
#AR_MENU show-progress
#AR_MENU_HOLD cycle mute
-#AR_VUP add volume 2
+#AR_VUP add user-volume 2
#AR_VUP_HOLD add chapter 1
-#AR_VDOWN add volume -2
+#AR_VDOWN add user-volume -2
#AR_VDOWN_HOLD add chapter -1
# For tv://
diff --git a/options/options.c b/options/options.c
index acef3ba6b9..5fd9f064fa 100644
--- a/options/options.c
+++ b/options/options.c
@@ -406,7 +406,7 @@ const m_option_t mp_opts[] = {
OPT_FLAG("window-dragging", allow_win_drag, CONF_GLOBAL),
- OPT_CHOICE("softvol", softvol, 0,
+ OPT_CHOICE("user-volume-mode", softvol, 0,
({"no", SOFTVOL_NO},
{"yes", SOFTVOL_YES},
{"auto", SOFTVOL_AUTO})),
@@ -687,6 +687,7 @@ const m_option_t mp_opts[] = {
OPT_REPLACED("media-title", "force-media-title"),
OPT_REPLACED("input-unix-socket", "input-ipc-server"),
OPT_REPLACED("softvol-max", "volume-max"),
+ OPT_REPLACED("softvol", "user-volume-mode"),
{0}
};
diff --git a/player/audio.c b/player/audio.c
index 6c53bdf721..f8ff33c0b7 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -194,9 +194,6 @@ static int recreate_audio_filters(struct MPContext *mpctx)
if (afs->initialized < 1 && af_init(afs) < 0)
goto fail;
- if (mpctx->opts->softvol == SOFTVOL_NO)
- MP_ERR(mpctx, "--softvol=no is not supported anymore.\n");
-
audio_update_volume(mpctx);
audio_update_balance(mpctx);
diff --git a/player/command.c b/player/command.c
index d8f4f83529..7a92ac759e 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1617,7 +1617,7 @@ static int mp_property_ao_volume(void *ctx, struct m_property *prop,
MPContext *mpctx = ctx;
struct ao *ao = mpctx->ao;
if (!ao)
- return M_PROPERTY_NOT_IMPLEMENTED;
+ return M_PROPERTY_UNAVAILABLE;
switch (action) {
case M_PROPERTY_SET: {
@@ -1660,7 +1660,7 @@ static int mp_property_ao_mute(void *ctx, struct m_property *prop,
MPContext *mpctx = ctx;
struct ao *ao = mpctx->ao;
if (!ao)
- return M_PROPERTY_NOT_IMPLEMENTED;
+ return M_PROPERTY_UNAVAILABLE;
switch (action) {
case M_PROPERTY_SET: {
@@ -1683,6 +1683,25 @@ static int mp_property_ao_mute(void *ctx, struct m_property *prop,
return M_PROPERTY_NOT_IMPLEMENTED;
}
+static int mp_property_user_volume(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ struct ao *ao = mpctx->ao;
+ if (!ao)
+ return M_PROPERTY_UNAVAILABLE;
+
+ bool softvol;
+ switch (mpctx->opts->softvol) {
+ case SOFTVOL_NO: softvol = false; break;
+ case SOFTVOL_YES: softvol = true; break;
+ default:
+ softvol = ao_control(ao, AOCONTROL_HAS_PER_APP_VOLUME, NULL) != CONTROL_OK;
+ }
+
+ return mp_property_do(softvol ? "volume" : "ao-volume", action, arg, ctx);
+}
+
static int get_device_entry(int item, int action, void *arg, void *ctx)
{
struct ao_device_list *list = ctx;
@@ -3702,6 +3721,7 @@ static const struct m_property mp_properties[] = {
{"mute", mp_property_mute},
{"ao-volume", mp_property_ao_volume},
{"ao-mute", mp_property_ao_mute},
+ {"user-volume", mp_property_user_volume},
{"audio-delay", mp_property_audio_delay},
{"audio-codec-name", mp_property_audio_codec_name},
{"audio-codec", mp_property_audio_codec},
@@ -3888,7 +3908,7 @@ static const char *const *const mp_event_property_change[] = {
"colormatrix-output-range", "colormatrix-primaries", "video-aspect"),
E(MPV_EVENT_AUDIO_RECONFIG, "audio-format", "audio-codec", "audio-bitrate",
"samplerate", "channels", "audio", "volume", "mute", "balance",
- "current-ao", "audio-codec-name", "audio-params",
+ "current-ao", "audio-codec-name", "audio-params", "user-volume",
"audio-out-params", "volume-max", "mixer-active"),
E(MPV_EVENT_SEEK, "seeking", "core-idle", "eof-reached"),
E(MPV_EVENT_PLAYBACK_RESTART, "seeking", "core-idle", "eof-reached"),
@@ -4050,11 +4070,14 @@ static const struct property_osd_display {
{ "clock", "Clock" },
// audio
{ "volume", "Volume",
- .msg = "Volume: ${?volume:${volume}% ${?mute==yes:(Muted)}}${!volume:${volume}}",
+ .msg = "Internal volume: ${?volume:${volume}% ${?mute==yes:(Muted)}}${!volume:${volume}}",
.osd_progbar = OSD_VOLUME },
{ "ao-volume", "AO Volume",
.msg = "AO Volume: ${?ao-volume:${ao-volume}% ${?ao-mute==yes:(Muted)}}${!ao-volume:${ao-volume}}",
.osd_progbar = OSD_VOLUME },
+ { "user-volume", "Volume",
+ .msg = "Volume: ${?user-volume:${user-volume}% ${?mute==yes:(Muted)}}${!user-volume:${user-volume}}",
+ .osd_progbar = OSD_VOLUME },
{ "mute", "Mute" },
{ "ao-mute", "AO Mute" },
{ "audio-delay", "A-V delay" },