summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-11-15 19:22:01 +0100
committerwm4 <wm4@nowhere>2012-11-16 21:21:15 +0100
commit25a098fe78ad2aee0ad7e18f8d4326e5cd29aeb1 (patch)
treeeb7630929380192859eeae40d1671910b43bedfb
parent1197e13c2f86ea0c521c206fa3412d50587376da (diff)
downloadmpv-25a098fe78ad2aee0ad7e18f8d4326e5cd29aeb1.tar.bz2
mpv-25a098fe78ad2aee0ad7e18f8d4326e5cd29aeb1.tar.xz
options: add --mute for setting initial audio mute status
Similar to --volume. Takes this as opportunity to move the variable corresponding to --volume into MPOpts.
-rw-r--r--DOCS/man/en/options.rst4
-rw-r--r--core/cfg-mplayer.h6
-rw-r--r--core/defaultopts.c2
-rw-r--r--core/mplayer.c8
-rw-r--r--core/options.h2
5 files changed, 18 insertions, 4 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index e25a7db4f1..e30de6a5a9 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -1158,6 +1158,10 @@
--msgmodule
Prepend module name in front of each console message.
+--mute=<auto|yes|no>
+ Set startup audio mute status. ``auto`` (default) will not change the mute
+ status. Also see ``--volume``.
+
--name
Set the window class name for X11-based video output methods.
diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h
index 26649b42f6..c45d4b42c7 100644
--- a/core/cfg-mplayer.h
+++ b/core/cfg-mplayer.h
@@ -570,7 +570,11 @@ const m_option_t mplayer_opts[]={
{"auto", SOFTVOL_AUTO})),
OPT_FLOATRANGE("softvol-max", softvol_max, 0, 10, 10000),
{"volstep", &volstep, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
- {"volume", &start_volume, CONF_TYPE_FLOAT, CONF_RANGE, -1, 10000, NULL},
+ OPT_FLOATRANGE("volume", mixer_init_volume, 0, -1, 10000),
+ OPT_CHOICE("mute", mixer_init_mute, 0,
+ ({"auto", -1},
+ {"no", 0},
+ {"yes", 1})),
OPT_MAKE_FLAGS("gapless-audio", gapless_audio, 0),
// override audio buffer size (used only by -ao oss/win32, obsolete)
OPT_INT("abs", ao_buffersize, 0),
diff --git a/core/defaultopts.c b/core/defaultopts.c
index a20656dd02..28ae445388 100644
--- a/core/defaultopts.c
+++ b/core/defaultopts.c
@@ -13,6 +13,8 @@ void set_default_mplayer_options(struct MPOpts *opts)
.fixed_vo = 1,
.softvol = SOFTVOL_AUTO,
.softvol_max = 200,
+ .mixer_init_volume = -1,
+ .mixer_init_mute = -1,
.ao_buffersize = -1,
.vo_wintitle = "mpv - ${media-title}",
.monitor_pixel_aspect = 1.0,
diff --git a/core/mplayer.c b/core/mplayer.c
index 3d38330c0a..d632bf5615 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -103,7 +103,6 @@
int slave_mode = 0;
int enable_mouse_movements = 0;
-float start_volume = -1;
#include "osdep/priority.h"
@@ -3947,8 +3946,11 @@ goto_enable_cache:
audio_delay += mpctx->sh_video->stream_delay;
}
if (mpctx->sh_audio) {
- if (start_volume >= 0)
- mixer_setvolume(&mpctx->mixer, start_volume, start_volume);
+ if (opts->mixer_init_volume >= 0)
+ mixer_setvolume(&mpctx->mixer, opts->mixer_init_volume,
+ opts->mixer_init_volume);
+ if (opts->mixer_init_mute >= 0)
+ mixer_setmute(&mpctx->mixer, opts->mixer_init_mute);
if (!ignore_start)
audio_delay -= mpctx->sh_audio->stream_delay;
}
diff --git a/core/options.h b/core/options.h
index 03298554cd..0ceef0f25a 100644
--- a/core/options.h
+++ b/core/options.h
@@ -11,6 +11,8 @@ typedef struct MPOpts {
char *mixer_device;
char *mixer_channel;
int softvol;
+ float mixer_init_volume;
+ int mixer_init_mute;
float softvol_max;
int gapless_audio;
int ao_buffersize;