From 74dd64e71d7641ac916be0e63471f076f51370af Mon Sep 17 00:00:00 2001 From: diego Date: Fri, 31 Oct 2008 18:44:45 +0000 Subject: [PATCH] Add an option that sets initial playback volume. patch by Reimar and rvm, rvm3000 ya com git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27872 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/en/mplayer.1 | 6 ++++++ DOCS/man/es/mplayer.1 | 6 ++++++ cfg-mplayer.h | 1 + mplayer.c | 3 +++ 4 files changed, 16 insertions(+) diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 4b0d562e20..1af9a61651 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -2648,6 +2648,12 @@ the maximum, which e.g.\& the OSD cannot display correctly. Set the step size of mixer volume changes in percent of the whole range (default: 3). . +.TP +.B \-volume <-1\-100> (also see \-af volume) +Set the startup volume in the mixer, either hardware or software (if +used with \-softvol). +A value of -1 (the default) will not change the volume. +. . . .SH "AUDIO OUTPUT DRIVERS (MPLAYER ONLY)" diff --git a/DOCS/man/es/mplayer.1 b/DOCS/man/es/mplayer.1 index 7938d1068f..31229b82b5 100644 --- a/DOCS/man/es/mplayer.1 +++ b/DOCS/man/es/mplayer.1 @@ -2360,6 +2360,12 @@ debajo del m Establece el porcentaje de incremento o decremento para los cambios de volumen, el porcentaje es en relación con el total. . +.TP +.B \-volume <-1\-100> (vea también \-af volume) +Establece el volumen inicial en el mezclador, ya sea por hardware o +software (si se usa con \-softvol). +Un valor de -1 (que es el valor por defecto) no cambiará el volumen. +. . . .SH "CONTROLADORES DE SALIDA DE AUDIO (MPLAYER SOLAMENTE)" diff --git a/cfg-mplayer.h b/cfg-mplayer.h index 7efe4acdbc..09591fe847 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -108,6 +108,7 @@ const m_option_t mplayer_opts[]={ {"nosoftvol", &soft_vol, CONF_TYPE_FLAG, 0, 1, 0, NULL}, {"softvol-max", &soft_vol_max, CONF_TYPE_FLOAT, CONF_RANGE, 10, 10000, NULL}, {"volstep", &volstep, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL}, + {"volume", &start_volume, CONF_TYPE_FLOAT, CONF_RANGE, -1, 10000, NULL}, {"master", "Option -master has been removed, use -af volume instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, // override audio buffer size (used only by -ao oss, anyway obsolete...) {"abs", &ao_data.buffersize, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL}, diff --git a/mplayer.c b/mplayer.c index 9129ee871b..3e6ad61983 100644 --- a/mplayer.c +++ b/mplayer.c @@ -86,6 +86,7 @@ int slave_mode=0; int player_idle_mode=0; int quiet=0; int enable_mouse_movements=0; +float start_volume = -1; #if defined(__MINGW32__) || defined(__CYGWIN__) char * proc_priority=NULL; @@ -3573,6 +3574,8 @@ if(mpctx->sh_video){ audio_delay += mpctx->sh_video->stream_delay; } if(mpctx->sh_audio){ + if (start_volume >= 0) + mixer_setvolume(&mpctx->mixer, start_volume, start_volume); if (! ignore_start) audio_delay -= mpctx->sh_audio->stream_delay; mpctx->delay=-audio_delay;