Skip to content

Commit

Permalink
shitmess
Browse files Browse the repository at this point in the history
  • Loading branch information
wm4 committed Jul 24, 2016
1 parent 99d9921 commit 7621a02
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 43 deletions.
9 changes: 8 additions & 1 deletion DOCS/interface-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions DOCS/man/input.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand All @@ -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``.

Expand Down
45 changes: 21 additions & 24 deletions DOCS/man/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
20 changes: 10 additions & 10 deletions etc/input.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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://
Expand Down
3 changes: 2 additions & 1 deletion options/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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})),
Expand Down Expand Up @@ -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}
};
Expand Down
3 changes: 0 additions & 3 deletions player/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
31 changes: 27 additions & 4 deletions player/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand All @@ -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;
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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" },
Expand Down

0 comments on commit 7621a02

Please sign in to comment.