[MPlayer-cvslog] r37992 - in trunk: Changelog DOCS/xml/de/skin.xml DOCS/xml/en/skin.xml gui/interface.c gui/skin/skin.c gui/win32/interface.c gui/win32/skinload.c
ib
subversion at mplayerhq.hu
Mon Oct 9 19:25:23 EEST 2017
Author: ib
Date: Mon Oct 9 19:25:23 2017
New Revision: 37992
Log:
Enable skins to leave current volume unchanged at GUI startup.
Starting with svn r37055, the meaning of zero as a potentiometer's
"default" parameter has changed.
Prior to this revision the volume set before the GUI's startup
remained unchanged with such default (due to a bug), after that
the volume was consequently set to zero.
In order to re-enable the old behavior, i.e. leaving the volume
unchanged at GUI startup, a plain hyphen-minus can be used as
"default" parameter now.
Additionally, update the documentation.
Modified:
trunk/Changelog
trunk/gui/interface.c
trunk/gui/skin/skin.c
trunk/gui/win32/interface.c
trunk/gui/win32/skinload.c
Changes in other areas also in this revision:
Modified:
trunk/DOCS/xml/de/skin.xml
trunk/DOCS/xml/en/skin.xml
Modified: trunk/Changelog
==============================================================================
--- trunk/Changelog Mon Oct 9 17:57:43 2017 (r37991)
+++ trunk/Changelog Mon Oct 9 19:25:23 2017 (r37992)
@@ -32,6 +32,7 @@ MPlayer
* Playback improvements for cue sheet playlists
* Implementation of audio playback utilizing ReplayGain data
* New symbol character 'g' and new dynamic label variable $g
+ * Skins can leave current volume unchanged at startup
1.3.0: "worksforme" February 16, 2016
Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c Mon Oct 9 17:57:43 2017 (r37991)
+++ trunk/gui/interface.c Mon Oct 9 19:25:23 2017 (r37992)
@@ -78,6 +78,7 @@ guiInterface_t guiInfo = {
.PlaylistNext = True
};
+static int current_volume;
static int guiInitialized;
static int orig_fontconfig;
static struct {
@@ -311,6 +312,12 @@ void guiInit(void)
btnValue(evSetBalance, &guiInfo.Balance);
btnValue(evSetMoviePosition, &guiInfo.Position);
+ // skin demands usage of current volume
+ if (guiInfo.Volume < 0.0f) {
+ guiInfo.Volume = 0.0f;
+ current_volume = True;
+ }
+
if (guiInfo.Position)
uiEvent(evSetMoviePosition, guiInfo.Position);
@@ -913,6 +920,12 @@ int gui(int what, void *data)
if (guiInfo.AudioChannels < 2 || guiInfo.AudioPassthrough)
btnSet(evSetBalance, btnDisabled);
+ if (current_volume) {
+ mixer_getvolume(mpctx_get_mixer(guiInfo.mpcontext), &l, &r);
+ guiInfo.Volume = FFMAX(l, r);
+ current_volume = False;
+ }
+
if (gtkReplayGainOn) {
if (demux_control(mpctx_get_demuxer(guiInfo.mpcontext), DEMUXER_CTRL_GET_REPLAY_GAIN, &replay_gain) == DEMUXER_CTRL_OK) {
guiInfo.LastVolume = guiInfo.Volume;
Modified: trunk/gui/skin/skin.c
==============================================================================
--- trunk/gui/skin/skin.c Mon Oct 9 17:57:43 2017 (r37991)
+++ trunk/gui/skin/skin.c Mon Oct 9 19:25:23 2017 (r37992)
@@ -603,9 +603,9 @@ static int parse_potmeter(guiItem *item,
{
unsigned char bfname[256];
unsigned char phfname[256];
- unsigned char buf[512];
+ unsigned char buf[512], dfmt[5];
int i = 0, av_uninit(x0), av_uninit(y0), av_uninit(x1), av_uninit(y1);
- int bwidth, bheight, num, d, x, y, w, h, message;
+ int bwidth, bheight, num, no_default, d, x, y, w, h, message;
if (!window_item(currItem))
return 1;
@@ -628,6 +628,9 @@ static int parse_potmeter(guiItem *item,
y1 = cutInt(in, ',', i++);
}
+ cutStr(in, buf, ',', i);
+ no_default = (strcmp(buf, "-") == 0);
+
d = cutInt(in, ',', i++);
x = cutInt(in, ',', i++);
y = cutInt(in, ',', i++);
@@ -650,9 +653,15 @@ static int parse_potmeter(guiItem *item,
return 1;
}
+ if ((message == evSetVolume) && no_default) {
+ d = -1;
+ strcpy(dfmt, "-");
+ } else
+ sprintf(dfmt, "%d%%", d);
+
mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] %s image: %s %d,%d %dx%d\n", currItem, phfname, x, y, w, h);
mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] button image: %s %dx%d\n", bfname, bwidth, bheight);
- mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] numphases: %d, default: %d%%\n", num, d);
+ mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] numphases: %d, default: %s\n", num, dfmt);
mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", buf, message);
item->x = x;
Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c Mon Oct 9 17:57:43 2017 (r37991)
+++ trunk/gui/win32/interface.c Mon Oct 9 19:25:23 2017 (r37992)
@@ -640,8 +640,11 @@ int gui(int what, void *data)
guiInfo.AudioChannels = 0;
guiInfo.AudioPassthrough = FALSE;
}
- guiSetEvent(evSetVolume);
- guiSetEvent(evSetBalance);
+ if (guiInfo.Volume >= 0.0f) /* otherwise skin demands usage of current volume */
+ {
+ guiSetEvent(evSetVolume);
+ guiSetEvent(evSetBalance);
+ }
if(IsWindowVisible(mygui->videowindow) && !guiInfo.VideoWindow)
ShowWindow(mygui->videowindow, SW_HIDE);
break;
Modified: trunk/gui/win32/skinload.c
==============================================================================
--- trunk/gui/win32/skinload.c Mon Oct 9 17:57:43 2017 (r37991)
+++ trunk/gui/win32/skinload.c Mon Oct 9 19:25:23 2017 (r37992)
@@ -371,7 +371,7 @@ static void addwidget(skin_t *skin, wind
else if(!strncmp(desc, "hpotmeter", 9) || !strncmp(desc, "vpotmeter", 9) || !strncmp(desc, "rpotmeter", 9) || /* legacy */ !strncmp(desc, "potmeter", 8))
{
int base = counttonextchar(desc, '=') + 1;
- int i, av_uninit(x0), av_uninit(y0), av_uninit(x1), av_uninit(y1);
+ int i, av_uninit(x0), av_uninit(y0), av_uninit(x1), av_uninit(y1), no_default;
/* hpotmeter = button, bwidth, bheight, phases, numphases, default, X, Y, width, height, message */
if(!strncmp(desc, "vpotmeter", 9)) mywidget->type = tyVpotmeter;
else if(!strncmp(desc, "rpotmeter", 9)) mywidget->type = tyRpotmeter;
@@ -403,6 +403,7 @@ static void addwidget(skin_t *skin, wind
}
mywidget->value = atof(findnextstring(temp, desc, &base));
+ no_default = (strcmp(temp, "-") == 0);
mywidget->x = mywidget->wx = atoi(findnextstring(temp, desc, &base));
mywidget->y = mywidget->wy = atoi(findnextstring(temp, desc, &base));
mywidget->wwidth = atoi(findnextstring(temp, desc, &base));
@@ -454,6 +455,8 @@ static void addwidget(skin_t *skin, wind
mywidget->width = mywidget->wwidth;
mywidget->height = mywidget->wheight;
}
+
+ if ((mywidget->msg == evSetVolume) && no_default) mywidget->value = -1.0f;
}
else if(!strncmp(desc, "pimage", 6))
{
More information about the MPlayer-cvslog
mailing list