0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00

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.
This commit is contained in:
wm4 2012-11-15 19:22:01 +01:00
parent 1197e13c2f
commit 25a098fe78
5 changed files with 18 additions and 4 deletions

View File

@ -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.

View File

@ -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),

View File

@ -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,

View File

@ -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;
}

View File

@ -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;